function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//our script

function articleImageWidth(){
	//(document.getElementById('articleimage').offsetHeight);
}



function checkHistory (){
	if(history.length>1){
		document.write('<div class="secondcolumn_button_tilbage" id="secondcolumn_button_tilbage"><a href="javascript:history.go(-1);"><img src="/images/common/button_tilbage_t.gif" alt="" border="0" /></a></div>');
	}
}

function firstPointWhite(theID){
	document.getElementById('li_' + theID).style.fontWeight = 'bold';
	document.getElementById('li_' + theID).style.fontSize = '11px';
	document.getElementById('a_' + theID).style.color = 'white';
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function goBack(){
	alert ('go back');
	//history.go(-1);	
}

function clearContents (theObject){
	theObject.value='';
}

function fillContents (theObject){
	//theObject.value='s&oslash;g i artikler';
}

function blurSearch(theID){
	//document.getElementById(theID).blur();
	//document.getElementById(theID).value='s&oslash;g i artikler';
}

function gotohref(theHref){
	//alert (theHref);
	window.location = theHref;
}

function pointer(theID){
	theID.style.cursor='pointer';
	//alert ('hey');
}

function vis_skjule(theID){
	if (document.getElementById(theID).style.visibility == 'hidden'){
		//alert('hidden, show it');
		document.getElementById(theID).style.visibility = 'visible';
		document.getElementById(theID).style.display = '';
	} else {
		//alert('visible, hide it');
		document.getElementById(theID).style.display = 'none';
		document.getElementById(theID).style.visibility = 'hidden';
	}

}
function vis(theID){
	document.getElementById(theID).style.visibility = 'visible';
	document.getElementById(theID).style.display = '';
}

function visRelateret(theID){
	try{
	document.getElementById(theID).style.visibility = 'visible';
	document.getElementById(theID).style.display = '';
	}catch(e){
	}
}


function mainmenu_over(theObject){
	//alert(document.getElementById(theID).className);
	//alert(theObject.id + '|' + theObject.className);
	//style.cursor='pointer';
	if (theObject.className == theObject.id) {
		//alert("hi");
		//document.getElementById(theID).className = theID+"_over";
		theObject.className = theObject.id+"_over";
	}
}
function mainmenu_out(theObject){
	//alert(document.getElementById(theID).className);
	if (theObject.className == theObject.id+"_over") {
		//alert("hi");
		//document.getElementById(theID).className = theID;
		theObject.className = theObject.id;
	}
}



function videncenter_over(theID){
	var targetIDclass = document.getElementById(theID+'_image').className;
	if (targetIDclass == theID+'_arrowdown') {
		document.getElementById(theID+'_image').className = theID+'_arrowdown_over';
	} 
	if (targetIDclass == theID+'_arrowup') {
		document.getElementById(theID+'_image').className = theID+'_arrowup_over';
	}
}
function videncenter_out(theID){
	var targetIDclass = document.getElementById(theID+'_image').className;
	if (targetIDclass == theID+'_arrowdown_over') {
		document.getElementById(theID+'_image').className = theID+'_arrowdown';
	} 
	if (targetIDclass == theID+'_arrowup_over') {
		document.getElementById(theID+'_image').className = theID+'_arrowup';
	}
}

//custom preloads

function preload_images_job() { //v3.0
	var correctPath = '/images/job/';
 	var d=document; 
	if(d.images){ 
		if(!d.MM_p) d.MM_p=new Array();
    var i,
	j=d.MM_p.length,
	a=preload_images_gray.arguments; 
	for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ 
			d.MM_p[j]=new Image; 
			d.MM_p[j++].src=correctPath + a[i];
		}
	}
}

function preload_images_gray() { //v3.0
	var correctPath = '/images/gray/';
 	var d=document; 
	if(d.images){ 
		if(!d.MM_p) d.MM_p=new Array();
    var i,
	j=d.MM_p.length,
	a=preload_images_gray.arguments; 
	for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ 
			d.MM_p[j]=new Image; 
			d.MM_p[j++].src=correctPath + a[i];
		}
	}
}

function preload_images_blue() { //v3.0

	var correctPath = '/images/blue/';
 	var d=document; 
	if(d.images){ 
		if(!d.MM_p) d.MM_p=new Array();
    var i,
	j=d.MM_p.length,
	a=preload_images_blue.arguments; 
	for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ 
			d.MM_p[j]=new Image; 
			d.MM_p[j++].src=correctPath + a[i];
		}
	}
}

function preload_images_yellow() { //v3.0
	var correctPath = '/images/yellow/';
 	var d=document; 
	if(d.images){ 
		if(!d.MM_p) d.MM_p=new Array();
    var i,
	j=d.MM_p.length,
	a=preload_images_yellow.arguments; 
	for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ 
			d.MM_p[j]=new Image; 
			d.MM_p[j++].src=correctPath + a[i];
		}
	}
}

function preload_images_orange() { //v3.0
	var correctPath = '/images/orange/';
 	var d=document; 
	if(d.images){ 
		if(!d.MM_p) d.MM_p=new Array();
    var i,
	j=d.MM_p.length,
	a=preload_images_orange.arguments; 
	for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ 
			d.MM_p[j]=new Image; 
			d.MM_p[j++].src=correctPath + a[i];
			//alert (correctPath + a[i]);
		}
	}
}

function preload_images_turquoise() { //v3.0
	var correctPath = '/images/turquoise/';
 	var d=document; 
	if(d.images){ 
		if(!d.MM_p) d.MM_p=new Array();
    var i,
	j=d.MM_p.length,
	a=preload_images_turquoise.arguments; 
	for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ 
			d.MM_p[j]=new Image; 
			d.MM_p[j++].src=correctPath + a[i];
		}
	}
}

function preload_images_red() { //v3.0
	var correctPath = '/images/red/';
 	var d=document; 
	if(d.images){ 
		if(!d.MM_p) d.MM_p=new Array();
    var i,
	j=d.MM_p.length,
	a=preload_images_red.arguments; 
	for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ 
			d.MM_p[j]=new Image; 
			d.MM_p[j++].src=correctPath + a[i];
		}
	}
}

function preload_images_darkgreen() { //v3.0

	/**/
	var correctPath = '/images/darkgreen/';
 	var d=document; 
	if(d.images){ 
		if(!d.MM_p) d.MM_p=new Array();
    var i,
	j=d.MM_p.length,
	a=preload_images_darkgreen.arguments; 
	for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ 
			d.MM_p[j]=new Image; 
			d.MM_p[j++].src=correctPath + a[i];
		}
	}
	
}

//Mikkels collapse stuff
// cookie_expire
	var $cookie_expire = new Date();
	$cookie_expire.setMilliseconds($cookie_expire.getMilliseconds()+(60*60*24*90*1000));
	$cookie_expire = $cookie_expire.toGMTString();
	

	// cookie_domain
	var $cookie_domain = '.' + location.host;
	$pos_dot = location.host.lastIndexOf('.');
	if ($pos_dot != -1) {
		$pos_dot = location.host.lastIndexOf('.', $pos_dot - 1);
		if ($pos_dot != -1) {
			var $cookie_domain = location.host.substring($pos_dot, location.host.length);
		}
	}

	function get_id ($id) {
		if (document.all && document.getElementById) {
			return document.all($id);
		} else if (!document.all && document.getElementById) {
			return document.getElementById($id);
		} else {
			return false;
		}
	}

	function box_click ($id) {
		if (($bcontent = get_id($id+'_content')) && ($img = get_id($id+'_image'))) {
			$bcontent = $bcontent.style;
		} else {
			return false;
		}
		if ($bcontent.visibility == 'hidden') {
			$bcontent.display = '';
			$bcontent.visibility = 'visible';
			$img.className = $id + '_arrowdown';
			set_cookie('box['+$id+']',1,$cookie_expire,'/',$cookie_domain);
		} else {
			$bcontent.display = 'none';
			$bcontent.visibility = 'hidden';
			$img.className = $id + '_arrowup';
			set_cookie('box['+$id+']',0,$cookie_expire,'/',$cookie_domain);
		}
	}
	
	function book_collect (theID, theObj) {
		var theValue = '';
		if(theObj){
			theValue = theObj.value;
		}else{
			theValue = document.getElementById(theID).value;
		}
		
		//if(document.getElementById(theID).type == 'radio'){
				//if(document.getElementById(theID)[1].checked){
				//alert(theID.value);
				//}
			//}
		//}
		//var theValue = tmpValue;
		set_cookie('bookInfo['+theID+']',theValue,$cookie_expire,'/',$cookie_domain);

	}

	function get_cookie ($name) {
		var $start = document.cookie.indexOf($name + '=');
		var $len = $start + $name.length + 1;
		if ((!$start) && ($name != document.cookie.substring(0, $name.length))) {
			return null;
		}
		if ($start == -1) {
			return null;
		}
		var $end = document.cookie.indexOf(';', $len);
		if ($end == -1) {
			$end = document.cookie.length;
		}
		return unescape(document.cookie.substring($len, $end));
		
		alert ('yeah?');
	}

	function set_cookie ($name, $value, $expires, $path, $domain, $secure) {
		document.cookie = $name + '=' + escape($value) + (($expires) ? '; expires=' + $expires : '') + (($path) ? '; path=' + $path : '') + (($domain) ? '; domain=' + $domain : '') + (($secure) ? '; secure' : '');
	}
