﻿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 popFull(url)
{
    newwindow = window.open(url, 'POPfull');//, '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");


}
/*ITD v5*/
function PrintThisPage(curPage) {
    var sOption = "toolbar=yes,location=no,directories=yes,menubar=yes,";
    sOption += "scrollbars=yes,width=750,height=600,left=100,top=25";
    var winprint = window.open("/Print.aspx?Param="+curPage, "Print", sOption);
    winprint.focus();
}
//function Select(Select) {
//    for (var n = 0; n < document.forms[0].length; n++)
//        if (document.forms[0].elements[n].type == 'checkbox')
//            document.forms[0].elements[n].checked = Select; return false;
//}
function CheckBoxListSelect(cbControl, state) {
    var chkBoxList = document.getElementById(cbControl);
    var chkBoxCount = chkBoxList.getElementsByTagName("input");
    for (var i = 0; i < chkBoxCount.length; i++) {
        chkBoxCount[i].checked = state;
    }

    return false;
}
/*BEGIN Landeinfo toogle kat + lande shit*/
    $(function () {
        var isClicked = false;
        $('#expandLande').click(function () {
            if (isClicked == false) {
                $(this).html('Vis landeoversigt');
                $('.catKontent2').slideUp();
                isClicked = true;
            }
            else {
                $(this).html('Luk landeoversigt');
                $('.catKontent2').slideDown();
                isClicked = false;
            }
        });

        var isClickedKat = false;
        $('#expandKat').click(function () {
            if (isClickedKat == false) {
                $(this).html('Vis kategorioversigt');
                $('.catKontent').slideUp();
                isClickedKat = true;
            }
            else {
                $(this).html('Luk kategorioversigt');
                $('.catKontent').slideDown();
                isClickedKat = false;
            }
        });
    });

/* END Landeinfo toogle kat + lande shit*/
