var confirmMsg  = 'Er du sikker på, at du vil ';
function confirmLink(theLink, theSqlQuery)
{
    // Confirmation is not required in the configuration file
    if (confirmMsg == '') {
        return true;
    }

    var is_confirmed = confirm(confirmMsg + '\n' + theSqlQuery);
    if (is_confirmed) {
        theLink.href += '&confirmed=1';
    }

    return is_confirmed;
} // end of the 'confirmLink()' function

function evalSpring(id) {
	document.spoergsmaal.naest_spoerg_id.value = id;
}

function switch_element ($id) {
	if (document.all && document.getElementById) {			//IE5
		$element = document.all($id).style;
	} else if (!document.all && document.getElementById) {	//NS6
		$element = document.getElementById($id).style;
	} else {	// !IE5 && !NS6
		return false;
	}
	if ($element.display == 'block') {
		$element.display = 'none';
	} else {
		$element.display = 'block';
	}
}

// Funktion der henter koordinator på mus
var IE = document.all?true:false
if (!IE) document.captureEvents(Event.MOUSEMOVE)
var tempX = 0
var tempY = 0

function getMouseX(e) {
	if (IE) { // grab the x-y pos.s if browser is IE
		tempX = event.clientX + document.body.scrollLeft;
	} else {  // grab the x-y pos.s if browser is NS
		tempX = e.pageX;
	}  
	// catch possible negative values in NS4
	if (tempX < 0){tempX = 0}
	// show the position values in the form named Show
	// in the text fields named MouseX and MouseY
	return tempX
}

function getMouseY(e) {
	if (IE) { // grab the x-y pos.s if browser is IE
		tempY = event.clientY + document.body.scrollTop
	} else {  // grab the x-y pos.s if browser is NS
		tempY = e.pageY
	}  
	// catch possible negative values in NS4
	if (tempY < 0){tempY = 0}
	// show the position values in the form named Show
	// in the text fields named MouseX and MouseY
	return tempY
}

// funktioner til at hente mus SLUT

var kal_sem = 0;
function visKal(kal, yOffset) {
	if (kal_sem == 0) {
		kalenderTilhoer = kal;
		var koorX = getMouseX()+20;
		var koorY = getMouseY()+yOffset;
		document.all.kalender.style.top = koorY;
		document.all.kalender.style.left = koorX;
		document.all.kalender.style.display = 'block';
		kal_sem = 1;
	} else {
		document.all.kalender.style.display = 'none';
		kal_sem = 0;
	}
}

function lukKal () {
	if (kal_sem == 1) {
		document.all.kalender.style.display = 'none';
		kal_sem = 0;
	}
}

function getElement($id) {
	//alert($id);
	if (document.all && document.getElementById) {			//IE5
		if (document.all($id)) {
			$element = document.all($id).style;
		}
	} else if (!document.all && document.getElementById) {	//NS6
			$element = document.getElementById($id).style;
	} else {	// !IE5 && !NS6
		return false; 
	}
	return $element;
}

var	formular;
formular = 'document.formular';

function switch_element_tricker ($id, $tricker,$omv,$nr) {
	if (document.all && document.getElementById) {			//IE5
		$element = document.all($id).style;
	} else if (!document.all && document.getElementById) {	//NS6
		$element = document.getElementById($id).style;
	} else {	// !IE5 && !NS6
		return false;
	}
	if (!$nr) {
		if ($omv) {
			if ($tricker[0].checked) {
				$element.display = '';
				$element.visibility = 'visible';
			} else {
				$element.display = 'none';
				$element.visibility = 'hidden';
			}
		} else {
			if ($tricker[1].checked) {
				$element.display = '';
				$element.visibility = 'visible';
			} else {
				$element.display = 'none';
				$element.visibility = 'hidden';
			}
		}
	} else {
		if ($tricker[$nr].checked) {
			$element.display = '';
			$element.visibility = 'visible';
		} else {
			$element.display = 'none';
			$element.visibility = 'hidden';
		}
	}
}

function popup_img(filNavn, titel) { 

	// LeftPos = (screen.width) ? (screen.width-130)/2 : 0;
	// TopPos = (screen.height) ? (screen.height-130)/2 : 0;
	LeftPos = 20;
	TopPos = 20;
	settings = 'height=130,width=130,top='+TopPos+',left='+LeftPos+',scrollbars=yes,resizable=yes';
	imageWin=window.open('',"imageWin",settings);
	imageWin.document.open(); 
	imageWin.document.write( 
	'<html>'+ 
	'<head>'+ 
	'<title>'+ titel + '</title>'+ 
	'<\script language="JavaScript">'+ 
	'function myResize() {'+ 
	'picW = document.images["pic"].width;'+ 
	'picH = document.images["pic"].height;'+ 
	'if (picW>1050) {picW=1050;}'+
	'if (picH>780) {picH=780;}'+
	'picW = picW+30;'+
	'picH = picH+35;'+
	'window.resizeTo(picW,picH);'+ 
	'}'+ 
	'<\/script>'+ 
	'</head>'+ 
	'<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="myResize();">'+ 
	'<a href="#" onclick="self.close();" title="Klik for at lukke">'+
	'<img src="' + filNavn + '" NAME="pic" border="0"></a>'+ 
	'</body>'+ 
	'</html>' ); 
	imageWin.focus();
	imageWin.document.close(); 
} 


