function showurl(url, pop, nw){
	if (pop == 1) {
		show_pop2(url,'titel',400,400,0,0,0,0,0,1,1,0);
	}
	if (nw == 1 && pop == 0) {
	  blank.location.href = url;	
	} 
	if(nw == 0 && pop == 0) {
	  top.content.location.href = url;	
	}
}


function menuurl(contenturl, menid) {
	if (menid==1311) {
		contenturl="/modules/newinfo.php";
	}
	if (contenturl != ""){
		top.content.location.href = contenturl;
	}
	top.tmenu.location.href = "/topmenu.php?menid="+menid;
	top.vmenu.location.href = "/menu.php?menid="+menid;
}

function show_file(file,wx,wy,toolbar,location,direct,status,menubar,scroll,resize) {
	
     var swidth=screen.availWidth? screen.availWidth : screen.width;
     var sheight=screen.availHeight? screen.availHeight : screen.height;
     var pwidth=parseInt(wx) ;
     var pheight=parseInt(wy) ;
	 var xaxis=Math.round((swidth-pwidth)/2) ;
	 var yaxis=Math.round((sheight-pheight)/2) ;
	 var props = 'width='+wx+',height='+wy+' dependent, top=' + yaxis + ', left=' + xaxis;

	 if (toolbar == 1) props += ',toolbar';
     if (location == 1) props += ',location';
     if (direct == 1) props += ',directories';
     if (status == 1) props += ',status';
     if (menubar == 1) props += ',menubar';
     if (scroll == 1) props += ',scrollbars';
     if (resize == 1) props += ',resizable';

     var NewWindow = window.open(file,'File',props);
}

function show_pop(file,pname,wx,wy,toolbar,location,direct,status,menubar,scroll,resize) {
	
	var swidth=screen.availWidth? screen.availWidth : screen.width;
	var sheight=screen.availHeight? screen.availHeight : screen.height;
	var pwidth=parseInt(wx) ;
	var pheight=parseInt(wy) ;
	var xaxis=Math.round((swidth-pwidth)/2) ;
	var yaxis=Math.round((sheight-pheight)/2) ;
	if (wx == -1) {
		wx = swidth-100;
	}
	if (wy == -1) {
		wy = sheight-100;
	}
	
	var props = 'width='+wx+',height='+wy+' dependent, top=' + yaxis + ', left=' + xaxis;
	
	if (toolbar == 1) props += ',toolbar';
	if (location == 1) props += ',location';
	if (direct == 1) props += ',directories';
	if (status == 1) props += ',status';
	if (menubar == 1) props += ',menubar';
	if (scroll == 1) props += ',scrollbars';
	if (resize == 1) props += ',resizable';
	
	var NewWindow = window.open(file,pname,props);
}

function show_pop2(pfile,pname,wx,wy,toolbar,location,direct,status,menubar,scroll,resize,title) {
	if (wx == -1) {
		wx = 100;
	}
	if (wy == -1) {
		wy = 100;
	}
	
	var swidth=screen.availWidth? screen.availWidth : screen.width;
	var sheight=screen.availHeight? screen.availHeight : screen.height;
	var pwidth=parseInt(wx) ;
	var pheight=parseInt(wy) ;
	var xaxis=Math.round((swidth-pwidth)/2) ;
	var yaxis=Math.round((sheight-pheight)/2) ;
	var props = 'width='+wx+',height='+wy+' dependent, top=' + yaxis + ', left=' + xaxis;
	
	if (toolbar == 1) props += ',toolbar';
	if (location == 1) props += ',location';
	if (direct == 1) props += ',directories';
	if (status == 1) props += ',status';
	if (menubar == 1) props += ',menubar';
	if (scroll == 1) props += ',scrollbars';
	if (resize == 1) props += ',resizable';
	
	var NewWindow = window.open(pfile,pname,props);
}

function palert(file,pname,wx,wy,toolbar,location,direct,status,menubar,scroll,resize) {
	var pwidth=parseInt(wx) ;
	var pheight=parseInt(wy) ;
	var props = 'width='+pwidth+',height='+pheight+' dependent,top=400,left=500';
	if (toolbar == 1) props += ',toolbar';
	if (location == 1) props += ',location';
	if (direct == 1) props += ',directories';
	if (status == 1) props += ',status';
	if (menubar == 1) props += ',menubar';
	if (scroll == 1) props += ',scrollbars';
	if (resize == 1) props += ',resizable';
	var NewWindow = window.open(file,pname,props);
}

function gofp() {
     top.location.href = "/";
}

function goafp() {
     location.href = "/";
}

function fchange(id){ 
     ID = document.getElementById(id); 
     
     if(ID.style.display == "") 
          ID.style.display = "none"; 
     else 
          ID.style.display = ""; 
}

function lchange(id, id2){ 
     ID = document.getElementById(id); 
     ID2 = document.getElementById(id2); 
     
     ID.style.display = ""; 
     ID2.style.display = "none"; 
}

function change(id){ 
     ID = document.getElementById(id); 
     
     if(ID.style.display == "") {
          ID.style.display = "none"; 
     } else {
          ID.style.display = ""; 
     }
}

function picdel(ref) {
  var agree=confirm("Er du sikker på du vil slette billedet?");
  if (agree) {
    location.href=ref+"&delpic=y";
  }
}

var heightAdd = 0;
var NS = (navigator.appName=="Netscape")?true:false;
function fitpage() {

	iWinWidth = (NS)?window.innerWidth:document.body.clientWidth;
	iWinHeight = (NS)?window.innerHeight:document.body.clientHeight;
	iWidth = document.images[0].width - iWinWidth;
	iHeight = document.images[0].height - iWinHeight;
	window.resizeBy(iWidth, iHeight+heightAdd);

	iWinWidth = (NS)?window.innerWidth:document.body.clientWidth;
	iWinHeight = (NS)?window.innerHeight:document.body.clientHeight;
	LeftPosition = (screen.width) ? (screen.width-iWinWidth)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-iWinHeight)/2 : 0;
	window.moveTo(LeftPosition,TopPosition-30) // -30 = kompenser for titellinje og statuslinje

	self.focus();

}


function del_word(prog, id){
  var agree=confirm("Er du sikker på du vil slette ordet?");
  if (agree) {
    location.href=prog+"?delete="+id;
  }
}


function del_user(prog, id){
  var agree=confirm("Er du sikker på du vil slette brugeren fra listen?");
  if (agree) {
    location.href=prog+"?delete="+id;
  }
}

function checkall(chkbx) {
	for (var i = 0; i < gbform.length; i++) {
		if (gbform.elements[i].name == chkbx) {
			gbform.elements[i].checked = (!gbform.elements[i].checked);
		}
	}
}

function del_me(prog, id, alerter){
  var agree=confirm(alerter);
  if (agree) {
    location.href=prog+"?delete="+id;
  }
}

function del_me2(prog, id, alerter){
  var agree=confirm(alerter);
  if (agree) {
    location.href=prog+"&delete="+id;
  }
}


var heightAdd = 0;
var NS = (navigator.appName=="Netscape")?true:false;

function fitPic() {

	iWinWidth = (NS)?window.innerWidth:document.body.clientWidth;
	iWinHeight = (NS)?window.innerHeight:document.body.clientHeight;
	iWidth = document.images[0].width - iWinWidth;
	iHeight = document.images[0].height - iWinHeight;
	window.resizeBy(iWidth, iHeight+heightAdd);

	iWinWidth = (NS)?window.innerWidth:document.body.clientWidth;
	iWinHeight = (NS)?window.innerHeight:document.body.clientHeight;
	LeftPosition = (screen.width) ? (screen.width-iWinWidth)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-iWinHeight)/2 : 0;
	window.moveTo(LeftPosition,TopPosition-30) // -30 = kompenser for titellinje og statuslinje

	self.focus();
}

function doPopup() {
	initbox();
}

var ie=document.all
var dom=document.getElementById
var ns4=document.layers
var calunits=document.layers? "" : "px"

var bouncelimit=32 //(must be divisible by 8)
var direction="up"

function initbox(){
if (!dom&&!ie&&!ns4)
return
crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
crossobj.top=scroll_top-250+calunits
crossobj.visibility=(dom||ie)? "visible" : "show"
dropstart=setInterval("dropin()",50)
}

function dropin(){
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
if (parseInt(crossobj.top)<80+scroll_top)
crossobj.top=parseInt(crossobj.top)+40+calunits
else{
clearInterval(dropstart)
bouncestart=setInterval("bouncein()",50)
}
}

function bouncein(){
crossobj.top=parseInt(crossobj.top)-bouncelimit+calunits
if (bouncelimit<0)
bouncelimit+=8
bouncelimit=bouncelimit*-1
if (bouncelimit==0){
clearInterval(bouncestart)
}
}

function dismissbox(){
if (window.bouncestart) clearInterval(bouncestart)
crossobj.visibility="hidden"
}

function centerform() {
	iWinWidth = (NS)?window.innerWidth:document.body.clientWidth;
	iWinHeight = (NS)?window.innerHeight:document.body.clientHeight;
	LeftPosition = (screen.width) ? (screen.width-iWinWidth)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-iWinHeight)/2 : 0;
	window.moveTo(LeftPosition,TopPosition-30) // -30 = kompenser for titellinje og statuslinje

	self.focus();
}

function popUpFit() {
	var intPopContentHeight = 0;
	for (i = 0; document.body.childNodes[i]; i++)
		if (document.body.childNodes[i].tagName == "DIV")
			intPopContentHeight += document.body.childNodes[i].offsetHeight;
	
	// W3C resize
	if (window.innerHeight) {
		if ((screen.availHeight - 24) >= intPopContentHeight) {
			window.innerHeight = intPopContentHeight;
		}
		else {
			window.outerHeight = (screen.availHeight - 24);
		}
		window.moveTo(parseInt((screen.availWidth - window.outerWidth)/2), parseInt(((screen.availHeight - 24) - window.outerHeight)/2));
	}
	// IE resize
	else {
		if ((screen.availHeight - 24) >= document.body.scrollHeight) {
			var intNewHeight = (window.innerHeight) ? (document.body.getElementsByTagName("DIV")[0].offsetHeight - window.innerHeight) : (document.body.scrollHeight - document.body.offsetHeight) + 4;
			if (external && external.dialogHeight) external.dialogHeight = parseInt(external.dialogHeight) + intNewHeight + "px";
			else window.resizeBy(0,intNewHeight);
			if (window.outerHeight) {
				if (window.outerHeight < 175) {
					window.outerHeight = 175;
					return;
				}
			}
			var intNewTop = (-(parseInt(intNewHeight/2)) > 0) ? -(parseInt(intNewHeight/2)) : 0;
			if (external && external.dialogTop) external.dialogTop = parseInt(external.dialogTop) - parseInt(intNewHeight/2) + "px";
			else window.moveBy(0,intNewTop);
		}
		else {
			var intNewHeight = (screen.availHeight - 24);
			var intOldWidth = (window.outerWidth) ? window.outerWidth : document.body.offsetWidth;
			window.resizeTo(intOldWidth,intNewHeight);
			if (!window.outerWidth && (intOldWidth != document.body.offsetWidth)) window.resizeBy((intOldWidth - document.body.offsetWidth),0);
			var intSameLeft = (screenX) ? screenX : (screenLeft) ? screenLeft : 0;
			window.moveTo(intSameLeft,10);
			if (!screenX && (intSameLeft != screenLeft)) window.moveBy((intSameLeft - screenLeft),0);
		}
	}
}


//******************** vis thump ****************************
var thumpImg = new Image();
thumpImg.onerror = handleImageError;

var objThumbErrorImg = new Image();
objThumbErrorImg.src = "/images/missingImage.gif";

var thumpInt;
var intImgIntervalCnt = 0;
//var minibannerArray	= new Array();
var strPopBG;


function buildPopLayer() {
		if (document.readyState && (document.readyState != "complete")) { //forhindre en windows alert: "sitet kan ikke loades" i IE hvis man refresher med mus over cam icon helpdesk 3915
		return false; 
	}
	var objThumbImg	= document.createElement("img");
	objThumbImg.src	= "/images/clock.gif";
	objThumbImg.width = "85";
	objThumbImg.height	= "85";
	objThumbImg.border	= "0";
		
	var objThumbImgDiv = document.createElement("div");
	objThumbImgDiv.align = "center";
	objThumbImgDiv.id = "thumpPic";
	objThumbImgDiv.appendChild(objThumbImg);
		
	var objThumbWrap = document.createElement("div");
	objThumbWrap.id = "thumpLayer";
	objThumbWrap.style.visibility = "hidden";
	objThumbWrap.style.position = "absolute";
	objThumbWrap.style.top = "0";
	objThumbWrap.style.left	= "0";
	objThumbWrap.style.width = "50";
	objThumbWrap.style.height	= "50";
	objThumbWrap.style.zIndex = "9999";
	objThumbWrap.appendChild(objThumbImgDiv);
	document.body.appendChild(objThumbWrap);
}

function positionPop(evt,imgName,hideSwitch) {
 if (document.getElementById && evt) {
		if (!document.getElementById("thumpLayer")) buildPopLayer();
		if (document.getElementById("thumpLayer")) {
			mouseThumpX = (evt.pageX) ? evt.pageX - evt.layerX - 55 : evt.clientX - evt.offsetX + document.body.scrollLeft - 55;
			mouseThumpY = (evt.pageY) ? evt.pageY - evt.layerY : evt.clientY - evt.offsetY + document.body.scrollTop;
 			objDivStyle = document.getElementById("thumpLayer").style;
			objDivStyle.left = mouseThumpX;
			objDivStyle.top = mouseThumpY;
			objDivStyle.width = 50;
			objDivStyle.height = 50;
			objDivStyle.zIndex = 999;
			if (typeof hideSwitch != "number") hideSwitch = 0;
			thumpImg.src = imgName;
			windowPadding = 24;
			thumpInt = window.setInterval("showPop('" + imgName + "')",100);
		}
	}
}

function showPop(imgName) {
	if (!document.getElementById("thumpLayer")) buildPopLayer();
	if (document.getElementById("thumpLayer") && (thumpImg.width > 0)) {
		clearInterval(thumpInt);
		intImgIntervalCnt = 0;
		imgWidth = 50; //thumpImg.width;
		imgHeight = 50; //thumpImg.height;
		document.getElementById("thumpPic").innerHTML = "<img src='" + thumpImg.src + "' border='0' width='50' style='border:1px solid #666'>";
		objDivStyle.width = (imgWidth + 2);
		objDivStyle.height = (imgHeight + 2);
		
		if (mouseThumpX + imgWidth + 24 + 20 >= document.body.clientWidth) {	
			objDivStyle.left = mouseThumpX - (imgWidth + 24 + 30);
		}
		if ((mouseThumpY - document.body.scrollTop) + imgHeight + windowPadding > document.body.clientHeight) {
			objDivStyle.top = (mouseThumpY - (((mouseThumpY - document.body.scrollTop) + imgHeight + windowPadding + 10) - document.body.clientHeight));
		}
		if (document.getElementById("minibannerTabel") && hideSwitch) {
			minibannerArray	= new Array();
			if (document.getElementById("minibannerTabel").innerHTML.indexOf(".swf") != -1) {
				minibannerArray[minibannerArray.length]	= document.getElementById("minibannerTabel");
				document.getElementById("minibannerTabel").style.visibility = "hidden"
			}
			else if (document.getElementById("minibannerTabel").getElementsByTagName("SELECT") && document.getElementById("minibannerTabel").getElementsByTagName("SELECT").length > 0) {
				for (i = 0; document.getElementById("minibannerTabel").getElementsByTagName("SELECT")[i]; i++) {
					minibannerArray[minibannerArray.length]	= document.getElementById("minibannerTabel").getElementsByTagName("SELECT")[i];
					document.getElementById.minibannerTabel.getElementsByTagName("SELECT")[i].style.visibility = "hidden";
				}
			}
		}
		document.getElementById("thumpLayer").style.visibility = "visible";
	}
	intImgIntervalCnt = intImgIntervalCnt + 1;
	if (intImgIntervalCnt > 30) {
		clearInterval(thumpInt);
		intImgIntervalCnt = 0;
	}
}

function hidePop() {
	if (document.getElementById && document.getElementById("thumpLayer")) {
		document.getElementById("thumpLayer").style.visibility = "hidden";
		document.getElementById("thumpLayer").style.backgroundColor = strPopBG;
//		if (minibannerArray.length > 0)
//			for (i = 0; minibannerArray[i]; i++) minibannerArray[i].style.visibility = "visible";
//		document.getElementById("thumpPic").innerHTML = "<img src='/images/clock.gif'>";
		clearInterval(thumpInt);
		intImgIntervalCnt = 0;
	}
}

function handleImageError() {
	thumpImg.src = objThumbErrorImg.src;
}

var dn;
c1 = new Image(); c1.src = "/images/clock/c1.gif";
c2 = new Image(); c2.src = "/images/clock/c2.gif";
c3 = new Image(); c3.src = "/images/clock/c3.gif";
c4 = new Image(); c4.src = "/images/clock/c4.gif";
c5 = new Image(); c5.src = "/images/clock/c5.gif";
c6 = new Image(); c6.src = "/images/clock/c6.gif";
c7 = new Image(); c7.src = "/images/clock/c7.gif";
c8 = new Image(); c8.src = "/images/clock/c8.gif";
c9 = new Image(); c9.src = "/images/clock/c9.gif";
c0 = new Image(); c0.src = "/images/clock/c0.gif";
cb = new Image(); cb.src = "/images/clock/cb.gif";

function extract(h,m,s,type) {
	if (!document.images) return;
		if (h <= 9) {
			document.images.a.src = cb.src;
			document.images.b.src = eval("c"+h+".src");
		} else {
			document.images.a.src = eval("c"+Math.floor(h/10)+".src");
			document.images.b.src = eval("c"+(h%10)+".src");
		}
		if (m <= 9) {
			document.images.d.src = c0.src;
			document.images.e.src = eval("c"+m+".src");
		} else {
			document.images.d.src = eval("c"+Math.floor(m/10)+".src");
			document.images.e.src = eval("c"+(m%10)+".src");
		}
		if (s <= 9) {
			document.g.src = c0.src;
			document.images.h.src = eval("c"+s+".src");
		} else {
			document.images.g.src = eval("c"+Math.floor(s/10)+".src");
			document.images.h.src = eval("c"+(s%10)+".src");
		}
}
function show3() {
	if (!document.images)
	return;
	var Digital = new Date();
	var hours = Digital.getHours();
	var minutes = Digital.getMinutes();
	var seconds = Digital.getSeconds();
	extract(hours, minutes, seconds, dn);
	setTimeout("show3()", 1000);
}

