function HideChildrenForRoom(B,F,D,C){var J=1;var K=false;if(F!=""&&GetElementInDocument(F)){J=GetElementInDocument(F).value}if(GetElementInDocument(D)){var I=GetElementInDocument(D).value;for(var G=0;G<C.length;G++){var H=GetSpansByName(C[G]);for(var E=0;E<H.length;E++){H[E].style.display=(G<I)&&(B<J)?"":"none";if((G<I)&&(B<J)){K=true}}}}if(B<J&&(K||B==0)){var A=GetSpansByName("ChildAgeHeader");for(var E=0;E<A.length;E++){A[E].style.display=K?"":"none"}}}function HideRoomSections(G,B,L,H,K,I){if(G==""){return }var C=GetElementInDocument(G);if(C){var D=C.value;for(var F=0;F<B.length;F++){var J=GetSpansByName(B[F]);for(var E=0;E<J.length;E++){J[E].style.display=F<D?"inline":"none"}}}var A=false;if(GetElementInDocument(L)){GetElementInDocument(L).style.display=D==1?"none":""}if(GetElementInDocument(H)){GetElementInDocument(H).style.display=(D==1&&A)?"none":""}if(GetElementInDocument(K)){GetElementInDocument(K).style.display=(D==1&&A)||!I?"none":""}}function HidePaxSections(C,F){if(C==""){return }var A=0;if(C!=""){A+=parseInt(GetElementInDocument(C).value)}A-=1;for(var D=0;D<F.length;D++){var E=GetElementsByNameAndType(F[D],"tr");if(E.length==0){GetElementsByNameAndType(F[D],"span")}for(var B=0;B<E.length;B++){E[B].style.display=D<A?"":"none"}}}function FillRoomTypesForRoom(Q,C,E,P,I,N,H){if(Q==""||C==""){return }var G=GetElementInDocument(Q).value;var K=GetElementInDocument(C);var L=GetElementInDocument(P).value;var J=GetElementInDocument(I).value;var R=mRoomTypesForPax[L+";"+J];var D=K.options;var A=K.selectedIndex==-1?-1:K.options[K.selectedIndex].value;D.length=0;var O=R&&R.length>0&&(R.length>1||R[0]!=0);if(!O){K.style.display="none";GetElementInDocument(E).style.display="none"}else{if(R.length==1){var F=mRoomTypeNames[R[0]];K.style.display="none";GetElementInDocument(E).style.display="";GetElementInDocument(E).innerHTML=GetRoomTypeName(R[0],L,J);D[0]=new Option("",R[M],false,false);D.selectedIndex=0}else{if(N){D[0]=new Option(H,-1,false,false)}var B=-1;for(var M=0;M<R.length;M++){D[D.length]=new Option(GetRoomTypeName(R[M],L,J),R[M],false,false);if(R[M]==A){B=D.length-1}}GetElementInDocument(E).style.display="none";K.style.display="";if(B>-1){K.selectedIndex=B}}}return O}function GetSpansByName(C){if(!IsIe()){return document.getElementsByName(C)}else{var D=new Array();var A=document.getElementsByTagName("span");for(var B=0;B<A.length;B++){if(A[B].name==C){D.push(A[B])}}return D}}function GetTRsByName(C){if(!IsIe()){return document.getElementsByName(C)}else{var D=new Array();var A=document.getElementsByTagName("tr");for(var B=0;B<A.length;B++){if(A[B].name==C){D.push(A[B])}}return D}}function RefreshRoomDisplay(){var A=FillRoomTypes();HideRooms(A);HideChildren()}function ShowNightCountTextBox(B){var C=GetElementInDocument("CountNightsOther");var A=GetElementInDocument(B);if(C!=null&&A!=null){C.style.display=A.value=="-1"?"":"none"}}var gStayLengthLastIndex=0;var gPaxCountLastIndex=0;function ShowStayLengthPopUp(){ShowDropDownPopUp(CountNightsDropDown,gStayLengthLastIndex,"Please enter the number of nights:")}function ShowPaxCountPopUp(){ShowDropDownPopUp(PaxCountDropDown,gPaxCountLastIndex,"Please enter the number of pax:")}function ShowDropDownPopUp(D,C,F){var A=GetElementInDocument(D);if(A.value=="-1"){var E=prompt(F,"");if(!isNaN(parseInt(E))&&E!=null&&E>0&&parseInt(E)==E){var G=true;for(var B=0;B<A.options.length;B++){if(E==A.options[B].value){G=false}}if(G){var H=A.options[A.options.length-1];A.options.length=A.options.length+1;A.options[A.options.length-1]=new Option(H.text,H.value);A.options[A.options.length-2]=new Option(E,E)}for(var B=0;B<A.options.length;B++){if(E==A.options[B].value){A.selectedIndex=B}}}else{A.selectedIndex=C}}C=A.selectedIndex}function ShowSection(C,B,D){var A=GetElementInDocument(C);if(A.value==B){D.style.display=="none"}else{D.style.display==""}}function DisplayRoomEntrySection(E,F,A){var D=GetSpansByName(F);for(var B=0;B<D.length;B++){D[B].style.display=E?"":"none"}var C=GetSpansByName(A);for(var B=0;B<C.length;B++){C[B].style.display=E?"none":""}};