

function gtEl(id) {
  return document.getElementById(id);
}

function SaveSearch() {
  saver = '';
  dd=document.PSForm.xcheckind.value;
  saver += (dd<10)?'0'+dd:dd;
  saver += '-';
  mm=document.PSForm.xcheckinm.value;
  saver += (mm<10)?'0'+mm:mm;
  saver += '-';
  yy=document.PSForm.xcheckiny.value;
  saver += (yy==0)?'0000':yy;
  saver += '-';
  dd=document.PSForm.xcheckoutd.value;
  saver += (dd<10)?'0'+dd:dd;
  saver += '-';
  mm=document.PSForm.xcheckoutm.value;
  saver += (mm<10)?'0'+mm:mm;
  saver += '-';
  yy=document.PSForm.xcheckouty.value;
  saver += (yy==0)?'0000':yy;
  saver += '-';
  gg=document.PSForm.xnumberguests.value;
  saver += (gg<10)?'0'+gg:gg;
  saver += '-';
  rr=document.PSForm.xnumberrooms.value;
  saver += (rr<10)?'0'+rr:rr;
  saver += '-';
  if (document.PSForm.xonlyinst && document.PSForm.xonlyinst.checked) {
  	saver += '1-';
  } else {
  	saver += '0-';
  }
  geosaver = '';
  geocount = document.PSForm.xgeocount.value;
  for (i=0;i<geocount;i++) {
  	j = document.PSForm.elements['xgv'+i];
  	if (j.checked) {
      k = j.value;
      if (geosaver != '') {
        geosaver += ',';
      }
      geosaver += k;
  	}
  }
  saver += geosaver;
  saver += '-';
  geosaver = '';
  if (document.PSForm.xgv99999999) {
  	if (document.PSForm.xgv99999999.checked) {
  	  geosaver += '1,';
  	  geosaver += document.PSForm.xgeocombo.options[document.PSForm.xgeocombo.selectedIndex].value;
  	} else {
  	  geosaver += '0,0';
  	}
  } else {
  	geosaver += '0,0';
  }
  saver += geosaver;
  saver += '-';
  typsaver = '';
  typcount = document.PSForm.xtypcount.value;
  for (i=0;i<typcount;i++) {
  	j = document.PSForm.elements['xtv'+i];
  	k = j.value;
  	if (j.checked) {
      if (typsaver != '') {
        typsaver += ',';
      }
      typsaver += k + ',' + l;
    }
  }
  saver += typsaver;
  saver += '-';
  icosaver = '';
  icocount = document.PSForm.xicocount.value;
  for (i=0;i<icocount;i++) {
  	j = document.PSForm.elements['xiv'+i];
  	k = j.value;
  	if (j.checked) {
      if (icosaver != '') {
        icosaver += ',';
      }
      icosaver += k + ',' + l;
    }
  }
  saver += icosaver;
  saver += '-';
  attsaver = '';
  attcount = document.PSForm.xattcount.value;
  for (i=0;i<attcount;i++) {
  	j = document.PSForm.elements['xav'+i];
  	k = j.value;
  	if (j.checked) {
      if (attsaver != '') {
        attsaver += ',';
      }
      attsaver += k + ',' + l;
    }
  }
  saver += attsaver;
  saver += '-';
  if ((document.getElementById('showhide6').className=='searchengine searchenginev') || (document.getElementById('showhide6').className=='searchenginev')) {
  	saver += '0';
  } else {
  	saver += '1';
  }
  
  saver += '-';
  gg=document.PSForm.xnumberkids.value;
  saver += (gg<10)?'0'+gg:gg;
  saver += '-';
  if (gg > 0) {
    for (z=1; z<=gg; z++) {
      if (z > 1) saver += ',';
      saver += document.PSForm.elements['xchildage'+z].value;
    }
  }

  setCookie(saver);
}

function LoadSearch() {
  dataset = getCookie();
  if (dataset == '') {
  	return false;
  }
  mydata = dataset.split('-');

  document.PSForm.xcheckind.value = mydata[0]-0;
  document.PSForm.xcheckinm.value = mydata[1]-0;
  document.PSForm.xcheckiny.value = mydata[2]-0;
  document.PSForm.xcheckoutd.value = mydata[3]-0;
  document.PSForm.xcheckoutm.value = mydata[4]-0;
  document.PSForm.xcheckouty.value = mydata[5]-0;
  document.PSForm.xnumberguests.value = mydata[6]-0;
  document.PSForm.xnumberrooms.value = mydata[7]-0;
  if (mydata[8] == 0) {
  	if (document.PSForm.xonlyinst) document.PSForm.xonlyinst.checked = false;
  	if (document.PSForm.xonlyinstdummy) document.PSForm.xonlyinstdummy.checked = true;
  } else {
  	if (document.PSForm.xonlyinst) document.PSForm.xonlyinst.checked = true;
  	if (document.PSForm.xonlyinstdummy) document.PSForm.xonlyinstdummy.checked = false;
  }
  didcheck = 0;
  showlocs = 0;
  sp = mydata[9].split(',');
  geocount = document.PSForm.xgeocount.value;
  for (i=0;i<geocount;i++) {
  	j = document.PSForm.elements['xgv'+i];
  	k = false;
  	for (l=0;l<sp.length;l++) {
  	  if (sp[l] == j.value) {
  	  	k = true;
        didcheck = 1;
		if (document.PSForm.elements['xgvany'+i].value == 0) showlocs = 1;
  	  }
  	}
  	j.checked = k;
  }
  if (document.PSForm.xgv99999999) {
    document.PSForm.xgv99999999.checked = false;
    document.PSForm.xgeocombo.value = 0;
  }
  if (didcheck == 0) {
    sp = mydata[10].split(',');
    for (i=0;i<geocount;i++) {
      j = document.PSForm.elements['xgv'+i];
      if (sp[1] == j.value) {
      	j.checked = true;
      	didcheck = 1;
		if (document.PSForm.elements['xgvany'+i].value == 0) showlocs = 1;
      }
    }
    if (didcheck == 0) {
      if (document.PSForm.xgv99999999) {
        if (sp[0] == 0) {
          document.PSForm.xgv99999999.checked = false;
          document.PSForm.xgeocombo.value = 0;
        } else {
          document.PSForm.xgeocombo.value = sp[1];
          if (sp[1] != '' && document.PSForm.xgeocombo.value == sp[1]) {
		    document.PSForm.xgv99999999.checked = true;
		    showlocs = 1;
		  } else if (569 != 0) {
            document.PSForm.xgeocombo.value = 569;
		  }
        }
      }
    }
  }
  if (showlocs == 1 && document.getElementById('tab11')) {
    document.getElementById('tab11').className='searchenginev';
  }
  sp = mydata[11].split(',');
  typcount = document.PSForm.xtypcount.value;
  for (i=0;i<typcount;i++) {
  	j = document.PSForm.elements['xtv'+i];
  	k = false;
  	for (l=0;l<sp.length;l++) {
  	  if (sp[l] == j.value) {
  	  	k = true;
  	  }
  	}
  	j.checked = k;
  }
  sp = mydata[12].split(',');
  icocount = document.PSForm.xicocount.value;
  for (i=0;i<icocount;i++) {
  	j = document.PSForm.elements['xiv'+i];
  	k = false;
  	for (l=0;l<sp.length;l++) {
  	  if (sp[l] == j.value) {
  	  	k = true;
  	  }
  	}
  	j.checked = k;
  }
  sp = mydata[13].split(',');
  attcount = document.PSForm.xattcount.value;
  for (i=0;i<attcount;i++) {
  	j = document.PSForm.elements['xav'+i];
  	k = false;
  	for (l=0;l<sp.length;l++) {
  	  if (sp[l] == j.value) {
  	  	k = true;
  	  }
  	}
  	j.checked = k;
  }
  if (mydata[14] == 0) {
    document.getElementById('showhide6').className='searchenginev';
    document.getElementById('showhide7').className='searchenginei';
    document.getElementById('showhide8').className='searchenginei';
    if (document.PSForm.xattcount.value != 0) {
      document.getElementById('showhide9').className='searchenginei';
    }
    document.getElementById('showhide10').className='searchenginei';
  } else {
    document.getElementById('showhide6').className='searchenginei';
	document.getElementById('tab6').className='searchenginev';
	document.getElementById('tab2').className='searchenginev';
    document.getElementById('showhide7').className='searchenginev';
    document.getElementById('showhide8').className='searchenginev';
    if (document.PSForm.xattcount.value != 0) {
      document.getElementById('showhide9').className='searchenginev';
    }
    document.getElementById('showhide10').className='searchenginev';
  }
  
  document.PSForm.xnumberkids.value = mydata[15]-0;
  
  var kids = mydata[15]-0; var kidiv = document.getElementById('kidiv'); if (kids > 0) {kidivhtml = unescape('%3Cfont%20face%3D%22arial%22%20size%3D%222%22%3E%3Cb%3E') + 'Âge des enfants: ' + unescape('%3C/b%3E%3C/font%3E'); for (z=1; z<=kids; z++) {kidivhtml += unescape('%3Cfont%20face%3D%22%27courier%20new%27%22%20size%3D%222%22%3E%3Cselect%20class%3D%22stylexnumberguests%22%20name%3D%22xchildage') + z + unescape('%22%20size%3D%221%22%3E%3Coption%20value%3D%22%22%20selected%3E%26nbsp%3B%3F%3C/option%3E%3Coption%20value%3D%220%22%3E%26lt%3B1%3C/option%3E%3Coption%20value%3D%221%22%3E1%3C/option%3E%3Coption%20value%3D%222%22%3E2%3C/option%3E%3Coption%20value%3D%223%22%3E3%3C/option%3E%3Coption%20value%3D%224%22%3E4%3C/option%3E%3Coption%20value%3D%225%22%3E5%3C/option%3E%3Coption%20value%3D%226%22%3E6%3C/option%3E%3Coption%20value%3D%227%22%3E7%3C/option%3E%3Coption%20value%3D%228%22%3E8%3C/option%3E%3Coption%20value%3D%229%22%3E9%3C/option%3E%3Coption%20value%3D%2210%22%3E10%3C/option%3E%3Coption%20value%3D%2211%22%3E11%3C/option%3E%3Coption%20value%3D%2212%22%3E12%3C/option%3E%3Coption%20value%3D%2213%22%3E13%3C/option%3E%3Coption%20value%3D%2214%22%3E14%3C/option%3E%3Coption%20value%3D%2215%22%3E15%3C/option%3E%3Coption%20value%3D%2216%22%3E16%3C/option%3E%3Coption%20value%3D%2217%22%3E17%3C/option%3E%3C/select%3E%20%3C/font%3E%20')} kidiv.innerHTML = kidivhtml; kidiv.style.display = 'block';} else {kidiv.style.display = 'none'; kidiv.innerHTML = '';}
  
  if (kids > 0) {
    sp = mydata[16].split(',');
    for (z=1; z<=kids; z++) {
      if (sp[z-1] >= '0') document.PSForm.elements['xchildage'+z].value = sp[z-1];
    }
  }

  
  var PSF = document.PSForm;
  if (PSF && PSF.xcheckiny && window.setCheckinValues) {
    setCheckinValues(PSF.xcheckiny.value, PSF.xcheckinm.value, PSF.xcheckind.value);
    setCheckoutValues(PSF.xcheckouty.value, PSF.xcheckoutm.value, PSF.xcheckoutd.value);
  }
  
  return true;
}

function setCookie(value) {
  cookie = 'GGINOPOW=' + escape(value);
  today=new Date();
  expire=new Date(); 
  expire.setTime(today.getTime() + 28*24*60*60*1000);
  cookie += ";expires=" + expire.toGMTString() + ";path=/";
  document.cookie = cookie;
}

function getCookie(name) {
  cookie = document.cookie 
  result = '';
  if(cookie.length > 0) {
    offset = cookie.indexOf('GGINOPOW=');
    if (offset != -1) {
      offset += 9;
      end = cookie.indexOf(";",offset);
      if (end == -1) {
        end = cookie.length;
      }
      result = unescape(cookie.substring(offset,end));
    } 
  }
  return result;
}

setd = [1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31];
setm = [1,'jan',2,'fév',3,'mar',4,'avr',5,'mai',6,'juin',7,'juil',8,'aoû',9,'sep',10,'oct',11,'nov',12,'déc'];
sety = [2010,'10',2011,'11',2012,'12',2013,'13',2014,'14'];
setr = [1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8];
setg = [1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,16,'16+'];
setz = [569,'Toutes les Zones de Amsterdam',570,'A - Binnenstad',917,'Hoofddorp / Schiphol',577,'N - Amsterdam-Noord',583,'V - Amsterdam Oud-Zuid'];
function FillComboZ() {
  i = document.PSForm.xgeocombo;
  for (j=i.length; j>0; j--) {
    i.options[j] = null;
  }
  for (i=0;i<setz.length;i+=2) {
    j = setz[i+1];
    k = '';
    while (j.substr(0,6) == '&nbsp;') {
      j = j.substr(6);
      k += String.fromCharCode(160);
    }
    l = k+j;
    qqq = document.PSForm.xgeocombo;
    ooo = new Option(l,setz[i+0]);
    qqq.options[qqq.length] = ooo;
  }
}
function FillComboD() {
  i = document.PSForm.xcheckind;
  for (j=i.length; j>0; j--) {
    i.options[j] = null;
  }
  i = document.PSForm.xcheckoutd;
  for (j=i.length; j>0; j--) {
    i.options[j] = null;
  }
  for (i=0;i<setd.length;i+=2) {
    qqq = document.PSForm.xcheckind;
    ooo = new Option(setd[i+1],setd[i+0]);
    qqq.options[qqq.length] = ooo;
    qqq = document.PSForm.xcheckoutd;
    ooo = new Option(setd[i+1],setd[i+0]);
    qqq.options[qqq.length] = ooo;
  }
}
function FillComboM() {
  i = document.PSForm.xcheckinm;
  for (j=i.length; j>0; j--) {
    i.options[j] = null;
  }
  i = document.PSForm.xcheckoutm;
  for (j=i.length; j>0; j--) {
    i.options[j] = null;
  }
  for (i=0;i<setm.length;i+=2) {
    qqq = document.PSForm.xcheckinm;
    ooo = new Option(setm[i+1],setm[i+0]);
    qqq.options[qqq.length] = ooo;
    qqq = document.PSForm.xcheckoutm;
    ooo = new Option(setm[i+1],setm[i+0]);
    qqq.options[qqq.length] = ooo;
  }
}
function FillComboY() {
  i = document.PSForm.xcheckiny;
  for (j=i.length; j>0; j--) {
    i.options[j] = null;
  }
  i = document.PSForm.xcheckouty;
  for (j=i.length; j>0; j--) {
    i.options[j] = null;
  }
  for (i=0;i<sety.length;i+=2) {
    qqq = document.PSForm.xcheckiny;
    ooo = new Option(sety[i+1],sety[i+0]);
    qqq.options[qqq.length] = ooo;
    qqq = document.PSForm.xcheckouty;
    ooo = new Option(sety[i+1],sety[i+0]);
    qqq.options[qqq.length] = ooo;
  }
}
function FillComboR() {
  i = document.PSForm.xnumberrooms;
  for (j=i.length; j>0; j--) {
    i.options[j] = null;
  }
  for (i=0;i<setr.length;i+=2) {
    qqq = document.PSForm.xnumberrooms;
    ooo = new Option(setr[i+1],setr[i+0]);
    qqq.options[qqq.length] = ooo;
  }
}
function FillComboG() {
  i = document.PSForm.xnumberguests;
  for (j=i.length; j>0; j--) {
    i.options[j] = null;
  }
  for (i=0;i<setg.length;i+=2) {
    qqq = document.PSForm.xnumberguests;
    ooo = new Option(setg[i+1],setg[i+0]);
    qqq.options[qqq.length] = ooo;
  }
}

function DoRadioCombo(idx) {
  i = document.PSForm.xgeocount.value;
  if (idx == 100000000) {
    for (j=0;j<i;j++) {
      document.PSForm.elements['xgv'+j].checked = false;
    }
    document.PSForm.xgv99999999.checked = true;
  }
  if (idx == 99999999) {
    for (j=0;j<i;j++) {
      document.PSForm.elements['xgv'+j].checked = false;
    }
    document.PSForm.xgv99999999.checked = true;
    document.PSForm.xgeocombo.value = 0;
//    document.PSForm.xgeocombo.disabled = false;
  }
  if (idx < 99999999) {
    if (document.PSForm.elements['xgv'+idx].checked == true) {
      if (document.PSForm.elements['xgvany'+idx].value == 1) {
        for (j=0;j<i;j++) {
          if (document.PSForm.elements['xgvany'+j].value == 0) {
            document.PSForm.elements['xgv'+j].checked = false;
          }
        }
      } else {
        for (j=0;j<i;j++) {
          if (document.PSForm.elements['xgvany'+j].value == 1) {
            document.PSForm.elements['xgv'+j].checked = false;
          }
        }
      }
      if (document.PSForm.xgeocombo) {
        document.PSForm.xgv99999999.checked = false;
        document.PSForm.xgeocombo.value = 0;
//        document.PSForm.xgeocombo.disabled = true;
      }
    }
  }
}

function uncheckBoxes() {
  for (i=0;i<document.PSForm.xtypcount.value;i++) {
  	document.PSForm.elements['xtv'+i].checked = false;
  }
  for (i=0;i<document.PSForm.xicocount.value;i++) {
  	document.PSForm.elements['xiv'+i].checked = false;
  }
}

function TabShowHide(cls1,cls2) {
  uncheckBoxes();
  gtEl('tab1').className=cls1;
  gtEl('tab2').className=cls2;
  //gtEl('tab3').className=cls2;
  gtEl('showhide8').className=cls2;
  gtEl('tab6').className=cls2;
  if (gtEl('tab11') && (cls2 == 'searchenginei' || gtEl('maintab1').className == 'searchenginev')) {
    gtEl('tab11').className=cls2;
  }
}

function DoAdvanced() {
  TabShowHide('searchenginei','searchenginev');
  
  for (i=0;i<document.PSForm.xtypcount.value;i++) {
  	document.PSForm.elements['xtv'+i].checked = false;
  }
  for (i=0;i<document.PSForm.xicocount.value;i++) {
  	document.PSForm.elements['xiv'+i].checked = false;
  }
  for (i=0;i<document.PSForm.xattcount.value;i++) {
  	document.PSForm.elements['xav'+i].checked = false;
  }
  document.getElementById('showhide6').className='searchenginei';
  document.getElementById('showhide7').className='searchenginev';
  document.getElementById('showhide8').className='searchenginev';
  if (document.PSForm.xattcount.value != 0) {
    document.getElementById('showhide9').className='searchenginev';
  }
  document.getElementById('showhide10').className='searchenginev';

  if (document.getElementById('dingus').className == 'searchenginev') {
  //dingus move ...
    button='buttonb';
    buttonx = 0;
    buttony = 0;
    temp = document.getElementById(button);
    while (temp) {
      tempuc = temp.tagName.toUpperCase();
      buttonx += temp.offsetLeft;
      buttony += temp.offsetTop;
      if (tempuc == 'BODY') {
        break;
      }
      temp = temp.offsetParent;
    }
    document.getElementById('dingus').style.left = (buttonx-10)+'px';
    document.getElementById('dingus').style.top = (buttony-47)+'px';
    document.getElementById('dingus').className = 'searchenginev';
  }

}
function DoSimple() {
  TabShowHide('searchenginev','searchenginei');
  
  for (i=0;i<document.PSForm.xtypcount.value;i++) {
  	document.PSForm.elements['xtv'+i].checked = false;
  }
  for (i=0;i<document.PSForm.xicocount.value;i++) {
  	document.PSForm.elements['xiv'+i].checked = false;
  }
  for (i=0;i<document.PSForm.xattcount.value;i++) {
  	document.PSForm.elements['xav'+i].checked = false;
  }
  document.getElementById('showhide6').className='searchenginev';
  document.getElementById('showhide7').className='searchenginei';
  document.getElementById('showhide8').className='searchenginei';
  if (document.PSForm.xattcount.value != 0) {
    document.getElementById('showhide9').className='searchenginei';
  }
  document.getElementById('showhide10').className='searchenginei';

  if (document.getElementById('dingus').className == 'searchenginev') {
  //dingus move ...
    button='buttona';
    buttonx = 0;
    buttony = 0;
    temp = document.getElementById(button);
    while (temp) {
      tempuc = temp.tagName.toUpperCase();
      buttonx += temp.offsetLeft;
      buttony += temp.offsetTop;
      if (tempuc == 'BODY') {
        break;
      }
      temp = temp.offsetParent;
    }
    document.getElementById('dingus').style.left = (buttonx-10)+'px';
    document.getElementById('dingus').style.top = (buttony-47)+'px';
    document.getElementById('dingus').className = 'searchenginev';
  }
  window.scroll(0,0);
}
function DoPopWhatsThis() {
  url = 'http://www.hotelsby.fr/amsterdam/indexpowerwhatsthis/';
  
  window.open(url,'_blank','width=500,height=600,directories=0,location=0,menubar=0,scrollbars=1,status=0,toolbar=0,resizable=0');
}
function DoAllInst(idx) {
  if (idx == 0 && document.PSForm.xonlyinst && document.PSForm.xonlyinstdummy) {
  	if (document.PSForm.xonlyinstdummy.checked == true) {
      document.PSForm.xonlyinst.checked = false;
    } else {
  	  if (document.PSForm.xonlyinst.checked == false) {
        document.PSForm.xonlyinstdummy.checked = true;
      }
    }
  }
  if (idx == 1 && document.PSForm.xonlyinst && document.PSForm.xonlyinstdummy) {
  	if (document.PSForm.xonlyinst.checked == true) {
      document.PSForm.xonlyinstdummy.checked = false;
    } else {
  	  if (document.PSForm.xonlyinstdummy.checked == false) {
        document.PSForm.xonlyinst.checked = true;
      }
    }
  }
}  		

wbcajax1preload = new Image(20,20);
wbcajax2preload = new Image(20,20);
wbcajax3preload = new Image(20,20);
wbcajax4preload = new Image(20,20);
wbcajax5preload = new Image(20,20);


function PresetDates() {
      if (document.PSForm.xgeocombo) {
        FillComboZ();
      }
      //FillComboD();
      //FillComboM();
      //FillComboY();
      FillComboG(); //somethign here is messed up
      FillComboR(); //somethign here is messed up

     wbcanipreload.src = 'http://img.hotelsby.fr/amsterdam/images/loading_image_ok2.gif';
     wbcbackpreload.src = 'http://img.hotelsby.fr/amsterdam/images/loading_shadow.gif';
     wbcajax1preload.src = 'http://img.hotelsby.fr/amsterdam/images/shared/magnify.gif';
     wbcajax2preload.src = 'http://img.hotelsby.fr/amsterdam/images/shared/searching.gif';
     wbcajax3preload.src = 'http://img.hotelsby.fr/amsterdam/images/shared/searchacc.gif';
     wbcajax4preload.src = 'http://img.hotelsby.fr/amsterdam/images/shared/searchgeo.gif';
     wbcajax5preload.src = 'http://img.hotelsby.fr/amsterdam/images/shared/noresults.gif';
	  
    if (LoadSearch() == false) {
      if (document.PSForm.xgeocombo) {
        if (569 != 0) {
          document.PSForm.xgeocombo.value = 569;
        }
      }
      d = new Date(new Date().valueOf()+(6652800000));
      d1 = d.getDate();
      d2 = d.getMonth();
      d3 = d.getFullYear();
      //document.PSForm.xcheckind.value = d1;
      //document.PSForm.xcheckinm.value = d2+1;
      //document.PSForm.xcheckiny.value = d3;
      d = new Date(new Date().valueOf()+ (6998400000));
      d1 = d.getDate();
      d2 = d.getMonth();
      d3 = d.getFullYear();
      //document.PSForm.xcheckoutd.value = d1;
      //document.PSForm.xcheckoutm.value = d2+1;
      //document.PSForm.xcheckouty.value = d3;
      document.PSForm.xnumberguests.value = 2;
      document.PSForm.xnumberrooms.value = 1;
    }
	DoCreateDynaStuff();
    DoMainTab1();
}
	

function DoCreateDynaStuff() {
dynstuff = '';
dynstuff += '<table width="450" border="0" cellpadding="0" cellspacing="0" id="maintab2" class="searchengine searchenginei">';
dynstuff += '<tr><td width="450" bgcolor="" align="left" valign="middle">';
dynstuff += '<font face="arial" size="2" color="#000000"><b>Recherche destination ou nom:<\/b><\/font>';
dynstuff += '<\/td><\/tr><tr><td width="450" bgcolor="" align="left" valign="middle" style="padding-bottom:6px">';
dynstuff += '<table cellspacing="0" cellpadding="0" border="0"><tr><td>';
dynstuff += '<table width="436" cellspacing="0" cellpadding="2" border="0">';
dynstuff += '<tr><td bgcolor="#FFFFFF" width="436" align="left" valign="middle" style="border: solid #395C39 1px">';
dynstuff += '<table width="436" cellspacing="0" cellpadding="0" border="0"><tr>';
dynstuff += '<td width="24" align="center"><img id="ajaximage1" src="http://www.hotelsby.fr/amsterdam/images/shared/magnify.gif" width="20" height="20"><\/td>';
dynstuff += '<td width="410"><input style="width:410px;border-width:0px" autocomplete="off" type="text" name="ajaxsearch1" id="ajaxsearch1" size="80" maxlength="80"><\/td>';
dynstuff += '<\/tr><\/table><\/td><\/tr><\/table><\/td><\/tr><tr><td>';
dynstuff += '<div id="ajaxlist1" style="width:440px;height:206px;position:absolute;display:none;z-index:100">';
dynstuff += '<table width="436" cellspacing="0" cellpadding="2" border="0"><tr>';
dynstuff += '<td bgcolor="#FFFFFF" width="436" align="left" valign="top" style="border: solid #395C39 1px">';
dynstuff += '<div style="height:200px; width:436px; overflow:auto; border:0px" id="ajaxinternal1"><\/div>';
dynstuff += '<\/td><\/tr><\/table><\/div>';
dynstuff += '<iframe style="position:absolute;top:0px;left:0px;display:none" id="ajaxlist2" src="javascript:void(0)" scrolling="no" frameborder="0"><\/iframe>';
dynstuff += '<\/td><\/tr><\/table><\/td><\/tr><\/table>';
dynstuff += '<input type="hidden" name="ajaxtype" value="0"><input type="hidden" name="ajaxaccid" value="0"><input type="hidden" name="ajaxgeoid" value="0">';
gtEl('dynastuffb').innerHTML = dynstuff;
//set event handlers ...
bar = {};
bar.onkeydown = function(event) { Auto_Keydown(event); };
bar.onkeyup = function(event) { Auto_Keyup(event); };
bar.onclick = function(event) { Auto_Click(); };
gtEl('ajaxsearch1').onkeydown = bar.onkeydown;
gtEl('ajaxsearch1').onkeyup = bar.onkeyup;
gtEl('ajaxsearch1').onclick = bar.onclick;
dynstuff = '';
dynstuff += '<table width="450" border="0" cellpadding="0" cellspacing="0" id="maintab3" class="searchengine searchenginei">';
dynstuff += '<tr><td width="450" bgcolor="" align="left" valign="middle">';
dynstuff += '<font face="arial" size="2" color="#000000"><b>Adresse ou Point d\'Intérêt:<\/b><\/font>';
dynstuff += '<\/td><\/tr><tr><td width="450" bgcolor="" align="left" valign="middle" style="padding-bottom:7px">';
dynstuff += '<table width="100%" bgcolor="#FFFFFF" cellspacing="0" cellpadding="2" border="0" style="border: solid #395C39 1px"><tr><td width="1"><img src="http://www.hotelsby.fr/amsterdam/images/1v.gif" width="1" height="20"><\/td><td align="left" valign="middle">';
dynstuff += '<input type="hidden" name="gmapcoords" value="">';
dynstuff += '<input type="hidden" name="gmapsearchuser" value="">';
dynstuff += '<input type="text" name="gmapsearch" value="" style="width: 100%;border-width:0px" onclick="gmlist_hide()">';
dynstuff += '<\/td><\/tr><\/table>';
dynstuff += '<iframe id="gmapaddrfr" style="position:absolute;width:442px;height:0px;z-index:100" src="javascript:void(0)" scrolling="no" frameborder="0"><\/iframe>';
dynstuff += '<div id="gmapaddr" style="position:absolute;z-index:150"><\/div>';
dynstuff += '<\/td><\/tr><\/table>';
gtEl('dynastuffc').innerHTML = dynstuff;

}

function DoMainTab1() {
  gtEl('maintab1').className='searchenginev';
  if (gtEl('maintab2')) {
    gtEl('maintab2').className='searchenginei';
  }
  if (gtEl('maintab3')) {
    gtEl('maintab3').className='searchenginei';
  }
  if (gtEl('tab11')) {
    if (gtEl('tab6').className == 'searchenginev') {
	  gtEl('tab11').className='searchenginev';
    }
	//if (gtEl('showhide7').style.backgroundColor != '#FFF4E6') {
    //  gtEl('showhide7').style.backgroundColor = '#FFF4E6';
    //}
  }
}
function DoMainTab2() {
  gtEl('maintab1').className='searchenginei';
  if (gtEl('maintab3')) {
    gtEl('maintab3').className='searchenginei';
  }
  if (gtEl('maintab2')) {
    gtEl('maintab2').className='searchenginev';
	document.PSForm.ajaxsearch1.focus();
  }
  if (gtEl('tab11')) {
    gtEl('tab11').className='searchenginei';
	//if (gtEl('showhide7').style.backgroundColor != '#FFE9BC') {
    //  gtEl('showhide7').style.backgroundColor = '#FFE9BC';
    //}
  }
}
function DoMainTab3() {
  gtEl('maintab1').className='searchenginei';
  if (gtEl('maintab2')) {
    gtEl('maintab2').className='searchenginei';
  }
  if (gtEl('maintab3')) {
    gtEl('maintab3').className='searchenginev';
	document.PSForm.gmapsearch.focus();
  }
  if (gtEl('tab11')) {
    gtEl('tab11').className='searchenginei';
	//if (gtEl('showhide7').style.backgroundColor != '#FFE9BC') {
    //  gtEl('showhide7').style.backgroundColor = '#FFE9BC';
    //}
  }
}

function TabHtml(i,is_active) {
  var tab_names = new Array("","Recherche&nbsp;d\'Hôtel","Recherche&nbsp;par&nbsp;nom","Recherche&nbsp;par&nbsp;carte");
  if (is_active) {
    var tw = (i == 2) ? 143 : 138; //parent-12
	
	return '<table border="0" cellpadding="0" cellspacing="0"><tr style="height:20px"><td width="6" bgcolor="#F6AB4F" valign="top" align="left"><img src="http://img.hotelsby.fr/amsterdam/wideimages/searchengine_corner_left.gif" width="6" height="6" alt=""><br><img src="http://www.amsterdamby.com/images/1v.gif" width="1" height="20" alt=""><\/td><td width="' + tw + '" bgcolor="#F6AB4F" valign="middle" align="center"><font face="arial" size="3" color="#000000"><b>' + tab_names[i] + '<\/b><\/font><\/td><td width="6" bgcolor="#F6AB4F" valign="top" align="right"><img src="http://img.hotelsby.fr/amsterdam/wideimages/searchengine_corner_right.gif" width="6" height="6" alt=""><\/td><\/tr><\/table>';
  } else {
    return '<font face="arial" size="3" color="#000000"><a href="#" onclick="DoSwitchTab('+i+');return false;">' + tab_names[i] + '<\/a><\/font>';
  }
}

function DoSwitchTab(active_id) {
  for (i=1;i<=3;i++) {
    var tobj = gtEl('dynatab'+i);
	if (tobj) {
	  if (active_id == i) {
        tobj.innerHTML = TabHtml(i,1);
      } else {
        tobj.innerHTML = TabHtml(i,0);
      }
    }
  }
  if (active_id == 1) DoMainTab1();
  if (active_id == 2) DoMainTab2();
  if (active_id == 3) DoMainTab3();
  //if (window.choosedate) window.choosedate.HideMe();
  return false;
}

function gmlist_hide() {
	gtEl('gmapaddr').innerHTML = '';
	gtEl('gmapaddrfr').style.height = '0px';
}

function DoSearchPower(gmap) {
  var CVF = document.PSForm;
  
  if (!gmap && CVF.gmapcoords) CVF.gmapcoords.value = '';


  maintab = 0;
  if (gtEl('maintab1').className!='searchenginei') {
    maintab = 1;
  }
  if (gtEl('maintab2')) {
  if (gtEl('maintab2').className!='searchenginei') {
    maintab = 2;
  }
  }
  if (gtEl('maintab3')) {
  if (gtEl('maintab3').className!='searchenginei') {
    maintab = 3;
  }
  }
  CVF.maintab.value = maintab;
  
  if (gtEl('showhide6').className!='searchenginei') {
    uncheckBoxes();
  }

  if ((document.getElementById('showhide6').className=='searchengine searchenginev') || (document.getElementById('showhide6').className=='searchenginev')) {
    for (i=0;i<document.PSForm.xtypcount.value;i++) {
  	  document.PSForm.elements['xtv'+i].checked = false;
    }
    for (i=0;i<document.PSForm.xicocount.value;i++) {
  	  document.PSForm.elements['xiv'+i].checked = false;
    }
    for (i=0;i<document.PSForm.xattcount.value;i++) {
  	  document.PSForm.elements['xav'+i].checked = false;
    }
  }

  l = 0;
  for (i=0;i<document.PSForm.xgeocount.value;i++) {
    if (document.PSForm.elements['xgv'+i].checked == true) {
      l = 1;
    }
  }
  if (l == 0 && maintab != 2 && maintab != 3) {
    if (document.PSForm.xgeocombo) {
      i = document.PSForm.xgeocombo;
  	  if (i.options[i.selectedIndex].value == 0) {
  	    alert('Le Lieu est un champ obligatoire');
        i.focus();
        return;
      }
    } else {
      alert('Le Lieu est un champ obligatoire');
      document.PSForm.xgv0.focus();
      return;
    }
  }

  
  i = document.PSForm.cb_sd;
  j = i.options[i.selectedIndex].value;
  if (j == 0) {
    alert ('Le Jour d\'Arrivée est un champ obligatoire');
    i.focus();
    return;
  }

  i = document.PSForm.cb_smy;
  j = i.options[i.selectedIndex].value;
  var smy = j.split("/");
  if (smy[0] == 0) {
    alert ('Le Mois d\'Arrivée est un champ obligatoire');
    i.focus();
    return;
  }

  if (smy[1] == 0) {
    alert ('L\'Année d\'Arrivée est un champ obligatoire');
    i.focus();
    return;
  }

  iid = document.PSForm.cb_sd;
  jjd = iid.options[iid.selectedIndex].value;
  jjm = smy[0];
  jjy = smy[1];
	
  
  if ((jjm == 1) || (jjm == 3) || (jjm == 5) || (jjm == 7) || (jjm == 8) || (jjm == 10) || (jjm == 12)) {
    jjdm = 31;
  }
  if ((jjm == 4) || (jjm == 6) || (jjm == 9) || (jjm == 11)) {
    jjdm = 30;
  }
  if (jjm == 2) {
    jjdm = 28;
    if ((jjy % 4) == 0) {
      jjdm = 29;
      if ((jjy % 100) == 0) {
        jjdm = 28;
        if ((jjy % 400) == 0) {
          jjdm = 29;
        }
      }
    }
  }
  if (jjd > jjdm) {
    alert('La Date d\'Arrivée doit être une date valable');
    iid.focus();
    return;
  }
  xx1 = new Date(jjy,jjm-1,jjd,0,0,0);

  xx3 = new Date(2010,2,11,0,0,0);
  if (xx1 < xx3) {
  	alert('La Date d\'Arrivée doit être au moins aujourd\'hui');
    return;
  }

  
  i = document.PSForm.cb_ed;
  j = i.options[i.selectedIndex].value;
  if (j == 0) {
    alert ('Le Jour de Départ est un champ obligatoire');
    i.focus();
    return;
  }

  i = document.PSForm.cb_emy;
  j = i.options[i.selectedIndex].value;
  var emy = j.split("/");
  if (emy[0] == 0) {
    alert ('Le Mois de Départ est un champ obligatoire');
    i.focus();
    return;
  }

  if (emy[1] == 0) {
    alert ('L\'Année de Départ est un champ obligatoire');
    i.focus();
    return;
  }

  iid = document.PSForm.cb_ed;
  jjd = iid.options[iid.selectedIndex].value;
  jjm = emy[0];
  jjy = emy[1];
	
  
  if ((jjm == 1) || (jjm == 3) || (jjm == 5) || (jjm == 7) || (jjm == 8) || (jjm == 10) || (jjm == 12)) {
    jjdm = 31;
  }
  if ((jjm == 4) || (jjm == 6) || (jjm == 9) || (jjm == 11)) {
    jjdm = 30;
  }
  if (jjm == 2) {
    jjdm = 28;
    if ((jjy % 4) == 0) {
      jjdm = 29;
      if ((jjy % 100) == 0) {
        jjdm = 28;
        if ((jjy % 400) == 0) {
          jjdm = 29;
        }
      }
    }
  }
  if (jjd > jjdm) {
    alert('La Date de Départ doit être une date valable');
    iid.focus();
    return;
  }
  xx2 = new Date(jjy,jjm-1,jjd,0,0,0);

  xx4 = new Date(2010,2,12,0,0,0);
  if (xx2 < xx4) {
  	alert('La Date de Départ doit être au moins demain');
    return;
  }

  
  jjmm = jjm;
	

  if (xx2 <= xx1) {
  	alert('La Date de Départ doit être postérieure à celle d\'Arrivée');
    return;
  }

  xx3 = new Date(2010,2,11,0,0,0);
  dd3 = (xx1 - xx3)/86400000;
  dd3 = Math.round(dd3);

  if (dd3 <= 2) {
    brk = String.fromCharCode(13)+String.fromCharCode(10);
    if(confirm('AVERTISSEMENT SEJOUR DERNIERE MINUTE'+brk+brk+'Voulez-vous vraiment faire le check in dans les 2 jours à venir?') == false) {
      return;
    }
  }

  dd3 = (xx2 - xx1)/86400000;
  dd3 = Math.round(dd3);
  
  if (dd3 >= 21) {
    brk = String.fromCharCode(13)+String.fromCharCode(10);
    if(confirm('AVERTISSEMENT SEJOUR LONG'+brk+brk+'Etes-vous sûr de vouloir demander un séjour de '+dd3+' jours ?') == false) {
      return;
    }
  }

  xx3 = new Date(2012,2,11,0,0,0);
  if ((xx1 >= xx3) || (xx2 > xx3)) {
    var question1 = 'Etes-vous sûr de vouloir chercher pour [LINK] ?';
    var question = question1.replace(/\[LINK\]/, jjmm+' '+jjy);
    if (question == question1) question += ' '+jjmm+' '+jjy+' ?';
	
	if (confirm(question) == false) {
      return;
    }
  }

  
  document.PSForm.xcheckind.value = document.PSForm.cb_sd.value-0;
  document.PSForm.xcheckinm.value = smy[0]-0;
  document.PSForm.xcheckiny.value = smy[1]-0;
  document.PSForm.xcheckoutd.value = document.PSForm.cb_ed.value-0;
  document.PSForm.xcheckoutm.value = emy[0]-0;
  document.PSForm.xcheckouty.value = emy[1]-0;
	
  
  i = document.PSForm.xnumberguests;
  j = i.options[i.selectedIndex].value;
  if (j == 0) {
    alert ('Nb. de Personnes est un champ obligatoire');
    i.focus();
    return;
  }
  
  i = document.PSForm.xnumberkids;
  if (i) {
  j = i.options[i.selectedIndex].value;
  if (j > 0) {
    for (i=1; i<=j; i++) {
      z = document.PSForm.elements['xchildage'+i];
	  if (z && z.options[z.selectedIndex].value >= '0') {
	  } else {
	    alert ('Child '+i+' Age is a required field');
        z.focus();
        return;
      }
	}
  }
  }

  i = document.PSForm.xnumberrooms;
  j = i.options[i.selectedIndex].value;
  if (j == 0) {
    alert ('Nb. de Chambres est un champ obligatoire');
    i.focus();
    return;
  }

  i1 = document.PSForm.xnumberguests;
  j1 = i1.options[i1.selectedIndex].value;
  i2 = document.PSForm.xnumberrooms;
  j2 = i2.options[i2.selectedIndex].value;
  j1 -=0;
  j2 -=0;
  if (j1 < j2) {
    alert ('Le nombre d\'Hôtes ne peut être inférieur aux nombre de Chambres.');
    document.PSForm.xnumberguests.focus();
    return;
  }

  cbr = '';
  parurl = document.location.href;
  check1 = parurl.indexOf('serv.cgi?xcbr=');
  if (check1 != -1) {
    cbr = parurl.substr(check1+14,3);
  }
  document.PSForm.xcbr.value = cbr;

  if (maintab == 2 && document.PSForm.ajaxtype.value == 0) {
    alert('Le Lieu est un champ obligatoire');
    return;
  }
  
  if (maintab == 3) {
    if (!gmap) {
		var gmsearch = CVF.gmapsearch.value;
		
		if (!gmsearch) {
		  alert('Le Lieu est un champ obligatoire');
		  return;
		}
		
		if (gmsearch && !gmsearch.match(/Amsterdam/i)) gmsearch += ', Amsterdam';
        var xmlHttp;
		try { // Firefox, Opera 8.0+, Safari
			xmlHttp=new XMLHttpRequest();
		}
		catch (e) { // Internet Explorer
			try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e) {
				try {
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e) {
					alert("Your browser does not support AJAX!");
					return false;
				}
			}
		}
		
		xmlHttp.onreadystatechange = function() {
			if (xmlHttp.readyState!=4) return false;
			var xmlResponse = xmlHttp.responseText;
			var answ = eval("("+xmlHttp.responseText+")");

////////////////
			var addh = '';
			var coords = '';
			var addr = '';
			var pointcnt = 0;
			if (answ.Placemark) {
				for (i=0;i<answ.Placemark.length;i++) {
					var pnt = answ.Placemark[i].Point.coordinates;
					if (pnt[1] > 0 && pnt[0] < 40 && pnt[0] > -40) {
					 pointcnt++;
					 coords = '('+pnt[1]+', '+pnt[0]+')';
					 addr = answ.Placemark[i].address;
					 var addr_esc = addr.replace(/\\/g, '\\\\');
					 addr_esc = addr_esc.replace(/'/g, "\\'");
					 addh += '<font size="2" face="Arial"><a href="#" onclick="document.PSForm.gmapcoords.value=\''+coords+'\';document.PSForm.gmapsearchuser.value=document.PSForm.gmapsearch.value;document.PSForm.gmapsearch.value=\''+addr_esc+'\';DoSearchPower(\'gmap\');gmlist_hide();return false;">';
					 addh += (addr.length <= 70) ? addr : addr.substr(0,66)+'...';
					 addh += '<\/a><\/font><br>';
					}
				}
			}
			if (addh) {
				addh = '<table width="442" bgcolor="#FFFFFF" cellspacing="0" cellpadding="4" border="0" style="border: solid #660033 1px"><tr><td>'+addh+'<\/td><\/tr><\/table>';
			} else {
				alert(" Adresse non trouvé...");
			}
			if (pointcnt > 1) {
			  gtEl('gmapaddr').innerHTML = addh;
			  gtEl('gmapaddrfr').style.height = gtEl('gmapaddr').offsetHeight + 'px';
			} else if (coords) {
			  CVF.gmapcoords.value = coords;
			  CVF.gmapsearchuser.value = CVF.gmapsearch.value;
			  CVF.gmapsearch.value = addr;
              DoSearchPower('gmap');
			}
////////////////
			
		}
		
		xmlHttp.open("GET","/cgi/geoaddr.cgi?wid=9&a="+gmsearch,true);
		xmlHttp.send(null);

		return;
    }

  }
  
  SaveSearch();

//dingus show ...
  button='buttona';
  if (document.getElementById('showhide6').className=='searchenginei') {
    button='buttonb';
  }
  buttonx = 0;
  buttony = 0;
  temp = document.getElementById(button);
  while (temp) {
    tempuc = temp.tagName.toUpperCase();
    buttonx += temp.offsetLeft;
    buttony += temp.offsetTop;
    if (tempuc == 'BODY') {
      break;
    }
    temp = temp.offsetParent;
  }
  document.getElementById('dingus').style.left = (buttonx-10)+'px';
  document.getElementById('dingus').style.top = (buttony-47)+'px';
  document.getElementById('dingus').className = 'searchenginev';
  document.PSForm.submit();
  document.getElementById('wbcani').src = wbcanipreload.src;

}

// ajax stuff ...

var xmlRun = false;
var xmlObj = null;
we_use_safari = 0;
if (navigator.userAgent.indexOf('Safari') != -1) {
  we_use_safari = 1;
}

function AJAXSearch(search,show,ajnum_this) {
  if (ajnum_this && ajnum_this < ajnum) {
    return;
  }
  search = search.replace(/\s\s*$/, '');
  if (search == ajlast) {
    return;
  }
  if (xmlRun == true) {
    xmlObj.abort();
    xmlRun = false;
  }
  if (search.length < 3) {
    List_Hide();
    List_Clear();
    currindext = 0;
    currindexg = 0;
    currindexa = 0;
    currindexi = -1;
    currindexm = 0;
    gtEl('ajaximage1').src = wbcajax1preload.src;
    return;
  }
  
  ajlast = search;
  
  if(window.XMLHttpRequest){
    xmlObj = new XMLHttpRequest();
  } else if(window.ActiveXObject){
    xmlObj = new ActiveXObject("Msxml2.XMLHTTP");
  } else {
    alert('Sorry, cannot search - no AJAX support on this browser !');
    return;
  }
  var url = 'http://www.hotelsby.fr/amsterdam/cgi/intajaxsearch1.cgi?webid=9&lanid=3&search='+search+'&nocache'+new Date().getTime();
  xmlObj.onreadystatechange = function() {
    if(xmlObj.readyState == 4){
      gtEl('ajaximage1').src = wbcajax1preload.src;
      var status = 0;
      try {
        if(xmlObj.status !== undefined && xmlObj.status != 0){
          status = xmlObj.status;
        } else{
          status = 9999;
        }
      }
      catch(e){
        status = 9999;
      }
      if (status == '200') {
        var res = xmlObj.responseText;
        if (res == '') {
          List_Hide();
          List_Clear();
          currindext = 0;
          currindexg = 0;
          currindexa = 0;
          currindexi = -1;
          currindexm = 0;
          if (search != '') {
            gtEl('ajaximage1').src = wbcajax5preload.src;
          }
        } else {
          List_Clear();
          List_Fill(res,show);
        }
      }
    }
  }
  xmlObj.open('GET',url,true);
  xmlObj.send('');
  xmlRun = true;
  gtEl('ajaximage1').src = wbcajax2preload.src;
}

function List_Clear() {
  gtEl('ajaxinternal1').innerHTML = '';
}

currindext = 0;
currindexg = 0;
currindexa = 0;
currindexq = '';
currindexi = -1;
currindexm = 0;

function List_Fill(data,show) {
  var o = data.split(';;');

  var didlight = 0;

  currindexm = (o.length/5);
  if (currindexm > 8) { //total height is 200, and 200/24 = 8
  	tabwid = 274;
  	tab2wid = 120;
    overwid = 418;
  } else {
  	tabwid = 292;
  	tab2wid = 120;
  	overwid = 436;
  }

  dh = '';
  dh += '<table width="'+overwid+'" border="0" cellpadding="0" cellspacing="0">';
  for (var i=0;i<o.length;i+=5) {
  	var j = (i/5);
	var parent = '';
	if ((o[i+0] == 2 || o[i+0] == 3 || o[i+0] == 9) && o[i+3].match(/ \(([^\)]*)\)$/)) {
		parent = RegExp.$1;
		o[i+3] = o[i+3].replace(/ \([^\)]*\)$/, '');
	}
	var name_esc = o[i+3].replace(/\\/g, '\\\\');
	name_esc = name_esc.replace(/'/g, "\\'");
	name_esc = name_esc.replace(/"/g, '&quot;');
    dh += '<input type="hidden" id="ajaxlistitemd'+j+'" value="'+o[i+0]+';;'+o[i+1]+';;'+o[i+2]+';;'+o[i+3]+'">';
    dh += '<tr style="height:24px">';
    dh += '<td id="ajaxlistitema'+j+'" width="24" align="left" valign="middle"';
	if ((o[i+0] == currindext) && (o[i+1] == currindexg) && (o[i+2] == currindexa)) {
      dh += ' bgcolor="#FFE9BC"';
      didlight = 1;
      currindexi = j;
    }
	dh += '>';
    if (o[i+0] == 0) {
        dh += '&nbsp;';
    } else {
      if (o[i+0] == 1) {
          dh += '<img src="http://www.hotelsby.fr/amsterdam/images/shared/searchacc.gif" width="20" height="20">';
      } else {
    	  dh += '<img src="http://www.hotelsby.fr/amsterdam/images/shared/searchgeo.gif" width="20" height="20">';
      }
    }
    dh += '<\/td>';
	dh += '<td id="ajaxlistitemb'+j+'" width="'+tabwid+'" align="left" valign="middle"';
    if ((o[i+0] == currindext) && (o[i+1] == currindexg) && (o[i+2] == currindexa)) {
      dh += ' bgcolor="#FFE9BC"';
    }
	if (o[i+0] == 0 && o[i+4] == '') {
	  dh += ' colspan="2"';
	}
	dh += '>';
    if (o[i+0] > 0) {
	  dh += '<a id="ajaxlistitemc'+j+'" class="';
      if ((o[i+0] == currindext) && (o[i+1] == currindexg) && (o[i+2] == currindexa)) {
        dh += 'link3d';
      } else {
        dh += 'link3';
      }
	  dh += '" href="javascript:DoChoose('+o[i+0]+','+o[i+1]+','+o[i+2]+',\''+name_esc+'\');">';
    }
    dh += '<font size="2" face="Verdana">';
    if (o[i+0] > 0) {
      dh += '<u>';
    }
    dh += o[i+3];
    if (o[i+0] > 0) {
      dh += '<\/u>';
    }
    dh += '<\/font>';
    if (o[i+0] > 0) {
      dh += '<\/a>';
    }
    if (parent) {
      dh += '<font size="1" face="Verdana"> (<nobr>' + parent + '<\/nobr>)<\/font>';
    }
    dh += '<\/td>';
	if (o[i+0] == 0 && o[i+4] == '') {
	} else {
	  dh += '<td id="ajaxlistiteme'+j+'" width="'+tab2wid+'" align="left" valign="middle"';
      if ((o[i+0] == currindext) && (o[i+1] == currindexg) && (o[i+2] == currindexa)) {
        dh += ' bgcolor="#FFE9BC"';
      }
	  dh += '>';
      dh += '<font size="1" face="Verdana" color="#000000">';
      if (o[i+4] == '') {
        dh += '&nbsp;';
      } else {
        dh += o[i+4];
      }
      dh += '<\/font>';
      dh += '<\/td>';
	}
    dh += '<\/tr>';
  }
  dh += '<\/table>';
  gtEl('ajaxinternal1').innerHTML = dh;

  if (didlight == 0) {
    currindext = 0;
    currindexg = 0;
    currindexa = 0;
    currindexq = '';
    currindexi = -1;
  }

  if (show == 1) {
    List_Show();
  }

}

function List_Show() {
  var l = gtEl('ajaxlist1');
  var s = gtEl('ajaxlist2');
  l.style.display = 'block';
  s.style.width = l.style.width;
  s.style.height = l.style.height;
  s.style.left = l.style.left;
  s.style.top = l.style.top;
  s.style.zIndex = l.style.zIndex - 1;
  s.style.display = 'block';
}

function List_Hide() {
  var l = gtEl('ajaxlist1');
  var s = gtEl('ajaxlist2');
  l.style.display = 'none';
  s.style.display = 'none';
  ajlast = '';
}

function Auto_Click() {
  var n = gtEl('ajaxsearch1');
  n.value = '';
  AJAXSearch(n.value,0);
  gtEl('ajaximage1').src = wbcajax1preload.src;
  document.PSForm.ajaxtype.value = 0;
  document.PSForm.ajaxaccid.value = 0;
  document.PSForm.ajaxgeoid.value = 0;
}

moving = 0;

arrowup = 0;
arrowdown = 0;
ajnum = 0;
ajlast = '';

function Auto_Keyup(evt) {
  var code = 0;
  evt = (evt) ? evt : ((event) ? event : null);
  var evver = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null );
  code = evt.keyCode;
  if (code == 38) {
    arrowup = 0;
  }
  if (code == 40) {
    arrowdown = 0;
  }
}

function ajBg(el,bg) {
  if (gtEl(el)) {
    gtEl(el).style.backgroundColor=bg;
  }
}

function Auto_Keydown(evt) {
  var l = gtEl('ajaxlist1');
  var code = 0;
  evt = (evt) ? evt : ((event) ? event : null);
  var evver = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null );
  code = evt.keyCode;
  if (moving == 1) {
    return;
  }
  if ((code == 17 && evt.ctrlKey) || (code == 18 && evt.altKey) || code == 37 || code == 39) return;
  moving = 1;
  if (code == 38) {
    if (we_use_safari) return;
	arrowup = 1;
    while (arrowup == 1) {
    if (l.style.display == 'none') {
      moving = 0;
      return;
    }
    if (currindexi != -1) {
      if (currindexi > 0) {
        ajBg('ajaxlistitema'+currindexi,'#FFFFFF');
		ajBg('ajaxlistiteme'+currindexi,'#FFFFFF');
        ajBg('ajaxlistitemb'+currindexi,'#FFFFFF');
        if (gtEl('ajaxlistitemc'+currindexi)) {
          gtEl('ajaxlistitemc'+currindexi).className='link3';
        }
        currindexi--;
        ajBg('ajaxlistitema'+currindexi,'#FFE9BC');
		ajBg('ajaxlistiteme'+currindexi,'#FFE9BC');
        ajBg('ajaxlistitemb'+currindexi,'#FFE9BC');
        if (gtEl('ajaxlistitemc'+currindexi)) {
          gtEl('ajaxlistitemc'+currindexi).className='link3d';
        }
        gtEl('ajaxinternal1').scrollTop = (currindexi*24);
        var dataset = gtEl('ajaxlistitemd'+currindexi).value;
        var dataitems = dataset.split(';;');
        currindext = dataitems[0];
        currindexa = dataitems[1];
        currindexg = dataitems[2];
        currindexq = dataitems[3];
      }        
    } else {
      if (currindexm > 0) {
      	currindexi = currindexm-1;
        ajBg('ajaxlistitema'+currindexi,'#FFE9BC');
		ajBg('ajaxlistiteme'+currindexi,'#FFE9BC');
        ajBg('ajaxlistitemb'+currindexi,'#FFE9BC');
        if (gtEl('ajaxlistitemc'+currindexi)) {
          gtEl('ajaxlistitemc'+currindexi).className='link3d';
        }
        gtEl('ajaxinternal1').scrollTop = (currindexi*24);
        var dataset = gtEl('ajaxlistitemd'+currindexi).value;
        var dataitems = dataset.split(';;');
        currindext = dataitems[0];
        currindexa = dataitems[1];
        currindexg = dataitems[2];
        currindexq = dataitems[3];
      }      		
    }
    moving = 0;
  	return;
  }
  }
  if (code == 40) {
    if (we_use_safari) return;
	arrowdown = 1;
    while (arrowdown == 1) {
    if (l.style.display == 'none') {
      moving = 0;
      return;
    }
    if (currindexi != -1) {
      if (currindexi < (currindexm-1)) {
        ajBg('ajaxlistitema'+currindexi,'#FFFFFF');
		ajBg('ajaxlistiteme'+currindexi,'#FFFFFF');
        ajBg('ajaxlistitemb'+currindexi,'#FFFFFF');
        if (gtEl('ajaxlistitemc'+currindexi)) {
          gtEl('ajaxlistitemc'+currindexi).className='link3';
        }
        currindexi++;
        ajBg('ajaxlistitema'+currindexi,'#FFE9BC');
		ajBg('ajaxlistiteme'+currindexi,'#FFE9BC');
        ajBg('ajaxlistitemb'+currindexi,'#FFE9BC');
        if (gtEl('ajaxlistitemc'+currindexi)) {
          gtEl('ajaxlistitemc'+currindexi).className='link3d';
        }
        gtEl('ajaxinternal1').scrollTop = (currindexi*24);
        var dataset = gtEl('ajaxlistitemd'+currindexi).value;
        var dataitems = dataset.split(';;');
        currindext = dataitems[0];
        currindexa = dataitems[1];
        currindexg = dataitems[2];
        currindexq = dataitems[3];
      }        
    } else {
      if (currindexm > 0) {
      	currindexi = 0;
        ajBg('ajaxlistitema'+currindexi,'#FFE9BC');
		ajBg('ajaxlistiteme'+currindexi,'#FFE9BC');
        ajBg('ajaxlistitemb'+currindexi,'#FFE9BC');
        if (gtEl('ajaxlistitemc'+currindexi)) {
          gtEl('ajaxlistitemc'+currindexi).className='link3d';
        }
        gtEl('ajaxinternal1').scrollTop = (currindexi*24);
        var dataset = gtEl('ajaxlistitemd'+currindexi).value;
        var dataitems = dataset.split(';;');
        currindext = dataitems[0];
        currindexa = dataitems[1];
        currindexg = dataitems[2];
        currindexq = dataitems[3];
      }      		
    }
    moving = 0;
  	return;
  }
  }
  if (code == 13) {
    if (l.style.display == 'none') {
      moving = 0;
      return;
    }
    if (currindexi != -1) {
      if (currindext != 0) {
        document.PSForm.ajaxtype.value = currindext;
        document.PSForm.ajaxaccid.value = currindexa;
        document.PSForm.ajaxgeoid.value = currindexg;
        var n = gtEl('ajaxsearch1');
        n.value = currindexq;
        if (currindext == 1) {
          gtEl('ajaximage1').src = wbcajax3preload.src;
        } else {
          gtEl('ajaximage1').src = wbcajax4preload.src;
        }
        List_Hide();
      }
    }
    moving = 0;
    return;
  }
  if (we_use_safari) {
    AJAXSearch(gtEl('ajaxsearch1').value,1);
  } else {
    ajnum++;
    setTimeout("AJAXSearch(gtEl('ajaxsearch1').value,1,"+ajnum+")",500);
  }
  moving = 0;
}

function DoChoose(par1,par2,par3,par4) {
  document.PSForm.ajaxtype.value = par1;
  document.PSForm.ajaxaccid.value = par2;
  document.PSForm.ajaxgeoid.value = par3;
  var n = gtEl('ajaxsearch1');
  n.value = par4;
  if (par1 == 1) {
    gtEl('ajaximage1').src = wbcajax3preload.src;
  } else {
    gtEl('ajaximage1').src = wbcajax4preload.src;
  }
  List_Hide();
}
