// OBS: HARDCODEDE REFERENCER TIL MENUSIDEN PLACERING PÅ SERVER

var menusidekatalog = "menuside2";

function foldud(oDiv) {
	document.getElementById(oDiv).style.display = (document.getElementById(oDiv).style.display == "none") ? "block" : "none";	
}

function keyCheck(formname) {
	theKey = window.event.keyCode;
	if (theKey == 13) {
		theForm = eval("document." + formname);
		theForm.submit();
	}
}

function start(appnavn,sti,img,appID,serverurl,width,height,afslutning) {
	//ryd op efter gamle kursusvinduer som brugeren har glemt at afslutte
	if (nyt!=null) {
		nyt.close();
	}
	if (sti.indexOf("utility/firma") != -1) {
		nyt = window.open("","nyt","status=no,toolbar=no,resizable=yes,scrollbars=yes,width=790,height=555,top=0,left=0");
		nyt.location = "../" + sti;
	} else {
		var maxX = screen.availWidth;
		var maxY = screen.availHeight;
		if (maxY >= 715) {
	    	nyt = window.open("","nyt","status=no,toolbar=no,resizable=no,scrollbars=no,width=" + width + ",height=" + height + ",top=0,left=0");
		} else {
    		nyt = window.open("","nyt","status=no,toolbar=no,resizable=yes,scrollbars=yes,width=790,height=555,top=0,left=0");
		}

		//ved udvikling: slå nedenstående fra så sharepoint undgås, dvs. kurset skal findes på din localhost
		if (serverurl != "elearning.finansudd2.dk") {
			// applikationer på anden server end udd2 og som benytter cookies fungerer kun hvis de starter fra scratch, derfor omvejen via sharepoint
			nyt.location = "http://" + serverurl + "/utility/sharepoint2.asp?appID="+appID+"&logon="+username+"&password="+password;
		} else {
			nyt.document.write("<html><head><title>" + appnavn + "</title></head>");
			nyt.document.write("<FRAMESET ROWS='37,*' FRAMEBORDER='0' FRAMESPACING='0' BORDER='0'>");
			nyt.document.write("<FRAME NAME='menu' SRC='' SCROLLING='no'>");
			nyt.document.write("<FRAME NAME='indhold' SRC='' SCROLLING='auto'>");
			nyt.document.write("</FRAMESET>");
			nyt.document.write("</html>");
			nyt.document.close();
	
			var rodkatalog = sti.substring(0,sti.lastIndexOf("/"));
			nyt.menu.location = "http://" + serverurl + "/" + menusidekatalog + "/skjultframe.asp?brugerID="+brugerID+"&orgID="+orgID+"&navn="+displayname+"&orgnavn="+orgnavn+"&img="+img+"&appID="+appID+"&rodkatalog="+rodkatalog+"&afslutning="+afslutning+"&logon="+username+"&password="+password;		
			var display = "";
			var navver = navigator.appVersion;
			with(document) {
				display+= "w" + screen.width;
				display+= "h" + screen.height;
				display+= "c" + screen.colorDepth;
			}
			nyt.indhold.document.write("<html><head><title>Loading</title></head><link rel='stylesheet' href='style_indhold.css' type='text/css'><body><font face='arial' size='2'><br><br><br><br><br><br><br><br><br><br><center><b>V e n t&nbsp;&nbsp;&nbsp;v e n l i g s t . . .</b></center></font></body></html>");
			nyt.indhold.location = "../utility/log2.asp?mode=start&brugerID="+brugerID+"&sti=" + sti +"&display=" + display + "&navver=" + navver + "&serverurl=" + serverurl;
			nyt.moveTo(0,0);
		}
	}
}

var PopupId;
var nyt;

function SM_openPopupWindow(Sti,Name,features) {
	if (typeof PopupId != "undefined") PopupId.close();
	PopupId=window.open(Sti,"PopupId",features);
	if (PopupId == null) {
  		alert(Name+"\nDu har en popup blocker som forhindrer visning af vigtig fejlmeddelelse");
	} else {
		PopupId.focus();
	}
}
