﻿var newwindow;
var popUpsBlocked = false;
function OpenWindow(url, myHeight, myWidth) {
	    newwindow=window.open(url,'POPPER','height='+myHeight+',width=' + myWidth + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no');
		if (window.focus) {newwindow.focus()}
}
function OpenWindowSP(url, myHeight, myWidth) {
	    newwindow=window.open(url,'POP','height='+myHeight+',width=' + myWidth + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no');
		if (window.focus) {newwindow.focus()}
}
function test(url) {
	    newwindow=window.open(url,'POP','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no');
		if (window.focus) {newwindow.focus()}
}

function switchMenu(obj) {
    var el = document.getElementById(obj);
    if ( el.style.display != 'none' ) {
    el.style.display = 'none';
    }
    else {
    el.style.display = '';
    }
}
function PrintInfo(var1) {
    window.open('PrintInfo.aspx?ID='+var1, 'printinfo');
}
function DetectPopUp() {
    
       var popup = window.open('about:blank', 'Testing', 'width=300,height=300');

    if (!popup) {
        //PrintMessage('PopUp Blocker is OFF');
        window.open('PrintInfo.aspx', 'printinfo');
    }    
    else
        PrintMessage("Du har en popup blokker aktiveret. For at printe skal du tillade popup's fra itd.dk eller deaktivere popup blokkeren!");
    popup.close();
    return true;
}

function PrintMessage(message) {
    alert(message);
}

function addWkColumn(tblId, wkStart) {
    var tbl = document.getElementById(tblId);

    var tblBodyObj = tbl.tBodies[0];
    for (var i = 0; i < tblBodyObj.rows.length; i++) {
        // Month Header
        if (i == 0) {
            // Add extra colspan column
            tblBodyObj.rows[i].cells[0].colSpan = 8;
        }
        // Week Header
        if (i == 1) {
            // Add week column headline
            var newCell = tblBodyObj.rows[i].insertCell(0);
            newCell.innerHTML = 'uge';
            newCell.style.fontSize = '10px';
            newCell.style.fontWeight = 'bold';
            newCell.style.verticalAlign = 'bottom';
            newCell.style.backgroundColor = '#ffffee';
        }

        // Normal row
        if (i >= 2) {
            // Add the weeknumbers
            var newCell = tblBodyObj.rows[i].insertCell(0);
            if (tblBodyObj.rows[i].cells[1].style.color != 'white' || tblBodyObj.rows[i].cells[2].style.color != 'white' || tblBodyObj.rows[i].cells[3].style.color != 'white' || tblBodyObj.rows[i].cells[4].style.color != 'white' || tblBodyObj.rows[i].cells[5].style.color != 'white' || tblBodyObj.rows[i].cells[6].style.color != 'white' || tblBodyObj.rows[i].cells[7].style.color != 'white') {
                newCell.innerHTML = wkStart;
                if (wkStart == "53") {
                    wkStart = 0;
                }
                wkStart += 1;
            }
            newCell.style.fontSize = '10px';
            newCell.style.backgroundColor = '#ffffee';
        }
    }
}
var boolNS4 = navigator.appVersion.indexOf("Nav") > 0 && parseInt(navigator.appVersion) == 4;
function GetElement(strElement)
{
	if (document.getElementById)
	{
		// IE5+, Netscape 6, Mozilla
		return (document.getElementById(strElement));
	}
	else if (document.all)
	{
		// IE4
		return (eval("document.all." + strElement));
	}
	else if (document.layers)
	{
		// Netscape 4
		return (eval("document." + strElement));
	}
	else
	{
		// Crap!
		return (null);
	}
}
function showDesc(varID) {
   if(boolNS4) return false;
   objCurrentLong = GetElement("Desc"+varID+"Long");
   objCurrentLong.style.display = (objCurrentLong.style.display=="none" ? "block" : "none");
}