function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
window.onload = externalLinks;

function changeSearch1() {
  if (document.getElementById('searchtext').value == "") {
  document.getElementById('searchtext').style.backgroundImage="url('../images/content/system/google_custom_search_watermark_no.png')";
  document.getElementById('searchtext').value="";
  }
}

function changeSearch2() {
  document.getElementById('searchtext').style.backgroundImage="none";
}

function emailvalidation(field, alertbox) {
var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.sex)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{2,2}))$)\b/gi);
apos=field.value.indexOf("@");
dotpos=field.value.lastIndexOf(".");
lastpos=field.value.length-1;
var badEmail = (apos<1 || dotpos-apos<2 || lastpos-dotpos<2)

if (goodEmail && !badEmail) {
return true;
}
else {
alert(alertbox);
field.focus();
field.select();
return false;
   }
}
function emptyvalidation(entered, alertbox)
{
with (entered)
{
if (value==null || value=="")
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}

function formvalidation(thisform) {
with (thisform)
{if (emailvalidation(email,"Vennligst skriv inn en ekte e-post addresse")==false) {email.focus(); return false;};}
}

function emptyform2txt() {
  document.getElementById('email').select();
}

function closeHint(str1) {
  document.getElementById("hint_txt").innerHTML="";
  document.getElementById("hint_txt").style.visibility='hidden';
  document.getElementById(str1).value='';  
}

function showHint(str1,str2,str3,str4,str5,str6)
{
var xmlHttp=null;
if (str1.length==0) { 
  document.getElementById("hint_txt").innerHTML="";
  document.getElementById("hint_txt").style.visibility='hidden';
  return;
  }
try {// Firefox, Opera 8.0+, Safari, IE7
  xmlHttp=new XMLHttpRequest();
  }
catch(e) {// Old IE
  try {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  catch(e) {
    alert ("Your browser does not support XMLHTTP!");
    return;  
    }
  }
var url="/no/include/gethint.asp?q=" + str1 + "&form1=" + str2 + "&form2=" + str3 + "&src=" + str6;
url=url+"&sid="+Math.random();
xmlHttp.open("GET",url,false);
xmlHttp.send(null);

document.getElementById('hint_txt').style.top=str4+"px";
try{document.getElementById('hint_txt').style.left=str5+"px";}catch(err){}
document.getElementById('hint_txt').style.visibility='visible';
document.getElementById('hint_txt').innerHTML=xmlHttp.responseText;
}

function clearTxTField(str1) {
 document.getElementById(str1).select();
}

function FGcheck() {
  try{document.getElementById('calendarmain').style.visibility='hidden';}catch(err){}
  try{document.getElementById('hint_txt').style.visibility='hidden';}catch(err){}
  try{document.getElementById('progressbar').style.visibility='hidden';}catch(err){}
  try{document.getElementById('progressbarbutton').style.visibility='visible';}catch(err){}
}

function todoGlobe() {
  try{document.getElementById('todo_globe_href').innerHTML="<object type='application/x-shockwave-flash' data='/no/images/content/system/globe.swf' width='66' height='66' id='globe'><param name='movie' value='/no/images/content/system/globe.swf' /><param name='allowScriptAccess' value='sameDomain' /><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' /></object>";document.getElementById('todo_globe').style.visibility='visible';}catch(err){}
}

function priceTicker(str0,str1,str2) {
  try{
  try {
   xmlHttp=new XMLHttpRequest();
  }
  catch(e) {
  try {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  catch(e) {
    alert ("Your browser does not support XMLHTTP!");
    return;  
    }
  }
  var url="/no/templates/include/flight-ticker.asp?art_ID=" + str1 + "&des_ID=" + str2 + "&site_language=" + str0;
  url=url+"&sid="+Math.random();
  xmlHttp.open("GET",url,false);
  xmlHttp.send(null);
  document.getElementById('flight_ticker').innerHTML=xmlHttp.responseText;
  document.getElementById('flight_ticker').style.visibility='visible';
 }catch(err){}
}

function selectDestination(str1,str2,str3,str4) {
 document.getElementById(str2).value=str1;
 document.getElementById(str3).value=str4;
 document.getElementById("hint_txt").innerHTML='';
 document.getElementById("hint_txt").style.visibility='hidden';
}



function showCalendar(str1,str2,str3,str4,str5) {

var xmlHttp=null;

 if (document.getElementById('calendarmain').style.visibility=='visible') {
  document.getElementById('calendarmain').style.visibility='hidden'
 }
 else {
  document.getElementById('calendarmain').style.visibility='visible';
  document.getElementById('calendarmain').style.top=str1+"px";
  try{document.getElementById('calendarmain').style.left=str5+"px";}catch(err){}
 }

try {// Firefox, Opera 8.0+, Safari, IE7
  xmlHttp=new XMLHttpRequest();
  }
catch(e) {// Old IE
  try {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  catch(e) {
    alert ("Your browser does not support XMLHTTP!");
    return;  
    }
  }

var url="/no/include/calendar.asp?date=" + str2 + "&form=" + str3 + "&top=" + str1 + "&day=" + str4;
url=url+"&sid="+Math.random();
xmlHttp.open("GET",url,false);
xmlHttp.send(null);
document.getElementById("calendarmain").innerHTML=xmlHttp.responseText;
}

function showCalendarNext(str1,str2,str3,str4) {

var xmlHttp=null;

try {// Firefox, Opera 8.0+, Safari, IE7
  xmlHttp=new XMLHttpRequest();
  }
catch(e) {// Old IE
  try {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  catch(e) {
    alert ("Your browser does not support XMLHTTP!");
    return;  
    }
  }

var url="/no/include/calendar.asp?date=" + str2 + "&form=" + str3 + "&top=" + str1 + "&change=" + str4;
url=url+"&sid="+Math.random();
xmlHttp.open("GET",url,false);
xmlHttp.send(null);
document.getElementById("calendarmain").innerHTML=xmlHttp.responseText;
}

function selectPlaneDate(str1,str2) {
 document.getElementById(str1).value=str2;
 document.getElementById('calendarmain').style.visibility='hidden'
}

function roundtrip() {
 document.getElementById('plane_item9').disabled=false;
 document.getElementById('plane_item9').style.backgroundColor='#FFFFFF';
 document.getElementById('plane_item9').style.color='#2F72B0';
 document.getElementById('plane_item8').style.filter='alpha(opacity=100)';
 document.getElementById('plane_item8').style.opacity='1.0';
}

function oneway() {
 document.getElementById('plane_item9').disabled=true;
 document.getElementById('plane_item9').style.backgroundColor='#F3F3F3';
 document.getElementById('plane_item9').style.color='#C0C0C0';
 document.getElementById('plane_item8').style.filter='alpha(opacity=40)';
 document.getElementById('plane_item8').style.opacity='0.4';
}

function novasearchdetails(str1) {

if (document.getElementById('novasol_moreinfoaccess'+str1).innerHTML=='Se detaljer...') {
  document.getElementById('novasol_searchreply'+str1).style.height='210px';
  document.getElementById('novasol_moreinfoaccess'+str1).innerHTML='Skjul detaljer...';
 }
 else {
  document.getElementById('novasol_searchreply'+str1).style.height='80px';
  document.getElementById('novasol_moreinfoaccess'+str1).innerHTML='Se detaljer...';
 }
}

function showNovaArea() {
var str1=document.getElementById('novasearch_form').elements[2].value;
// alert(str1);

var xmlHttp=null;

try {// Firefox, Opera 8.0+, Safari, IE7
  xmlHttp=new XMLHttpRequest();
  }
catch(e) {// Old IE
  try {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  catch(e) {
    alert ("Your browser does not support XMLHTTP!");
    return;  
    }
  }

var url="/no/include/novasolarea.asp?nova_countryISO=" + str1;
url=url+"&sid="+Math.random();
xmlHttp.open("GET",url,false);
xmlHttp.send(null);
document.getElementById('nova_fromarea').innerHTML=xmlHttp.responseText;
}

function flightsearchwait() {
 var x=document.getElementById('plane_item4').selectedIndex
 if (x==0) {
  alert("Velg ankomststed!");
 }
 else {
  document.getElementById('planesearch_form').submit();
  document.getElementById('progressbar').style.visibility='visible';
  document.getElementById('progressbarbutton').style.visibility='hidden';
  var progressbarstring=document.getElementById('progressbar').src;
  document.getElementById('progressbar').src = progressbarstring;
  setTimeout("document.getElementById('progressbar').src = " + progressbarstring, 700); 
  try{document.getElementById('flightsearch_infotag').innerHTML='';}catch(err){}
 }
}

function hotelsearchwait() {
  try{document.getElementById('hotelsearch_form').submit();}catch(err){}
  document.getElementById('progressbar').style.visibility='visible';
  document.getElementById('progressbarbutton').style.visibility='hidden';
  var progressbarstring=document.getElementById('progressbar').src;
  document.getElementById('progressbar').src = progressbarstring;
  setTimeout("document.getElementById('progressbar').src = " + progressbarstring, 700); 
  try{document.getElementById('hotelsearch_infotag').innerHTML='';}catch(err){}
}

function novasearchwait() {
  document.getElementById('novasearch_form').submit();
  document.getElementById('progressbar').style.visibility='visible';
  document.getElementById('progressbarbutton').style.visibility='hidden';
  var progressbarstring=document.getElementById('progressbar').src;
  document.getElementById('progressbar').src = progressbarstring;
  setTimeout("document.getElementById('progressbar').src = " + progressbarstring, 700); 
  try{document.getElementById('novasearch_infotag').innerHTML='';}catch(err){}
}