var newwin = null;
function doDibsPopup() {
  newwin = window.open('', 'paywin', 'scrollbars,status,width=550,height=600');
  newwin.focus();
  return true;
}

window.onload=doReload;
window.onload=openinterests;
var c=1
var t
function timedCount(what){

if(c == 9){
c=1
}
document.getElementById(what).innerHTML="<a href=\"../Default.aspx?pageid=225&newsid=16\" alt=\"L&aelig;s mere\"><img src=\"filer/succes"+c+".jpg\" alt=\"L&aelig;s mere\"></a>";
c=c+1;
t=setTimeout("timedCount('"+what+"')",6000);
}

function removespaces(str)
{
    while (str.indexOf(" ") >= 0)
    {
        str = str.replace(" ", "");
    }
    
    return str;
}

function openinterests()
{
    if (document.getElementById("ctl03_FormView1_HFInterestList") != null)
    {
        var tekst = document.getElementById("ctl03_FormView1_HFInterestList").value.split(";");
        
        for (i = 0; i < tekst.length; i++)
        {
            if (tekst[i] != "")
            {
                document.getElementById(tekst[i]).style.display = "inline";
            }
        }
    }
}

function searchShowHide(iden, iden2)
{
    if (document.getElementById(iden2).checked == false)
    {
       document.getElementById(iden).className = "interest_hide";
    }
    else
    {
        document.getElementById(iden).className = "interest_show";
    }
}

function doSearchEnter()
{
//alert(window.event.keyCode);
    if(window.event.keyCode==13)
    {
        document.getElementById("ctl03_SearchLinkButton").click();
        
        //window['ctl03_RadAjaxPanel1'].AsyncRequest('ctl03$SearchLinkButton','');
    }
}

function doReload()
{
    if (document.getElementById("ctl03_RefreshHiddenField") != null)
    {
        //alert(document.getElementById("ctl03_RefreshHiddenField").value);
        if (document.getElementById("ctl03_RefreshHiddenField").value == "1")
        {
            document.getElementById("ctl03_RefreshHiddenField").value = "0";
            document.getElementById("IM_FORM").submit();
        }
    }
    
    if (document.getElementById("ctl03_ShortListControl_RefreshHiddenField") != null)
    {
        //alert(document.getElementById("ctl03_RefreshHiddenField").value);
        if (document.getElementById("ctl03_ShortListControl_RefreshHiddenField").value == "1")
        {
            document.getElementById("ctl03_ShortListControl_RefreshHiddenField").value = "0";
            document.getElementById("IM_FORM").submit();
        }
    }
}

function opretUdgiver()
{
    if (confirm('Du er ikke logget ind.\n\nØnsker du at oprette en Agentprofil?'))
    {
        document.location.href = "/Default.aspx?pageid=215";
    }
}

function show(target)
{
    var target = new String(target.id.replace("_overskrift",""));
    
    if(document.getElementById(target+"_liste").style.display == "none")
    {
        document.getElementById(target+"_liste").style.display = "";
        document.getElementById(target+"_overskrift").innerHTML = new String(document.getElementById(target+"_overskrift").innerHTML).replace("+","-");
    }
    else
    {
        document.getElementById(target+"_liste").style.display = "none";
        document.getElementById(target+"_overskrift").innerHTML = new String(document.getElementById(target+"_overskrift").innerHTML).replace("-","+");
    }
}

function showarb(target)
{
    var target = new String(target.id.replace("_overskrift",""));
    
    if(document.getElementById(target+"_liste").style.display == "none")
    {
        document.getElementById(target+"_liste").style.display = "";
        document.getElementById(target+"_overskrift").innerHTML = new String(document.getElementById(target+"_overskrift").innerHTML).replace("+","-");
    }
    else
    {
        document.getElementById(target+"_liste").style.display = "none";
        document.getElementById(target+"_overskrift").innerHTML = new String(document.getElementById(target+"_overskrift").innerHTML).replace("-","+");
    }
}

function show2(target)
{
    var target = new String(target.id.replace("_overskrift",""));
    
    if(document.getElementById(target+"_liste").className == "interest_hide")
    {
        document.getElementById(target+"_liste").className= "interest_show";
        document.getElementById(target+"_overskrift").innerHTML = new String(document.getElementById(target+"_overskrift").innerHTML).replace("+","-");
    }
    else
    {
        document.getElementById(target+"_liste").className = "interest_hide";
        document.getElementById(target+"_overskrift").innerHTML = new String(document.getElementById(target+"_overskrift").innerHTML).replace("-","+");
    }
}

var btn_right_para = "";

function sendShortList()
{
    document.location.href = btn_right_para + "&email=" + document.getElementById("shortlistsendemail").value;
}

function show_profilcreate_popup()
{
    var top = ( ( document.body.clientHeight / 2 ) - ( ( document.getElementById("popup_content").clientHeight + 20 ) / 2 ) ) + document.body.scrollTop;
    document.getElementById("popup_holder").style.top = top+"px";
    var left = ( document.body.clientWidth / 2 ) - ( ( document.getElementById("popup_content").clientWidth + 20 ) / 2 );
    document.getElementById("popup_holder").style.left = left+"px";
    
    document.getElementById("popup_holder").style.visibility = "visible";
}

function hide_profilcreate_popup()
{
    document.getElementById("popup_holder").style.visibility = "hidden";
}

function show_profilbillede_popup()
{
    var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }


//    var top = ( ( document.body.clientHeight / 2 ) - ( ( document.getElementById("popup_profilbillede_content").clientHeight + 20 ) / 2 ) ) + document.body.scrollTop;
//    document.getElementById("popup_profilbillede_holder").style.top = top+"px";
document.getElementById("popup_profilbillede_holder").style.top = (((myHeight/2) - ( document.getElementById("popup_profilbillede_content").clientHeight + 20 ) / 2 ) + document.body.scrollTop) + "px";
    var left = ( document.body.clientWidth / 2 ) - ( ( document.getElementById("popup_profilbillede_content").clientWidth + 20 ) / 2 );
    document.getElementById("popup_profilbillede_holder").style.left = (left/2)+"px";
    
    document.getElementById("popup_profilbillede_holder").style.visibility = "visible";
}

function hide_profilbillede_popup()
{
    document.getElementById("popup_profilbillede_holder").style.visibility = "hidden";
}
