// globale konstanter til bogmærke mv
bogm=null;
loginDlg=null;
arttype=0;
artno=0;
artname='';
retStatus='0'; // retur til

function showBookMark() {
var posX = 510+window.screenLeft;
var posY = 80+window.screenTop;

  var btnText = document.getElementById('btnLogin');
  if (btnText.value == 'Log ind')
  {
    if (bogm == null) {
      bogm=window.parent.open("NoBookMarks.jsp","",'width=230px,height=340px,top='+posY+',left='+posX+'resizable');
    }
    else
    {
      if (bogm.closed)
        bogm=window.parent.open("NoBookMarks.jsp","",'width=230px,height=340px,top='+posY+',left='+posX+'resizable');
      else
        bogm.focus();
    }
  }
  else
  {
    if (bogm == null) {
        bogm=window.parent.open("bookmarkservlet?action=2&artno="+artno+"&artname="+artname+"&arttype="+arttype,"",'width=280px,height=340px,top='+posY+',left='+posX+'resizable');
    }
    else
    {
      if (bogm.closed)
        bogm=window.parent.open("bookmarkservlet?action=2&artno="+artno+"&artname="+artname+"&arttype="+arttype,"",'width=280px,height=340px,top='+posY+',left='+posX+'resizable');
      else
        bogm.focus();
    }
  }
  bogm.opener=self;
  if (loginDlg != null && !loginDlg.closed)
    bogm.close();
}

function setBookMarkLink(type, no, name)
{
  arttype = type;
  artno = no;
  artname = name;
}

function setRetStatus(st)
{
  retStatus = st;
}
function startLogin(applType)
{
  var btnText = document.getElementById('btnLogin');
  if (btnText.value == 'Log ind')
  {
    var posX = 610+window.screenLeft;
    var posY = 80+window.screenTop;
    var sFeatures = "dialogWidth=195px; dialogHeight=365px; dialogTop="+posY+"px; dialogLeft="+posX+"px; center: No; help: No; status: no; scroll:no;";
    var rc = window.showModalDialog("SelectUserLoginLoader.jsp", "", sFeatures);
    if (rc == null)
      rc = "0";
    var irc = parseInt(rc);
     if (irc > 0) { // internal userid
      window.top.headerFrame.setLoginButton('Log ud');
      if (retStatus == "0"){//forside (hks)
      window.top.contentFrame.location.reload(); //href="forside/forside0.jsp"
      }
      if (retStatus == "2") // SPOR
        window.top.headerFrame.location.reload();
      if (retStatus == "3") // U-plan
        window.top.headerFrame.location.reload();
      if (retStatus == "7") // start af Selekt
        window.top.headerFrame.location.reload();
      if (retStatus == "71") // slut af Selekt
        window.top.contentFrame.navigationFrame.location.href="/SelektAppl/SelektForklResultat.jsp?iid="+rc+"&save=1";
/*        window.top.contentFrame.navigationFrame.location.href="http://localhost:8080/SelektAppl/SelektForklResultat.jsp?iid="+rc+"&save=1";*/

      window.top.footerFrame.location.reload();
//      window.top.headerFrame.location.reload();
    }
    else
    {
      setLoginButton('Log ind');
      top.footerFrame.location.reload();
    }
  }
  else
    startLogout();
}

function startLogout()
{
//  location.href='userloginservlet?loginType=3&appltype=9';
  setLoginButton('Log ind');
  top.footerFrame.location.reload();
//  top.headerFrame.location.reload();
  location.href='userloginservlet?loginType=3&appltype=9';
}

function setLoginButton(text)
{
  var btnText = document.getElementById('btnLogin');
  btnText.value=text;
}

function setContentPage(page)
{
  window.parent.frames["contentFrame"].location = page;
  setRetStatus(0);
}

