
var totalRooms=1;var totalAdults=4;var totalChilds=3;var numRooms=1;refresh();function setChildAge(room,child,age){if(varR_childAgesPerRoom[room]==null){varR_childAgesPerRoom[room]=new Array();}
varR_childAgesPerRoom[room][child]=age;setEdades(room);}
function setEdades(room){var R_EDADES='';for(i=0;i<varR_childrenPerRoom[room];i++){if(varR_childAgesPerRoom[room][i]&&varR_childAgesPerRoom[room][i]>0){R_EDADES+=String(varR_childAgesPerRoom[room][i]);if(i<varR_childrenPerRoom[room]-1)R_EDADES+=',';}}
$('#varR_EDADES').val(R_EDADES);}
function setNumAdults(room,numAdults){varR_adultsPerRoom[room]=numAdults;}
function setNumChildren(room,numChildren){setEdades(room);varR_childrenPerRoom[room]=numChildren;refresh();}
function setNumRooms(x){numRooms=x;for(i=0;i<x;i++){if(varR_adultsPerRoom[i]==null){varR_adultsPerRoom[i]=2;}
if(varR_childrenPerRoom[i]==null){varR_childrenPerRoom[i]=0;}}
refresh();}
function renderRoomSelect(){var x='<input type="hidden"  name="varR_numberOfRooms" value="1">';return x;}
function refresh(){maxChildren=0;for(var i=0;i<numRooms;i++){if(varR_childrenPerRoom[i]>maxChildren){maxChildren=varR_childrenPerRoom[i];}}
var x='';if(adultHelp.length>0){x=adultHelp+"<p>\n";}
x+='<table border="0"  cellspacing="2" cellpadding="0" width="100%">\n';x+='<tr>';for(var i=0;i<numRooms;i++){if(i==0){x+=renderRoomSelect();}else{x+='&nbsp;';}
x+='<td'+cellStyle+' align="right"><nobr>&nbsp;&nbsp;'+textAdults+': '+pad+'</nobr>';x+=buildSelect('varR_room_'+i+'_adult_total','setNumAdults('+i+', this.options[this.selectedIndex].value)',1,totalAdults,varR_adultsPerRoom[i]);x+='<td'+cellStyle+' align="right"><nobr>&nbsp;&nbsp;'+textChildren+': '+pad+'</nobr>';x+=buildSelect('varR_room_'+i+'_child_total','setNumChildren('+i+', this.options[this.selectedIndex].value)',0,totalChilds,varR_childrenPerRoom[i]);x+='</td>\n';x+='</tr>\n';x+='</tr>';}
x+='</table>\n';var didHeader=false;for(var i=0;i<numRooms;i++){if(varR_childrenPerRoom[i]>0){if(!didHeader){x+='<img src="/images/sep_line.gif" height="2px" width="100%" class="margin-b"><div class="padd-3 searchbox-children"><table  border="0" cellpadding="0" cellspacing="2">\n';x+='<tr><td'+cellStyle+' style="font-style:italic" colspan="'+(maxChildren)+'">';x+='<div class="padding-tb">'+childHelp+'</div>';x+='</td></tr>\n<tr>';for(var j=0;j<maxChildren;j++){x+='<td'+cellStyle+'><nobr class="bold">'+getValue(textChildX,j+1)+pad+'</nobr></td>\n';}
didHeader=true;}
x+='</tr>\n<tr>';if(varR_childrenPerRoom[i]<maxChildren){for(var j=varR_childrenPerRoom[i];j<maxChildren;j++){x+='<td'+cellStyle+'>&nbsp;</td>';}}
for(var j=0;j<varR_childrenPerRoom[i];j++){x+='<td'+cellStyle+'>';var def=-1;if(varR_childAgesPerRoom[i]!=null){if(varR_childAgesPerRoom[i][j]!=null){def=varR_childAgesPerRoom[i][j];}}
x+='<select class="form1" name="varR_room_'+i+'_child_'+j+'_age" onchange="setChildAge('+i+', '+j+', this.options[this.selectedIndex].value);">';x+='<option value="-1"'+(def==-1?' selected':'')+'>-?-';for(var k=0;k<=16;k++){x+='<option value="'+k+'"'+(def==k?' selected':'')+'>'+k;}
x+='</td>';}
x+='</tr>\n';}}
if(didHeader){x+='</table></div>\n';}
jQuery("#hot-search-params").html(x);}
function buildSelect(name,onchange,min,max,selected){var x='<select class="form1" name="'+name+'"';if(onchange!=null){x+=' onchange="'+onchange+'" ';}
x+='>\n';for(var i=min;i<=max;i++){x+='<option value="'+i+'"';if(i==selected){x+=' selected';}
x+='>'+i+'\n';}
x+='</select>';return x;}
function validateGuests(form){if(numRooms<9){var missingAge=false;for(var i=0;i<numRooms;i++){var numChildren=varR_childrenPerRoom[i];if(numChildren!=null&&numChildren>0){for(var j=0;j<numChildren;j++){if(varR_childAgesPerRoom[i]==null||varR_childAgesPerRoom[i][j]==null||varR_childAgesPerRoom[i][j]==-1){missingAge=true;}}}}
if(missingAge){alert_decode(textChildError);return false;}else{return true;}}else{return true;}}
function submitGuestInfoForm(form,message){setSearchCacheID();if(validateGuests(form)){searchHot(message);}}
function getValue(str,val){return str.replace(/\?/g,val);}