﻿var agt    = navigator.userAgent.toLowerCase();
var is_mac = (agt.indexOf("mac") != -1);
var is_opera = (agt.indexOf("opera") != -1);
var is_ie = ((agt.indexOf("msie") != -1) && (!is_opera));
var is_ie6 = (((is_ie) && (agt.indexOf("msie 5") != -1) || (agt.indexOf("msie 6") != -1)));

var instruction, Opened, Closed;

if(!is_mac) {
instruction = 'Blokering af pop-op-vinduer er slået til\n\nHold Ctrl tast nede, mens du klikker';
}
else {
instruction = 'Blokering af pop-op-vinduer er slået til\n\nHold Æble tast nede, mens du klikker';
}

if(fgMenuColor == '#000000') {
Opened = '<img src="files/vertical/home/external/black_opened.gif" alt="" width="15" height="6" />';
Closed = '<img src="files/vertical/home/external/black_closed.gif" alt="" width="15" height="6" />';
}
else {
Opened = '<img src="files/vertical/home/external/white_opened.gif" alt="" width="15" height="6" />';
Closed = '<img src="files/vertical/home/external/white_closed.gif" alt="" width="15" height="6" />';
}

var active = '<img src="files/vertical/home/external/arrow.gif" alt="" width="15" height="6" />';
var passive = '<img src="files/vertical/home/external/blank.gif" alt="" width="15" height="6" />';

var strMenu1 = '';
var strMenu2 = '';

var fullpath = location.href;

function getParm(string,parm) {
var startPos = string.indexOf(parm + "=");
  if (startPos > -1) {
  startPos = startPos + parm.length + 1;
  var endPos = string.indexOf("&",startPos);
    if (endPos == -1) {
    endPos = string.length;
    }
    return unescape(string.substring(startPos,endPos));
  }
  return '';
}

function HighLight(div, lnk) {
document.getElementById(div).style.backgroundColor = hlColor;
document.getElementById(lnk).className = 'on';
}

function LowLight(div, lnk) {
document.getElementById(div).style.backgroundColor = bgColor;
document.getElementById(lnk).className = 'off';
}

function visFlash(movieID) {
location.href = 'flash.aspx?id=' + escape(movieID);
}

function visBilledserie(folderID) {
location.href = 'dias.aspx?id=' + folderID;
}

var siteWindow = null;

function visHjemmeside(x) {
  var winleft = (screen.width - 790) / 2;
  siteWindow = window.open(x,'siteWindow','width=790,height=550,left='+winleft+',top=0,menubar=yes,toolbar=yes,location=yes,status=yes,resizable=yes,scrollbars=yes');
  if(!siteWindow) {
  alert(instruction);
  }
  else {
  if(siteWindow.open) siteWindow.focus();
  }
}

function getTitle(img) {
var separator = img.lastIndexOf("\/")+1;
var fullname = img.slice(separator);
return fullname;
}

var imageWindow = null;

function visBillede(iName, iWidth, iHeight) {
  var winleft = (screen.width - iWidth) / 2;
  var wintop = (screen.height - iHeight) / 2;
  imageWindow = window.open('','imageWindow','width='+iWidth+',height='+iHeight+',left='+winleft+',top='+wintop);
  if(imageWindow) {
  imageWindow.document.writeln('<html>');
  imageWindow.document.writeln('<head>');
  imageWindow.document.writeln('<meta http-equiv="imagetoolbar" content="no" />');
  imageWindow.document.writeln('<title>' + getTitle(iName) + '</title>');
  imageWindow.document.writeln('</head>');
  imageWindow.document.writeln('<body onblur="self.close()" style="margin:0px;border-style:none">');
  imageWindow.document.writeln('<img src="' + iName + '" width="' + iWidth + '" height="' + iHeight + '">');
  imageWindow.document.writeln('</body>');
  imageWindow.document.writeln('</html>');
  imageWindow.document.close();
  }
  else {
  alert(instruction);
  }
}

var intMinWidth;
var intMaxWidth;
var intBoxHeight;
var intSubWidth;

if(!is_ie6) {
intMinWidth = 153;
intMaxWidth = 163;
intBoxHeight = 13;
intSubWidth = 148;
}
else {
intMinWidth = 155;
intMaxWidth = 165;
intBoxHeight = 15;
intSubWidth = 155;
}

var intBoxWidth;
var intMargin;
var strMenuBorder;
var strTextBorder;
var intTextPadding;
var intTextWidth;

if(bgColor!='#ffffff') {		//Når der IKKE er hvid kanalfarve:
  intBoxWidth = intMinWidth;		//Altid minimum bredde til menu- og tekstbokse
  intMargin = 5;                        //... og 5px margin i begge sider til klassen column
  strTextBorder = '0px';		//... og ingen ramme omkring tekstbokse
  intTextPadding = 0;			//... og ingen luft i tekstbokse
  intTextWidth = 155;
  if(bgColor!=bgMenuColor) {		//Hvis menubaggrund og kanalbaggrund er forskellige fra hinanden:
  strMenuBorder = 'black';		//Sort ramme omring menubokse
  }
  else {				//Hvis menubaggrund og kanalbaggrund er identiske:
  strMenuBorder = bgColor;		//"Usynlig" ramme omkring menubokse
  }
}
else {					//Når der ER hvid kanalfarve:
  intBoxWidth = intMaxWidth;		//Maksimum bredde til menu- og tekstbokse
  intMargin = 0;			//... og derfor ingen margin i nogen sider til klassen column
  strMenuBorder = 'black';		//Sort ramme omkring menubokse
  strTextBorder = '1px solid black';	//Sort ramme omkring tekstbokse
  intTextPadding = 5;			//Luft i tekstbokse
  intSubWidth += 10;
  if(!is_ie6) {
  intTextWidth = 153;			//Fratræk 2 x padding og border
  }
  else {
  intTextWidth = 165;
  }
}

var strCSS = '<style type="text/css">';
strCSS += 'div.mainlink{width:'+intBoxWidth+'px;height:'+intBoxHeight+'px;background-color:'+bgMenuColor+';border:1px solid '+strMenuBorder+';margin-bottom:2px;}';
strCSS += 'div.sublink{width:'+intSubWidth+'px;background-color:'+bgColor+';border:1px solid '+bgColor+';padding-left:5px;margin-bottom:2px;}';
strCSS += 'div.column{width:'+intBoxWidth+'px;margin-left:'+intMargin+'px;margin-right:'+intMargin+'px;}';
strCSS += 'table#container td.channel{height:100%;width:165px;background-color:'+bgColor+';color:'+fgColor+';padding-top:15px;padding-bottom:15px;font-size:10px;font-family:verdana,arial,sans-serif;}';
strCSS += 'table#container td#content{height:100%;width:570px;font-size:13px;font-family:'+strFont+';}';
strCSS += 'table#container td#content table td{border:1px solid black;font-size:13px;font-family:'+strFont+';}';
strCSS += 'div.mainlink a:link{color:'+fgMenuColor+';background-color:transparent;text-decoration:none;width:100%;height:100%;display:block;}';
strCSS += 'div.mainlink a:visited{color:'+fgMenuColor+';background-color:transparent;text-decoration:none;width:100%;height:100%;display:block;}';
strCSS += 'div.mainlink a:active{color:'+fgMenuColor+';background-color:transparent;text-decoration:none;width:100%;height:100%;display:block;}';
strCSS += 'div.mainlink a:hover{color:'+fgMenuColor+';background-color:transparent;text-decoration:none;width:100%;height:100%;display:block;}';
strCSS += 'div.sublink a.off:link{color:'+fgColor+';background-color:transparent;}';
strCSS += 'div.sublink a.off:visited{color:'+fgColor+';background-color:transparent;}';
strCSS += 'div.sublink a.off:active{color:'+fgColor+';background-color:transparent;}';
strCSS += 'div.sublink a.off:hover{color:'+fgColor+';background-color:transparent;}';
strCSS += 'a.z_link_z:link{color:'+lnkColor+';background-color:transparent;text-decoration:'+lnkDecor+';}';
strCSS += 'a.z_link_z:visited{color:'+lnkColor+';background-color:transparent;text-decoration:'+lnkDecor+';}';
strCSS += 'a.z_link_z:active{color:'+lnkColor+';background-color:transparent;text-decoration:'+lnkDecor+';}';
strCSS += 'a.z_link_z:hover{color:'+lnkColor+';background-color:transparent;text-decoration:'+lnkHover+';}';
strCSS += 'div.text{width:'+intTextWidth+'px;border:'+strTextBorder+';padding:'+intTextPadding+'px;}';
strCSS += 'div.text a:link {color:'+fgColor+';background-color:transparent;text-decoration:underline;}';
strCSS += 'div.text a:visited {color:'+fgColor+';background-color:transparent;text-decoration:underline;}';
strCSS += 'div.text a:active {color:'+fgColor+';background-color:transparent;text-decoration:underline;}';
strCSS += 'div.text a:hover {color:'+fgColor+';background-color:transparent;text-decoration:none;}';
strCSS += 'div.text a.z_link_z:link{color:'+lnkColor+';background-color:transparent;text-decoration:'+lnkDecor+';}';
strCSS += 'div.text a.z_link_z:visited{color:'+lnkColor+';background-color:transparent;text-decoration:'+lnkDecor+';}';
strCSS += 'div.text a.z_link_z:active{color:'+lnkColor+';background-color:transparent;text-decoration:'+lnkDecor+';}';
strCSS += 'div.text a.z_link_z:hover{color:'+lnkColor+';background-color:transparent;text-decoration:'+lnkHover+';}';
strCSS += 'div.text hr{color:'+fgColor+';background-color:'+fgColor+';}';
strCSS += 'input.btn{cursor:pointer;cursor:hand;background-color:'+bgMenuColor+';color:'+fgMenuColor+';width:60px;font-size:9px;}';
strCSS += 'table#container td#content table td.forumlabel{background-color:'+bgColor+';color:'+fgColor+';font-size:10px;font-family:verdana,arial,sans-serif;}';
strCSS += '.unilabel{background-color:'+bgColor+';color:'+fgColor+';border:1px solid '+fgColor+';}';
if(!is_ie6) {
  strCSS += 'div#panel div{width:61px;cursor:default;float:left;margin-right:2px;margin-bottom:2px;text-align:right;display:block;padding-left:1px;padding-right:1px;color:black;border:1px solid black;}';
  if(is_ie) {
  strCSS += 'div#bodytext{overflow:hidden;}';
  }
  else {
  strCSS += 'html{overflow:-moz-scrollbars-vertical;}';
  }
  if(!is_opera) {
  strCSS += 'div#bodytext textarea{height:18px;}';
  }
  else {
  strCSS += 'div#bodytext textarea{height:60px;}';
  }
}
else {
  strCSS += 'div#panel div{width:65px;cursor:default;float:left;margin-right:2px;margin-bottom:2px;text-align:right;display:block;padding-left:1px;padding-right:1px;color:black;border:1px solid black;}';
}
strCSS += '</style>';

document.write(strCSS);
