function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

//header
function header() {
document.write('<div id="obj" style="height:66px;overflow:hidden;z-index:9999;position:absolute;top:0px;"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="950" height="320"><param name="movie" value="../_flash/menu.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always" /><embed src="../_flash/menu.swf" width="950" height="320" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" wmode="transparent" allowscriptaccess="always"></embed></object></div>');
}
//showhide layers
function sh() { //v9.0
  var i,p,v,obj,args=sh.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
//validate form
function validate_req(field,alerttxt){
	with (field){if (value==null||value=="")
	{document.getElementById('form-error').innerHTML = '<div>'+alerttxt+'</div>' ; return false}
	else {return true}
	}
}
function validate_req_sel(field,alerttxt){
	with (field){if (value=='Velg'||value=="")
	{document.getElementById('form-error').innerHTML = '<div>'+alerttxt+'</div>' ; return false}
	else {return true}
	}
}

function validate_email(field,alerttxt)
{
with (field)
{
apos=value.indexOf("@")
dotpos=value.lastIndexOf(".")
if (apos<1||dotpos-apos<2) 
  {document.getElementById('form-error').innerHTML = '<div>'+alerttxt+'</div>' ; return false}
else {return true}
}
}

function validate_form(thisform)
{
with (thisform)
{
if (validate_req(sender_name,"Du har glemt &aring; fylle ut navn")==false) {sender_name.focus();return false}
if (validate_req(sender_adr,"Du har glemt &aring; fylle ut adresse")==false) {sender_adr.focus();return false}
if (validate_req(sender_area,"Du har glemt &aring; fylle ut sted")==false) {sender_area.focus();return false}
if (validate_req(sender_zip,"Du har glemt &aring; fylle ut postnummer")==false) {sender_zip.focus();return false}
if (validate_req(sender_tel,"Du har glemt &aring; fylle ut telefonnummer")==false) {sender_mob.focus();return false}
if (validate_email(sender_mail,"Epostadressen er ikke gyldig")==false) {sender_mail.focus();return false}
if (validate_req(sender_info,"Du har glemt &aring; skrive en melding")==false) {sender_info.focus();return false}
}
}

// flash >> html
function openHeader(id){
	document.getElementById(id).style.height='400px'
}
function closeHeader(id){
	document.getElementById(id).style.height='66px'
}

// view images
function viewImg(url, width, height, title) 
{
	var topPos = 200;
	var leftPos = 200;
	var features = 'width='+width;
	features += ',height='+height;
	features += ',top='+topPos;
	features += ',left='+leftPos;

	newWindow = window.open("", "ImagePopup", features);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+title+'</title><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close();" onclick="self.close();">');  
	newWindow.document.write('<a href="#" title="Klikk for &aring; lukke vinduet"><img src="'+url+'" width="'+width+'" height="'+height+'" alt="Klikk for &aring; lukke vinduet" border="0" /></a>'); 
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}
