﻿// JScript File
var w = null;

function focusWindow()
{
  if(w != null && w.open && w.focus)
  {
    w.focus();
    w = null;
  }  
}

function skift_anonym(menu_id_url)
{
  if (isNaN(menu_id_url)) {
    w = window.open();
    w.location.assign(menu_id_url);
    setTimeout("focusWindow()", 500);
  }  
  else
    parent.forside.location.href="Side.aspx?TopmenuID=0&VenstremenuID=" + menu_id_url;
}

function skift_topmenu(topmenu_id)
{
  //alert('skift_topmenu ' + topmenu_id);
  marker_menu('TOP', topmenu_id, 'T_MENU_');
  parent.venstremenu.location.href = "SideMenu.aspx?TopmenuID=" + topmenu_id;
  parent.indhold.location.assign("SideIndhold.aspx");
  parent.rel_menu.location.reload();
}

function skift_menu(vmenu_id_url)
{
  if (isNaN(vmenu_id_url)) {
    open(vmenu_id_url);
  }  
  else {
    parent.indhold.location.href="SideIndhold.aspx?VenstremenuID=" + vmenu_id_url;
    parent.rel_menu.location.reload();
  }  
}

function skift_rel_menu(vmenu_id)
{
  parent.indhold.location.href="SideIndhold.aspx?VenstremenuID=" + vmenu_id;
}

function skift_indhold(aspx_url)
{
  parent.indhold.location.href=aspx_url;
}

function glemt_password()
{
  parent.forside.location.assign("Forside.aspx?password=1");
}
function konto_laast()
{
  parent.forside.location.assign("Forside.aspx?konto_laast=1");
}
function password_udlobet()
{ 
  parent.forside.location.assign("Forside.aspx?password_udlobet=1");
}

function rens_link(e)
{
  var targ
  if (e.target)          targ = e.target
  else if (e.srcElement) targ = e.srcElement

  var box = targ.id.substring(0, targ.id.indexOf("_")+1);
  var h = document.getElementById(box+"HiddenLogin").value;
  var t = targ.value;
  if ( h != t )
  {
    document.getElementById(box+"linkPassword").innerHTML = "Glemt password?";
    document.getElementById(box+"linkPassword").href = "javascript:glemt_password()";
    if (document.getElementById(box+"COSAError")) 
      document.getElementById(box+"COSAError").innerHTML = "";
  }
}

function marker_menu(doc_id, menu_id, id_tag)
{
  var doc;
  var x = id_tag;

  if (doc_id == 'TOP')     { doc = parent.topmenu.document;     }
  if (doc_id == 'VENSTRE') { doc = parent.venstremenu.document; }
  //alert('marker_menu kaldt og doc tildelt ' + doc.anchors.length);
  for (var i=0; i < doc.anchors.length; i++)
  {
    if (doc.anchors[i].id.substring(0, x.length)==x)
    {
      //alert(doc.anchors[i].id + ' deco ' + doc.anchors[i].style.textDecoration);  
      if (doc.anchors[i].id == x+menu_id)
      {
        doc.anchors[i].style.textDecoration = 'underline';
        //doc.anchors[i].style.fontWeight = "bold";
        //doc.form1.style.fontWeight
      }
      else
      { 
        doc.anchors[i].style.textDecoration = 'none';
        //doc.anchors[i].style.fontWeight = "normal";
      }
      //alert(doc.anchors[i].style.textDecoration);
    }
  }

}
