﻿// Pre-selects the minisite with the given ID in the drop down.
function preSelectMinisite(dropdown, id) 
{
    var i;
    for( i = 0 ; i < dropdown.length ; i++ ) 
    {
        var val = dropdown[i].value;
        if ( val == '' ) 
        {
            dropdown.remove(i);
            preSelectMinisite(dropdown,id);
            return;
        }
        var index = val.indexOf('mini=');       
        if ( index > 0 ) 
        {
            val = val.substring(index + 5);
            index = val.indexOf('&');
            val = val.substring(0,index);
            if ( val == id ) 
            {
                dropdown[i].selected = true;
                return;
            }
        }
    }   
}

// Delete cookie with given name
function DeleteCookie() 
{
    document.cookie="Webdanmark.Siteserver.Protect.MiniSiteSelection" + "=null; expires=" + expired.toGMTString();
    bikky = document.cookie;
}