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;
}

function fncSikker() {
	var sure = confirm("Er du helt sikker?");
	if (sure) {
		return true;
	} else {
		return false;
	}
}

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 co(element,mode) {
	if (mode=="in") {
		cursortype = 'hand'
		colorval = '#EAEAEA'
	
	} else if (mode=="out") {
		cursortype = ''
		colorval = '#FFFFFF'		
	}
	element.style.background=colorval;
	element.style.cursor=cursortype;
}

function vindue(fil,bredde,hojde) {
	LeftPos = (screen.width) ? ((screen.width-bredde)/2) : 0;
	TopPos = (screen.height) ? ((screen.height-hojde)/2)-30 : 0;
	window.open(fil,'','height='+hojde+',width='+bredde+',top='+TopPos+',left='+LeftPos+',status=no,scrollbars=yes,resizable=yes');
}

function vindueModal(fil,bredde,hojde) {
	window.showModalDialog(fil,window,"font-family:Trebuchet MS; font-size:12; dialogWidth:"+bredde+"px; dialogHeight:"+hojde+"px;unadorned: yes;status: no;help:no;edge:raised;resizable:yes");
}

function vindue_nyside(parent,mappe) {
	if (mappe) {
		vindue('../nyside9561.html?parent='+parent+'&mappe='+mappe,600,550);
	} else {
		vindue('nyside9561.html?parent='+parent,600,550);
	}
	
}

function vindue_nyhed(parent,mappe) {
	vindue('nynyhed9561.html?parent='+parent,600,550);
}

function popup(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>750) {picW=750;}'+
	'if (picH>550) {picH=550;}'+
	'picW = picW+30;'+
	'picH = picH+25;'+
	'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();">'+
	'<img src="' + filNavn + '" NAME="pic" border="0"></a>'+ 
	'</body>'+ 
	'</html>' ); 
	imageWin.focus();
	imageWin.document.close(); 
} 

function popupz(filNavn) {
	var	LeftPos = (screen.width) ? (screen.width-130)/2 : 0;
	var TopPos = (screen.height) ? (screen.height-130)/2 : 0;
	window.open(filNavn,"imageWin",'height=500,width=400,top='+TopPos+',left='+LeftPos+',scrollbars=no,resizable=yes');
}


function billedepop ($id,$type) {
	var $btitle, $bcontent, $bimg;
	if (document.all && document.getElementById) {			//IE5
		$bcontent = document.all($id).style;
	} else if (!document.all && document.getElementById) {	//NS6
		$bcontent = document.getElementById($id).style;
	} else {	// !IE5 && !NS6
		return false;
	}
	if ($type == 'show') {
		$bcontent.display = 'block';
		$bcontent.visibility = 'visible';
	} else {
		$bcontent.display = 'none';
		$bcontent.visibility = 'hidden';
	}
}

// Funktion til wysiwyg editor
function wysiwyg_checkInput()
{
	if (isHTMLMode) {
		setMode(false);
	}
	idContentForm.idContentSave.value = idContent.document.body.innerHTML;
	
	// Submit form
  	idContentForm.submit();
}

function modifyText(id, text) {
	if(document.getElementById && text != '') {
		obj = document.getElementById(id);
		obj.innerHTML = text;
	}
}


function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  } 
  alert('Query Variable ' + variable + ' not found');
}

