		var helpw;

		function documentfeatures()
		{
			var dwidth	= 750;
			var dleft	= parseInt(top.window.screenLeft+top.document.body.clientWidth-dwidth-12);
			
			var dtop	= top.window.screenTop-110;
			var dheight	= top.document.body.clientHeight+20;
			if (dheight<500) { dheight=500; }
			
			var features="Top="+dtop+",Left="+dleft+",Width="+dwidth+",Height="+dheight+",Location=no, Status=yes, Toolbar=no, Resizable=yes, menubar=yes, scrollbars=yes";
			
			return(features);
		}
		
		function showhelp()
		{
			var dwidth	= 1000;
			var dleft	= parseInt(top.window.screenLeft+top.document.body.clientWidth-dwidth-12);
			
			var dtop	= top.window.screenTop-110;
			var dheight	= top.document.body.clientHeight+20;
			if (dheight<500) { dheight=500; }
			
			var features="Top="+dtop+",Left="+dleft+",Width="+dwidth+",Height="+dheight+",Location=no, Status=yes, Toolbar=no, Resizable=yes, menubar=yes, scrollbars=yes";

			helpw=window.open("Help.htm","helpw",features);
			helpw.focus()
		}

		function getbrowser() {
		    var browser = "OTHER";
		    if (navigator.userAgent.indexOf("MSIE") > -1) { browser = "MSIE"; }
		    if (navigator.userAgent.indexOf("Firefox") > -1) { browser = "Firefox"; }
		    if (navigator.userAgent.indexOf("Chrome") > -1) { browser = "Chrome"; }
		    if (navigator.userAgent.indexOf("Opera") > -1) { browser = "Opera"; }
		    if (navigator.userAgent.indexOf("Safari") > -1) { browser = "Safari"; }
		    return (browser);
		}

		function modalfeaturesnear(dwidth, dheight, thisbutton) {
		    var browser = getbrowser();
		    if (browser == "MSIE") {
		        //window.screenLeft & window.screenTop return the frames position
		        dleft = window.screenLeft + thisbutton.getBoundingClientRect().left + 50;
		        dtop = window.screenTop + thisbutton.getBoundingClientRect().top - parseInt(dheight / 2) - 50;
		    }
		    else {
		        //window.screenX & window.screenY returns whole browsers position
		        dleft = window.screenX + document.getBoxObjectFor(thisbutton).x + 50;
		        dtop = window.screenY + document.getBoxObjectFor(thisbutton).y - 50;
		    }
		    var features = "dialogLeft:" + dleft + "px; dialogTop:" + dtop + "px; dialogWidth:" + dwidth + "px; dialogHeight:" + dheight + "px; Status:yes; Scroll:no; Help:no";
		    return (features);
		}

		function modalfeatures(dwidth, dheight) {
		    var browser = getbrowser();
		    if (browser == "MSIE") {
		        dleft = parseInt(top.window.screenLeft + (top.document.body.clientWidth - dwidth) / 2 - 12);
		        dtop = parseInt(top.window.screenTop + (top.document.body.clientHeight - dheight) / 2-50);

		        if (window.navigator.appVersion.indexOf("MSIE 6") >= 0) {
		            dheight += 52;
		        }
		    }
		    else {
		        dleft = parseInt(top.window.screenX + (top.document.body.clientWidth - dwidth) / 2 - 12);
		        dtop = parseInt(top.window.screenY + (top.document.body.clientHeight - dheight) / 2) + 50;
		    }
		    var features = "dialogLeft:" + dleft + "px; dialogTop:" + dtop + "px; dialogWidth:" + dwidth + "px; dialogHeight:" + dheight + "px; Status:yes; Scroll:no; Help:no";
		    return (features);
		}

		function showcolordialog(txtBackId, txtTekstId, overskrift) {

		    var selcolor = document.getElementById(txtBackId).value;

		    //alert("selcolor: " + selcolor);
		    
		    retval = window.showModalDialog("ColorSelector.aspx?InitColor=" + escape(selcolor), "", modalfeatures(704, 560));
		    if (retval != "") {

		        var txtBack = document.getElementById(txtBackId);
		        txtBack.value = retval;
		        txtBack.style.backgroundColor = retval;
		        txtBack.style.color = makeTextColor(retval);

		        if (txtTekstId != "") {
		            var textcolor = makeTextColor(retval);
		            var txtTekst = document.getElementById(txtTekstId);
		            txtTekst.value = textcolor;
		            txtTekst.style.backgroundColor = textcolor;
		            txtTekst.style.color = makeTextColor(textcolor);
		        }
		    }
		}

		function selectdate(dialogtitle, startvalue) {
		    var url = "Kalender.aspx?Title=" + dialogtitle + "&Dato=" + startvalue;
		    retval = window.showModalDialog(url, "", modalfeatures(288, 300));
		    return (retval);
		}

		function printfeatures(orientation) {
		    if (orientation == "portrait") {
		        pwidth = 740;
		        pheight = 1000;
		    }
		    if (orientation == "landscape") {
		        pwidth = 1080;
		        pheight = 700;
		    }

		    if (pwidth > screen.width) { pwidth = screen.width; }
		    if (pheight > screen.height - 150) { pheight = screen.height - 150; }

		    var pleft = parseInt((screen.width - pwidth) / 2);
		    var ptop = parseInt((screen.height - pheight) / 2) - 150;

		    var features = "Top=" + ptop + ",Left=" + pleft + ",Width=" + pwidth + ",Height=" + pheight + ",Location=no, Status=yes, Toolbar=no, Resizable=yes, menubar=yes, scrollbars=yes";
		    return (features);
		}

		function pdffeatures() {
            pwidth = 990;
	        pheight = 1000;

		    if (pwidth > screen.width) { pwidth = screen.width; }
		    if (pheight > screen.height - 150) { pheight = screen.height - 150; }

		    var pleft = parseInt((screen.width - pwidth) / 2);
		    var ptop = parseInt((screen.height - pheight) / 2) - 150;

		    var features = "Top=" + ptop + ",Left=" + pleft + ",Width=" + pwidth + ",Height=" + pheight + ",Location=no, Status=yes, Toolbar=no, Resizable=yes, menubar=yes, scrollbars=yes";
		    return (features);
		}


