function showClosedMessage(){
 document.getElementById('indhold').style.visibility="visible";
 document.getElementById('skygge').style.visibility="visible";
 if(document.getElementById('c')){document.getElementById('c').style.visibility="hidden";}
 if(document.getElementById('R')){document.getElementById('R').style.visibility="hidden";}
 if(document.getElementById('PE')){document.getElementById('PE').style.visibility="hidden";}
 if(document.getElementById('Q51')){document.getElementById('Q51').style.visibility="hidden";}
}
function subwin(s, t, w, h) {
 addWindow = window.open(s,t,"width="+w+",height="+h+",resizable=1,status=1,menubar=0,scrollbars=1,fullscreen=0");
 addWindow.focus() 
}
function SetIndex( indextext ) 
{
var index;
 if ( navigator.appName == 'Netscape'  ) {
  for ( var i = 0; i < document.search.R.options.length; i++ ) {
  if ( indextext == document.search.R.options[i].value ) {
   index = i
  }
}
 document.search.R.options[index].selected=true;
 } else {
 document.search.R.value = indextext;
 }
}
function SetArea( indextext ) 
{
var index;
 if ( navigator.appName == 'Netscape'  ) {
  for ( var i = 0; i < document.searchalpine.R.options.length; i++ ) {
  if ( indextext == document.searchalpine.R.options[i].value ) {
   index = i
  }
}
 document.searchalpine.R.options[index].selected=true;
 } else {
 document.searchalpine.R.value = indextext;
 }
}
function SetIndexRS( indextext ) 
{
 var index;
 if ( navigator.appName == 'Netscape'  ) {
  for ( var i = 0; i < document.search.RS.options.length; i++ ) {
  if ( indextext == document.search.RS.options[i].value ) {
   index = i
  }
 }
 document.search.RS.options[index].selected=true;
 } else {
 document.search.RS.value = indextext;
 }
}
function getSelectedRadio(buttonGroup) {
   // returns the array number of the selected radio button or -1 if no button is selected
   if (buttonGroup[0]) { // if the button group is an array (one button is not an array)
      for (var i=0; i<buttonGroup.length; i++) {
         if (buttonGroup[i].checked) {
            return i
         }
      }
   } else {
      if (buttonGroup.checked) { return 0; }
   }
   return -1;
}
var da = (document.all) ? 1 : 0;
var pr = (window.print) ? 1 : 0;
var mac = (navigator.userAgent.indexOf("Mac") != -1); 

function printPage() {
 if (pr) // NS4, IE5
  window.print()
 else if (da && !mac) // IE4 (Windows)
  vbPrintPage()
}

if (da && !pr && !mac) with (document) {
 writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>');
 writeln('<' + 'SCRIPT LANGUAGE="VBScript">');
 writeln('Sub window_onunload');
 writeln('  On Error Resume Next');
 writeln('  Set WB = nothing');
 writeln('End Sub');
 writeln('Sub vbPrintPage');
 writeln('  OLECMDID_PRINT = 6');
 writeln('  OLECMDEXECOPT_DONTPROMPTUSER = 2');
 writeln('  OLECMDEXECOPT_PROMPTUSER = 1');
 writeln('  On Error Resume Next');
 writeln('  WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER');
 writeln('End Sub');
 writeln('<' + '/SCRIPT>');
}
function redirectAgency() {
pw = prompt("Zum Zugang der Reisebüroseiten, geben Sie bitte den CRS-Kode von NOVASOL ein:","")
if ((pw =="NOSO") || (pw=="noso")) {
document.location.href='http://buro.novasol.de'
}
}
function searchhouse( elm, housenumber, agency, showit )
{
var elementsBeforeCheckboxes = 0
var elementsAfterCheckboxes = 1
var startDatoStr = null;
for (var i = elementsBeforeCheckboxes; i < elm.elements.length-elementsAfterCheckboxes; i++)
{
 if(elm.elements[i].type=='hidden') {continue;}
  if (elm.elements[i].checked)
   {
    startDatoStr = elm.elements[i].value
    var start = i;
    break;
   }
else
   {
    startDatoStr = null;
   }
  }
 for (var i = start; i < elm.elements.length-elementsAfterCheckboxes; i++)
  {
if (elm.elements[i+1].type=='checkbox')
{
   if (!elm.elements[i+1].checked)
    {
     slutDatoStr = elm.elements[i+1].value
     break;
    }
}
else
{
   slutDatoStr = elm.elements[i+1].value
     break;
}
  }
if ( startDatoStr == null  )
{
var url = "/NOV/826.nsf/"+showit+"/house?opendocument&H="+housenumber+"&S="+elm.season.value+"&PE="+elm.people.value+"&A="+agency;
if ( showit == 'x' )
{
subwin(url, housenumber, '750', '440');
}
else
{
location.href = url;
}
} else {
house( housenumber, '-1', startDatoStr, slutDatoStr, elm.people.value, elm.season.value, agency, showit)
}
}
function house(housenumber, price, startdate, enddate, people, season, agency, showit)
{
var url = "/house.nsf/0/ESERVED=LANGUAGEESERVED=SITECODE?opendocument&H="+housenumber+"&P="+price+"&PE="+people+"&SD="+startdate+"&ED="+enddate+"&S="+season+"&A="+agency;
if ( showit == 'x' )
{
url = url + "&_xview"; 
subwin(url, housenumber, '760', '440');
}
else
{
location.href = url;
}
}
function housealpine(housenumber, price, startdate, enddate, people, season, agency, showit)
{
var url = "/NOV/826.nsf/"+showit+"/housealpine?opendocument&H="+housenumber+"&P="+price+"&PE="+people+"&SD="+startdate+"&ED="+enddate+"&S="+season+"&A="+agency;
if ( showit == 'x' )
{
subwin(url, housenumber, '760', '540');
}
else
{
location.href = url;
}
}
function danhouse(housenumber, price, startdate, enddate, people, season, agency, showit)
{
var url = "/house.nsf/0/826NOV?opendocument&H="+housenumber+"&P="+price+"&PE="+people+"&SD="+startdate+"&ED="+enddate+"&S="+season+"&A="+agency;
if ( showit == 'x' )
{
url = url + "&_xview"; 
subwin(url, housenumber, '760', '440');
}
else
{
location.href = url;
}
}
function checkEmail (strng) {
var error="";
if (strng == "") {
 error = "You did not enter an email address";
}
 var emailFilter=/^.+@.+..{2,3}$/;
 if (!(emailFilter.test(strng))) {
  error = "Please enter a valid email address";
 }
 else {
  var illegalChars= /[()<>,;:\"[]]/;
  if (strng.match(illegalChars)) {
   error = "The email address contains illegal characters";
  }
 }
return error;
}
function required(which) {
if (which.FN.value=="") {
alert ("Please enter your name");
which.FN.focus();
return false;
}
if (which.S.value=="") {
alert ("Please enter your street name");
which.S.focus();
return false;
}
if (which.STN.value=="") {
alert ("Please enter your house number");
which.STN.focus();
return false;
}
if (which.Z.value=="") {
alert ("Please enter your ZIP-code");
which.Z.focus();
return false;
}
if (which.ZC.value=="") {
alert ("Please enter your city");
which.ZC.focus();
return false;
}
if (which.PH.value=="") {
alert ("Please enter your phone number");
which.PH.focus();
return false;
}
var EmailOK = checkEmail(which.E.value);
if (!(EmailOK=="")) {
alert (EmailOK);
which.E.focus();
return false;
}
else
return true;
}
function reqfields(which, fn, sn, s, z, zc, co, ph, e, wf, stn) {
if (fn==1) {if (which.FN.value=="") {alert ("Please enter your name");which.FN.focus();return false;}}
if (sn==1) {if (which.SN.value=="") {alert ("Please enter your name");which.SN.focus();return false;}}
if (s==1) {if (which.S.value=="") {alert ("Please enter your street name");which.S.focus();return false;}}
if (stn==1) {if (which.STN.value=="") {alert ("Please enter your house number");which.STN.focus();return false;}}
if (z==1) {if (which.Z.value=="") {alert ("Please enter your ZIP-code");which.Z.focus();return false;}}
if (zc==1) {if (which.ZC.value=="") {alert ("Please enter your city");which.ZC.focus();return false;}}
if (co==1) {if (which.CO[which.CO.selectedIndex].value=='') {alert ("Please select country");which.CO.focus();return false;}
else {if (which.CO[which.CO.selectedIndex].value=='000' && which.OC.value=='') {alert ("Please enter country name or select country");which.OC.focus();return false;}}
if (ph==1) {if (which.PH.value=="") {alert ("Please enter your phone number");which.PH.focus();return false;}}
if (e==1) {var EmailOK = checkEmail(which.E.value);if (!(EmailOK=="")) {alert (EmailOK);which.E.focus();return false;}else return true;}}
if (wf==1) {if (which.W[which.W.selectedIndex].value=='') {alert ("Please select where did you find us");which.W.focus();return false;}}
return true;
}
function showhouse2( elm, housenumber, price, people, season, a, lang ) {
var elementsBeforeCheckboxes = 0
var elementsAfterCheckboxes = 1
var startDatoStr = null;
// Startdatoen fastlægges
for (var i = elementsBeforeCheckboxes; i < elm.elements.length-elementsAfterCheckboxes; i++)
 {
 if(elm.elements[i].type=='hidden') {continue;}
  if (elm.elements[i].checked)
   {
    startDatoStr = elm.elements[i].value
    var start = i;
    break;
   }
else
   {
    startDatoStr = null;
   }
  }
 for (var i = start; i < elm.elements.length-elementsAfterCheckboxes; i++)
  {
if (elm.elements[i+1].type=='checkbox')
{
   if (!elm.elements[i+1].checked)
    {
     slutDatoStr = elm.elements[i+1].value
     break;
    }
}
else
{
   slutDatoStr = elm.elements[i+1].value
     break;
}
  }
if ( startDatoStr == null  )
{
var url = "/NOV/826.nsf/x/house?opendocument&H="+housenumber+"&O=1&S="+elm.season.value+"&A="+a;
anotherwin =  window.open(url, housenumber, 'width=750,height=440,toolbar=no,scrollbars=yes,resizable=yes');
anotherwin.focus;
} else {
showhouse( housenumber, '826', price, startDatoStr, slutDatoStr, people, 'NOV', '&A='+a)
}
}
function showhouse1(housenumber, language, price, startdate, enddate, people, company, season)
{
 location.href = "/"+company+"/"+language+".nsf/0/house?opendocument&H="+housenumber+"&P="+price+"&SD="+startdate+"&ED="+enddate+"&PE="+people+"&"+ "&S="+season;
}
function showhouse(housenumber, language, price, startdate, enddate, people, company, a)
{
 var season = startdate.substr( startdate.lastIndexOf( '-' )+1 );
// anotherwin =  window.open( "/web/nov.nsf/house?openagent&H="+housenumber+"&P="+price+"&SD="+startdate+"&ED="+enddate+"&PE="+people+"&L=208&S=" + season + "&"+login, housenumber,'width=760,height=440,toolbar=no,status=yes,scrollbars=yes,resizable=yes');
 anotherwin =  window.open( "/"+company+"/"+language+".nsf/x/house?opendocument&H="+housenumer+"&P="+price+"&SD="+startdate+"&ED="+enddate+"&PE="+people+"&"+ "&S=" + season + "&"+a, housenumber,'width=760,height=440,toolbar=no,status=yes,scrollbars=yes,resizable=yes');
 anotherwin.focus;
}
function showMarkers(house_x, house_y, index) {
 // Array to hold coordinats of map cropping geocodes (map_x1,map_y1,map_x2,map_y2)
 var country_map_array = new Array(16);
 country_map_array["denmark"]=  new Array(430000,6055000,747000,6440000); 
 country_map_array["sweden"]=   new Array(239444,6190000,1550556,7810000);
 country_map_array["norway"]=   new Array(142380,6470000,1487619,8100000);
 country_map_array["holland"]=  new Array(100000,5631904,387000,5988095);
 country_map_array["belgium"]=  new Array(41000,5448571,325000,5791429);
 country_map_array["germany"]=  new Array(280000,5260000,930000,6150000);
 country_map_array["austria"]=  new Array(540000,4984444,1120000,5695556);
 country_map_array["hungary"]=  new Array(1040000,4996667,1520000,5613333);
 country_map_array["poland"]=   new Array(840000,5432414,1580000,6287586);
 country_map_array["czechrep"]= new Array(720000,5249746,1220000,5880254);
 country_map_array["slovakia"]= new Array(1070000,5211842,1480000,5738158);
 country_map_array["italy"]=    new Array(300000,4080000,1340000,5320000);
 country_map_array["france"]=   new Array(-550000,4517647,580000,5882353);
 country_map_array["croatia"]=  new Array(850000,4706733,1300000,5253267);
 country_map_array["greece"]=   new Array(1420000,3843636,2360000,5016364);
 country_map_array["spain"]=    new Array(-1255859,3787594,95393,5298646);
 country_map_array["switzerl"]= new Array(265000,5305000,615000,5040000);
 // array of house-geocodes
 var webhouses = new Array(1);
 webhouses[1]= new Array(house_x,house_y); 
 // array of country-maps
 var webmaps = new Array(2);
 for (var loop = 1; loop < webmaps.length; loop++)
 {
 if (index != undefined) {webmaps[loop]= document.getElementById("houseMap_"+ index);
 } else {
  webmaps[loop]= document.getElementById("houseMap_"+loop);
 }
 }
 
 // array of map-markers
 var webmarkers = new Array(2);
 for (var loop = 1; loop < webmarkers.length; loop++)
 {
 if (index != undefined) {webmarkers[loop]= document.getElementById("marker_"+ index);
 } else {
  webmarkers[loop]= document.getElementById("marker_"+loop);
 }
 }
 
 
  
 for (var loop = 1; loop < webmaps.length; loop++)
 {
  //get geomap coordinates
  geomap_coordinates = country_map_array[webmaps[loop].name];
  
  //calculate map-size i geocodes
  geomap_width=(geomap_coordinates[2]-geomap_coordinates[0]);
  geomap_height=(geomap_coordinates[3]-geomap_coordinates[1]);
  
  // calculate number of geocodes per pixel
  geocodes_per_pixel_width = (geomap_width / webmaps[loop].width);
  geocodes_per_pixel_height = (geomap_height / webmaps[loop].height);
  
  // calculate position of marker
  if ((webhouses[loop][0] > 855464 & webhouses[loop][0] < 897022) & (webhouses[loop][1] > 6104899 & webhouses[loop][1] < 6152359)) { //bornholm
   leftmarker = ((webhouses[loop][0] - geomap_coordinates[0])/ geocodes_per_pixel_width)- 47 +"px";
   topmarker = ((geomap_coordinates[3]- webhouses[loop][1])/ geocodes_per_pixel_height)- 64 +"px";
   
  } else if ((webhouses[loop][0] < -1700000 & webhouses[loop][0] > -2200000) & (webhouses[loop][1] > 3100000 & webhouses[loop][1] < 3600000)) { //canary islands
   leftmarker = ((webhouses[loop][0] - geomap_coordinates[0])/ geocodes_per_pixel_width)+ 67 +"px";
   topmarker = ((geomap_coordinates[3]- webhouses[loop][1])/ geocodes_per_pixel_height)- 47 +"px";
   
  } else {
   leftmarker = ((webhouses[loop][0] - geomap_coordinates[0])/ geocodes_per_pixel_width)- 3 +"px";
   topmarker = ((geomap_coordinates[3]- webhouses[loop][1])/ geocodes_per_pixel_height)- 3 +"px";
  }
  //place marker on maplayer, and make in visible
  webmarkers[loop].style.left = leftmarker;
  webmarkers[loop].style.top = topmarker;
  webmarkers[loop].style.visibility = "visible";
 }
}
function showMarker(house_x,house_y) {
 // Array to hold coordinats of map cropping geocodes (map_x1,map_y1,map_x2,map_y2)
 var country_map_array = new Array(16);
 country_map_array["denmark"]=  new Array(430000,6055000,747000,6440000); 
 country_map_array["sweden"]=   new Array(600000,6160000,1190000,7790000);
 country_map_array["norway"]=   new Array(250000,6470000,1380000,8100000);
 country_map_array["holland"]=  new Array(100000,5640000,387000,5980000);
 country_map_array["belgium"]=  new Array(41000,5500000,325000,5740000);
 country_map_array["germany"]=  new Array(280000,5260000,930000,6150000);
 country_map_array["austria"]=  new Array(540000,5180000,1120000,5500000);
 country_map_array["hungary"]=  new Array(1040000,5120000,1520000,5490000);
 country_map_array["poland"]=   new Array(840000,5550000,1580000,6170000);
 country_map_array["czechrep"]= new Array(720000,5410000,1220000,5720000);
 country_map_array["slovakia"]= new Array(1070000,5350000,1480000,5600000);
 country_map_array["italy"]=    new Array(300000,4080000,1340000,5320000);
 country_map_array["france"]=   new Array(-550000,4620000,580000,5780000);
 country_map_array["croatia"]=  new Array(850000,4750000,1300000,5210000);
 country_map_array["greece"]=   new Array(1420000,4000000,2360000,4860000);
 country_map_array["spain"]=    new Array(-1255859,3976475,95393,5109764);
 country_map_array["switzerl"]= new Array(265000,5540000,615000,5040000);
 // array of house-geocodes
 var webhouses = new Array(1);
 webhouses[1]= new Array(house_x,house_y); 
 // array of country-maps
 var webmaps = new Array(2);
 for (var loop = 1; loop < webmaps.length; loop++)
 {
  webmaps[loop]= document.getElementById("houseMap_"+loop);
 }
 
 
 // array of map-markers
 var webmarkers = new Array(2);
 for (var loop = 1; loop < webmarkers.length; loop++)
 {
  webmarkers[loop]= document.getElementById("marker_"+loop);
 }
 
 
 
  
 for (var loop = 1; loop < webmaps.length; loop++)
 { 
  //get geomap coordinates
  geomap_coordinates = country_map_array[webmaps[loop].name];
  
  //calculate map-size i geocodes
  geomap_width=(geomap_coordinates[2]-geomap_coordinates[0]);
  geomap_height=(geomap_coordinates[3]-geomap_coordinates[1]);
  
  // calculate number of geocodes per pixel
  geocodes_per_pixel_width = (geomap_width / webmaps[loop].width);
  geocodes_per_pixel_height = (geomap_height / webmaps[loop].height);
  
  // calculate position of marker
  if ((webhouses[loop][0] > 855464 & webhouses[loop][0] < 897022) & (webhouses[loop][1] > 6104899 & webhouses[loop][1] < 6152359)) { //bornholm
   leftmarker = ((webhouses[loop][0] - geomap_coordinates[0])/ geocodes_per_pixel_width)- 47 +"px";
   topmarker = ((geomap_coordinates[3]- webhouses[loop][1])/ geocodes_per_pixel_height)- 64 +"px";
   
  } else if ((webhouses[loop][0] < -1700000 & webhouses[loop][0] > -2200000) & (webhouses[loop][1] > 3100000 & webhouses[loop][1] < 3600000)) { //canary islands
   leftmarker = ((webhouses[loop][0] - geomap_coordinates[0])/ geocodes_per_pixel_width)+ 67 +"px";
   topmarker = ((geomap_coordinates[3]- webhouses[loop][1])/ geocodes_per_pixel_height)- 47 +"px";
   
  } else {
   leftmarker = ((webhouses[loop][0] - geomap_coordinates[0])/ geocodes_per_pixel_width)- 3 +"px";
   topmarker = ((geomap_coordinates[3]- webhouses[loop][1])/ geocodes_per_pixel_height)- 3 +"px";
  }
  //place marker on maplayer, and make in visible
  webmarkers[loop].style.left = leftmarker;
  webmarkers[loop].style.top = topmarker;
  webmarkers[loop].style.visibility = "visible";
 }
}
function SelectCountry(Country) {
window.location.href = "/NOV/826.nsf/0/" + Country + "searchalpine?OpenDocument";
}

function chgs(c,s){
var URLString = location.href;
oldValue = "S=" + c;
newValue = "S=" + s;
if (URLString.indexOf(oldValue) > 0){
URLString = URLString.replace(oldValue, newValue);} else {
URLString = location.href + "&" + newValue;}
location.replace(URLString);
}
function fbs_click(url) {
u= url + "&WT.mc_id=FB";
t=document.title;
window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
return false;
}

function check_gb_form() {
var error_message = '';
if (document.gb_form.gb_email.value=="") { error_message +='Please enter valid email address'; ; }
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.gb_form.gb_email.value)==false) { error_message += 'Please enter valid email address'; }
if(error_message !=''){
alert(error_message);
return false;
}
return true;
}
function openSitemapWindow(URL) {
sitemapWin=window.open(URL,'sitemap','width=815,height=600,directories=no,status=yes,scrollbars=yes,resizable=no,menubar=no,toolbar=no');
}
function VisHusPopup(house) {
url = '/house.nsf/0/826NOV?opendocument&H='+house+'&_xview';
window.open(url,"",'width=775,height=700,directories=no,status=yes,scrollbars=yes,resizable=yes,menubar=yes,toolbar=no');
}
function openWindow(URL) {
window.open(URL,"",'width=580,height=460,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=yes,toolbar=no');
}

function goLogin(loginpath) {
  window.location = "/appserver/Redirect?action=safe&basehref="+location.hostname+"&destination="+loginpath;
}

          function login(){
              $("#loginreply").html("<img src='/site/_img/ajax-loader.gif' alt='' />")
              $.post("/appserver/BureauWebsite/CheckSession", $("#loginform").serialize(), function(reply){
                  if(reply=="true"){
                      var ref = document.referrer;
                      if(ref != null && ref.indexOf("BureauWebsite")!=-1){
                          window.location = document.referrer;
                      }else{
                        window.location = "/appserver/Redirect?action=safe&basehref=&destination=https://safe.novasol.com/login/agency.html?F=A&A="+loginform.account.value;
                      }
                  }else{
                      setReply("loginreply","","red");
                  }
              }, "text");
              return false;
          }

          function agencySendPassword(){
              $.post("/appserver/BureauWebsite/SendPassword", {"email":$("#email").val(),"COM":"NOV","L":"826","account":$("#account").val()}, function(reply){
                  if(reply=="true"){
                    setReply("sendEmailReply","","green");
                  }else{
                    setReply("sendEmailReply","","red")
                  }
              }, "text");
              return false;
          }

          function setReply(id,text,color){
            $("#"+id).html(text);
            $("#"+id).css("color",color);
            $("#"+id).fadeIn("slow");
            setTimeout('$("#'+id+'").fadeOut("slow");','5000');
          }

function setOption(v, key) {
 if (v) {
  for (var loop = 0; loop < v.length; loop++) {
   if (v[loop].value == key) {
    v[loop].selected = true;
   }
  }
 }
}

function chkSelect(f){
  pe=f.PE.options[document.search.PE.options.selectedIndex].value;
  if (f.C.type=="hidden") {
    c = f.C.value;
  } else {
    c = f.C.options[document.search.C.options.selectedIndex].value;
  }
  if (!pe||!c){
   alert("Please select a destination and number in party.");
   return false;
  }
}

function doSubmit(f) {
 if (cookielist['A']) {
  if (f.A) {   
   f.A.value = cookielist['A'];
  }
 }
  if(f.name == 'search') {
   if(chkSelect(f) == false){
    return;
  }
   f.action = '/result.nsf/0/826nov';
   f.submit();
  }
  else if (f.name == 'housesearch'){
   go2house(f.house.value, 'NOV');
   return false;
  } else {
    f.submit();
  }
} 
function doAdvSearch() {
 if (cookielist['A']) {
  if (document.search.A) {   
   document.search.A.value = cookielist['A'];
  }
 }
 if (cookielist['F']) {
  if (document.search.A) {   
   document.search.A.value = cookielist['A'];
  }
 }
 document.search.action = '/search.nsf/0/826novCON';
 document.search.submit();
} 
function validateStartDate( theform )
{
 var s1 = theform.SD.value.indexOf( '-' );
 var s2 = theform.SD.value.lastIndexOf( '-' );
 var e1 = theform.ED.value.indexOf( '-' );
 var e2 = theform.ED.value.lastIndexOf( '-' );
 var sy = Math.abs(theform.SD.value.substr(s2+1,s2+5));
 var sm = Math.abs(theform.SD.value.substring(s1+1,s2));
 var sd = Math.abs(theform.SD.value.substr(0,s1));
 var ey = Math.abs(theform.ED.value.substr(e2+1,e2+5));
 var em = Math.abs(theform.ED.value.substring(e1+1,e2));
 var ed = Math.abs(theform.ED.value.substr(0,e1));
 var temp = new Date( sy, sm-1, sd+7);
 // Netscape JS fix
 var zY = temp.getYear() < 1999 ? temp.getYear() + 1900 : temp.getYear();
 theform.ED.value = temp.getDate() + "-" + eval(temp.getMonth()+1) + "-" + zY; 
}
function subcal(s) {
 addWindow = window.open(s,"calendar","width=203,height=140,resizable=1,status=0,menubar=0,scrollbars=0,fullscreen=0");
 addWindow.focus() 
}
function makeLink(f,dateField,country) {
 findValue = document.forms[f].elements[dateField].value.split('-');
 myMonth = findValue[1];
 myYear = findValue[2];
 var calname = f;
 if (calname.search(/alpine/) > -1) {
  subcal('/search.nsf/0/calendaralpine826?opendocument&dateField='+dateField+'&m='+myMonth+'&y='+myYear+'&formname='+f+'&country='+country)
 } else {
  subcal('/search.nsf/0/826novcalendar?opendocument&dateField='+dateField+'&m='+myMonth+'&y='+myYear+'&formname='+f+'&country='+country)
 }
}
function getCookie(v, value, param_list) {
 var the_cookie = ' '+document.cookie;
 var broken_cookie = the_cookie.split(";");
 var cookiestring="";
 var search_for; 
 for (var loop = 0; loop < broken_cookie.length; loop++) {
  search_for = v+'=';
  if (search_for == broken_cookie[loop].substring(1,v.length+2)) {
   cookiestring = broken_cookie[loop].substring(v.length+2,broken_cookie[loop].length);
  }
 }
 if (value.length>1) {
  if (cookiestring.length>1) {
   cookiestring= cookiestring+'&'+value;
  } else {
   cookiestring= value;
  }
 }
 var valuesets = cookiestring.split('&');
 for (var loop1 = 0; loop1 < valuesets.length; loop1++) {
  if (valuesets[loop1].indexOf('=')>0) {
   var broken_info = valuesets[loop1].split("=");
   param_list[broken_info[0]] = broken_info[1];
  }
 }
}
function setCookie( param, value, e ) {
 var merged_value = "";
 var cookielist = new Array();
 getCookie(param, value, cookielist);

 for (key in validParametersArray) {
  if (cookielist[validParametersArray[key]]) {
   merged_value=merged_value+validParametersArray[key]+"="+cookielist[validParametersArray[key]]+"&";
  }
 }

 var expires = new Date();
 var domain = "";
 expires.setTime( expires.getTime() + e*60*60*1000 );
 var domainset = document.domain.split(".");
 if (domainset.length > 1) {
  domain = domainset[domainset.length-2]+"."+domainset[domainset.length-1];
 }
 var curCookie = param + "=" + merged_value + ((expires) ? "; expires=" + expires.toGMTString() : "") + "; path=/; domain="+domain;
 document.cookie = curCookie;
}

function deleteCookie(cookiename) {
  var cookie_date = new Date ( );
  cookie_date.setTime ( cookie_date.getTime() - 1 );
  document.cookie = cookiename+"=;expires=" + cookie_date.toGMTString();
}

function go2house(housenumber, site) {
 if ((housenumber.length == 6 && site=="NOV")  || ( housenumber.length >4 &&  housenumber.length <7 && site=="DAN")) {
  var url = "/house.nsf/0/826"+site+"?opendocument&H="+housenumber;

   if (cookielist['A']) {
     url = url + "&A="+cookielist['A'];
   }
 location.href = url;
  } else if (housenumber.length == 6 && site=="CUE") {
  var url = "/appserver/ConsumerWebsite/ShowHouse?L=826&THEME=CON&COM="+site+"&H="+housenumber;

   if (cookielist['A']) {
     url = url + "&A="+cookielist['A'];
   }
 location.href = url;
 } else {
  var errDesc = "Please enter the 6 digit NOVASOL Object number (e.g. EBL102)"
  alert(errDesc)
 }
}

function go2result(theform) {
 var houselist = "";
 var housearray = document.getElementsByName("HQ");

 for (var count = 0; count  < housearray.length; count++) {
  if (housearray[count].value) {
   if (housearray[count].value.length == 6 ) {
    houselist = houselist + "^"+housearray[count].value;
   } else {
    houselist = "";
    break;
   }
  }
 }

 if (houselist.length>6) {
  houselist = houselist.substring(1,houselist.length);
 }

 if (!houselist){
  var errDesc = "Please enter the 6 digit NOVASOL Object number (e.g. EBL102)"
  alert(errDesc)
 } else {
  var url = "/result.nsf/0/list826nov?opendocument";
  url =url + "&SD="+theform.SD.value;
  url =url + "&ED="+theform.ED.value;
  url =url + "&HQ="+houselist;
  url =url + "&RTYPE=HOUSELIST";
  if (cookielist['A']) {
   url = url + "&A="+cookielist['A'];
  }
  location.href = url;
 }
}
function switchform(formtype) {
 if (formtype=='multiple') {
  document.getElementById("housesearch").style.display="none";
  document.getElementById("housesearchmultiple").style.display="inline";
 } else {
  document.getElementById("housesearch").style.display="inline";
  document.getElementById("housesearchmultiple").style.display="none";
 }
}

function VisHusPopup(house) {
url = '/house.nsf/0/826NOV?opendocument&H='+house+'&_xview';
window.open(url,"",'width=775,height=700,directories=no,status=yes,scrollbars=yes,resizable=yes,menubar=yes,toolbar=no');
}
function setAdvSearchValues(){
   for (element in advcookielist) { 
      changevalue = true;
      collection = document.getElementsByName(element);
      if (collection.length > 0) {
         for (counter in validParametersArray) {
            if (validParametersArray[counter] == element) {
               changevalue = false;
            }
         }
         if (changevalue) {
            if (collection[0].type == "checkbox") {
               collection[0].checked = true;
            } else if (collection[0].type == "text") {
               collection[0].value = advcookielist[element];
            } else if (collection[0].type == "select-one") {
               setOption(collection[0] , advcookielist[element]);
            }
         }
      }
   }
}
function setFieldValues(){

var cgiString = location.search;
if (cgiString.length > 1) {
var qstringlist = new Array();

 var valuesets = cgiString.substring(1, cgiString.length).split('&');
 for (var loop1 = 0; loop1 < valuesets.length; loop1++) {
  if (valuesets[loop1].indexOf('=')>0) {
   var broken_info = valuesets[loop1].split("=");
   qstringlist[broken_info[0]] = broken_info[1];
  }
 }

   for (element in qstringlist) { 
      collection = document.getElementsByName(element);
      if (collection.length > 0) {
         if (collection[0].type == "checkbox" && qstringlist[element] == "Y") {
            collection[0].checked = true;
         } else if (collection[0].type == "text") {
            collection[0].value = unescape(unescape(qstringlist[element]));
         } else if (collection[0].type == "textarea") {
            collection[0].value = unescape(unescape(qstringlist[element]));
         } else if (collection[0].type == "select-one") {
            setOption(collection[0] , unescape(qstringlist[element]));
         }
      }
   }
}
}

    function LatLng(lat, lng) {
      this.lat = lat;
      this.lng = lng;
          
      this.toUTM = convertToUTM;
      this.toUTM32 = convertToUTM32;
          
      this.toString = LatLngToString;
    }
    
    function LatLngToString() {
      return "Lat, Long: (" + this.lat + ", " + this.lng + ")";
    }
    
    function UTMRef(easting, northing, zone, southhemi) {
      this.easting  = easting;
      this.northing = northing;
      this.southhemi = southhemi;
      this.zone  = zone;
        
      this.toLatLng = convertFromUTM;
        
      this.toString = UTMRefToString;
    }
    
    
    function UTMRefToString() {
      var reply = this.lngZone + " " + this.easting + " " + this.northing;
      if(this.southhemi){
        reply += " southern hemisphere";
      }
      return reply;
    }
    
    var pi = 3.14159265358979;

    /* Ellipsoid model constants (actual values here are for WGS84) */
    var sm_a = 6378137.0;
    var sm_b = 6356752.314;
    var sm_EccSquared = 6.69437999013e-03;

    var UTMScaleFactor = 0.9996;


    /*
    * DegToRad
    *
    * Converts degrees to radians.
    *
    */
    function DegToRad (deg)
    {
        return (deg / 180.0 * pi)
    }




    /*
    * RadToDeg
    *
    * Converts radians to degrees.
    *
    */
    function RadToDeg (rad)
    {
        return (rad / pi * 180.0)
    }




    /*
    * ArcLengthOfMeridian
    *
    * Computes the ellipsoidal distance from the equator to a point at a
    * given latitude.
    *
    * Reference: Hoffmann-Wellenhof, B., Lichtenegger, H., and Collins, J.,
    * GPS: Theory and Practice, 3rd ed.  New York: Springer-Verlag Wien, 1994.
    *
    * Inputs:
    *     phi - Latitude of the point, in radians.
    *
    * Globals:
    *     sm_a - Ellipsoid model major axis.
    *     sm_b - Ellipsoid model minor axis.
    *
    * Returns:
    *     The ellipsoidal distance of the point from the equator, in meters.
    *
    */
    function ArcLengthOfMeridian (phi)
    {
        var alpha, beta, gamma, delta, epsilon, n;
        var result;

        /* Precalculate n */
        n = (sm_a - sm_b) / (sm_a + sm_b);

        /* Precalculate alpha */
        alpha = ((sm_a + sm_b) / 2.0)
           * (1.0 + (Math.pow (n, 2.0) / 4.0) + (Math.pow (n, 4.0) / 64.0));

        /* Precalculate beta */
        beta = (-3.0 * n / 2.0) + (9.0 * Math.pow (n, 3.0) / 16.0)
           + (-3.0 * Math.pow (n, 5.0) / 32.0);

        /* Precalculate gamma */
        gamma = (15.0 * Math.pow (n, 2.0) / 16.0)
            + (-15.0 * Math.pow (n, 4.0) / 32.0);
    
        /* Precalculate delta */
        delta = (-35.0 * Math.pow (n, 3.0) / 48.0)
            + (105.0 * Math.pow (n, 5.0) / 256.0);
    
        /* Precalculate epsilon */
        epsilon = (315.0 * Math.pow (n, 4.0) / 512.0);
    
    /* Now calculate the sum of the series and return */
    result = alpha
        * (phi + (beta * Math.sin (2.0 * phi))
            + (gamma * Math.sin (4.0 * phi))
            + (delta * Math.sin (6.0 * phi))
            + (epsilon * Math.sin (8.0 * phi)));

    return result;
    }



    /*
    * UTMCentralMeridian
    *
    * Determines the central meridian for the given UTM zone.
    *
    * Inputs:
    *     zone - An integer value designating the UTM zone, range [1,60].
    *
    * Returns:
    *   The central meridian for the given UTM zone, in radians, or zero
    *   if the UTM zone parameter is outside the range [1,60].
    *   Range of the central meridian is the radian equivalent of [-177,+177].
    *
    */
    function UTMCentralMeridian (zone)
    {
        var cmeridian;

        cmeridian = DegToRad (-183.0 + (zone * 6.0));
    
        return cmeridian;
    }



    /*
    * FootpointLatitude
    *
    * Computes the footpoint latitude for use in converting transverse
    * Mercator coordinates to ellipsoidal coordinates.
    *
    * Reference: Hoffmann-Wellenhof, B., Lichtenegger, H., and Collins, J.,
    *   GPS: Theory and Practice, 3rd ed.  New York: Springer-Verlag Wien, 1994.
    *
    * Inputs:
    *   y - The UTM northing coordinate, in meters.
    *
    * Returns:
    *   The footpoint latitude, in radians.
    *
    */
    function FootpointLatitude (y)
    {
        var y_, alpha_, beta_, gamma_, delta_, epsilon_, n;
        var result;
        
        /* Precalculate n (Eq. 10.18) */
        n = (sm_a - sm_b) / (sm_a + sm_b);
         
        /* Precalculate alpha_ (Eq. 10.22) */
        /* (Same as alpha in Eq. 10.17) */
        alpha_ = ((sm_a + sm_b) / 2.0)
            * (1 + (Math.pow (n, 2.0) / 4) + (Math.pow (n, 4.0) / 64));
        
        /* Precalculate y_ (Eq. 10.23) */
        y_ = y / alpha_;
        
        /* Precalculate beta_ (Eq. 10.22) */
        beta_ = (3.0 * n / 2.0) + (-27.0 * Math.pow (n, 3.0) / 32.0)
            + (269.0 * Math.pow (n, 5.0) / 512.0);
        
        /* Precalculate gamma_ (Eq. 10.22) */
        gamma_ = (21.0 * Math.pow (n, 2.0) / 16.0)
            + (-55.0 * Math.pow (n, 4.0) / 32.0);
         
        /* Precalculate delta_ (Eq. 10.22) */
        delta_ = (151.0 * Math.pow (n, 3.0) / 96.0)
            + (-417.0 * Math.pow (n, 5.0) / 128.0);
         
        /* Precalculate epsilon_ (Eq. 10.22) */
        epsilon_ = (1097.0 * Math.pow (n, 4.0) / 512.0);
         
        /* Now calculate the sum of the series (Eq. 10.21) */
        result = y_ + (beta_ * Math.sin (2.0 * y_))
            + (gamma_ * Math.sin (4.0 * y_))
            + (delta_ * Math.sin (6.0 * y_))
            + (epsilon_ * Math.sin (8.0 * y_));
        
        return result;
    }



    /*
    * MapLatLonToXY
    *
    * Converts a latitude/longitude pair to x and y coordinates in the
    * Transverse Mercator projection.  Note that Transverse Mercator is not
    * the same as UTM; a scale factor is required to convert between them.
    *
    * Reference: Hoffmann-Wellenhof, B., Lichtenegger, H., and Collins, J.,
    * GPS: Theory and Practice, 3rd ed.  New York: Springer-Verlag Wien, 1994.
    *
    * Inputs:
    *    phi - Latitude of the point, in radians.
    *    lambda - Longitude of the point, in radians.
    *    lambda0 - Longitude of the central meridian to be used, in radians.
    *
    * Outputs:
    *    xy - A 2-element array containing the x and y coordinates
    *         of the computed point.
    *
    * Returns:
    *    The function does not return a value.
    *
    */
    function MapLatLonToXY (phi, lambda, lambda0, xy)
    {
        var N, nu2, ep2, t, t2, l;
        var l3coef, l4coef, l5coef, l6coef, l7coef, l8coef;
        var tmp;

        /* Precalculate ep2 */
        ep2 = (Math.pow (sm_a, 2.0) - Math.pow (sm_b, 2.0)) / Math.pow (sm_b, 2.0);
    
        /* Precalculate nu2 */
        nu2 = ep2 * Math.pow (Math.cos (phi), 2.0);
    
        /* Precalculate N */
        N = Math.pow (sm_a, 2.0) / (sm_b * Math.sqrt (1 + nu2));
    
        /* Precalculate t */
        t = Math.tan (phi);
        t2 = t * t;
        tmp = (t2 * t2 * t2) - Math.pow (t, 6.0);

        /* Precalculate l */
        l = lambda - lambda0;
    
        /* Precalculate coefficients for l**n in the equations below
           so a normal human being can read the expressions for easting
           and northing
           -- l**1 and l**2 have coefficients of 1.0 */
        l3coef = 1.0 - t2 + nu2;
    
        l4coef = 5.0 - t2 + 9 * nu2 + 4.0 * (nu2 * nu2);
    
        l5coef = 5.0 - 18.0 * t2 + (t2 * t2) + 14.0 * nu2
            - 58.0 * t2 * nu2;
    
        l6coef = 61.0 - 58.0 * t2 + (t2 * t2) + 270.0 * nu2
            - 330.0 * t2 * nu2;
    
        l7coef = 61.0 - 479.0 * t2 + 179.0 * (t2 * t2) - (t2 * t2 * t2);
    
        l8coef = 1385.0 - 3111.0 * t2 + 543.0 * (t2 * t2) - (t2 * t2 * t2);
    
        /* Calculate easting (x) */
        xy[0] = N * Math.cos (phi) * l
            + (N / 6.0 * Math.pow (Math.cos (phi), 3.0) * l3coef * Math.pow (l, 3.0))
            + (N / 120.0 * Math.pow (Math.cos (phi), 5.0) * l5coef * Math.pow (l, 5.0))
            + (N / 5040.0 * Math.pow (Math.cos (phi), 7.0) * l7coef * Math.pow (l, 7.0));
    
        /* Calculate northing (y) */
        xy[1] = ArcLengthOfMeridian (phi)
            + (t / 2.0 * N * Math.pow (Math.cos (phi), 2.0) * Math.pow (l, 2.0))
            + (t / 24.0 * N * Math.pow (Math.cos (phi), 4.0) * l4coef * Math.pow (l, 4.0))
            + (t / 720.0 * N * Math.pow (Math.cos (phi), 6.0) * l6coef * Math.pow (l, 6.0))
            + (t / 40320.0 * N * Math.pow (Math.cos (phi), 8.0) * l8coef * Math.pow (l, 8.0));
    
        return;
    }
    
    
    
    /*
    * MapXYToLatLon
    *
    * Converts x and y coordinates in the Transverse Mercator projection to
    * a latitude/longitude pair.  Note that Transverse Mercator is not
    * the same as UTM; a scale factor is required to convert between them.
    *
    * Reference: Hoffmann-Wellenhof, B., Lichtenegger, H., and Collins, J.,
    *   GPS: Theory and Practice, 3rd ed.  New York: Springer-Verlag Wien, 1994.
    *
    * Inputs:
    *   x - The easting of the point, in meters.
    *   y - The northing of the point, in meters.
    *   lambda0 - Longitude of the central meridian to be used, in radians.
    *
    * Outputs:
    *   philambda - A 2-element containing the latitude and longitude
    *               in radians.
    *
    * Returns:
    *   The function does not return a value.
    *
    * Remarks:
    *   The local variables Nf, nuf2, tf, and tf2 serve the same purpose as
    *   N, nu2, t, and t2 in MapLatLonToXY, but they are computed with respect
    *   to the footpoint latitude phif.
    *
    *   x1frac, x2frac, x2poly, x3poly, etc. are to enhance readability and
    *   to optimize computations.
    *
    */
    function MapXYToLatLon (x, y, lambda0, philambda)
    {
        var phif, Nf, Nfpow, nuf2, ep2, tf, tf2, tf4, cf;
        var x1frac, x2frac, x3frac, x4frac, x5frac, x6frac, x7frac, x8frac;
        var x2poly, x3poly, x4poly, x5poly, x6poly, x7poly, x8poly;
     
        /* Get the value of phif, the footpoint latitude. */
        phif = FootpointLatitude (y);
         
        /* Precalculate ep2 */
        ep2 = (Math.pow (sm_a, 2.0) - Math.pow (sm_b, 2.0))
              / Math.pow (sm_b, 2.0);
         
        /* Precalculate cos (phif) */
        cf = Math.cos (phif);
         
        /* Precalculate nuf2 */
        nuf2 = ep2 * Math.pow (cf, 2.0);
         
        /* Precalculate Nf and initialize Nfpow */
        Nf = Math.pow (sm_a, 2.0) / (sm_b * Math.sqrt (1 + nuf2));
        Nfpow = Nf;
         
        /* Precalculate tf */
        tf = Math.tan (phif);
        tf2 = tf * tf;
        tf4 = tf2 * tf2;
        
        /* Precalculate fractional coefficients for x**n in the equations
           below to simplify the expressions for latitude and longitude. */
        x1frac = 1.0 / (Nfpow * cf);
        
        Nfpow *= Nf;   /* now equals Nf**2) */
        x2frac = tf / (2.0 * Nfpow);
        
        Nfpow *= Nf;   /* now equals Nf**3) */
        x3frac = 1.0 / (6.0 * Nfpow * cf);
        
        Nfpow *= Nf;   /* now equals Nf**4) */
        x4frac = tf / (24.0 * Nfpow);
        
        Nfpow *= Nf;   /* now equals Nf**5) */
        x5frac = 1.0 / (120.0 * Nfpow * cf);
        
        Nfpow *= Nf;   /* now equals Nf**6) */
        x6frac = tf / (720.0 * Nfpow);
        
        Nfpow *= Nf;   /* now equals Nf**7) */
        x7frac = 1.0 / (5040.0 * Nfpow * cf);
        
        Nfpow *= Nf;   /* now equals Nf**8) */
        x8frac = tf / (40320.0 * Nfpow);
        
        /* Precalculate polynomial coefficients for x**n.
           -- x**1 does not have a polynomial coefficient. */
        x2poly = -1.0 - nuf2;
        
        x3poly = -1.0 - 2 * tf2 - nuf2;
        
        x4poly = 5.0 + 3.0 * tf2 + 6.0 * nuf2 - 6.0 * tf2 * nuf2
         - 3.0 * (nuf2 *nuf2) - 9.0 * tf2 * (nuf2 * nuf2);
        
        x5poly = 5.0 + 28.0 * tf2 + 24.0 * tf4 + 6.0 * nuf2 + 8.0 * tf2 * nuf2;
        
        x6poly = -61.0 - 90.0 * tf2 - 45.0 * tf4 - 107.0 * nuf2
         + 162.0 * tf2 * nuf2;
        
        x7poly = -61.0 - 662.0 * tf2 - 1320.0 * tf4 - 720.0 * (tf4 * tf2);
        
        x8poly = 1385.0 + 3633.0 * tf2 + 4095.0 * tf4 + 1575 * (tf4 * tf2);
         
        /* Calculate latitude */
        philambda[0] = phif + x2frac * x2poly * (x * x)
         + x4frac * x4poly * Math.pow (x, 4.0)
         + x6frac * x6poly * Math.pow (x, 6.0)
         + x8frac * x8poly * Math.pow (x, 8.0);
         
        /* Calculate longitude */
        philambda[1] = lambda0 + x1frac * x
         + x3frac * x3poly * Math.pow (x, 3.0)
         + x5frac * x5poly * Math.pow (x, 5.0)
         + x7frac * x7poly * Math.pow (x, 7.0);
         
        return;
    }




    /*
    * LatLonToUTMXY
    *
    * Converts a latitude/longitude pair to x and y coordinates in the
    * Universal Transverse Mercator projection.
    *
    * Inputs:
    *   lat - Latitude of the point, in radians.
    *   lon - Longitude of the point, in radians.
    *   zone - UTM zone to be used for calculating values for x and y.
    *          If zone is less than 1 or greater than 60, the routine
    *          will determine the appropriate zone from the value of lon.
    *
    * Outputs:
    *   xy - A 2-element array where the UTM x and y values will be stored.
    *
    * Returns:
    *   The UTM zone used for calculating the values of x and y.
    *
    */
    function LatLonToUTMXY (lat, lon, zone, xy)
    {
        MapLatLonToXY (lat, lon, UTMCentralMeridian (zone), xy);

        /* Adjust easting and northing for UTM system. */
        xy[0] = xy[0] * UTMScaleFactor + 500000.0;
        xy[1] = xy[1] * UTMScaleFactor;
        if (xy[1] < 0.0)
            xy[1] = xy[1] + 10000000.0;

        return zone;
    }
    
    
    
    /*
    * UTMXYToLatLon
    *
    * Converts x and y coordinates in the Universal Transverse Mercator
    * projection to a latitude/longitude pair.
    *
    * Inputs:
    * x - The easting of the point, in meters.
    * y - The northing of the point, in meters.
    * zone - The UTM zone in which the point lies.
    * southhemi - True if the point is in the southern hemisphere;
    *               false otherwise.
    *
    * Outputs:
    * latlon - A 2-element array containing the latitude and
    *            longitude of the point, in radians.
    *
    * Returns:
    * The function does not return a value.
    *
    */
    function UTMXYToLatLon (x, y, zone, southhemi, latlon)
    {
        var cmeridian;
         
        x -= 500000.0;
        x /= UTMScaleFactor;
         
        /* If in southern hemisphere, adjust y accordingly. */
        if (southhemi)
        y -= 10000000.0;
          
        y /= UTMScaleFactor;
        
        cmeridian = UTMCentralMeridian (zone);
        MapXYToLatLon (x, y, cmeridian, latlon);
         
        return;
    }
    
    function convertToUTM ()
    {
        var xy = new Array(2);
        
        if (isNaN (parseFloat (this.lng))) {
            alert ("Please enter a valid longitude in the lon field.");
            return false;
        }
        
        var lon = parseFloat(this.lng);

        if ((lon < -180.0) || (180.0 <= lon)) {
            alert ("The longitude you entered is out of range.  " +
                   "Please enter a number in the range [-180, 180).");
            return false;
        }

        if (isNaN (parseFloat (this.lat))) {
            alert ("Please enter a valid latitude in the lat field.");
            return false;
        }
        
        var lati = parseFloat(this.lat);
        
        if ((lati < -90.0) || (90.0 < lati)) {
            alert ("The latitude you entered is out of range.  " +
                   "Please enter a number in the range [-90, 90].");
            return false;
        }

        // Compute the UTM zone.
        zone = Math.floor ((lon + 180.0) / 6) + 1;

        zone = LatLonToUTMXY (DegToRad (lati), DegToRad (lon), zone, xy);
        
        return new UTMRef(xy[0], xy[1], zone, lati < 0);
    }
    
    /**
     *  Converts a longitude latitude to the UTM set of the chosen zone. Returns a size two array with the easting and northing.
     */         
    function convertToUTM32 (longitude, latitude)
    {
        var xy = new Array(2);
        
        if (isNaN (parseFloat (this.lng))) {
            alert ("Please enter a valid longitude in the lon field.");
            return false;
        }

        lon = parseFloat (this.lng);

        if ((lon < -180.0) || (180.0 <= lon)) {
            alert ("The longitude you entered is out of range.  " +
                   "Please enter a number in the range [-180, 180).");
            return false;
        }

        if (isNaN (parseFloat (this.lat))) {
            alert ("Please enter a valid latitude in the lat field.");
            return false;
        }

        lat = parseFloat (this.lat);

        if ((lat < -90.0) || (90.0 < lat)) {
            alert ("The latitude you entered is out of range.  " +
                   "Please enter a number in the range [-90, 90].");
            return false;
        }

        // Compute the UTM zone.
        zone = 32;

        zone = LatLonToUTMXY (DegToRad (lat), DegToRad (lon), zone, xy);

        return new UTMRef(xy[0], xy[1], zone, lat < 0);
    }
    
    /**
     * Returns a given UTM coordinate as a Longitude Latitude coordinate set as an array of size two
     */         
    function convertFromUTM (){
        latlon = new Array(2);
        
        if (isNaN (parseFloat (this.easting))) {
            alert ("Please enter a valid easting in the x field.");
            return false;
        }

        if (isNaN (parseFloat (this.northing))) {
            alert ("Please enter a valid northing in the y field.");
            return false;
        }

        if (isNaN (parseInt (this.zone))) {
            alert ("Please enter a valid UTM zone in the zone field.");
            return false;
        }

        if ((this.zone < 1) || (60 < this.zone)) {
            alert ("The UTM zone you entered is out of range.  " +
                   "Please enter a number in the range [1, 60].");
            return false;
        }

        UTMXYToLatLon (this.easting, this.northing, this.zone, this.southhemi, latlon);

        return new LatLng(RadToDeg(latlon[0]),RadToDeg(latlon[1]));
    }
/* Coords is in UTM32 */
function placeMapMarkers(coordFormat,coord1,coord2,counter){
    
    if (coordFormat == "latlng") {
     var latlng = new LatLng(coord2,coord1);
     var umt32 = latlng.toUTM32();     
     coord1 = umt32.easting;
     coord2 = umt32.northing;
    }
    
                var h=new Array(16);
                h.c208=new Array(430000,6055000,747000,6440000);
                h.c752=new Array(239444,6190000,1550556,7810000);
                h.c578=new Array(142380,6470000,1487619,8100000);
                h.c528=new Array(100000,5631904,387000,5988095);
                h.c056=new Array(41000,5448571,325000,5791429);
                h.c280=new Array(280000,5260000,930000,6150000);
                h.c040=new Array(540000,4984444,1120000,5695556);
                h.c348=new Array(1040000,4996667,1520000,5613333);
                h.c616=new Array(840000,5432414,1580000,6287586);
                h.c203=new Array(720000,5249746,1220000,5880254);
                h.c703=new Array(1070000,5211842,1480000,5738158);
                h.c380=new Array(300000,4080000,1340000,5320000);
                h.c250=new Array(-550000,4517647,580000,5882353);
                h.c191=new Array(850000,4706733,1300000,5253267);
                h.c300=new Array(1420000,3843636,2360000,5016364);
                h.c724=new Array(-1255859,3787594,95393,5298646);
                h.c756=new Array(265000,5540000,615000,5040000);
                var map = document.getElementById("houseMap_"+counter);
                var dot = document.getElementById("marker_"+counter);

                geomap_coordinates=h[map.alt];
                geomap_width=(geomap_coordinates[2]-geomap_coordinates[0]);
                geomap_height=(geomap_coordinates[3]-geomap_coordinates[1]);
                geocodes_per_pixel_width=(geomap_width/map.width);
                geocodes_per_pixel_height=(geomap_height/map.height);
                if( (coord1>855464 && coord1<897022) && (coord2>6104899 && coord2<6152359) ){
                    leftmarker=((coord1-geomap_coordinates[0])/geocodes_per_pixel_width)-47+"px";
                    topmarker=((geomap_coordinates[3]-coord2)/geocodes_per_pixel_height)-64+"px";
                }else{
                    if((coord1<-1700000 && coord1>-2200000) && (coord2>3100000 && coord2<3600000)){
                        leftmarker=((coord1-geomap_coordinates[0])/geocodes_per_pixel_width)+67+"px";
                        topmarker=((geomap_coordinates[3]-coord2)/geocodes_per_pixel_height)-47+"px";
                    }else{
                        leftmarker=((coord1-geomap_coordinates[0])/geocodes_per_pixel_width)-4+"px";
                        topmarker=((geomap_coordinates[3]-coord2)/geocodes_per_pixel_height)-11+"px";
                    }
                }
                dot.style.left=leftmarker;
                dot.style.top=topmarker;
                dot.style.visibility="visible";
            }

function isElementInArray (arr, searchFor){
 for(var i = 0; i < arr.length; i++) {
  if (arr[i] == searchFor) {
   return true;
  }
 }
 return false;
}
// this function convert a date of type dd-mm-yyyy or yyyy-mm-dd from one to another
function convertDate_dd_mm_yyyyOryyyy_mm_dd (date, seperator){
var dateArr = date.split(seperator);
if (dateArr.length = 3) {
  return dateArr[2]+ '-' + dateArr[1] + '-' + dateArr[0];   
} else { 
 return false;
} 
} 
function EOSsearchParameters() {
// pic up the search parameters in map form
var args = getArgs(); 
//the delimeter characther used in the return string 
var delimeterChar = ',';
var rsStr = ''; 

// the array of parameters where we just take the value of the parameter. All other characters are converted
// to have the value 0 or 1.

var parameterArrayDates = ['SD','ED'];
var parameterArrayValue = ['C','R','SD','ED','PE','K','QE1','Q50','Q54','P','Q51','Q52','Q67','Q00'];

// all the parameters that we test for having a value
var parameterArray = ['C','R','SD','ED','PE','K','QE1','Q50','Q54','P','Q51','Q52','Q67','Q00','Q01','Q45','Q02','Q03','Q06','Q05','Q30','Q10','Q04','Q38','Q09','Q29','Q08','Q31','Q13','Q15','Q12','Q26','Q32'];

// run through the array of all parameters
for(var i = 0; i < parameterArray.length; i++) {
var searchParameter = parameterArray[i];
// search to see if the parameter is of type "Value" or type "0 or 1" 
 if (isElementInArray(parameterArrayValue,searchParameter)) { 
 // here we the value of the parameter (can be empty) 
  if (eval('args.' + parameterArray[i])) {
   if (isElementInArray(parameterArrayDates,searchParameter)) {
                                  rsStr = rsStr + convertDate_dd_mm_yyyyOryyyy_mm_dd (eval('args.' + parameterArray[i]),'-');     
   } else {
    rsStr = rsStr + eval('args.' + parameterArray[i]);
   }
  } else {
   rsStr = rsStr;
  }
   rsStr = rsStr + delimeterChar;
 } else { // here we know that the return value is 0 or 1
   if (eval('args.' + parameterArray[i])) { 
  // If we have the parameter we return 1   
    rsStr = rsStr + '1';
  } else {
  // here we don't have the parameter 
   rsStr = rsStr + '0';
  }
   rsStr = rsStr + delimeterChar;
 } // end if
 
} // end for
      return rsStr.substring(0,rsStr.lastIndexOf(delimeterChar));
} // end function
function EOSParam(value){
      if(value){
        return value;
      }
      return "";
    }
function EOSDateFormat(date){
      dateArray = date.split("-");
      if(dateArray.length<3) return date;
      return dateArray[2]+"-"+dateArray[1]+"-"+dateArray[0];
    }
function EOSProfiling(params){
      HEIAS_T=Math.random(); HEIAS_T=HEIAS_T*10000000000000000000;
      var shop_id=EOSParam(params.shop_id);
      var newsletter_flag=EOSParam(params.newsletter_flag);
      var catalogorder_flag=EOSParam(params.catalogorder_flag);
      var catalogorder_name=EOSParam(params.catalogorder_name);
      var product_recommendation=EOSParam(params.product_recommendation);
      var user_searchkeywords=EOSParam(params.user_searchkeywords);
      var order_article=EOSParam(params.order_article);
      var customer_zip=EOSParam(params.customer_zip);
      var product_onsale=EOSParam(params.product_onsale);
      var product_id=EOSParam(params.product_id);
      var wishlist_article=EOSParam(params.wishlist_article);
      var travel_start_date=EOSDateFormat(EOSParam(params.travel_start_date));
      var travel_end_date=EOSDateFormat(EOSParam(params.travel_end_date));
      var travel_kids=EOSParam(params.travel_kids);
      var travel_adults=EOSParam(params.travel_adults);
      var travel_hotel_category=EOSParam(params.travel_hotel_category);
      
      var HEIAS_SRC='https://ads.heias.com/x/heias.ret.px.fr/?PX=HT|' + HEIAS_T + '|n|5723|cus|6593|pb|1|customer_zip|' + customer_zip + '|order_article|' + order_article + '|shop_id|' + shop_id + '|newsletter_flag|' + newsletter_flag + '|catalogorder_flag|' + catalogorder_flag + '|catalogorder_name|' + catalogorder_name + '|product_recommendation|' + product_recommendation + '|user_searchkeywords|' + user_searchkeywords + '|product_onsale|' + product_onsale + '|product_id|' + product_id + '|wishlist_article|' + wishlist_article + '|travel_start_date|' + travel_start_date + '|travel_end_date|' + travel_end_date + '|travel_kids|' + travel_kids + '|travel_adults|' + travel_adults + '|travel_hotel_category|' + travel_hotel_category + '';

      document.write('<div id="px_div_' + HEIAS_T + '" style="position: absolute; left:0; top:0; width:0px; height:0px;"><iframe id="px_fr_'+HEIAS_T+'" name="px_fr_'+HEIAS_T+'" src="' + HEIAS_SRC + '" allowtransparency="true" framespacing="0" frameborder="no" scrolling="no" width="1" height="1"></iframe></div>');
    }
function EOSCheckOut(params){
      HEIAS_T=Math.random(); HEIAS_T=HEIAS_T*10000000000000000000;
  
      var order_article=EOSParam(params.order_article);
      var order_id=EOSParam(params.order_id);
      var order_total=EOSParam(params.order_total);
      var order_payment_method=EOSParam(params.order_payment_method);
      var customer_status=EOSParam(params.customer_status);
      var customer_zip=EOSParam(params.customer_zip);
      var travel_start_date=EOSDateFormat(EOSParam(params.travel_start_date));
      var travel_end_date=EOSDateFormat(EOSParam(params.travel_end_date));
      var travel_kids=EOSParam(params.travel_kids);
      var travel_adults=EOSParam(params.travel_adults);
      var travel_hotel_category=EOSParam(params.travel_hotel_category);
            
      document.write('<scr' + 'ipt language="JavaScript" type="text/javascript" src="https://ads.heias.com/x/heias.cpa/count.px.js/?PX=HT|' + HEIAS_T + '|cus|6593|pb|1|order_article|' + order_article + '|order_payment_method|' + order_payment_method + '|order_id|' + order_id + '|order_total|' + order_total + '|customer_status|' + customer_status + '|customer_zip|' + customer_zip + '|travel_start_date|' + travel_start_date + '|travel_end_date|' + travel_end_date + '|travel_kids|' + travel_kids + '|travel_adults|' + travel_adults + '|travel_hotel_category|' + travel_hotel_category + '"><\/scr' + 'ipt>');
    }

function checkSession(allowanonymous) {
  if(document.cookie.indexOf("agencySession=")!=-1) {
    if(allowanonymous) {
      jQuery("#mainmenu_login").html("");
      jQuery("#mainmenu_login").attr("href","https://safe.novasol.com/login/agency.html");
    } else {
      jQuery.post("/appserver/BureauWebsite/CheckSession", {"COM":"NOV","L":"826"}, function(reply){ 
        if(reply=="false"){ 
          window.location = "http://www.novasol.co.uk/login/login.html"; 
        } else {
          jQuery("#mainmenu_login").html("");
          jQuery("#mainmenu_login").attr("href","https://safe.novasol.com/login/agency.html");
        }
      });
    }
  } else {  
    if(!allowanonymous) {
      window.location = "http://www.novasol.co.uk/login/login.html"; 
    }
  }
}


function generateAreaOptions (countrycode) {
var select = document.search.R;
select.options.length=1;

var arealist = new Array();arealist["752"] = "^CENTRAL SWEDEN|MELSV^- Stockholm/Mälardalen|S43^- Värmland/Dalsland|S45^- Dalarna|S46^NORTHERN SWEDEN|NORSV^- Northern Sweden|S49^SOUTHERN SWEDEN|SYDSV^- Skåne|S01^- Halland|S02^- Blekinge|S03^- Småland|S04^- Västergötland/Göteborg|S07^- Bohuslän|S08^- Östergötland/Närke|S09^- Öland|S41^Gotland|S42"; arealist["100"] = "^BOURGAS|BBURG^- Sunny Beach - Bourgas north|BGS^- Black Sea Coast - Bourgas south|BGZ^VARNA|BVARN^- Black Sea Coast - Varna south|BGM^- Northern Black Sea Coastline|BGN^- Varna and surroundings|BGV"; arealist["040"] = "^CENTRAL AUSTRIA|CENTR^- Province of Salzburg|ASA^EASTERN AUSTRIA|EASTH^- Burgenland|ABU^NORTHERN AUSTRIA|NORTH^- Lower Austria|ANO^- Upper Austria|AOE^SOUTHERN AUSTRIA|SOUTH^- Carinthia|AKA^- Styria|AST^WESTERN AUSTRIA|WESTH^- Tirol|ATI^- Voralberg|AVO"; arealist["616"] = "^CENTRAL POLAND|CEPOL^- Wielkopolska|PPW^NORTHERN POLAND|NOPOL^- Pomorze/Kaszubes|PKA^- Mazury|PMA^- Baltic Sea Region|PPO^- Rowy/Baltic sea Region|PRO^SOUTHERN POLAND|SOPOL^- Beskidy Mountains/Hohe Tatra|PPG^- The Sudeten Mountains|PPZ"; arealist["280"] = "^Whole of GERMANY|TYSKL^- The Harz & region|DAN^- Bavaria|DBA^- Brandenburg|DBB^- Berlin|DBE^- Lake Constance|DBO^- Black Forest|DBW^- Kurhessisches Bergland|DHE^- Lüneburg Heath|DLH^- Mecklenburg coast|DMK^- Rügen|DMR^- Usedom|DMU^- Mecklenburg-Western Pomerania|DMV^- Niedersachsen-north|DNS^- Sauerland|DNW^- Mosel/Eifel/Hunsrück|DRP^- Vogtland/Ore Mountains/Saxon Switzerland|DSA^- Schleswig Holstein|DSH^- Thuringia|DTH^- Unteres Saaletal|DUS^- Weserbergland|DWE^- Westerwald|DWW"; arealist["056"] = "^Whole of BELGIUM|BELG^- The Ardennes|BAR^- Limburg|BLI^- Flanders|BVA^- Flemish Brabant|BVB"; arealist["208"] = "^BORNHOLM|BORNH^- Balka, Dueodde, Sømarken|I50^- South west Bornholm|I53^- North Bornholm/Allinge/Sandvig|I55^- East Bornholm/Neksø/Snogebæk|I57^FANØ|FANO^- Fanø|M21^FUNEN, LANGELAND, TÅSINGE|FYN^- Langeland & Tåsinge|G10^- Funen|G51^LIMFJORDEN|LIMFJ^- Limfjord|L50^LOLLAND, FALSTER, MØN|LOLL^- Falster|K05^- Lolland|K10^- Falster, Marielyst|K11^- Møn|K30^NORTH JUTLAND|NORDJ^- Skagen & Tannisbugten|A01^- North west coast/Jammerbugten|A03^- North east coast, Hou, Hals|A16^NORTH WEST JUTLAND|NORVJ^- North west coast/Thy|B01^- Jammerbugten/Han Herred|B60^EAST JUTLAND|OSTJ^- Mols, Ebeltoft|D01^- East Himmerland|D60^- North Djursland/Fjellerup Strand|D70^- East Jutland, Juelsminde, Vejle/Fredericia area|D80^RØMØ|ROMO^- Rømø|R10^- South wassensea/Arrild Ferieby|S10^ZEALAND|SJELL^- North Zealand, Hornbæk, Gilleleje|E01^- Helsingør|E01X^- North West Zealand, Sejerøbugten|E16^- West Zealand|E20^- South Zealand|K50^- South east Zealand|K51^SOUTH JUTLAND|SONDJ^- South east coast, Hejlsminde|F02^- Als|F09^THE WEST COAST|VESTK^- Holmsland Klit Nord/Søndervig|C01^- Fjand, Vrist, Vejlby Klit, Thorsminde|C71^- Ringkøbing Fjord Nord|C81^- Blåvand, Vejers, Ho, Grærup, Mosevrå|P32^- Houstrup, Jegum, Henne Strand, Lønne|P42^- Ringkøbing Fjord Syd, Bork Havn|P52^- Holmsland Klit Syd, Bjerregård|P62^- Kvie Sø|P85"; arealist["528"] = "^Whole of NEDERLAND|HOLLA^- The Coast region|HKU^CENTRAL HOLLAND|MIDTH^- Gelderland|HGE^- Overijssel|HOV^- Utrecht|HUT^NORTHERN HOLLAND|NORDH^- Drenthe|HDR^- Friesland|HFR^- Groningen|HGR^- Northern Holland|HNH^SOUTHERN HOLLAND|SYDLH^- Limburg|HLI^- Noord-Brabant|HNB"; arealist["203"] = "^Whole of CZECH REPUBLIC|TJEK^- The Bohemian Forests|TBB^- The Bohemian Mountains|TBG^- Central Bohemia|TBM^- Northern Bohemia|TBN^- Eastern Bohemia|TBO^- Prague|TBP^- Southern Bohemia|TBS^- Environs of Prague|TBU^- Western Bohemia|TBW^- The Western Beskidy Mountains|TMB^- The Highlands|TMH^- Northern Mähren|TMN^- Southern & central Mähren|TMS"; arealist["352"] = "^ICELAND|ISLAN^- East|ICE^- North|ICN^- South|ICS^- West|ICW"; arealist["250"] = "^AQUITAINE|FAQUI^- Dordogne|FAD^- Gironde|FAG^- Landes|FAL^- Pyrénées Atlantiques|FAP^- Lot et Garonne|FAT^THE ATLANTIC OCEAN|FATLA^- Charente Maritime|FCH^- Vendée|FVE^BRITTANY|FBR^- Côte d´Amor|FBC^- Finistére|FBF^- Ille and Vilaine|FBI^- Loire Atlantique|FBL^- Morbihan|FBM^CENTRE-LOIRE|FCELO^- Centre|FEC^CÕTE D`AZUR|FCOTE^- Alpes Maritimes|FCA^- Var|FCV^CORSICA|FKORS^- Corsica|FKO^LANGUEDOC-ROUSSILLON|FLANG^- Aude|FLA^- Gard|FLG^- Hérault|FLH^- Lozère|FLL^- Pyrénées Orientales|FLP^NORMANDY|FNORM^- Calvados|FNC^- Manche|FNM^- Orne|FNO^- Seine Maritimes|FNS^PROVENCE-DRÔME-ARDÈCHE|FPROV^- Alpes de haute Provence|FPA^- Bouches du Rhône|FPB^- Drôme|FPD^- Vaucluse|FPV^- Ardèche|FRA^MIDI-PYRÉNÉES|FPYRE^- Lot|FML"; arealist["246"] = "^FINLAND|FINLA^- Lake district|SLA^- North|SNA^- South|SSA^- West|SWA"; arealist["348"] = "^BALATON|UBALA^- Balaton sydvest|UBF^- Balaton North|UBN^- Balaton South|UBS^- Balaton west|UBW^Whole of HUNGARY|UNGAR^- Budapest|UBP^- Tata|UBU^- The Danube-island|UDI^- The Danube Knee|UDK^- Fertö-Neusiedler See|UFT^- The Lake Velence|UHB^- Mátra/Bükk|UMB^- The Lake Theis|UTS^- Zalakaros|UWZ"; arealist["703"] = "^Whole of SLOAVKIA|SLOV^- Central Slowakia|TSM^- Eastern Slovakia|TSO^- Tatra Mountains|TST^- Western Slovakia|TSW"; arealist["756"] = "^SCHWEIZ|SCHWE^- SCHWYZ|ZCE^- GRAUBUENDEN|ZGR"; arealist["191"] = "^CENTRAL DALMATIA|DALMM^- Brac island|CDB^- Island Hvar|CDH^- Vis island|CDK^- Ciovo Island|CDM1^- Drvenik Veli Island|CDM2^- Drvenik Mali Island|CDM3^- Makarska|CDM4^- Omis|CDM5^- Split|CDM6^- Trogir|CDM7^- Solta island|CDO^NORTHERN DALMATIA|DALMN^- Biograd|CDN1^- Nin|CDN2^- Starigrad Paklenica|CDN3^- Vir Island|CDN4^- Zadar|CDN5^- Dugi Otok Island|CDU1^- Rivanj Island|CDU10^- Ist Island|CDU2^- Iz Island|CDU3^- Molat Island|CDU4^- Pasman Island|CDU5^- Rava Island|CDU6^- Ugljan Island|CDU8^- Drnis|CDV1^- Prvic Island|CDV10^- Kaprije Island|CDV2^- Krapanj Island|CDV3^- Murter Island|CDV4^- Primosten|CDV5^- Rogoznica|CDV6^- Sibenik|CDV7^- Vodice|CDV8^- Zlarin Island|CDV9^SOUTHERN DALMATIA|DALMS^- Dubrovnik Riviera|CDD^- Peljesac peninsula|CDP^- Neretva Delta|CDR^- Korcula island|CDS^ISTRIA|ISTRI^- Premantura|CIA^- Banjole|CIB^- Porec|CIE1^- Vrsar|CIE2^- Fazana|CIF1^- Barbariga|CIF2^- East coast|CIK^- Rabac|CIK1^- Labin|CIK2^- Krnica|CIK3^- Duga Uvala|CIK4^- Istria hinterland|CIL^- Barban|CIL1^- Ucka|CIL10^- Visnjan|CIL11^- Vodnjan|CIL12^- Zminj|CIL13^- Bale|CIL14^- Buje|CIL2^- Buzet|CIL3^- Kanfanar|CIL4^- Motovun|CIL5^- Pazin|CIL6^- Sv. Lovrec|CIL7^- Svetvincenat|CIL8^- Tinjan|CIL9^- Medulin|CIM^- Pula|CIP^- Umag & Novigrad|CIU^- Umag|CIU1^- Novigrad|CIU2^- Rovinj|CIV^- Liznjan|CIZ^KVARNER BAY|KVARN^- Gorski Kotar|CKB1^- Lika|CKB2^- Crikvenica|CKC^- KrK|CKK^- Cres island|CKL1^- Losinj island|CKL2^- Ilovik Island|CKL3^- Susak Island|CKL4^- Novi Vinodolski|CKN^- Opatija|CKO^- Pag|CKP^- Rab|CKR^- Senj and the coast down|CKV^- Karlobag|CKV1^- Senj|CKV2"; arealist["724"] = "^THE CANARY ISLANDS|CANAR^- Fuerteventura|EFU^- Gran Canary|EGR^- El Hierro|EHI^- Lanzarote|ELA^- La Palma|EPA^- Tenerife|ETE^Majorca|EML^MAINLAND|ESPAN^- Costa del Sol/Andalusia|EAN^- Costa Blanca|EBL^- Costa Brava|ECB^- Costa Calida|ECC^- Costa Dorada|EDO"; arealist["578"] = "^HORDALAND|HORDA^- Southern Hordaland|N18^- Hardanger|N19^- Northern Hordaland|N20^TRØNDELAG|MIDTN^- Northern Trøndelag|N38NT^- Southern Trøndelag|N38ST^MØRE & ROMSDAL|MORO^- Sunnmøre|N27^- Romsdal|N28^- Nordmøre|N29^MOUNTAIN AREA|MOUNT^- Hedmark|N30^- Oppland|N31^- Buskerud north|N33^- Telemark & Indre Agder|N35^NORTH NORWAY|NORDN^- Nordland & Lofoten|N39NO^- Troms|N39TR^OSLOFJORDEN|OSLOF^- Akershus|N37AK^- Buskerud Sør|N37BU^- Østfold|N37OF^- Vestfold|N37VF^ROGALAND|ROGA^- Southern Rogaland|N15^- Ryfylke|N16^- Northern Rogaland|N17^SOGN & FJORDANE|SOFJ^- Ydre Sogn|N21^- Midt Sogn|N22^- Indre Sogn|N23^- Sunnfjord|N24^- Ydre Nordfjord|N25^- Indre Nordfjord|N26^SOUTHERN NORWAY|SOUTN^- Innland|N34^- Coast|N36"; arealist["792"] = "^TURKEY|TYRKI^- Southern Aegean and Lycian Coast|TLK^- Northern and Middle Aegean Coast|TMA^- Turkish Riviera|TRV"; arealist["380"] = "^BASILICATA|IBASI^- Ionian Coast|IBJ^- Tyrrhenian coast|IBT^EMILIA-ROMAGNA|IEMIL^- Emilia-Romagna countryside|IEC^- Emilia-Romagna Adriaticcoast|IEK^FRIULI|IFRIA^- Friuli countryside|IFC^- Friuli - coast of Adriatic Sea|IFK^CALABRIA|IKALA^- Calabria|IKK^CAMPANIA|IKAMP^- Amalfi coast|IKA^- Cilento/Salerno bay|IKC^- Gaeta and Baia Domizia|IKG^- Sorrento coast|IKS^LATIUM|ILATI^- Rome|IRO^- Environs of Latium|IRU^LIGURIA|ILIGU^- Liguria|ILL^MARCHES|IMARK^- Marches|IMM^NORTHERN LAKES|INORD^- Garda Lake|IVG^- Lake Maggiore|IVM^APULIA|IPUGL^- Apulia|ISA^SARDINIA|ISARD^- Sardinia|ISD^SICILY|ISIZI^- Sicily|ISS^TUSCANY|ITOSC^- Arezzo/Cortona and surroundings|ITA^- Florentine|ITB^- Chianti|ITC^- Florence and surroundings|ITF^- Grosseto and surroundings|ITG^- Lucca and surroundings|ITL^- San Gimignano and Volterra|ITN^- Pisa and surroundings|ITP^- Siena and surroundings|ITS^- Montecatini/Pistoia and surroundings|ITT^TUSCANY COAST|ITOSK^- Elba Island|ITE^- Etruscan Coast|ITK^- Argentario/Maremma|ITM^- Versilia|ITV^UMBRIA|IUMBR^- Perugia and surroundings|IUP^- Spoleto and surroundings|IUS^- Trasimeno Lake|IUT^VENICE|IVE^- Veneto countryside|IVC^- Veneto coast|IVK^- Venice|IVV"; arealist["300"] = "^Corfu|GCF^Chios|GCH^Cyprus|GCY^Crete|GKR^Lesbos|GLE^MAINLAND|GMAIN^- Athens|GAT^- Chalkidiki|GHA^- Peloponese|GPE^CYCLADES|KYKLA^- Kea|GKK^- Paros|GKP^- Syros|GKS^THESSALIEN|THESS^- Pelion|GPI^- Thessalien|GTH"; optionlist = arealist[countrycode].substring(1).split("^");
for (i=0; i<optionlist.length; i++){
valueset = optionlist[i].split("|");
select.options[i+1]=new Option(valueset[0],valueset[1],true,false);
}
}


function nmtrack() {
   function getElementsByClass(searchClass,node,tag) { var classElements = new Array(); if ( node == null ) node = document; if ( tag == null ) tag = '*'; var els = node.getElementsByTagName(tag); var elsLen = els.length; var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)"); for (i = 0, j = 0; i < elsLen; i++) { if ( pattern.test(els[i].className) ) { classElements[j] = els[i]; j++; }} return classElements;}
   function getInnerText(el) { if (!el) return ""; var txt = ""; for (var i=0; i<el.childNodes.length; i++) { switch (el.childNodes.item(i).nodeType) { case 1: txt += getInnerText(el.childNodes.item(i)); break; case 3: txt += el.childNodes.item(i).nodeValue; break; } } return txt; }
   function trim(str){ return str.replace(/^[\s\xA0]+|[\s\xA0]+$/g, '');}

   try{
   var cid = 'novasol';
   var nm_title = ''; 
   if(nm_title == '') {

      var bc = [];
      var navPathArea = document.getElementById('navPathArea');
      var cl = getElementsByClass('currentLocation');
      if(navPathArea != null) {
         var links = navPathArea.getElementsByTagName('a');
         for(var i = 0; i <links.length; i++)
            bc[bc.length] = links[i].innerHTML;

         var currentLocation = navPathArea.getElementsByTagName('span');
         bc[bc.length] = currentLocation[currentLocation.length-1].innerHTML;
      } else if(cl.length > 0) {

         bc = getInnerText(bc[0]).split(' > ');
      } else if(new String(document.location).indexOf('/booking') != -1) {
      
         bc[bc.length] = 'Home'; bc[bc.length] = 'Booking';
         var step = getElementsByClass('BOKSTPsteptable');
         var active = step[0].getElementsByTagName('b')[0].parentNode.parentNode.getElementsByTagName('img')[0].alt;
         bc[bc.length] = 'Step ' + active;
      }

      var bc2 = []; for(var i = 1; i < bc.length; i++) bc2[bc2.length] = trim(bc[i]); nm_title = bc2.join(' > ');
   }
   var loc=new String(window.document.location);var loc2=loc;try{var toploc=new String(top.document.location);loc2=toploc.indexOf('nm_extag')!=-1?toploc:loc2;}catch(e){} if(nm_title=='')nm_title=document.title;
   var ref = ''; var c = document.cookie; 
   if( c.indexOf('nm_exref')!=-1 ){var ca = c.split(';');for( i = 0; i < c.length; i++ ){var item = new String(ca[i]);var idx = item.indexOf('nm_exref');if( idx!=-1 )ref = new String(item.substr( idx+9 ));}document.cookie='nm_exref=';}
   if( ref == '' ){ ref=document.referrer;try{ref=top.document.referrer;}catch(e){}}
   var begext=loc2.indexOf('nm_extag='); var ext='';if( begext!=-1){ begext+=9;var endext=loc2.indexOf('&',begext); ext=endext==-1?loc2.substr(begext):loc2.substr(begext,endext-begext); ext=encodeURIComponent(ext);}
   nm_title=encodeURIComponent(nm_title);loc=encodeURIComponent(loc);ref=encodeURIComponent(ref);ext=encodeURIComponent(ext);
   if(nm_title.length>250)nm_title=nm_title.slice(0,246)+'...';if(loc.length>800)loc=loc.slice(0,796)+'...';if(ref.length>800)ref=ref.slice(0,796)+'...';
   var script = document.createElement('SCRIPT');
   script.language = 'javascript';
   script.src = 'http'+(document.location.protocol=='https:'?'s':'')+'://'+cid+'.netminers.dk/tracker/dispatch.aspx?action=log'+'&n='+Math.random()+'&nav='+loc+'&cid='+cid+(ref.length>0?('&ref='+ref):'') +'&ti1='+nm_title+'&ext='+ext;
   document.getElementsByTagName('body')[0].appendChild( script );
   }catch(e){}
}
  function googleAreaMapInitialize(area) {
        var coords = new Array();
        coords["191"] = new Array(45.1667 , 15.5 , 5 ); // Croatia
        coords["250"] = new Array(46 , 2  , 5 ); // France
        coords["300"] = new Array(39 , 22 , 5 );  // Greece
        coords["380"] = new Array(42.8333 , 12.8333 , 5 );  // Italy
        coords["724"] = new Array(40 , -4 , 5);  // Spain
    
        var areacoords = coords[area];

        if (areacoords) {
        var map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(areacoords[0], areacoords[1]), areacoords[2]);
        map.disableDragging();
        
//        var point = new GLatLng(areacoords[0],areacoords[1]);
//        map.addOverlay(new GMarker(point));
     }
    }


/*
  This javascript code runs through all elements with the class 'inputtext' and sets each value to be equal to its title. Text color is set to a light gray.
  When focus is on the element, to default text is removed and the color is set to black.
  When focus on the element is lost, the code checks to see if the element is empty or equal to its title, in which case the text is again set to the title and the color to a light gray.
*/
jQuery(document).ready(function(){
jQuery(".inputtext").focusin(function(){
    if(jQuery(this).val()==jQuery(this).attr("title")){
        jQuery(this).val("");
    }
});
jQuery(".inputtext").focusout(function(){
    if(jQuery(this).val()=="" || jQuery(this).val()==jQuery(this).attr("title")){
        jQuery(this).val(jQuery(this).attr("title"));
        jQuery(this).css("color","#999");
    }
});
jQuery(".inputtext").each(function(){
    jQuery(this).val(jQuery(this).attr("title"));
    jQuery(this).css("color","#999");
});
jQuery(".inputtext").keydown(function(){
    jQuery(this).attr('style','');
});
});
function encodeStr(str) {
var string;
if (encodeURIComponent) {
    string = encodeURIComponent(str);
} else {
    string = escape(str);
}
return string;
}
