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() ;
    jQuery.fn.colorbox({href:s,innerWidth:w,innerHeight:h,iframe:true});
}
function SetIndex( indextext ) 
{
var index;
 if ( navigator.appName == 'Netscape'  ) {
  for ( var i = 0; i < document.getElementById("search").R.options.length; i++ ) {
  if ( indextext == document.getElementById("search").R.options[i].value ) {
   index = i
  }
}
 document.getElementById("search").R.options[index].selected=true;
 } else {
 document.getElementById("search").R.value = indextext;
 }
}
function SetArea( indextext ) 
{
var index;
 if ( navigator.appName == 'Netscape'  ) {
  for ( var i = 0; i < document.getElementById("searchalpine").R.options.length; i++ ) {
  if ( indextext == document.getElementById("searchalpine").R.options[i].value ) {
   index = i
  }
}
 document.getElementById("searchalpine").R.options[index].selected=true;
 } else {
 document.getElementById("searchalpine").R.value = indextext;
 }
}
function SetIndexRS( indextext ) 
{
 var index;
 if ( navigator.appName == 'Netscape'  ) {
  for ( var i = 0; i < document.getElementById("search").RS.options.length; i++ ) {
  if ( indextext == document.getElementById("search").RS.options[i].value ) {
   index = i
  }
 }
 document.getElementById("search").RS.options[index].selected=true;
 } else {
 document.getElementById("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;
}
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 = "/CUE/250.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, adults, season, agency, showit)
{
var url = "http://www.cuendet.fr/p/"+housenumber+"?NA="+adults+"&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 = "/CUE/250.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, adults, season, agency, showit)
{
var url = "/p/"+housenumber+"?NA="+adults+"&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 = "Vous n&#39;avez pas renseigné l&#39;adresse e-mail";
}
 var emailFilter=/^.+@.+..{2,3}$/;
 if (!(emailFilter.test(strng))) {
  error = "Merci de renseigner une adresse e-mail";
 }
 else {
  var illegalChars= /[()<>,;:\"[]]/;
  if (strng.match(illegalChars)) {
   error = "Veuillez indiquer une adresse mail valide.";
  }
 }
return error;
}
function required(which) {
if (which.FN.value=="") {
alert ("S&#39;il vous plaît entrer un nom");
which.FN.focus();
return false;
}
if (which.S.value=="") {
alert ("S&#39;il vous plaît entrez l&#39;adresse");
which.S.focus();
return false;
}
if (which.STN.value=="") {
alert ("S&#39;il vous plaît, entrez un numéro de rue");
which.STN.focus();
return false;
}
if (which.Z.value=="") {
alert ("S&#39;il vous plaît, entrez un numéro de lot");
which.Z.focus();
return false;
}
if (which.ZC.value=="") {
alert ("S&#39;il vous plaît entrez dans la ville");
which.ZC.focus();
return false;
}
if (which.PH.value=="") {
alert ("S&#39;il vous plaît entrer votre numéro de téléphone");
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 ("S&#39;il vous plaît entrer un nom");which.FN.focus();return false;}}
if (sn==1) {if (which.SN.value=="") {alert ("S&#39;il vous plaît entrer un nom");which.SN.focus();return false;}}
if (s==1) {if (which.S.value=="") {alert ("S&#39;il vous plaît entrez l&#39;adresse");which.S.focus();return false;}}
if (stn==1) {if (which.STN.value=="") {alert ("S&#39;il vous plaît, entrez un numéro de rue");which.STN.focus();return false;}}
if (z==1) {if (which.Z.value=="") {alert ("S&#39;il vous plaît, entrez un numéro de lot");which.Z.focus();return false;}}
if (zc==1) {if (which.ZC.value=="") {alert ("S&#39;il vous plaît entrez dans la ville");which.ZC.focus();return false;}}
if (co==1) {if (which.CO[which.CO.selectedIndex].value=='') {alert ("S&#39;il vous plaît sélectionner votre pays");which.CO.focus();return false;}
else {if (which.CO[which.CO.selectedIndex].value=='000' && which.OC.value=='') {alert ("S&#39;il vous plaît entrer dans votre pays");which.OC.focus();return false;}}
if (ph==1) {if (which.PH.value=="") {alert ("S&#39;il vous plaît entrer votre numéro de téléphone");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 ("Où nous avez vous connu?");which.W.focus();return false;}}
return true;
}
function SelectCountry(Country) {
window.location.href = "/CUE/250.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) {
dcsMultiTrack('DCS.dcsuri','/facebooksharer.php?u='+encodeURIComponent(url),'WT.ti','Facebook Share','WT.cg_n','Facebook Share');
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.getElementById("gb_form").gb_email.value=="") { error_message +='Veuillez indiquer une adresse mail valide'; ; }
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById("gb_form").gb_email.value)==false) { error_message += 'Veuillez indiquer une adresse mail valide'; }
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 = '/p/'+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 getArgs() { 
  var args = new Object(); 
  var query = location.search.substring(1); 
  var pairs = query.split("&"); 
  for(var i = 0; i < pairs.length; i++) { 
    var pos = pairs[i].indexOf('='); 
    if (pos == -1) continue; 
    var argname = pairs[i].substring(0,pos); 
    var value = pairs[i].substring(pos+1); 
    args[argname] = unescape(value); 
  } 
  return args; 
}


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="+document.getElementById("loginform").account.value;
                      }
                  }else{
                      setReply("loginreply","Erreur mot de passe ou code agence ","red");
                  }
              }, "text");
              return false;
          }

          function agencySendPassword(){
              $.post("/appserver/BureauWebsite/SendPassword", {"email":$("#email").val(),"COM":"CUE","L":"250","account":$("#account").val()}, function(reply){
                  if(reply=="true"){
                    setReply("sendEmailReply","Votre mail a été envoyé avec succès !","green");
                  }else{
                    setReply("sendEmailReply","Votre mail n&#39;a pas été envoyé. Merci d&#39;essayer une nouvelle fois avec une adresse mail correcte.","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 setOptionByText(v, key) {
 if (v) {
  for (var loop = 0; loop < v.length; loop++) {
   if (v[loop].innerHTML == key) {
    v[loop].selected = true;
   }
  }
 }
}
function chkSelect(f){
  pe=f.NA.options[document.getElementById("search").NA.options.selectedIndex].value;
  if (f.C.type=="hidden") {
    c = f.C.value;
  } else {
    c = f.C.options[document.getElementById("search").C.options.selectedIndex].value;
  }
  if (!pe||!c){
   alert("Merci de choisir la destination et le nombre de personnes.");
   return false;
  }
}

function doSubmit(f) {
 if (cookielist['A']) {
  if (f.A) {   
   f.A.value = cookielist['A'];
  }
 }
  if(f.id == 'search') {
   if(chkSelect(f) == false){
    return;
  }
    if (f.C.type == "select-one") {
      f.action = '/r/'+f.C.options[f.C.options.selectedIndex].value;
    } else {
      f.action = '/r/'+f.C.value;
    }
   f.submit();
  }
  else if (f.id == 'housesearch'){
   go2house(f.house.value, 'CUE');
   return false;
  } else {
    f.submit();
  }
} 
function doAdvSearch() {
    var f = document.getElementById('search');
 if (cookielist['A']) {
  if (f.A) {   
   f.A.value = cookielist['A'];
  }
 }
 if (cookielist['F']) {
  if (f.F) {   
   f.F.value = cookielist['F'];
  }
 }
    if (f.C.type == "select-one")  {
      f.action = '/s/'+f.C.options[f.C.options.selectedIndex].value+'?';
    } else {
      f.action = '/s/'+f.C.value+'?';
    }
 f.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();
 var outd = temp.getDate().toString();
 var outm = eval(temp.getMonth()+1).toString();
 if (outd.length == 1) {
  outd = "0"+outd;
 } 
 if (outm.length == 1) {
  outm = "0"+outm;
 } 
 theform.ED.value = outd + "-" + outm + "-" + 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('/scalendaralpine250?opendocument&dateField='+dateField+'&m='+myMonth+'&y='+myYear+'&formname='+f+'&country='+country)
 } else {
  subcal('/s250cuecalendar?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 setBasicCookie( param, value, e ) {
 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 + "=" + 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 = "/p/"+housenumber+"?S=2012";

   if (cookielist['A']) {
     url = url + "&A="+cookielist['A'];
   }
 location.href = url;
  } else if (housenumber.length == 6 && site=="CUE") {
  var url = "/p/"+housenumber;

   if (cookielist['A']) {
     url = url + "?A="+cookielist['A'];
   }
 location.href = url;
 } else {
  var errDesc = "La référence Novasol est composée de 6 caractères (p.ex.  FCV180)"
  alert(errDesc)
 }
}

function go2result(theform) {
 var houselist = "";
 var housearray = document.getElementsByName("house");

 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 = "La référence Novasol est composée de 6 caractères (p.ex.  FCV180)"
  alert(errDesc)
 } else {
  var url = "/r/";
  url =url + "&SD="+theform.SD.value;
  url =url + "&ED="+theform.ED.value;
  url =url + "&HQ="+houselist;
  url =url + "&RTYPE=HOUSELIST";
  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 = '/p/'+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 setPSC(pscelement, pscstring) {
  var inputstring = "";
  var array = pscstring.split("&");
  for(input in array){
    valueset = array[input].split("=");
    if (valueset.length > 1) {
      inputstring += "<"+"input type='hidden' name='"+valueset[0]+"' value='"+valueset[1]+"' "+"/>";
    } else if (valueset[0]) {
      inputstring += "<"+"input type='hidden' name='"+array[input][0]+"' value='' "+"/>";
    }
  }
  $("#"+pscelement).html(inputstring);
}


    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){
                var map = document.getElementById("houseMap_"+counter);
                var dot = document.getElementById("marker_"+counter);

                if (map) {               
    
    if (coordFormat == "latlng") {
     var latlng = new LatLng(coord2,coord1);
     var umt32 = latlng.toUTM32();     
     coord1 = umt32.easting;
     coord2 = umt32.northing;
    }
    
                var h=new Array(23);
                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,4920000,625000,5540000);
            h.c100=new Array(1874000,4707000,2065000,5169000);
  h.c792=new Array(2004166,3980205,3900575,4799000);
            h.c705=new Array(832314,5001089,1079502,5331560);
            h.c442=new Array(253794,5482965,330329,5572994);
            h.c008=new Array(1304987,4463973,1581288,4807619);
            h.c196=new Array(2624788,4027293,2853176,4375109);



                var 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)-55+"px";
                    topmarker=((geomap_coordinates[3]-coord2)/geocodes_per_pixel_height)-84+"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";
            } // end if
}



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'];

// 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 value and the value is not 'N' we return 1
               if (eval('args.' + parameterArray[i]) == 'N') {
       rsStr = rsStr + '0';
               } else { 
          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||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||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 getDate(AS400date){
  var year = AS400date.substring(0,4);
  var month = new String(new Number(AS400date.substring(4,6))-1);
  var day = AS400date.substring(6,8);
  return new Date(year, month, day);
}

function season(startDate, endDate){
  this.startDate;
  if(startDate=="" || startDate=="00000000"){
    this.startDate=new Date();
  }else{
    this.startDate = getDate(startDate);
  };
  this.endDate = getDate(endDate);
}
var seasonList = new Array();

  
      seasonList["280"]=new season("00000000","20130105");
  
      seasonList["208"]=new season("00000000","20130105");
  
      seasonList["578"]=new season("00000000","20130105");
  
      seasonList["752"]=new season("00000000","20130105");
  
      seasonList["528"]=new season("00000000","20130105");
  
      seasonList["056"]=new season("00000000","20130105");
  
      seasonList["250"]=new season("00000000","20130105");
  
      seasonList["724"]=new season("00000000","20130105");
  
      seasonList["040"]=new season("00000000","20130504");
  
      seasonList["756"]=new season("00000000","20130105");
  
      seasonList["203"]=new season("00000000","20130105");
  
      seasonList["348"]=new season("00000000","20130105");
  
      seasonList["616"]=new season("00000000","20130105");
  
      seasonList["246"]=new season("00000000","20130105");
  
      seasonList["380"]=new season("00000000","20130105");
  
      seasonList["300"]=new season("00000000","20130105");
  
      seasonList["442"]=new season("00000000","20130105");
  
      seasonList["703"]=new season("00000000","20130105");
  
      seasonList["191"]=new season("00000000","20130105");
  
      seasonList["352"]=new season("00000000","20130105");
  
      seasonList["196"]=new season("00000000","20130105");
  
      seasonList["100"]=new season("00000000","20130105");
  
      seasonList["792"]=new season("00000000","20130105");
  
      seasonList["705"]=new season("00000000","20130105");
  
      seasonList["008"]=new season("00000000","20130105");
  
      seasonList["499"]=new season("00000000","20130105");
  
      seasonList["807"]=new season("00000000","20110108");
  


// Set country 000 to contain a season which has the combined lowest startdate and the combined highest enddate of all seasons
seasonList["000"] = new season("00000000","20100114");
seasonList["000"].startDate = seasonList["040"].startDate;
seasonList["000"].endDate = seasonList["040"].endDate;
for(s in seasonList){
  if(seasonList[s].startDate.getTime()<seasonList["000"].startDate.getTime()){
    seasonList["000"].startDate = seasonList[s].startDate;
  }
  if(seasonList[s].endDate.getTime()>seasonList["000"].endDate.getTime()){
    seasonList["000"].endDate= seasonList[s].endDate;
  }
} 


function setCalendars(startID, endID, country){
  jQuery(startID).datepick("destroy");
  jQuery(endID).datepick("destroy");
  var startDate;
  var endDate;
  if(seasonList[country]){
    startDate = seasonList[country].startDate;
    endDate = seasonList[country].endDate;
  }else{
    startDate = new Date();
    endDate = new Date();
    endDate.setMonth(0);
    endDate.setDate(31);
    endDate.setYear(startDate.getFullYear()+1);
  }
  jQuery(startID).datepick({
      onSelect: function(value, date){ 
                   var departureDate = new Date(); 
                   departureDate.setTime(date.getTime()+1000*60*60*24*7+1000*60*60); //we add 7 days and one hour                   
                   jQuery(endID).attr("value",ensureTwoDecimals(departureDate.getDate().toString())+"-"+ensureTwoDecimals((departureDate.getMonth()+1).toString())+"-"+departureDate.getFullYear()); 
      }, 
      dateFormat: 'dd-mm-yy', 
      firstDay: 1, 
      showWeeks: true, 
      // *********** //
        minDate: startDate , 
        maxDate: endDate, 
      // *********** //
      showOn: 'both', 
      buttonImageOnly: true, 
      buttonImage: '/site/CUE/company/_img/calendar.gif',
      buttonText:'Calendrier'
  }); 

  jQuery(endID).datepick({ 
      dateFormat: 'dd-mm-yy', 
      firstDay: 1, 
      showOn: 'both', 
      buttonImageOnly: true, 
      showWeeks: true, 
      // *********** //
        minDate: startDate, 
        maxDate: endDate, 
      // *********** //
      buttonImage: '/site/CUE/company/_img/calendar.gif',
      buttonText:'Calendrier'
  });
}

function ensureTwoDecimals(number){
  while(number.length<2){
    number = "0"+number;
  }
  return number;
}

(function($) {

   $.datepick.regional['040'] = {
      clearText: 'löschen', clearStatus: 'aktuelles Datum löschen',
      closeText: 'schließen', closeStatus: 'ohne Änderungen schließen',
      prevText: '&#x3c;zurück', prevStatus: 'letzten Monat zeigen',
      prevBigText: '&#x3c;&#x3c;', prevBigStatus: '',
      nextText: 'Vor&#x3e;', nextStatus: 'nächsten Monat zeigen',
      nextBigText: '&#x3e;&#x3e;', nextBigStatus: '',
      currentText: 'heute', currentStatus: '',
      monthNames: ['Januar','Februar','März','April','Mai','Juni',
      'Juli','August','September','Oktober','November','Dezember'],
      monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun',
      'Jul','Aug','Sep','Okt','Nov','Dez'],
      monthStatus: 'anderen Monat anzeigen', yearStatus: 'anderes Jahr anzeigen',
      weekHeader: 'Wo', weekStatus: 'Woche des Monats',
      dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
      dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
      dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
      dayStatus: 'Setze DD als ersten Wochentag', dateStatus: 'Wähle D, M d',
      dateFormat: 'dd.mm.yy', firstDay: 1,
      initStatus: 'Wähle ein Datum', isRTL: false,
      showMonthAfterYear: false, yearSuffix: ''};


   $.datepick.regional['056'] = {
          clearText: 'Wissen', clearStatus: 'Wis de huidige datum',
      closeText: 'Sluiten', closeStatus: 'Sluit zonder verandering',
      prevText: '←', prevStatus: 'Bekijk de vorige maand',
      prevBigText: '«', nextBigStatus: 'Bekijk het vorige jaar',
      nextText: '→', nextStatus: 'Bekijk de volgende maand',
      nextBigText: '»', nextBigStatus: 'Bekijk het volgende jaar',
      currentText: 'Vandaag', currentStatus: 'Bekijk de huidige maand',
      monthNames: ['januari', 'februari', 'maart', 'april', 'mei', 'juni',
      'juli', 'augustus', 'september', 'oktober', 'november', 'december'],
      monthNamesShort: ['jan', 'feb', 'maa', 'apr', 'mei', 'jun',
      'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
      monthStatus: 'Bekijk een andere maand', yearStatus: 'Bekijk een ander jaar',
      weekHeader: 'Wk', weekStatus: 'Week van het jaar',
      dayNames: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'],
      dayNamesShort: ['zon', 'maa', 'din', 'woe', 'don', 'vri', 'zat'],
      dayNamesMin: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'],
      dayStatus: 'Stel DD in als eerste dag van de week', dateStatus: 'dd/mm/yy',
      dateFormat: 'dd/mm/yy', firstDay: 1,
      initStatus: 'Kies een datum', isRTL: false,
      showMonthAfterYear: false, yearSuffix: ''};

   $.datepick.regional['191'] = {
      clearText: 'löschen', clearStatus: 'aktuelles Datum löschen',
      closeText: 'schließen', closeStatus: 'ohne Änderungen schließen',
      prevText: '&#x3c;zurück', prevStatus: 'letzten Monat zeigen',
      prevBigText: '&#x3c;&#x3c;', prevBigStatus: '',
      nextText: 'Vor&#x3e;', nextStatus: 'nächsten Monat zeigen',
      nextBigText: '&#x3e;&#x3e;', nextBigStatus: '',
      currentText: 'heute', currentStatus: '',
      monthNames: ['Januar','Februar','März','April','Mai','Juni',
      'Juli','August','September','Oktober','November','Dezember'],
      monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun',
      'Jul','Aug','Sep','Okt','Nov','Dez'],
      monthStatus: 'anderen Monat anzeigen', yearStatus: 'anderes Jahr anzeigen',
      weekHeader: 'Wo', weekStatus: 'Woche des Monats',
      dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
      dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
      dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
      dayStatus: 'Setze DD als ersten Wochentag', dateStatus: 'Wähle D, M d',
      dateFormat: 'dd.mm.yy', firstDay: 1,
      initStatus: 'Wähle ein Datum', isRTL: false,
      showMonthAfterYear: false, yearSuffix: ''};

  $.datepick.regional['203'] = {
      clearText: 'Vymazat', clearStatus: 'Vymaže zadané datum',
      closeText: 'Zavřít',  closeStatus: 'Zavře kalendář beze změny',
      prevText: '&#x3c;Dříve', prevStatus: 'Přejít na předchozí měsí',
      prevBigText: '&#x3c;&#x3c;', prevBigStatus: '',
      nextText: 'Později&#x3e;', nextStatus: 'Přejít na další měsíc',
      nextBigText: '&#x3e;&#x3e;', nextBigStatus: '',
      currentText: 'Nyní', currentStatus: 'Přejde na aktuální měsíc',
      monthNames: ['leden','únor','březen','duben','květen','červen',
        'červenec','srpen','září','říjen','listopad','prosinec'],
      monthNamesShort: ['led','úno','bře','dub','kvě','čer',
      'čvc','srp','zář','říj','lis','pro'],
      monthStatus: 'Přejít na jiný měsíc', yearStatus: 'Přejít na jiný rok',
      weekHeader: 'Týd', weekStatus: 'Týden v roce',
      dayNames: ['neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota'],
      dayNamesShort: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'],
      dayNamesMin: ['ne','po','út','st','čt','pá','so'],
      dayStatus: 'Nastavit DD jako první den v týdnu', dateStatus: '\'Vyber\' DD, M d',
      dateFormat: 'dd.mm.yy', firstDay: 1,
      initStatus: 'Vyberte datum', isRTL: false,
      showMonthAfterYear: false, yearSuffix: ''};


    $.datepick.regional['208'] = {
      clearText: 'Nulstil', clearStatus: 'Nulstil den aktuelle dato',
      closeText: 'Luk', closeStatus: 'Luk uden ændringer',
        prevText: '&#x3c;Forrige', prevStatus: 'Vis forrige måned',
      prevBigText: '&#x3c;&#x3c;', prevBigStatus: '',
      nextText: 'Næste&#x3e;', nextStatus: 'Vis næste måned',
      nextBigText: '&#x3e;&#x3e;', nextBigStatus: '',
      currentText: 'Idag', currentStatus: 'Vis aktuel måned',
        monthNames: ['Januar','Februar','Marts','April','Maj','Juni',
        'Juli','August','September','Oktober','November','December'],
        monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun',
        'Jul','Aug','Sep','Okt','Nov','Dec'],
      monthStatus: 'Vis en anden måned', yearStatus: 'Vis et andet år',
      weekHeader: 'Uge', weekStatus: 'Årets uge',
      dayNames: ['Søndag','Mandag','Tirsdag','Onsdag','Torsdag','Fredag','Lørdag'],
      dayNamesShort: ['Søn','Man','Tir','Ons','Tor','Fre','Lør'],
      dayNamesMin: ['Sø','Ma','Ti','On','To','Fr','Lø'],
      dayStatus: 'Sæt DD som første ugedag', dateStatus: 'Vælg D, M d',
        dateFormat: 'dd-mm-yy', firstDay: 0,
      initStatus: 'Vælg en dato', isRTL: false,
      showMonthAfterYear: false, yearSuffix: ''};


   $.datepick.regional['250'] = {
      clearText: 'Effacer', clearStatus: 'Effacer la date sélectionnée',
      closeText: 'Fermer', closeStatus: 'Fermer sans modifier',
      prevText: '&#x3c;Préc', prevStatus: 'Voir le mois précédent',
      prevBigText: '&#x3c;&#x3c;', prevBigStatus: '',
      nextText: 'Suiv&#x3e;', nextStatus: 'Voir le mois suivant',
      nextBigText: '&#x3e;&#x3e;', nextBigStatus: '',
      currentText: 'Courant', currentStatus: 'Voir le mois courant',
      monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin',
      'Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
      monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun',
      'Jul','Aoû','Sep','Oct','Nov','Déc'],
      monthStatus: 'Voir un autre mois', yearStatus: 'Voir une autre année',
      weekHeader: 'Sm', weekStatus: '',
      dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
      dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
      dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'],
      dayStatus: 'Utiliser DD comme premier jour de la semaine', dateStatus: '\'Choisir\' le DD d MM',
      dateFormat: 'dd/mm/yy', firstDay: 1,
      initStatus: 'Choisir la date', isRTL: false,
      showMonthAfterYear: false, yearSuffix: ''};


   $.datepick.regional['280'] = {
      clearText: 'löschen', clearStatus: 'aktuelles Datum löschen',
      closeText: 'schließen', closeStatus: 'ohne Änderungen schließen',
      prevText: '&#x3c;zurück', prevStatus: 'letzten Monat zeigen',
      prevBigText: '&#x3c;&#x3c;', prevBigStatus: '',
      nextText: 'Vor&#x3e;', nextStatus: 'nächsten Monat zeigen',
      nextBigText: '&#x3e;&#x3e;', nextBigStatus: '',
      currentText: 'heute', currentStatus: '',
      monthNames: ['Januar','Februar','März','April','Mai','Juni',
      'Juli','August','September','Oktober','November','Dezember'],
      monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun',
      'Jul','Aug','Sep','Okt','Nov','Dez'],
      monthStatus: 'anderen Monat anzeigen', yearStatus: 'anderes Jahr anzeigen',
      weekHeader: 'Wo', weekStatus: 'Woche des Monats',
      dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
      dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
      dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
      dayStatus: 'Setze DD als ersten Wochentag', dateStatus: 'Wähle D, M d',
      dateFormat: 'dd.mm.yy', firstDay: 1,
      initStatus: 'Wähle ein Datum', isRTL: false,
      showMonthAfterYear: false, yearSuffix: ''};


   $.datepick.regional['380'] = {
      clearText: 'Svuota', clearStatus: 'Annulla',
      closeText: 'Chiudi', closeStatus: 'Chiudere senza modificare',
      prevText: '&#x3c;Prec', prevStatus: 'Mese precedente',
      prevBigText: '&#x3c;&#x3c;', prevBigStatus: 'Mostra l\'anno precedente',
      nextText: 'Succ&#x3e;', nextStatus: 'Mese successivo',
      nextBigText: '&#x3e;&#x3e;', nextBigStatus: 'Mostra l\'anno successivo',
      currentText: 'Oggi', currentStatus: 'Mese corrente',
      monthNames: ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno',
      'Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'],
      monthNamesShort: ['Gen','Feb','Mar','Apr','Mag','Giu',
      'Lug','Ago','Set','Ott','Nov','Dic'],
      monthStatus: 'Seleziona un altro mese', yearStatus: 'Seleziona un altro anno',
      weekHeader: 'Sm', weekStatus: 'Settimana dell\'anno',
      dayNames: ['Domenica','Lunedì','Martedì','Mercoledì','Giovedì','Venerdì','Sabato'],
      dayNamesShort: ['Dom','Lun','Mar','Mer','Gio','Ven','Sab'],
      dayNamesMin: ['Do','Lu','Ma','Me','Gi','Ve','Sa'],
      dayStatus: 'Usa DD come primo giorno della settimana', dateStatus: '\'Seleziona\' D, M d',
      dateFormat: 'dd/mm/yy', firstDay: 1,
      initStatus: 'Scegliere una data', isRTL: false,
      showMonthAfterYear: false, yearSuffix: ''};


   $.datepick.regional['528'] = {
      clearText: 'Wissen', clearStatus: 'Wis de huidige datum',
      closeText: 'Sluiten', closeStatus: 'Sluit zonder verandering',
      prevText: '←', prevStatus: 'Bekijk de vorige maand',
      prevBigText: '«', nextBigStatus: 'Bekijk het vorige jaar',
      nextText: '→', nextStatus: 'Bekijk de volgende maand',
      nextBigText: '»', nextBigStatus: 'Bekijk het volgende jaar',
      currentText: 'Vandaag', currentStatus: 'Bekijk de huidige maand',
      monthNames: ['januari', 'februari', 'maart', 'april', 'mei', 'juni',
      'juli', 'augustus', 'september', 'oktober', 'november', 'december'],
      monthNamesShort: ['jan', 'feb', 'maa', 'apr', 'mei', 'jun',
      'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
      monthStatus: 'Bekijk een andere maand', yearStatus: 'Bekijk een ander jaar',
      weekHeader: 'Wk', weekStatus: 'Week van het jaar',
      dayNames: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'],
      dayNamesShort: ['zon', 'maa', 'din', 'woe', 'don', 'vri', 'zat'],
      dayNamesMin: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'],
      dayStatus: 'Stel DD in als eerste dag van de week', dateStatus: 'dd/mm/yy',
      dateFormat: 'dd/mm/yy', firstDay: 1,
      initStatus: 'Kies een datum', isRTL: false,
      showMonthAfterYear: false, yearSuffix: ''};


   $.datepick.regional['578'] = {
      clearText: 'T&oslash;m', clearStatus: '',
      closeText: 'Lukk', closeStatus: '',
      prevText: '&laquo;Forrige',  prevStatus: '',
      prevBigText: '&#x3c;&#x3c;', prevBigStatus: '',
      nextText: 'Neste&raquo;', nextStatus: '',
      nextBigText: '&#x3e;&#x3e;', nextBigStatus: '',
      currentText: 'I dag', currentStatus: '',
      monthNames: ['Januar','Februar','Mars','April','Mai','Juni',
      'Juli','August','September','Oktober','November','Desember'],
      monthNamesShort: ['Jan','Feb','Mar','Apr','Mai','Jun',
      'Jul','Aug','Sep','Okt','Nov','Des'],
      monthStatus: '', yearStatus: '',
      weekHeader: 'Uke', weekStatus: '',
      dayNamesShort: ['S&oslash;n','Man','Tir','Ons','Tor','Fre','L&oslash;r'],
      dayNames: ['S&oslash;ndag','Mandag','Tirsdag','Onsdag','Torsdag','Fredag','L&oslash;rdag'],
      dayNamesMin: ['S&oslash;','Ma','Ti','On','To','Fr','L&oslash;'],
      dayStatus: 'DD', dateStatus: 'D, M d',
      dateFormat: 'yy-mm-dd', firstDay: 0,
      initStatus: '', isRTL: false,
      showMonthAfterYear: false, yearSuffix: ''};


   $.datepick.regional['616'] = {
      clearText: 'WyczyÅ›Ä‡', clearStatus: 'WyczyÅ›Ä‡ obecnÄ… datÄ™',
      closeText: 'Zamknij', closeStatus: 'Zamknij bez zapisywania',
      prevText: '&#x3c;Poprzedni', prevStatus: 'PokaÅ¼ poprzedni miesiÄ…c',
      prevBigText: '&#x3c;&#x3c;', prevBigStatus: '',
      nextText: 'NastÄ™pny&#x3e;', nextStatus: 'PokaÅ¼ nastÄ™pny miesiÄ…c',
      nextBigText: '&#x3e;&#x3e;', nextBigStatus: '',
      currentText: 'DziÅ›', currentStatus: 'PokaÅ¼ aktualny miesiÄ…c',
      monthNames: ['StyczeÅ„','Luty','Marzec','KwiecieÅ„','Maj','Czerwiec',
      'Lipiec','SierpieÅ„','WrzesieÅ„','PaÅºdziernik','Listopad','GrudzieÅ„'],
      monthNamesShort: ['Sty','Lu','Mar','Kw','Maj','Cze',
      'Lip','Sie','Wrz','Pa','Lis','Gru'],
      monthStatus: 'PokaÅ¼ inny miesiÄ…c', yearStatus: 'PokaÅ¼ inny rok',
      weekHeader: 'Tydz', weekStatus: 'TydzieÅ„ roku',
      dayNames: ['Niedziela','Poniedzialek','Wtorek','Åšroda','Czwartek','PiÄ…tek','Sobota'],
      dayNamesShort: ['Nie','Pn','Wt','Åšr','Czw','Pt','So'],
      dayNamesMin: ['N','Pn','Wt','Åšr','Cz','Pt','So'],
      dayStatus: 'Ustaw DD jako pierwszy dzieÅ„ tygodnia', dateStatus: '\'Wybierz\' D, M d',
      dateFormat: 'yy-mm-dd', firstDay: 1,
      initStatus: 'Wybierz datÄ™', isRTL: false,
      showMonthAfterYear: false, yearSuffix: ''};


    $.datepick.regional['752'] = {
      clearText: 'Rensa', clearStatus: '',
      closeText: 'Stäng', closeStatus: '',
        prevText: '&laquo;Förra',  prevStatus: '',
      prevBigText: '&#x3c;&#x3c;', prevBigStatus: '',
      nextText: 'Nästa&raquo;', nextStatus: '',
      nextBigText: '&#x3e;&#x3e;', nextBigStatus: '',
      currentText: 'Idag', currentStatus: '',
        monthNames: ['Januari','Februari','Mars','April','Maj','Juni',
        'Juli','Augusti','September','Oktober','November','December'],
        monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun',
        'Jul','Aug','Sep','Okt','Nov','Dec'],
      monthStatus: '', yearStatus: '',
      weekHeader: 'Ve', weekStatus: '',
      dayNames: ['Söndag','Måndag','Tisdag','Onsdag','Torsdag','Fredag','Lördag'],
      dayNamesShort: ['Sön','Mån','Tis','Ons','Tor','Fre','Lör'],
      dayNamesMin: ['Sö','Må','Ti','On','To','Fr','Lö'],
      dayStatus: 'DD', dateStatus: 'D, M d',
        dateFormat: 'yy-mm-dd', firstDay: 1,
      initStatus: '', isRTL: false,
      showMonthAfterYear: false, yearSuffix: ''};


   $.datepick.regional['756'] = {
      clearText: 'löschen', clearStatus: 'aktuelles Datum löschen',
      closeText: 'schließen', closeStatus: 'ohne Änderungen schließen',
      prevText: '&#x3c;zurück', prevStatus: 'letzten Monat zeigen',
      prevBigText: '&#x3c;&#x3c;', prevBigStatus: '',
      nextText: 'Vor&#x3e;', nextStatus: 'nächsten Monat zeigen',
      nextBigText: '&#x3e;&#x3e;', nextBigStatus: '',
      currentText: 'heute', currentStatus: '',
      monthNames: ['Januar','Februar','März','April','Mai','Juni',
      'Juli','August','September','Oktober','November','Dezember'],
      monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun',
      'Jul','Aug','Sep','Okt','Nov','Dez'],
      monthStatus: 'anderen Monat anzeigen', yearStatus: 'anderes Jahr anzeigen',
      weekHeader: 'Wo', weekStatus: 'Woche des Monats',
      dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
      dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
      dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
      dayStatus: 'Setze DD als ersten Wochentag', dateStatus: 'Wähle D, M d',
      dateFormat: 'dd.mm.yy', firstDay: 1,
      initStatus: 'Wähle ein Datum', isRTL: false,
      showMonthAfterYear: false, yearSuffix: ''};


    $.datepick.regional['826'] = {
      clearText: 'Clear', clearStatus: 'Clear the current date',
      closeText: 'Close', closeStatus: 'Close without changes',
        prevText: '&#x3c;Previous', prevStatus: 'Show previous month',
      prevBigText: '&#x3c;&#x3c;', prevBigStatus: '',
      nextText: 'Next&#x3e;', nextStatus: 'Show next month',
      nextBigText: '&#x3e;&#x3e;', nextBigStatus: '',
      currentText: 'Today', currentStatus: 'Show current month',
        monthNames: ['January','February','March','April','May','June',
        'July','August','September','October','November','December'],
        monthNamesShort: ['Jan','Feb','Mar','Apr','May','Jun',
        'Jul','Aug','Sep','Oct','Nov','Dec'],
      monthStatus: 'Show another month', yearStatus: 'Show another year',
      weekHeader: 'Week', weekStatus: 'Week of the year',
      dayNames: ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
      dayNamesShort: ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],
      dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'],
      dayStatus: 'Select DD as first weekday', dateStatus: 'Select D, M d',
        dateFormat: 'dd-mm-yy', firstDay: 0,
      initStatus: 'Select a date', isRTL: false,
      showMonthAfterYear: false, yearSuffix: ''};
    $.datepick.setDefaults($.datepick.regional['826']);

    $.datepick.regional['840'] = {
      clearText: 'Clear', clearStatus: 'Clear the current date',
      closeText: 'Close', closeStatus: 'Close without changes',
        prevText: '&#x3c;Previous', prevStatus: 'Show previous month',
      prevBigText: '&#x3c;&#x3c;', prevBigStatus: '',
      nextText: 'Next&#x3e;', nextStatus: 'Show next month',
      nextBigText: '&#x3e;&#x3e;', nextBigStatus: '',
      currentText: 'Today', currentStatus: 'Show current month',
        monthNames: ['January','February','March','April','May','June',
        'July','August','September','October','November','December'],
        monthNamesShort: ['Jan','Feb','Mar','Apr','May','Jun',
        'Jul','Aug','Sep','Oct','Nov','Dec'],
      monthStatus: 'Show another month', yearStatus: 'Show another year',
      weekHeader: 'Week', weekStatus: 'Week of the year',
      dayNames: ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
      dayNamesShort: ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],
      dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'],
      dayStatus: 'Select DD as first weekday', dateStatus: 'Select D, M d',
        dateFormat: 'dd-mm-yy', firstDay: 0,
      initStatus: 'Select a date', isRTL: false,
      showMonthAfterYear: false, yearSuffix: ''};
    $.datepick.setDefaults($.datepick.regional['826']);


    $.datepick.regional['999'] = {
      clearText: 'Clear', clearStatus: 'Clear the current date',
      closeText: 'Close', closeStatus: 'Close without changes',
        prevText: '&#x3c;Previous', prevStatus: 'Show previous month',
      prevBigText: '&#x3c;&#x3c;', prevBigStatus: '',
      nextText: 'Next&#x3e;', nextStatus: 'Show next month',
      nextBigText: '&#x3e;&#x3e;', nextBigStatus: '',
      currentText: 'Today', currentStatus: 'Show current month',
        monthNames: ['January','February','March','April','May','June',
        'July','August','September','October','November','December'],
        monthNamesShort: ['Jan','Feb','Mar','Apr','May','Jun',
        'Jul','Aug','Sep','Oct','Nov','Dec'],
      monthStatus: 'Show another month', yearStatus: 'Show another year',
      weekHeader: 'Week', weekStatus: 'Week of the year',
      dayNames: ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
      dayNamesShort: ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],
      dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'],
      dayStatus: 'Select DD as first weekday', dateStatus: 'Select D, M d',
        dateFormat: 'dd-mm-yy', firstDay: 0,
      initStatus: 'Select a date', isRTL: false,
      showMonthAfterYear: false, yearSuffix: ''};
    $.datepick.setDefaults($.datepick.regional['826']);


$.datepick.setDefaults($.datepick.regional['250']);
})(jQuery);



function getCountry(ISOCountry){
var isoArray = [];
isoArray['191']='Croatie';isoArray['724']='Espagne';isoArray['250']='France';isoArray['300']='Grèce';isoArray['380']='Italie';

if (isoArray[ISOCountry]) {
  return isoArray[ISOCountry];
} else {
  return "";
}
}
function setSelected(myselect, selected) {
 for (var i=0; i<myselect.options.length; i++){
  if (myselect.options[i].value == selected){   
   myselect.options[i].selected = true;
  }  
 }
}

function generateAreaOptions (countrycode) {
  var select = document.getElementById("search").R;
  select.options.length=1;

  var arealist = new Array();  arealist["191"] = "^Dalmatie centrale|DALMM^- Ile de Brac|CDB^- Ile de Hvar|CDH^- Ile de Vis|CDK^- Ile de Ciovo|CDM1^- Ile de Drvenik Veli|CDM2^- Ile de Drvenik Mali|CDM3^- Makarska|CDM4^- Omis|CDM5^- Split|CDM6^- Trogir|CDM7^- Ile de Solta|CDO^Dalmatie du Nord|DALMN^- Biograd|CDN1^- Nin|CDN2^- Starigrad Paklenica|CDN3^- Vir|CDN4^- Zadar|CDN5^- Ile de Dugi Otok|CDU1^- l'Ile de Rivanj|CDU10^- l'Ile de Krknata|CDU11^- Ile de Ist|CDU2^- Ile de Iz|CDU3^- Ile de Molat|CDU4^- Ile de Pasman|CDU5^- Ile de Rava|CDU6^- Ile de Ugljan|CDU8^- Ile de Zverinac|CDU9^- Drnis|CDV1^- Prvic|CDV10^- Ile de Zirje|CDV11^- Ile Kaprije|CDV2^- Ile Krapanj|CDV3^- Ile Murter|CDV4^- Primosten|CDV5^- Rogoznica|CDV6^- Sibenik|CDV7^- Vodice|CDV8^- Ile Zlarin|CDV9^Dalmatie du Sud|DALMS^- Dubrovnik|CDD^- la Péninsule de Peljesac|CDP^- le Delta de la Neretva|CDR^- Ile de Korcula|CDS^Istrie|ISTRI^- Premantura|CIA^- Banjole|CIB^- Porec|CIE1^- Vrsar|CIE2^- Fazana|CIF1^- Barbariga|CIF2^- Littoral est|CIK^- Rabac|CIK1^- Labin|CIK2^- Krnica|CIK3^- Duga Uvala|CIK4^- Barban|CIL1^- Ucka|CIL10^- Visnjan|CIL11^- Vodnjan|CIL12^- Zminj|CIL13^- Bale|CIL14^- Groznjan|CIL15^- Buje|CIL2^- Buzet|CIL3^- Kanfanar|CIL4^- Motovun|CIL5^- Pazin|CIL6^- Sv. Lovrec|CIL7^- Svetvincenat|CIL8^- Tinjan|CIL9^- Medulin|CIM^- Pula|CIP^- Umag|CIU1^- Novigrad|CIU2^- Rovinj|CIV^- Liznjan|CIZ^la Baie de Kvarner|KVARN^- Gorski Kotar|CKB1^- Lika|CKB2^- Crikvenica Riviera|CKC^- Ile de KrK|CKK^- Ile de Cres|CKL1^- Ile de Losinj|CKL2^- Ile de Ilovik|CKL3^- Ile de Susak|CKL4^- Novi Vinodolski|CKN^- la Riviera Opatija|CKO^- Ile de Pag|CKP^- Ile de Rab|CKR^- Karlobag|CKV1^- Senj|CKV2^- Lacs de Plitvice|CKV3";   arealist["724"] = "^Îles Canaries|CANAR^- Fuerteventura|EFU^- Gran Canaria|EGR^- El Hierro|EHI^- Lanzarote|ELA^- Palma|EPA^- Teneriffe|ETE^Majorque|EML^ESPAGNE CONTINENTALE|ESPAN^- Costa del Sol/Andalousie|EAN^- Costa Blanca|EBL^- Costa Brava|ECB^- Costa Calida|ECC^- Costa Dorada|EDO";   arealist["250"] = "^AQUITAINE|FAQUI^- Dordogne|FAD^- Gironde|FAG^- les Landes|FAL^- les Pyrénées Atlantiques|FAP^- le Lot et Garonne|FAT^Bretagne|FBR^- Côtes d´Armor|FBC^- le Finistére|FBF^- Ille et Vilaine|FBI^- le Morbihan|FBM^le Centre-Loire|FCELO^- Indre|FEC^- Indre-et-Loire|FEI^CÔTE D`AZUR|FCOTE^- les Alpes Maritimes|FCA^- Cannes|FCA1^- Var|FCV^Alsace & Lorraine|FELSA^- Bas-Rhin|FDB^- Haut-Rhin|FDH^- Meuse|FTE^- Vosges|FTV^CORSE|FKORS^- Corse|FKO^Languedoc-Roussillon|FLANG^- Aude|FLA^- Gard|FLG^- Hérault|FLH^- Pyrénées Orientales|FLP^Normandie|FNORM^- Calvados|FNC^- Manche|FNM^- Orne|FNO^- Seine Maritime|FNS^Les pays de la Loire|FPAYS^- Loire Atlantique|FBL^- Mayenne|FVA^- Vendée|FVE^- Maine-et-Loire|FVM^- Sarthe|FVS^Poitou-Charentes|FPOIT^- Charente Maritime|FCH^PROVENCE-DRÔME-ARDÈCHE|FPROV^- Alpes de haute Provence|FPA^- Bouches du Rhône|FPB^- Drôme|FPD^- |FPS^- Vaucluse|FPV^- Ardèche|FRA^MIDI-PYRÉNÉES|FPYRE^- Ariège|FMA^- Gers|FMG^- Lot|FML^- Tarn-et-Garonne|FMN^- Hautes-Pyrénées|FMP^- Tarn|FMT^Alpes Françaises|FRHON^- Savoie|FRS";   arealist["300"] = "^|GCY^ILES GRECQUES|GISLA^- Corfou|GCF^- Chios|GCH^- Kos|GDK^- Hydra|GHY^- Crète|GKR^- Lesbos|GLE^GRÈCE CONTINENTALE|GMAIN^- Athènes|GAT^- Chalkidiki|GHA^- Peloponèse|GPE^- Pelion|GPI^les Cyclades|KYKLA^- Kea|GKK^- Paros|GKP^- Syros|GKS";   arealist["380"] = "^VALLÉE D'AOSTE|IAOST^Région de Basilicata|IBASI^- Côte Ionienne|IBJ^- Côte Tyrrhénienne|IBT^Région d'Émilie-Romagne|IEMIL^- Arrière-pays d'Émilie-Romagne|IEC^- Côte d'Emilie-Romagne|IEK^FRIOUL|IFRIA^- Frioul - Campagne|IFC^- Frioul - Côte Adriatique|IFK^CALABRE|IKALA^- Calabre|IKK^CAMPANIE|IKAMP^- Côte Amalfitaine|IKA^- Cilento/Salerno|IKC^- Gaeta et Baia|IKG^- Campanie arrière-pays|IKL^- Naples|IKN^- Côte de Sorrente|IKS^LATIUM|ILATI^- la Côte du Latium|IRK^- Rome|IRO^- la Campagne du Latium|IRU^Ligurie|ILIGU^- Ligurie|ILL^Marches|IMARK^- Marches|IMK^- Arrière pays des Marches|IMM^LES LACS DU NORD|INORD^- Lac de Lugano|ILO^- Lac de Garde|IVG^- le Lac de Côme|IVL^- Lac Majeur|IVM^- Lac d'Orta|IVO^PIÉMONT|IPIEM^- Piémont|IPL^POUILLES|IPUGL^- Pouilles|ISA^SARDAIGNE|ISARD^- Sardaigne|ISD^SICILE|ISIZI^- Sicile|ISS^Toscane|ITOSC^- Arezzo/Cortona et environs|ITA^- Florence|ITB^- Chianti|ITC^- Florence et ses environs|ITF^- Grosseto et ses environs|ITG^- Lucques et ses environs|ITL^- San Gimignano et Volterra|ITN^- Pise et ses environs|ITP^- Sienne et ses environs|ITS^- Montecatini/Pistoia et environs|ITT^Toscane littorale|ITOSK^- Île d'Elbe|ITE^- Côte des Etrusques|ITK^- Argentario/Maremma|ITM^- Versilia|ITV^Région de l'Ombrie|IUMBR^- Pérouse et ses environs|IUP^- Spoleto et ses environs|IUS^- Lac Trasimène|IUT^VENETIE|IVE^- l'Arrière-pays vénitien|IVC^- La côte vénitienne|IVK^- Venise|IVV";   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;
}


