// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
//           (c) 2005 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
function redeemVoucher(contractCode,voucherNum,redeemed){form=document.checkoutCartForm;form.voucherNumberHid.value=voucherNum;form.redeemContract.value=contractCode;form.redeemOperation.value=redeemed?"VR":"VU";form.submit()}
function redeemGiftCard(contractCode,contractIndex){form=document.checkoutCartForm;form.redeemContract.value=contractCode;form.redeemContractIndex.value=contractIndex;form.redeemOperation.value="GR";document.getElementById("giftCardSectionExpandedFlag_"+contractIndex).value="true";form.submit()}
function undoGiftCard(contractCode,giftCardNum){form=document.checkoutCartForm;form.giftCardNumberHid.value=giftCardNum;form.redeemContract.value=contractCode;form.redeemOperation.value="GU";form.submit()}function undoAllRedeems(contractCode){form=document.checkoutCartForm;form.redeemContract.value=contractCode;form.redeemOperation.value="UA";form.submit()}
function addInputRowFocusAndBlur(theContainer,textTypeOnly){inputCollection=theContainer.getElementsByTagName("INPUT");for(iDex=0;iDex<inputCollection.length;iDex++)if(textTypeOnly==true&&inputCollection[iDex].type!="text");else{inputCollection[iDex].onfocus=new Function("doRowFocus(this)");inputCollection[iDex].onblur=new Function("doRowFocus(this,false)");inputCollection[iDex].onmouseover=new Function("this.title=this.value")}}
function addRowMouseOverandOut(theContainer){rowCollection=theContainer.getElementsByTagName("TR");for(rDex=0;rDex<rowCollection.length;rDex++){rowCollection[rDex].onmouseover=new Function("doRowMouseOver(this,true)");rowCollection[rDex].onmouseout=new Function("doRowMouseOver(this,false)")}}function doRowFocus(srcInput,doAdd){doAdd=!(doAdd==false);theRow=getParentByTagName(srcInput,"TR");addClassName(theRow,"focus",doAdd)}
function doRowMouseOver(theRow,doAdd){doAdd=!(doAdd==false);addClassName(theRow,"hover",doAdd)}function selectRow(callingChkBox){doAdd=callingChkBox.checked;theRow=getParentByTagName(callingChkBox,"TR");if(addClassName(theRow,"slct",doAdd))changeSelectedCounter(callingChkBox.checked)}
function disableChildInputs(theNode,enable){if(theNode!=null){theNode.style.visibility=enable!=true?"hidden":"visible";theInputs=theNode.getElementsByTagName("INPUT");for(inDex=0;inDex<theInputs.length;inDex++)theInputs.item(inDex).disabled=enable!=true}}
function checkboxRowMaster(theCheckbox){checked=theCheckbox.checked;theRow=getParentByTagName(theCheckbox,"TR");rowInputs=theRow.getElementsByTagName("INPUT");for(inDex=0;inDex<rowInputs.length;inDex++)if(rowInputs.item(inDex).checked!=null)rowInputs.item(inDex).checked=checked}
function checkboxColMaster(theCheckbox,doRowSelect,wholeTable){checked=theCheckbox.checked;theColCells=getColumnCellsBySibling(theCheckbox,!(wholeTable==false));for(cDex=0;cDex<theColCells.length;cDex++){childCheckBox=theColCells[cDex].getElementsByTagName("INPUT")[0];if(childCheckBox!=null&&childCheckBox.type=="checkbox"){childCheckBox.checked=checked;if(doRowSelect&&childCheckBox!==theCheckbox)selectRow(childCheckBox)}}}
function clearInstruction(theElement){matchInstRegExpr=new RegExp("\\[[^\\]]*\\]");theElement.value=theElement.value.replace(matchInstRegExpr,"")}
function changeSelectedCounter(increment,init){theCounter=document.getElementById("rowsSelected");output=document.getElementById("rowsSelectedText");if(theCounter&&output){if(init)rowsSelected=parseInt(theCounter.value,10);else if(increment)rowsSelected++;else if(!increment)rowsSelected--;theCounter.value=rowsSelected;output.innerHTML=String(rowsSelected)}}function confirmAction(message,link){if(confirm(message)==true)window.location=link}var submitted=false;
function submitAndWait(btnElement,formName,elementNameToHide,title,isLink){if(submitted)return false;submitted=true;if(!isLink)btnElement.disabled=true;var elementToHide=$(elementNameToHide);elementToHide.style.display="none";var progressContent="<h2>"+title+"</h2>";progressContent=progressContent+'<div id="progressbar">';for(var i=0;i<10;i++)progressContent=progressContent+"<div>&nbsp;</div>";for(var i=3;i>=0;i--)progressContent=progressContent+'<div class="blip'+i+'">&nbsp;</div>';progressContent=
progressContent+"</div>";progressDiv=document.createElement("DIV");progressDiv.className="component";progressDiv.innerHTML=progressContent;if(elementToHide.nextSibling)elementToHide.parentNode.insertBefore(progressDiv,elementToHide.nextSibling);else elementToHide.parentNode.appendChild(progressDiv);updateProgressFeedback(progressDiv);window.setTimeout("submitMyForm('"+formName+"',"+isLink+")",100)}
function updateProgressFeedback(progressDiv){try{var container=$("progressbar");var theCycleObjects=container.getElementsByTagName("div");container.insertBefore(theCycleObjects[theCycleObjects.length-1],theCycleObjects[0]);window.setTimeout("updateProgressFeedback(progressDiv)",100)}catch(ex){}}var progressSubmited=0;
function submitMyForm(formName,isLink){if(progressSubmited>0)return;progressSubmited++;if(isLink){var form=document.createElement("FORM");form.action=formName;form.name="dummyForm";form.method="POST";progressDiv.appendChild(form);form.submit()}else $(formName).submit()}
function cycleChildren(theContainerID,childTag,msecSpeed){theContainer=$(theContainerID);theCycleObjects=theContainer.getElementsByTagName(childTag);theContainer.insertBefore(theCycleObjects[theCycleObjects.length-1],theCycleObjects[0]);window.setTimeout('cycleChildren("'+theContainerID+'","'+childTag+'",'+msecSpeed+")",msecSpeed)}
function showProgressPopup(theContainerID,formName){theContainer=$(theContainerID);theContainer.style.display="";cycleChildren("progressbar","DIV",100);window.setTimeout("submitMyForm('"+formName+"',"+false+")",100);return false}var testProgressBarImage=new Image(205,48);testProgressBarImage.src="/images/progress_bar.gif";var partialImage=new Image(22,22);partialImage.src="/images/icon_partial.gif";var fullImage=new Image(22,22);fullImage.src="/images/icon_full.gif";var animationStarted=false;
function showProgressBar(theContainerID,title,message,elementToHide){if(!animationStarted){animationStarted=true;theContainer=$(theContainerID);progressContent=getProgressContent(title,false);if(message)progressContent=progressContent+message;theContainer.innerHTML=progressContent;theContainer.style.display="";if(elementToHide!=null){hideContainer=$(elementToHide);if(document.getElementById(elementToHide))hideContainer.style.display="none"}animate("progressBar")}}
function showShortProgressBar(theContainerID,title,message,elementToHide){if(!animationStarted){animationStarted=true;theContainer=$(theContainerID);progressContent=getProgressContent(title,true);if(message)progressContent=progressContent+message;theContainer.innerHTML=progressContent;theContainer.style.display="";if(elementToHide!=null){hideContainer=$(elementToHide);if(document.getElementById(elementToHide))hideContainer.style.display="none"}animate("progressBar")}}
function getProgressContent(title,isShort){progressContent="<h2>"+title+"</h2>";progressContent=progressContent+"<div id='progressBar'>";if(!isShort){progressContent=progressContent+"<div>&nbsp;</div>";progressContent=progressContent+"<div>&nbsp;</div>"}progressContent=progressContent+"<div>&nbsp;</div>";progressContent=progressContent+"<div>&nbsp;</div>";progressContent=progressContent+"<div>&nbsp;</div>";progressContent=progressContent+"<div>&nbsp;</div>";progressContent=progressContent+"<div>&nbsp;</div>";
progressContent=progressContent+"<div>&nbsp;</div>";progressContent=progressContent+"<div>&nbsp;</div>";progressContent=progressContent+"<div>&nbsp;</div>";progressContent=progressContent+"<div style='background-color:#d9f5d9'>&nbsp;</div>";progressContent=progressContent+"<div style='background-color:#b3ebb3'>&nbsp;</div>";progressContent=progressContent+"<div style='background-color:#65d565'>&nbsp;</div>";progressContent=progressContent+"<div style='background-color:#19c119'>&nbsp;</div>";progressContent=
progressContent+"</div>";return progressContent}function showInlineProgressBar(theContainerID,title,elementToHide){if(!animationStarted){animationStarted=true;theContainer=$(theContainerID);theContainer.style.display="";document.getElementById("pBarTitle").innerHTML=title;if(elementToHide!=null){hideContainer=$(elementToHide);if(document.getElementById(elementToHide))hideContainer.style.display="none"}animate("inlineProgressBar")}}
function animate(elementID){animationStarted=true;var theElement=document.getElementById(elementID);if(theElement){var theChildDivs=theElement.getElementsByTagName("DIV");var storedColor=theChildDivs[theChildDivs.length-1].style.backgroundColor;for(chilDex=theChildDivs.length-1;chilDex>0;chilDex--)theChildDivs[chilDex].style.backgroundColor=theChildDivs[chilDex-1].style.backgroundColor;theChildDivs[0].style.backgroundColor=storedColor;window.setTimeout("animate('"+elementID+"')",60)}}
function copyCardInfo(cardDropdownId,currentIndx){if(i<=1){alert("No credit card information to copy from.");return}var previousDropdown=$(cardDropdownId+(currentIndx-1));var currentDropdown=$(cardDropdownId+currentIndx);if(previousDropdown.value==null||previousDropdown.value==""){alert("No credit card information to copy from.");return}var selectedIndex=-1;for(var i=0;i<currentDropdown.options.length;i++)if(currentDropdown.options[i].value==previousDropdown.value){selectedIndex=i;break}if(selectedIndex<
0){alert("Credit card type to copy from is not supported.");return}if($("fname_"+currentIndx).type=="hidden")if(trim($("fname_"+(currentIndx-1)).value.toLowerCase())!=trim($("fname_"+currentIndx).value.toLowerCase())||trim($("lname_"+(currentIndx-1)).value.toLowerCase())!=trim($("lname_"+currentIndx).value.toLowerCase())){alert("This payment requires the cardholder name to be the same as the user name. Cannot copy card info.");return}currentDropdown.selectedIndex=selectedIndex;$("cardnum_"+currentIndx).value=
$("cardnum_"+(currentIndx-1)).value;$("expmonth_"+currentIndx).value=$("expmonth_"+(currentIndx-1)).value;$("expyear_"+currentIndx).value=$("expyear_"+(currentIndx-1)).value;$("fname_"+currentIndx).value=$("fname_"+(currentIndx-1)).value;$("lname_"+currentIndx).value=$("lname_"+(currentIndx-1)).value;$("seccode_"+currentIndx).value=$("seccode_"+(currentIndx-1)).value;if($("postalCodeApplicableFlag_"+currentIndx).value=="true"&&$("postalCodeApplicableFlag_"+currentIndx-1).value=="true"){$("pCodeReq_"+
currentIndx).checked=$("pCodeReq_"+(currentIndx-1)).checked;$("ccPostCode_"+currentIndx).value=$("ccPostCode_"+(currentIndx-1)).value;$("ccPostCodeValue_"+currentIndx).value=$("ccPostCodeValue_"+(currentIndx-1)).value}}
function swipeCard(index){var splitExp="%|B|/|\\^|\\?|;";var cardData=window.showModalDialog("/htm/cardSwipe.htm","","dialogHeight: 200px; dialogWidth: 300px; edge: Raised; center: Yes; help: No; resizable: No; status: No;");if(cardData==null)return;cardData=cardData.substring(2);var ccData=cardData.split(new RegExp(splitExp));removeEmptyStrings(ccData);var cardType=determineCreditCardType(ccData[0]);if(cardType!="VISA"&&cardType!="MAST"&&cardType!="AMEX"&&cardType!="DISC"){alert("The swiped Credit Card type is not an accepted payment type. Please try another credit card.");
return}document.getElementById("cardTypeId_"+index).value=cardType;document.getElementById("cardnum_"+index).value=ccData[0];document.getElementById("expmonth_"+index).value=ccData[3].substring(2,4);document.getElementById("expyear_"+index).value=ccData[3].substring(0,2);document.getElementById("lname_"+index).value=ccData[1];document.getElementById("fname_"+index).value=ccData[2];document.getElementById("swiped_"+index).value="true";document.getElementById("swipeData_"+index).value=ccData[4]}
function removeEmptyStrings(strArray){var i;for(i=0;i<strArray.length;i++)if(strArray[i]=="")strArray.splice(i--,1)}
function determineCreditCardType(cardNumber){if(cardNumber.length<13)return"ERR1";var first1=cardNumber.substring(0,1)-0;var first2=cardNumber.substring(0,2)-0;var first3=cardNumber.substring(0,3)-0;var first4=cardNumber.substring(0,4)-0;if(first2>=51&&first2<=56)return"MAST";if(first2==34||first2==37)return"AMEX";if(first2==36||first2==38)return"DINE";if(first3>=300&&first3<=305)return"DINE";if(first1==4)return"VISA";if(first4==6011||first3==650)return"DISC";return"ERR2"}
function resetSwipe(index){if(document.getElementById("swiped_"+index)!=null){document.getElementById("swiped_"+index).value="false";document.getElementById("swipeData_"+index).value=""}}function trim(str){return str.replace(/^\s+|\s+$/g,"")}var geo=null;var reasons=[];var gAResult=null;function onLoadLandmark(){try{init()}catch(e){}initializeClientGeocoder()}
function initializeClientGeocoder(){geo=new google.maps.Geocoder;reasons[google.maps.GeocoderStatus.OK]="Success";reasons[google.maps.GeocoderStatus.INVALID_REQUEST]="Missing Address: The address was either missing or had no value.";reasons[google.maps.GeocoderStatus.ZERO_RESULTS]=" does not match any location.";reasons[google.maps.GeocoderStatus.OVER_QUERY_LIMIT]="Too Many Queries: The daily geocoding quota for this site has been exceeded."}
var standards=[["road","rd"],["street","st"],["avenue","ave"],["av","ave"],["drive","dr"],["saint","st"],["north","n"],["south","s"],["east","e"],["west","w"],["expressway","expy"],["parkway","pkwy"],["terrace","ter"],["turnpike","tpke"],["highway","hwy"],["lane","ln"]];function standardize(a){for(var i=0;i<standards.length;i++)if(a==standards[i][0])a=standards[i][1];return a}
function different(a,b){var c=b.split(",");b=c[0];a=a.toLowerCase();b=b.toLowerCase();a=a.replace(/'/g,"");b=b.replace(/'/g,"");a=a.replace(/\W/g," ");b=b.replace(/\W/g," ");a=a.replace(/\s+/g," ");b=b.replace(/\s+/g," ");awords=a.split(" ");bwords=b.split(" ");var reply=false;for(var i=0;i<bwords.length;i++)if(standardize(awords[i])!=standardize(bwords[i]))reply=true;return reply}
function place(address,lat,lng){document.getElementById("message").innerHTML="";document.getElementById("message").style.display="none";document.getElementById("landmarkName").value=address;document.getElementById("landmarkName").focus();document.getElementById("landmarkLat").value=lat;document.getElementById("landmarkLong").value=lng}
function verifyLandmarkEntry(landmark){var numregexp=/^\d+$/;var rgx_zipUS=/(^\d{5}$)|(^\d{5}-\d{4}$)/;var len=landmark.length;if(numregexp.test(landmark))if(len!=5)return false;var idx=landmark.search(/-/);if(idx!=-1)if(!rgx_zipUS.test(landmark)){var beforeDash=landmark.substring(0,idx);var afterDash=landmark.substring(idx+1,len);if(numregexp.test(beforeDash)&&numregexp.test(afterDash))if(beforeDash.length!=5||afterDash.length!=4)return false}return true}var loc=false;var appendState=true;
function showAddress(){if(document.getElementById("message").innerHTML!="")document.getElementById("message").innerHTML="";var searchLandmark=document.getElementById("landmarkName").value;searchLandmark=trim(searchLandmark);if(searchLandmark==""||searchLandmark=="City or ZIP")return true;if(!verifyLandmarkEntry(searchLandmark))return true;loc=false;try{if(appendState&&document.getElementById("pstate")){searchLandmark+=","+document.getElementById("pstate").value;appendState=false}if(geo)geo.geocode({"address":searchLandmark},
function(result,status){if(status==google.maps.GeocoderStatus.OK)onSuccess(result);else onFailure(status)})}catch(ex){alert("catched error"+ex)}return loc}var PROGRESS_LEGEND="";
function onSuccess(result){if(result.length>1){document.getElementById("message").style.display="block";document.getElementById("message").innerHTML="<div class='msg alertTitle'><h3>Did you mean:</h3></div>";var comma=",";var regexcomma=new RegExp(comma,"g");var blank="";var bslsh="\\\\";var regexbslsh=new RegExp(bslsh,"g");var lineBreak="<br>";for(var i=0;i<result.length;i++){var address=result[i].formatted_address.replace(regexcomma,blank);address=address.replace(regexbslsh,bslsh);document.getElementById("message").innerHTML+=
"<br><a href='javascript:place(\""+address+'","'+result[i].geometry.location.lat()+'","'+result[i].geometry.location.lng()+"\");'>"+result[i].formatted_address+"</a>"}}else{loc=true;var sourceField=document.getElementById("landmarkName");sourceField.value=result[0].formatted_address;document.getElementById("landmarkLat").value=result[0].geometry.location.lat();document.getElementById("landmarkLong").value=result[0].geometry.location.lng();var form=getParentByTagName(sourceField,"FORM");showProgressBar("contentProgressBar",
"Searching ...",PROGRESS_LEGEND,"contentArea");form.submit();return}}function onFailure(status){var reason="Code: "+status;var searchLandmark=document.getElementById("landmarkName").value;if(reasons[status])reason=reasons[status];document.getElementById("message").innerHTML="<div class='msg error'>\""+searchLandmark+'"'+reason+"</div>"}String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};String.prototype.ltrim=function(){return this.replace(/^\s+/,"")};
String.prototype.rtrim=function(){return this.replace(/\s+$/,"")};
function showAddressOnGoogleMap(){if(document.getElementById("message").innerHTML!="")document.getElementById("message").innerHTML="";var searchLandmark=document.getElementById("landmarkName").value;searchLandmark=trim(searchLandmark);if(searchLandmark==""||searchLandmark=="City or ZIP")return false;if(!verifyLandmarkEntry(searchLandmark))return false;try{if(geo)geo.geocode({"address":searchLandmark},function(result,status){if(status==google.maps.GeocoderStatus.OK)getGoogleMapResult(result);else onFailure(status)})}catch(ex){alert("catched error"+
ex)}}function place(address){document.getElementById("message").innerHTML="";document.getElementById("message").style.display="none";document.getElementById("landmarkName").value=address;document.getElementById("landmarkName").focus()}
function getGoogleMapResult(result){if(result.length>1){document.getElementById("message").style.display="block";document.getElementById("message").innerHTML="<div class='msg alertTitle'><h3>Did you mean:</h3></div>";var comma=",";var regexcomma=new RegExp(comma,"g");var blank="";for(var i=0;i<result.length;i++){var address=result[i].formatted_address.replace(regexcomma,blank);document.getElementById("message").innerHTML+="<br><a href='javascript:place(\""+address+"\");'>"+result[i].formatted_address+
"</a>"}}else{var lat=result[0].geometry.location.lat();var lng=result[0].geometry.location.lng();changeLandmarkText(document.getElementById("landmarkName").value,lat,lng)}}function populateWithHomeAddress(address){document.getElementById("landmarkName").value=address;document.getElementById("landmarkName").focus()}
function printPDFDirect(url){window.showModalDialog(url+"&systime="+(new Date).getTime(),"","dialogHeight: 160px; dialogWidth: 300px; edge: Raised; center: Yes; help: No; resizable: No; status: No;")}function printPDFOnlinePermit(url){window.open(url+"&systime="+(new Date).getTime(),"ViewReport","location=0,toolbar=no,status=yes,scrollbars=yes,resizable=yes,menubar=yes,width=640,height=480")}
function printUwpPDFDirectSetup(permitNum,tagReport,contractCode,facilityId){if(permitNum=="null"||permitNum==""||tagReport=="null");else{var base="UwpPrintAction.do?ReportName="+tagReport+"&ReservationNumber="+permitNum+"&ContractCode="+contractCode+"&FacilityId="+facilityId+"&printDirect=true";printPDFDirect(base)}}
function checkFrame(iFrameName){var iframe=window.document.getElementById(iFrameName);var iFrameLoaded="loading";if(iframe==null)alert("iframe not found");else if(iframe.document==null)if(document.addEventListener==null)setTimeout("window.close()",5E3);else try{if(document.addEventListener)document.addEventListener("DOMContentLoaded",setTimeout("window.close()",5E3),false);else setTimeout("window.close()",5E3)}catch(ex){setTimeout("window.close()",5E3)}else{iFrameLoaded=iframe.document.readyState;
if(iFrameLoaded!="complete")setTimeout("checkFrame("+iFrameName+")",5E3);else{window.opener=self;setTimeout("window.close()",5E3)}}}
function printUwpPDFDirectFromHidden(){if(window.document.getElementById("PrintPermitAction")==null||window.document.getElementById("PrintPermitAction").value==null);else{var url=window.document.getElementById("PrintPermitAction").value;if(window.document.getElementById("OnlinePermitAction")==null||window.document.getElementById("OnlinePermitAction").value==null)printPDFDirect(url);else printPDFOnlinePermit(url+"&PermitDeliveryMethodOnline=true")}}
function printUwpPDFDirectFromHiddenList(){if(window.document.getElementById("PrintPermitAction")==null||window.document.getElementById("PrintPermitAction").value==null);else{var url=window.document.getElementById("PrintPermitAction").value;urlSingle=url.split(":");if(window.document.getElementById("OnlinePermitAction")==null||window.document.getElementById("OnlinePermitAction").value==null)for(var i=0;i<urlSingle.length;i++)printPDFDirect(urlSingle[i]);else for(var i=0;i<urlSingle.length;i++)printPDFOnlinePermit(urlSingle[i]+
"&PermitDeliveryMethodOnline=true")}}function performAdminUpdate(subaction){document.getElementById("statusUpdateAction").value=subaction;document.forms["attractionsForm"].submit()}function printPrecheckinForm(url){var name="PreCheckInForm";var params="scrollbars=yes,resizable=yes,menubar=yes,width=800,height=800";window.open(url,name,params)}
function toggleSelections(sourceField,excludeFieldId,fieldGroupId){var checked=sourceField.checked;var excludedField=document.getElementById(excludeFieldId);var excludeOthers=excludedField.id==sourceField.id;var theForm=getParentByTagName(sourceField,"FORM");if(excludeOthers&&checked){var debug="";for(i=0;i<theForm.elements.length;i++){var currId=theForm.elements[i].id.substring(0,fieldGroupId.length);if(currId==fieldGroupId&&sourceField.id!=theForm.elements[i].id)theForm.elements[i].checked=false}}else if(checked)excludedField.checked=
false}function randomInt(min,max){return Math.floor(Math.random()*(max-min+1)+min)}
function toggleFieldState(checkbox,associatedFieldId,backingTextFieldId){var associatedField=document.getElementById(associatedFieldId);var backingTextFieldId=document.getElementById(backingTextFieldId);if(checkbox.checked){associatedField.value="";associatedField.readOnly=true;addClassName(associatedField,"disabled",true);backingTextFieldId.value="true"}else{associatedField.readOnly=false;addClassName(associatedField,"disabled",false);backingTextFieldId.value="false"}}
function requestNewCaptchaImg(captchaImgId){var captchaImg=document.getElementById(captchaImgId);if(captchaImg){var src=captchaImg.src;var idx=src.indexOf("?");if(idx>=0)src=src.substr(0,idx);src=src+"?p="+randomInt(1E3,1E6);captchaImg.src=src;var inputFld=document.getElementById("securitycheckid");if(inputFld)inputFld.value=""}}
function showSsnDetail(displayValue){if(displayValue=="true"){document.getElementById("ssnDescShort").style.display="none";document.getElementById("ssnDescLong").style.display="";document.getElementById("ssnShowHideDetails").value="show"}else{document.getElementById("ssnDescShort").style.display="";document.getElementById("ssnDescLong").style.display="none";document.getElementById("ssnShowHideDetails").value="hide"}};function addClassName(theNode,theClassName,doAdd){if(theNode!=null){existingClassName=theNode.className;theNode.className=addWord(existingClassName,theClassName,doAdd)}return theNode!=null&&existingClassName!=theNode.className}
function addWord(thePhrase,theWord,doAdd){matchWordRegExpr=new RegExp("\\s?\\b"+theWord+"\\b");if(thePhrase==null)thePhrase="";if(doAdd!=false){if(!matchWordRegExpr.test(thePhrase)){addSpace=thePhrase>""?" ":"";thePhrase+=addSpace+theWord}}else thePhrase=thePhrase.replace(matchWordRegExpr,"");return thePhrase}function hasClassName(theNode,theClassName){if(theNode!=null){existingClassName=theNode.className;return hasThisWord(existingClassName,theClassName)}return false}
function hasThisWord(thePhrase,theWord){matchWordRegExpr=new RegExp("\\b"+theWord+"\\b");return matchWordRegExpr.test(thePhrase)};function getParentByTagName(theNode,byTagName,orTagName){var theParent=theNode.parentNode;if(theParent!=null)if(theParent.tagName!=byTagName&&theParent.tagName!=orTagName)theParent=getParentByTagName(theParent,byTagName,orTagName);return theParent}
function getFirstChildByTagName(theNode,byTagName,orTagName){var theFirstChild=null;var theChildren=theNode.childNodes;for(nDex=0;nDex<theChildren.length;nDex++)if(theChildren[nDex].tagName==byTagName||theChildren[nDex].tagName==orTagName){theFirstChild=theChildren[nDex];break}return theFirstChild}
function getNextSiblingByTagName(theNode,byTagName,orTagName){if(orTagName==null)orTagName=byTagName;var theNextSibling=theNode.nextSibling;if(theNextSibling!=null)if(theNextSibling.tagName!=byTagName&&theNextSibling.tagName!=orTagName)theNextSibling=getNextSiblingByTagName(theNextSibling,byTagName,orTagName);return theNextSibling}
function getParentByClassName(theNode,byClassName){var theParent=theNode.parentNode;if(theParent!=null)if(!hasWord(theParent.className,byClassName))theParent=getParentByClassName(theParent,byClassName);return theParent}function hasWord(thePhrase,theWord){matchWordRegExpr=new RegExp("\\b"+theWord+"\\b");return matchWordRegExpr.test(thePhrase)}function getElementsByTagNameAndAttribute(theTagName,theAttributeName,theAttributeValue){}
function getActualLeft(theNode){actualLeft=document.body.offsetLeft;if(theNode.offsetParent)while(theNode.offsetParent){actualLeft+=theNode.offsetLeft;theNode=theNode.offsetParent}else if(theNode.x)actualLeft+=theNode.x;return actualLeft}function getActualRight(theNode){actualRight=theNode.offsetWidth;actualRight+=getActualLeft(theNode);return actualRight}
function getActualTop(theNode){actualTop=document.body.offsetTop;if(theNode.offsetParent){var node=theNode;while(node.offsetParent){actualTop+=node.offsetTop;node=node.offsetParent}if(theNode.parentNode)while(theNode.offsetParent){actualTop-=theNode.scrollTop;theNode=theNode.parentNode}}else if(theNode.y)actualTop+=theNode.y;return actualTop}function getActualBottom(theNode){actualBottom=theNode.offsetHeight;actualBottom+=getActualTop(theNode);return actualBottom}
function openFull(el){var theNextSibling=getNextSiblingByTagName(el,"DIV");theNextSibling.style.display=="none"?theNextSibling.style.display="block":theNextSibling.style.display="none";return false}function expandAll(fl){var elAr=document.getElementsByTagName("DIV");for(var i=1;i<elAr.length;i++)if(elAr[i].style.display=="none"||elAr[i].block_fl){elAr[i].block_fl=true;if(fl)elAr[i].style.display="";else elAr[i].style.display="none"}}
function getWindowSize(){var myWidth=0,myHeight=0;if(typeof window.innerWidth=="number"){myWidth=window.innerWidth;myHeight=window.innerHeight}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){myWidth=document.documentElement.clientWidth;myHeight=document.documentElement.clientHeight}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){myWidth=document.body.clientWidth;myHeight=document.body.clientHeight}return[myWidth,
myHeight]}
function getScrollXY(){var scrOfX=0,scrOfY=0;if(typeof window.pageYOffset=="number"){scrOfY=window.pageYOffset;scrOfX=window.pageXOffset}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){scrOfY=document.body.scrollTop;scrOfX=document.body.scrollLeft}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){scrOfY=document.documentElement.scrollTop;scrOfX=document.documentElement.scrollLeft}return[scrOfX,scrOfY]}
function log(message){if(!log.window_||log.window_.closed){var win=window.open("",null,"width=400,height=200,"+"scrollbars=yes,resizable=yes,status=no,"+"location=no,menubar=no,toolbar=no");if(!win)return;var doc=win.document;doc.write("<html><head><title>Debug Log</title></head>"+"<body></body></html>");doc.close();log.window_=win}var logLine=log.window_.document.createElement("div");logLine.appendChild(log.window_.document.createTextNode(message));log.window_.document.body.appendChild(logLine)}
;dashExpr=new RegExp("-","g");defaultMaxWindowMonths=12;function asDoubleDigit(value){return String(value).length==1?"0"+value:value}
function updateDefaultMaximumWindow(stateDropdown){var currentStateCode=stateDropdown.options[stateDropdown.selectedIndex].value;var currentMaximumWindowMonths=document.getElementById("currentMaximumWindow");var stateDefaultMaxWindowMapping=document.getElementById("stateDefaultMaxWindow");currentMaximumWindowMonths.value=defaultMaxWindowMonths;if(currentMaximumWindowMonths!=null&&stateDefaultMaxWindowMapping!=null){theMappings=stateDefaultMaxWindowMapping.value;if(theMappings.indexOf(currentStateCode)>
-1&&currentStateCode!=""){var stateMappings=theMappings.split(";");for(i=0;i<stateMappings.length;i++)if(stateMappings[i].indexOf(currentStateCode)>-1){result=stateMappings[i].split(":");currentMaximumWindowMonths.value=result[1]}}else currentMaximumWindowMonths.value=defaultMaxWindowMonths}}
function readDate(inputDate){today=new Date;today.setHours(-1);if(!isNaN(inputDate)){if(inputDate>1E3&&inputDate<9999)inputDate="Jan 1 ,"+inputDate}else inputDate=inputDate.replace(dashExpr,"/");var theDateInMilis=Date.parse(inputDate);var theDate=null;if(!isNaN(theDateInMilis)){theDate=forceYearWithinWindow(new Date(theDateInMilis));var minDate=new Date;var currentMaximumWindowMonths=document.getElementById("currentMaximumWindow");if(currentMaximumWindowMonths){var maxDate=new Date(minDate.getFullYear()+
currentMaximumWindowMonths.value/12,minDate.getMonth()+currentMaximumWindowMonths.value%12,minDate.getDate());if(theDate.getTime()<minDate.getTime()||theDate.getTime()>maxDate.getTime())theDate=minDate}}return theDate}
function forceYearWithinWindow(theDate,yearsBeforeThisYear,yearsAfterThisYear){if(yearsBeforeThisYear==null)yearsBeforeThisYear=50;if(yearsAfterThisYear==null)yearsAfterThisYear=50;thisYear=(new Date).getFullYear();theYear=theDate.getFullYear();if(theYear<thisYear){if(thisYear-theYear>yearsBeforeThisYear){theYear+=100;if(theYear-thisYear>yearsAfterThisYear)theYear=thisYear-yearsBeforeThisYear}}else if(theYear-thisYear>yearsAfterThisYear)theYear=1*thisYear+yearsAfterThisYear;theDate.setFullYear(theYear);
return theDate}function forceToNextYear(theDate,minimumDate){if(!isNaN(theDate)&&theDate<minimumDate)theDate.setFullYear(theDate.getFullYear()+1);return theDate}function forceWithinDateWindow(theDate,minimumDate,maximumDate){if(theDate.valueOf()<minimumDate.valueOf()||isNaN(theDate))theDate=new Date(minimumDate);else if(theDate.valueOf()>maximumDate.valueOf())theDate=new Date(maximumDate);return theDate}
function toISODate(theDate){if(theDate!=null)return theDate.getFullYear()+"-"+asDoubleDigit(theDate.getMonth()+1)+"-"+asDoubleDigit(theDate.getDate());else return""}function toDateString(theDate){if(theDate!=null)return theDate.toDateString();else return""}function reformatDate(inputDate){return toDateString(readDate(inputDate))}
function orderDateInElements(startEleId,endDateEle){resStartDate=readDate(startDateEle.getAttribute("value"));resEndDate=readDate(endDateEle.getAttribute("value"));if(resEndDate<resStartDate&&resEndDate!=null){startDateEle.setAttribute("value",toDateString(resEndDate));endDateEle.setAttribute("value",toDateString(resStartDate))}}
function setNights(nightsEle,startDateEle,endDateEle){startDate=readDate(startDateEle.getAttribute("value"));endDate=readDate(endDateEle.getAttribute("value"));nights=(endDate-startDate)/(1E3*60*60*24);if(nights>0)nightsEle.setAttribute("value",nights)}
function updateNights(nightsEle,startDateEle,endDateEle){if(startDateEle!=null&&endDateEle!=null&&nightsEle!=null){nights=1*nightsEle.getAttribute("value");startDate=readDate(startDateEle.getAttribute("value"));startDate.setDate(1*startDate.getDate()+nights);endDateEle.setAttribute("value",toDateString(startDate))}}function setDisplayDateText(){document.getElementById("displayDate").innerText=(new Date).toDateString()}
function fireEvent(theObject,eventAttribute){try{theObject.fireEvent(eventAttribute)}catch(e){try{eval("theObject."+eventAttribute+"()")}catch(e){}}}
function setDefaultEndDate(arvDateId,endDateId,lengthOfStayId){var arvDate=document.getElementById(arvDateId);if(arvDate.value=="")return;var endDate=document.getElementById(endDateId);var lengthOfStay=document.getElementById(lengthOfStayId);if(endDate.value==""){nights=1*lengthOfStay.value;if(nights==0)nights=14;startDate=readDate(arvDate.value);var newEndDate=new Date(startDate);newEndDate.setDate(1*newEndDate.getDate()+nights);endDate.value=toDateString(newEndDate)}};function closeIframePopup(iframeId){if(typeof theIframe!="undefined")try{theIframe.contentWindow.finPop()}catch(e){}if(typeof iframeId=="string")theIframe=document.getElementById(iframeId);else theIframe=iframeId;if(theIframe!=null)theIframe.style.display="none";return false}
function addPopupIframe(theId,theSrc,autoClosePopup){var newIframe=document.createElement("IFRAME");newIframe.setAttribute("id",theId);newIframe.setAttribute("src",theSrc);newIframe.setAttribute("scrolling","no");newIframe.setAttribute("frameBorder","0");newIframe.setAttribute("width","100");newIframe.setAttribute("height","100");newIframe.setAttribute("class","popup");newIframe.setAttribute("className","popup");newIframe.setAttribute("allowTransparency","yes");newIframe.style.position="absolute";
newIframe.style.display="none";if(autoClosePopup){try{newIframe.ondeactivate=new Function("closeIframePopup('"+theId+"')")}catch(e){}try{document.onfocus=new Function("closeIframePopup('"+theId+"')")}catch(e){}}document.body.appendChild(newIframe)}
function showIframePopup(callingButton,iframeId,showUnder,offsetX,offsetY){if(isNaN(offsetX))offsetX=0;if(isNaN(offsetY))offsetY=0;theIframe=document.getElementById(iframeId);theIframe.style.display="none";xRevealOffset=32;if(theIframe!=null){theIframe.contentWindow.targetInput=callingButton;theTop=showUnder?getActualBottom(callingButton):getActualTop(callingButton);iTop=theTop+offsetY;iLeft=getActualLeft(callingButton)+xRevealOffset+offsetX;var autoCloseHandler=function(event){var target;if(event.srcElement)target=
event.srcElement;else if(event.target)target=event.target;if(theIframe.style.display=="block"&&target.id!=callingButton.id){var IE=document.all?true:false;if(IE){x=event.clientX+document.documentElement.scrollLeft;y=event.clientY+document.documentElement.scrollTop}else{x=event.pageX;y=event.pageY}try{iWidth=eval(theIframe.style.width.replace("px",""));iHeight=eval(theIframe.style.height.replace("px",""));if(x<iLeft||x>iLeft+iWidth||y<iTop||y>iTop+iHeight)$(iframeId).style.display="none"}catch(err){}}};
setTimeout(function(){Event.observe(document,"mousedown",autoCloseHandler)},300);theIframe.style.top=iTop+"px";theIframe.style.left=iLeft+"px";frameSizeToContent(theIframe);try{theIframe.contentWindow.updatePop()}catch(e){}theIframe.style.display="block";theIframe.contentWindow.document.onactivate=new Function("activeFromIframe = true");theIframe.contentWindow.targetInput.select()}return false}
function onFocusShowIframePopup(callingInput,iframeId,offsetX,offsetY){activeFromIframe=false;document.onactivate=new Function("if(!activeFromIframe)closeIframePopup('"+iframeId+"');activeFromIframe = false");return showIframePopup(callingInput,iframeId,true,offsetX,offsetY)}
function frameSizeToContent(theIframe){theIframe.style.width=theIframe.contentWindow.document.body.getElementsByTagName("DIV")[0].style.width;theIframe.style.height=theIframe.contentWindow.document.body.getElementsByTagName("DIV")[0].style.height}function focusLastInput(theDoc){theInputs=theDoc.getElementsByTagName("INPUT");if(theInputs.length>0){try{theInputs[theInputs.length-1].focus()}catch(e){}try{theInputs[0].focus()}catch(e){}}}var newChildWindow=null;
function openChildWindow(theUrl,theName,theParams){if(theUrl==null)theUrl="about:blank";if(theName==null)theName="New Child Window";if(theParams==null)theParams="scrollbars=YES,resizable=YES, width=700, height=500";try{newChildWindow.focus()}catch(e){newChildWindow=window.open(theUrl,theName,theParams)}return newChildWindow}
function photo(photoSrc){if(!photo.window_||photo.window_.closed){var win=window.open("",null,"width=500,height=500,"+"scrollbars=no,resizable=1,status=no,"+"location=no,menubar=no,toolbar=no");if(!win)return;photo.window_=win}var doc=photo.window_.document;var htmlStr="";htmlStr+="<html><head>";htmlStr+="<script src='/js/_all.js' type='text/javascript'><\/script>";htmlStr+="<script type='text/javascript'>";htmlStr+="var arrTemp=self.location.href.split('?');";htmlStr+="var picUrl = (arrTemp.length>0)?arrTemp[1]:'';";
htmlStr+="function resizeWin(){";htmlStr+="var fFoxCorr = 0; var n = window.navigator.userAgent; if (n.indexOf('Firefox')>=0) fFoxCorr = 30;";htmlStr+="var iWidth = 2 * getActualLeft(document.images[0]) + getActualRight(document.images[0]);";htmlStr+="var iHeight = 4 * getActualTop(document.images[0]) + getActualBottom(document.images[0]) + fFoxCorr ;";htmlStr+="window.resizeTo(iWidth, iHeight);";htmlStr+="}window.onload=resizeWin;";htmlStr+="<\/script> </head><body>";htmlStr+="<img src='"+photoSrc+
"'/>";htmlStr+="</body><script type='text/javascript'>focus();<\/script></html>";doc.write(htmlStr);doc.close();photo.window_.focus()}function showKeyAttr(callingElem,siteId){try{document.onactivate=new Function("if(!activeKeyAttrPopup)closeKeyAttr();activeKeyAttrPopup = false")}catch(err){}showKeyAttrPopup(callingElem,siteId,"popupKeyAttr",false,0,-5)}var crtKeyAttrCallingElem=null;
function showKeyAttrPopup(callingElem,siteId,iframeId,showUnder,offsetX,offsetY){theIframe=document.getElementById(iframeId);if(theIframe.style.display!="block"||callingElem!=crtKeyAttrCallingElem){crtKeyAttrCallingElem=callingElem;if(isNaN(offsetX))offsetX=0;if(isNaN(offsetY))offsetY=0;xRevealOffset=-210;if(theIframe!=null){theIframe.contentWindow.document.getElementById("content").innerHTML="<div>Updating ...</div>";theTop=showUnder?getActualBottom(callingElem):getActualTop(callingElem);theIframe.style.top=
theTop+offsetY+"px";theIframe.style.left=getActualLeft(callingElem)+xRevealOffset+offsetX+"px";if(theIframe.contentWindow.document.body)frameSizeToContent(theIframe);if(callingElem.id.indexOf("rb")==0);else{var autoCloseHandler=function(event){if(theIframe.style.display=="block"){var pos=Position.cumulativeOffset(crtKeyAttrCallingElem);var sLimit=30;var sLeft=pos[0]-sLimit;var sTop=pos[1]-sLimit;var sRight=pos[0]+crtKeyAttrCallingElem.offsetWidth+sLimit;var sBottom=pos[1]+crtKeyAttrCallingElem.offsetHeight+
sLimit;var IE=document.all?true:false;if(IE){x=event.clientX+document.documentElement.scrollLeft;y=event.clientY+document.documentElement.scrollTop}else{x=event.pageX;y=event.pageY}if(!(x>sLeft&&x<sRight&&y>sTop&&y<sBottom))$(iframeId).style.display="none"}};Event.observe(document,"mousemove",autoCloseHandler)}var contractCode=document.getElementById("contractCode").value;var parkId=document.getElementById("parkId").value;theIframe.style.display="block";theIframe.contentWindow.document.onactivate=
new Function("activeKeyAttrPopup = true");http_request=false;makeRequest("/getKeySiteAttrs.do?siteId="+siteId+"&contractCode="+contractCode+"&parkId="+parkId)}}return false}function closeKeyAttr(event){if(!event)closeIframePopup("popupKeyAttr")}
function makePostRequest(url){http_request=false;if(window.XMLHttpRequest){http_request=new XMLHttpRequest;if(http_request.overrideMimeType)http_request.overrideMimeType("text/html")}else if(window.ActiveXObject)try{http_request=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{http_request=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}if(!http_request){alert("Cannot create XMLHTTP instance");return false}http_request.open("POST",url,true);http_request.send(null)}
function makeRequest(url){http_request=false;if(window.XMLHttpRequest){http_request=new XMLHttpRequest;if(http_request.overrideMimeType)http_request.overrideMimeType("text/html")}else if(window.ActiveXObject)try{http_request=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{http_request=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}if(!http_request){alert("Cannot create XMLHTTP instance");return false}http_request.onreadystatechange=alertContents;http_request.open("GET",url,true);http_request.send(null)}
function alertContents(){if(http_request.readyState==4){if(http_request.status==200){result=http_request.responseText;theIframe.contentWindow.document.getElementById("content").innerHTML=result;photo=theIframe.contentWindow.document.getElementById("sitePhoto")}else theIframe.contentWindow.document.getElementById("content").innerHTML="<DIV class='error'>We cannot retrieve site information at this time. Please try again later.</DIV>";resetPosition()}}
function resetPosition(){if(photo&&!photo.complete)window.setTimeout("resetPosition()",500);var content=theIframe.contentWindow.document.getElementById("content");var frameBottom=getActualTop(theIframe)+(getActualBottom(content)-getActualTop(content)+20);var windowPosition=getWindowSize()[1]+getScrollXY()[1];if(windowPosition<frameBottom)theTop-=frameBottom-windowPosition;theIframe.style.top=theTop+"px"}
function openShareFbPopup(fbUrl,shUrl,width,height){var left=parseInt(screen.availWidth/2-width/2);var top=parseInt(screen.availHeight/2-height/2);var windowFeatures="width="+width+",height="+height+",status,resizable,location=0,left="+left+",top="+top+"screenX="+left+",screenY="+top;var openURL=fbUrl+"?u="+escape(shUrl);var spWindow=window.open(openURL,"sp_share",windowFeatures);spWindow.focus()}
function openShareTwitterPopup(twUrl,shUrl,txt,width,height){var left=parseInt(screen.width/2-width/2);var top=parseInt(screen.height/2-height/2);var windowFeatures="width="+width+",height="+height+",status,resizable,location=0,left="+left+",top="+top+"screenX="+left+",screenY="+top;var openURL=twUrl+"?url="+escape(shUrl)+"&text="+escape(txt);var spWindow=window.open(openURL,"sp_share",windowFeatures);spWindow.focus()};function init(){try{addPopupIframe("popupCalendar","/htm/pop_calendar.html",true)}catch(e){}}function initSiteSarch(){activeKeyAttrPopup=false;try{addPopupIframe("popupCalendar","/htm/pop_calendar.html",true);addPopupIframe("popupKeyAttr","/htm/pop_keyattributes.html",false)}catch(e){}}function initHome(){try{init();refreshHiddenOptions(document.getElementById("homesearchform"))}catch(e){}}
function initCampsiteDetail(){try{init();fireEvent(window.document.booksiteform.arrivaldate,"onchange")}catch(e){}}function initKoaCampsiteDetail(){try{init();fireEvent(window.document.koaCampsiteDetailsForm.arrivalDate,"onchange");fireEvent(window.document.koaCampsiteDetailsForm.equipmentType,"onchange")}catch(e){}}function checkForJS(name){var form=document.getElementById(name);form.jssupport.value="true"}
function initTourDetails(){try{init();fireEvent(window.document.tourAvailForm.tourDate,"onchange")}catch(e){}}function addLoadEvent(func){var oldonload=window.onload;if(typeof window.onload!="function")window.onload=func;else window.onload=function(){oldonload();func()}};function showExtraInfo(chkBox,sectionId){if(document.getElementById(sectionId))if(chkBox.checked==1)showSection(sectionId,true);else showSection(sectionId,false)}function showSection(sectionId,show){document.getElementById(sectionId).style.display=show?"":"none"}function showHiddenOptions(theNode,doShow){if(theNode!=null){containerForHiddenOptions=getParentByClassName(theNode,"hiddenoptions");addClassName(containerForHiddenOptions,"hide",!doShow);if(doShow)focusNextElement(theNode)}}
function showHiddenOptionsByList(theNode,selectedId,showList){if(theNode!=null){var doShow=false;var elemShowArray=showList.split(";");for(i=0;i<elemShowArray.length;i++)if(selectedId==elemShowArray[i]){doShow=true;break}containerForHiddenOptions=getParentByClassName(theNode,"hiddenoptions");addClassName(containerForHiddenOptions,"hide",!doShow);if(doShow)focusNextElement(theNode)}}
function showExclusiveHiddenOptions(theNode,doShow,exclusiveNodeName){var exclusiveNode=document.getElementById(exclusiveNodeName);showHiddenOptions(theNode,doShow);if(document.getElementById(exclusiveNodeName))if(doShow){exclusiveNode.checked=false;showHiddenOptions(exclusiveNode,!doShow)}}
function refreshHiddenOptions(theForm){if(theForm!=null){theElements=theForm.elements;for(elDex=0;elDex<theElements.length;elDex++){var theValue=theElements[elDex]["onclick"];theValue=theValue==null?"":theValue.toString();if(theValue.indexOf("showHiddenOptions")>-1)showHiddenOptions(theElements[elDex],theElements[elDex].checked)}}}function focusNextElement(theNode){}
function isIDInList(id,idList){var idArray=idList.split(";");for(i=0;i<idArray.length;i++)if(id==idArray[i])return true;return false}
function showEquipmentLenghtOrDepthKOA(dropDown,equipmentLengthUI,equipmentDepthUI,equipmentLengthIDs,equipmentDepthIDs){var showEquipmentLength="";if(dropDown.selectedIndex>=1){var equipmentID=dropDown.options[dropDown.selectedIndex].value;var showEquipmentLength=isIDInList(equipmentID,equipmentLengthIDs)?"":"none"}if($(equipmentLengthUI+"_error"))$(equipmentLengthUI+"_error").style.display=showEquipmentLength;$(equipmentLengthUI).style.display=showEquipmentLength}
function showEquipmentLenghtOrDepth(equipmentID,equipmentLengthUI,equipmentDepthUI,equipmentLengthIDs,equipmentDepthIDs){var showEquipmentLength=isIDInList(equipmentID,equipmentLengthIDs)?"":"none";if($(equipmentLengthUI+"_error"))$(equipmentLengthUI+"_error").style.display=showEquipmentLength;$(equipmentLengthUI).style.display=showEquipmentLength;try{$("maxEquipmentLengthDisplay").innerHTML=maxLengthEquipmentMap[equipmentID]}catch(err){}}
function showEquipmentLenght(equipmentID,equipmentLengthUI,equipmentLengthIDs){var showEquipmentLength=isIDInList(equipmentID,equipmentLengthIDs)?"":"none";if($(equipmentLengthUI+"_error"))$(equipmentLengthUI+"_error").style.display=showEquipmentLength;$(equipmentLengthUI).style.display=showEquipmentLength}
function toggleHiddenOptions(openNodeId,closeNodeId,doShow){var openNode=document.getElementById(openNodeId);var closeNode=document.getElementById(closeNodeId);openNode.style.display="block";closeNode.style.display="none"}
function showGiftCardInfo(contractIndex){document.getElementById("giftCardInputContainer_"+contractIndex).style.display="block";document.getElementById("giftCardSectionExpandedFlag_"+contractIndex).value="true";var numberOfGiftCards=document.getElementById("numberOfGiftCardsRedeemed_"+contractIndex).value-=0;if(numberOfGiftCards==0){document.getElementById("giftCardOpenLinkContainer_"+contractIndex).style.display="none";document.getElementById("giftCardInfo_"+contractIndex).style.display="block"}return false}
function redeemAnother(contractIndex){document.getElementById("giftCardRedeemLink_"+contractIndex).style.display="none";return showGiftCardInfo(contractIndex)}
function updatePaymentChoice(buttonValue,contractCode){var full=buttonValue=="FULL";var amountFullElem=document.getElementById(contractCode+"_ccAmountFull");var amountMinimumElem=document.getElementById(contractCode+"_ccAmountMinimum");if(amountFullElem!=null)amountFullElem.style.display=full?"":"none";if(amountMinimumElem!=null)amountMinimumElem.style.display=full?"none":"";var ccAmountCellId=full?contractCode+"_ccAmountFull":contractCode+"_ccAmountMinimum";var amountCell=document.getElementById(ccAmountCellId);
if(amountCell!=null){var amountStr=amountCell.innerHTML;if(amountStr=="$0.00"){showElementById(contractCode+"_cardPaymentType",false);showElementById(contractCode+"_cardPaymentNumber",false);showElementById(contractCode+"_cardPaymentSecCode",false);showElementById(contractCode+"_cardPaymentExpDate",false);showElementById(contractCode+"_cardPaymentName",false)}else{showElementById(contractCode+"_cardPaymentType",true);showElementById(contractCode+"_cardPaymentType",true);showElementById(contractCode+
"_cardPaymentNumber",true);showElementById(contractCode+"_cardPaymentSecCode",true);showElementById(contractCode+"_cardPaymentExpDate",true);showElementById(contractCode+"_cardPaymentName",true)}}}function showElementById(id,show){var elem=document.getElementById(id);if(elem!=null)elem.style.display=show?"":"none"}
function toggleHide(theTrigger,theId,expandedText,collapsedText){var target=document.getElementById(theId);if(target.className.indexOf("hidex")>-1){addClassName(target,"hidex",false);addClassName(target,"showx",true);addClassName(theTrigger,"hidex",false);theTrigger.innerHTML=expandedText}else{addClassName(target,"hidex",true);addClassName(theTrigger,"hidex",true);addClassName(target,"showx",false);theTrigger.innerHTML=collapsedText}};function logoff(){if(document.all)if(window.screenTop>9999)window.location.href="/memberLogging.do";else;};var Prototype={Version:"1.4.0_pre4",emptyFunction:function(){},K:function(x){return x}};var Class={create:function(){return function(){this.initialize.apply(this,arguments)}}};var Abstract=new Object;Object.extend=function(destination,source){for(property in source)destination[property]=source[property];return destination};Function.prototype.bind=function(object){var __method=this;return function(){return __method.apply(object,arguments)}};
Function.prototype.bindAsEventListener=function(object){var __method=this;return function(event){return __method.call(object,event||window.event)}};var Try={these:function(){var returnValue;for(var i=0;i<arguments.length;i++){var lambda=arguments[i];try{returnValue=lambda();break}catch(e){}}return returnValue}};Object.extend(String.prototype,{stripTags:function(){return this.replace(/<\/?[^>]+>/gi,"")},unescapeHTML:function(){var div=document.createElement("div");div.innerHTML=this.stripTags();return div.childNodes[0].nodeValue}});
function $(){var elements=new Array;for(var i=0;i<arguments.length;i++){var element=arguments[i];if(typeof element=="string")element=document.getElementById(element);if(arguments.length==1)return element;elements.push(element)}return elements}var Ajax={getTransport:function(){return Try.these(function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")},function(){return new XMLHttpRequest})||false}};Ajax.Base=function(){};
Ajax.Base.prototype={setOptions:function(options){this.options={method:"post",asynchronous:true,parameters:""};Object.extend(this.options,options||{})},responseIsSuccess:function(){return this.transport.status==undefined||this.transport.status==0||this.transport.status>=200&&this.transport.status<300},responseIsFailure:function(){return!this.responseIsSuccess()}};Ajax.Request=Class.create();Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];
Ajax.Request.prototype=Object.extend(new Ajax.Base,{initialize:function(url,options){this.transport=Ajax.getTransport();this.setOptions(options);this.request(url)},request:function(url){var parameters=this.options.parameters||"";if(parameters.length>0)parameters+="&_=";try{if(this.options.method=="get")url+="?"+parameters;this.transport.open(this.options.method,url,this.options.asynchronous);if(this.options.asynchronous){this.transport.onreadystatechange=this.onStateChange.bind(this);setTimeout(function(){this.respondToReadyState(1)}.bind(this),
10)}this.setRequestHeaders();var body=this.options.postBody?this.options.postBody:parameters;this.transport.send(this.options.method=="post"?body:null)}catch(e){}},setRequestHeaders:function(){var requestHeaders=["X-Requested-With","XMLHttpRequest","X-Prototype-Version",Prototype.Version];if(this.options.method=="post"){requestHeaders.push("Content-type","application/x-www-form-urlencoded");if(this.transport.overrideMimeType)requestHeaders.push("Connection","close")}if(this.options.requestHeaders)requestHeaders.push.apply(requestHeaders,
this.options.requestHeaders);for(var i=0;i<requestHeaders.length;i+=2)this.transport.setRequestHeader(requestHeaders[i],requestHeaders[i+1])},onStateChange:function(){var readyState=this.transport.readyState;if(readyState!=1)this.respondToReadyState(this.transport.readyState)},respondToReadyState:function(readyState){var event=Ajax.Request.Events[readyState];if(event=="Complete")(this.options["on"+this.transport.status]||this.options["on"+(this.responseIsSuccess()?"Success":"Failure")]||Prototype.emptyFunction)(this.transport);
(this.options["on"+event]||Prototype.emptyFunction)(this.transport);if(event=="Complete")this.transport.onreadystatechange=Prototype.emptyFunction}});if(!window.Element)var Element=new Object;
Object.extend(Element,{toggle:function(){for(var i=0;i<arguments.length;i++){var element=$(arguments[i]);element.style.display=element.style.display=="none"?"":"none"}},hide:function(){for(var i=0;i<arguments.length;i++){var element=$(arguments[i]);element.style.display="none"}},show:function(){for(var i=0;i<arguments.length;i++){var element=$(arguments[i]);element.style.display=""}},remove:function(element){element=$(element);element.parentNode.removeChild(element)},getHeight:function(element){element=
$(element);return element.offsetHeight},hasClassName:function(element,className){element=$(element);if(!element)return;var a=element.className.split(" ");for(var i=0;i<a.length;i++)if(a[i]==className)return true;return false},addClassName:function(element,className){element=$(element);Element.removeClassName(element,className);element.className+=" "+className},removeClassName:function(element,className){element=$(element);if(!element)return;var newClassName="";var a=element.className.split(" ");for(var i=
0;i<a.length;i++)if(a[i]!=className){if(i>0)newClassName+=" ";newClassName+=a[i]}element.className=newClassName},cleanWhitespace:function(element){var element=$(element);for(var i=0;i<element.childNodes.length;i++){var node=element.childNodes[i];if(node.nodeType==3&&!/\S/.test(node.nodeValue))Element.remove(node)}}});if(!window.Event)var Event=new Object;
Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(event){return event.target||event.srcElement},isLeftClick:function(event){return event.which&&event.which==1||event.button&&event.button==1},pointerX:function(event){return event.pageX||event.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)},pointerY:function(event){return event.pageY||event.clientY+(document.documentElement.scrollTop||
document.body.scrollTop)},stop:function(event){if(event.preventDefault){event.preventDefault();event.stopPropagation()}else event.returnValue=false},findElement:function(event,tagName){var element=Event.element(event);while(element.parentNode&&(!element.tagName||element.tagName.toUpperCase()!=tagName.toUpperCase()))element=element.parentNode;return element},observers:false,_observeAndCache:function(element,name,observer,useCapture){if(!this.observers)this.observers=[];if(element.addEventListener){this.observers.push([element,
name,observer,useCapture]);element.addEventListener(name,observer,useCapture)}else if(element.attachEvent){this.observers.push([element,name,observer,useCapture]);element.attachEvent("on"+name,observer)}},unloadCache:function(){if(!Event.observers)return;for(var i=0;i<Event.observers.length;i++){Event.stopObserving.apply(this,Event.observers[i]);Event.observers[i][0]=null}Event.observers=false},observe:function(element,name,observer,useCapture){var element=$(element);useCapture=useCapture||false;
if(name=="keypress"&&(/Konqueror|Safari|KHTML/.test(navigator.userAgent)||element.attachEvent))name="keydown";this._observeAndCache(element,name,observer,useCapture)},stopObserving:function(element,name,observer,useCapture){element=typeof element=="string"?$(element):element;useCapture=useCapture||false;if(name=="keypress"&&(/Konqueror|Safari|KHTML/.test(navigator.userAgent)||element.detachEvent))name="keydown";if(element.removeEventListener)element.removeEventListener(name,observer,useCapture);else if(element.detachEvent)element.detachEvent("on"+
name,observer)}});Event.observe(window,"unload",Event.unloadCache,false);
var Position={cumulativeOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent}while(element);return[valueL,valueT]},clone:function(source,target){source=$(source);target=$(target);target.style.position="absolute";var offsets=this.cumulativeOffset(source);target.style.top=offsets[1]+"px";target.style.left=offsets[0]+"px";target.style.width=source.offsetWidth+"px";target.style.height=source.offsetHeight+"px"}};
Effect={};Effect.Transitions={};Effect.Base=function(){};
Effect.Base.prototype={setOptions:function(options){this.options=Object.extend({transition:Effect.Transitions.sinoidal,duration:1,fps:25,sync:false,from:0,to:1},options||{})},start:function(options){this.setOptions(options||{});this.currentFrame=0;this.startOn=(new Date).getTime();this.finishOn=this.startOn+this.options.duration*1E3;if(this.options.beforeStart)this.options.beforeStart(this);if(!this.options.sync)this.loop()},loop:function(){var timePos=(new Date).getTime();if(timePos>=this.finishOn){this.render(this.options.to);
if(this.finish)this.finish();if(this.options.afterFinish)this.options.afterFinish(this);return}var pos=(timePos-this.startOn)/(this.finishOn-this.startOn);var frame=Math.round(pos*this.options.fps*this.options.duration);if(frame>this.currentFrame){this.render(pos);this.currentFrame=frame}this.timeout=setTimeout(this.loop.bind(this),10)},render:function(pos){if(this.options.transition)pos=this.options.transition(pos);pos*=this.options.to-this.options.from;pos+=this.options.from;if(this.options.beforeUpdate)this.options.beforeUpdate(this);
if(this.update)this.update(pos);if(this.options.afterUpdate)this.options.afterUpdate(this)},cancel:function(){if(this.timeout)clearTimeout(this.timeout)}};Abstract.Insertion=function(adjacency){this.adjacency=adjacency};
Abstract.Insertion.prototype={initialize:function(element,content){this.element=$(element);this.content=content;if(this.adjacency&&this.element.insertAdjacentHTML)this.element.insertAdjacentHTML(this.adjacency,this.content);else{this.range=this.element.ownerDocument.createRange();if(this.initializeRange)this.initializeRange();this.fragment=this.range.createContextualFragment(this.content);this.insertContent()}}};var Insertion=new Object;Insertion.After=Class.create();
Insertion.After.prototype=Object.extend(new Abstract.Insertion("afterEnd"),{initializeRange:function(){this.range.setStartAfter(this.element)},insertContent:function(){this.element.parentNode.insertBefore(this.fragment,this.element.nextSibling)}});Effect.Fade=function(element){options=Object.extend({from:1,to:0,afterFinish:function(effect){Element.hide(effect.element);effect.setOpacity(1)}},arguments[1]||{});new Effect.Opacity(element,options)};
Effect.Appear=function(element){options=Object.extend({from:0,to:1,beforeStart:function(effect){effect.setOpacity(0);Element.show(effect.element)},afterUpdate:function(effect){Element.show(effect.element)}},arguments[1]||{});new Effect.Opacity(element,options)};Effect.Opacity=Class.create();
Object.extend(Object.extend(Effect.Opacity.prototype,Effect.Base.prototype),{initialize:function(element){this.element=$(element);options=Object.extend({from:0,to:1},arguments[1]||{});this.start(options)},update:function(position){this.setOpacity(position)},setOpacity:function(opacity){opacity=opacity==1?0.99999:opacity;this.element.style.opacity=opacity;this.element.style.filter="alpha(opacity:"+opacity*100+")"}});
Element.collectTextNodesIgnoreClass=function(element,ignoreclass){var children=$(element).childNodes;var text="";var classtest=new RegExp("^([^ ]+ )*"+ignoreclass+"( [^ ]+)*$","i");for(var i=0;i<children.length;i++)if(children[i].nodeType==3)text+=children[i].nodeValue;else if(!children[i].className.match(classtest)&&children[i].hasChildNodes())text+=Element.collectTextNodesIgnoreClass(children[i],ignoreclass);return text};var Autocompleter={};Autocompleter.Base=function(){};
Autocompleter.Base.prototype={base_initialize:function(element,update,options){this.element=$(element);this.update=$(update);this.has_focus=false;this.changed=false;this.active=false;this.index=0;this.entry_count=0;if(this.setOptions)this.setOptions(options);else this.options={};this.options.tokens=this.options.tokens||new Array;this.options.frequency=this.options.frequency||0.8;this.options.min_chars=this.options.min_chars||2;this.options.onShow=this.options.onShow||function(element,update){if(!update.style.position||
update.style.position=="absolute"){update.style.position="absolute";var offsets=Position.cumulativeOffset(element);var safariFixWidth=navigator.appVersion.indexOf("AppleWebKit")>0?document.getElementById("page").offsetLeft+6:0;update.style.left=offsets[0]+safariFixWidth+"px";update.style.top=offsets[1]+element.offsetHeight+"px";update.style.width=element.offsetWidth+"px"}new Effect.Appear(update,{duration:0.15})};this.options.onHide=this.options.onHide||function(element,update){new Effect.Fade(update,
{duration:0.15})};if(this.options.indicator)this.indicator=$(this.options.indicator);if(typeof this.options.tokens=="string")this.options.tokens=new Array(this.options.tokens);this.observer=null;Element.hide(this.update);Event.observe(this.element,"blur",this.onBlur.bindAsEventListener(this));Event.observe(this.element,"keypress",this.onKeyPress.bindAsEventListener(this))},show:function(){if(this.update.style.display=="none"){this.options.onShow(this.element,this.update);if(this.update.scrollHeight>
this.update.clientHeight)this.update.scrollTop=0}if(!this.iefix&&navigator.appVersion.indexOf("MSIE")>0&&this.update.style.position=="absolute"){new Insertion.After(this.update,'<iframe id="'+this.update.id+'_iefix" '+'style="display:none;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=50);" '+'src="javascript:false;" frameborder="1" scrolling="yes" height="20"> </iframe>');this.iefix=$(this.update.id+"_iefix")}if(this.iefix){Position.clone(this.update,this.iefix);this.iefix.style.zIndex=1;
this.update.style.zIndex=2}},hide:function(){if(this.update.style.display=="")this.options.onHide(this.element,this.update);if(this.iefix)Element.hide(this.iefix);this.removeCloseButton()},startIndicator:function(){if(this.indicator)Element.show(this.indicator)},stopIndicator:function(){if(this.indicator)Element.hide(this.indicator)},onKeyPress:function(event){if(this.active)switch(event.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.select_entry();Event.stop(event);case Event.KEY_ESC:this.hide();
this.active=false;return;case Event.KEY_LEFT:case Event.KEY_RIGHT:return;case Event.KEY_UP:this.mark_previous();this.renderKey();if(navigator.appVersion.indexOf("AppleWebKit")>0)Event.stop(event);return;case Event.KEY_DOWN:this.mark_next();this.renderKey();if(navigator.appVersion.indexOf("AppleWebKit")>0)Event.stop(event);return}else if(event.keyCode==Event.KEY_TAB||event.keyCode==Event.KEY_RETURN)return;this.changed=true;this.has_focus=true;if(this.observer)clearTimeout(this.observer);this.observer=
setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1E3)},onHover:function(event){var element=Event.findElement(event,"LI");if(this.index!=element.autocompleteIndex){this.index=element.autocompleteIndex;this.render()}Event.stop(event)},onClick:function(event){var element=Event.findElement(event,"LI");this.index=element.autocompleteIndex;this.select_entry();Event.stop(event);if(navigator.appVersion.indexOf("AppleWebKit")>0&&this.update.scrollHeight>this.update.clientHeight&&this.safariBlurEventFired){this.safariBlurEventFired=
false;var scrollbarWidth=this.update.offsetWidth-this.update.clientWidth;var offsets=Position.cumulativeOffset(this.update);var scrollLeft=offsets[0]+this.update.clientWidth;var scrollRight=scrollLeft+scrollbarWidth;var scrollTop=offsets[1];var scrollBottom=scrollTop+this.update.clientHeight;var xClick=event.clientX;var yClick=event.clientY;if(xClick>=scrollLeft&&xClick<scrollRight&&yClick>=scrollTop&&yClick<scrollBottom){this.hasFocus=true;this.active=true}else{setTimeout(this.hide.bind(this),250);
this.hasFocus=false;this.active=false}}},onBlur:function(event){if(navigator.appVersion.match(/\bMSIE\b/)&&!window.opera&&this.update.style.display!="none"){var verticalScrollbarWidth=this.update.offsetWidth-this.update.clientWidth-this.update.clientLeft-(parseInt(this.update.currentStyle["borderRightWidth"])||0);if(verticalScrollbarWidth){var x=event.clientX,y=event.clientY,parent=this.update.offsetParent,sbLeft=this.update.offsetLeft+this.update.clientLeft+this.update.clientWidth,sbTop=this.update.offsetTop+
this.update.clientTop,sbRight=sbLeft+verticalScrollbarWidth,sbBottom=sbTop+this.update.clientHeight;while(parent){var offs=parent.offsetLeft+parent.clientLeft,scrollOffs=offs-parent.scrollLeft;sbLeft=(sbLeft+=scrollOffs)<offs?offs:sbLeft;sbRight=(sbRight+=scrollOffs)<offs?offs:sbRight;offs=parent.offsetTop+parent.clientTop;scrollOffs=offs-parent.scrollTop;sbTop=(sbTop+=scrollOffs)<offs?offs:sbTop;sbBottom=(sbBottom+=scrollOffs)<offs?offs:sbBottom;parent=parent.offsetParent}if(x>=sbLeft&&x<sbRight&&
y>=sbTop&&y<sbBottom){this.element.setActive();return}if(this.update.scrollWidth>this.update.clientWidth){var horz_scrollbarLeft=this.update.offsetLeft;var horz_scrollbarRight=this.update.offsetLeft+this.update.offsetWidth;var horz_scrollbarTop=this.update.offsetTop+this.update.clientHeight;var horz_scrollbarBottom=this.update.offsetTop+this.update.offsetHeight;if(x>=horz_scrollbarLeft&&x<horz_scrollbarRight&&y>=horz_scrollbarTop&&y<horz_scrollbarBottom){this.element.setActive();return}}}}if(navigator.appVersion.indexOf("AppleWebKit")>
0)if(this.update.scrollHeight>this.update.clientHeight){this.safariBlurEventFired=true;return}setTimeout(this.hide.bind(this),250);this.hasFocus=false;this.active=false},addCloseButton:function(){var closeButtonDiv=document.createElement("div");closeButtonDiv.id="closeButtonDiv";Event.observe(closeButtonDiv,"click",this.onClick.bindAsEventListener(this));closeButtonDiv.className="auto_complete_close";closeButtonDiv.innerHTML='<a href="#">Close</a>';var theWidth=this.update.clientWidth;var offsets=
Position.cumulativeOffset(this.update);var leftPosition=offsets[0];var scrollTop=offsets[1]+200;closeButtonDiv.style.width=theWidth+"px";closeButtonDiv.style.left=leftPosition+"px";closeButtonDiv.style.top=scrollTop+"px";this.update.parentNode.appendChild(closeButtonDiv)},removeCloseButton:function(){if(document.getElementById("closeButtonDiv")!=null)this.update.parentNode.removeChild(document.getElementById("closeButtonDiv"))},render:function(){if(this.entry_count>0){for(var i=0;i<this.entry_count;i++)this.index==
i?Element.addClassName(this.get_entry(i),"selected"):Element.removeClassName(this.get_entry(i),"selected");if(this.has_focus){this.show();this.active=true}}else this.hide();if(navigator.appVersion.indexOf("AppleWebKit")>0&&document.getElementById("closeButtonDiv")==null&&this.update.scrollHeight>this.update.clientHeight)this.addCloseButton()},renderKey:function(){if(this.entry_count>0){for(var i=0;i<this.entry_count;i++)this.index==i?Element.addClassName(this.get_entry(i),"selected"):Element.removeClassName(this.get_entry(i),
"selected");if(this.has_focus){if(this.get_current_entry().scrollIntoView)this.get_current_entry().scrollIntoView(false);this.show();this.active=true}}else this.hide()},mark_previous:function(){if(this.index>0)this.index--;else this.index=this.entry_count-1},mark_next:function(){if(this.index<this.entry_count-1)this.index++;else this.index=0},get_entry:function(index){return this.update.firstChild.childNodes[index]},get_current_entry:function(){return this.get_entry(this.index)},select_entry:function(){this.active=
false;value=Element.collectTextNodesIgnoreClass(this.get_current_entry(),"informal").unescapeHTML();this.updateElement(value);this.element.focus()},updateElement:function(value){var last_token_pos=this.findLastToken();if(last_token_pos!=-1){var new_value=this.element.value.substr(0,last_token_pos+1);var whitespace=this.element.value.substr(last_token_pos+1).match(/^\s+/);if(whitespace)new_value+=whitespace[0];this.element.value=new_value+value}else this.element.value=value},updateChoices:function(choices){if(!this.changed&&
this.has_focus){this.update.innerHTML=choices;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.firstChild);if(this.update.firstChild&&this.update.firstChild.childNodes){this.entry_count=this.update.firstChild.childNodes.length;for(var i=0;i<this.entry_count;i++){entry=this.get_entry(i);entry.autocompleteIndex=i;this.addObservers(entry)}}else this.entry_count=0;this.stopIndicator();this.index=0;this.render()}},addObservers:function(element){Event.observe(element,"mouseover",
this.onHover.bindAsEventListener(this));Event.observe(element,"click",this.onClick.bindAsEventListener(this))},onObserverEvent:function(){this.changed=false;if(this.getEntry().length>=this.options.min_chars){this.startIndicator();this.getUpdatedChoices()}else{this.active=false;this.hide()}},getEntry:function(){var token_pos=this.findLastToken();if(token_pos!=-1)var ret=this.element.value.substr(token_pos+1).replace(/^\s+/,"").replace(/\s+$/,"");else var ret=this.element.value;return/\n/.test(ret)?
"":ret},findLastToken:function(){var last_token_pos=-1;for(var i=0;i<this.options.tokens.length;i++){var this_token_pos=this.element.value.lastIndexOf(this.options.tokens[i]);if(this_token_pos>last_token_pos)last_token_pos=this_token_pos}return last_token_pos}};Ajax.Autocompleter=Class.create();
Ajax.Autocompleter.prototype=Object.extend(new Autocompleter.Base,Object.extend(new Ajax.Base,{initialize:function(element,update,url,options){this.base_initialize(element,update,options);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.method="post";this.url=url},getUpdatedChoices:function(){entry=encodeURIComponent(this.element.name)+"="+encodeURIComponent(this.getEntry());this.options.parameters=this.options.callback?this.options.callback(this.element,
entry):entry;new Ajax.Request(this.url,this.options)},onComplete:function(request){this.updateChoices(request.responseText)}}));Autocompleter.Local=Class.create();
Autocompleter.Local.prototype=Object.extend(new Autocompleter.Base,{initialize:function(element,update,array,options){this.base_initialize(element,update,options);this.options.array=array},getUpdatedChoices:function(){this.updateChoices(this.options.selector(this))},setOptions:function(options){this.options=Object.extend({choices:10,partial_search:true,partial_chars:2,ignore_case:true,full_search:false,selector:function(instance){var ret=new Array;var partial=new Array;var entry=instance.getEntry();
var count=0;for(var i=0;i<instance.options.array.length&&ret.length<instance.options.choices;i++){var elem=instance.options.array[i];var found_pos=instance.options.ignore_case?elem.toLowerCase().indexOf(entry.toLowerCase()):elem.indexOf(entry);if(found_pos==0&&elem.length==entry.length)continue;else if(found_pos==0)ret.push("<li><strong>"+elem.substr(0,entry.length)+"</strong>"+elem.substr(entry.length)+"</li>");else if(entry.length>=instance.options.partial_chars&&instance.options.partial_search&&
found_pos!=-1){if(!instance.options.full_search&&!/\s/.test(elem.substr(found_pos-1,1)))continue;partial.push("<li>"+elem.substr(0,found_pos)+"<strong>"+elem.substr(found_pos,entry.length)+"</strong>"+elem.substr(found_pos+entry.length)+"</li>")}}if(partial.length)ret=ret.concat(partial.slice(0,instance.options.choices-ret.length));return"<ul>"+ret.join("")+"</ul>"}},options||{})}});Ajax.RAAutocompleter=Class.create();
Ajax.RAAutocompleter.prototype=Object.extend(new Autocompleter.Base,Object.extend(new Ajax.Base,{initialize:function(element,update,url,options,additionalAlias){this.base_initialize(element,update,options);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.method="post";this.url=url;this.additionalAlias=additionalAlias},getUpdatedChoices:function(){var textValue=encodeURIComponent(this.getEntry());entry=encodeURIComponent(this.element.name)+"="+textValue;
if(this.additionalAlias["alias"])entry+="&"+this.additionalAlias["alias"]+"="+textValue;if(this.additionalAlias["paramAliases"]){var paramAliases=this.additionalAlias["paramAliases"];for(i=0;i<paramAliases.length;i++){var element=$(paramAliases[i]["element"]);entry+="&"+paramAliases[i]["alias"]+"="+element.value}}this.options.parameters=this.options.callback?this.options.callback(this.element,entry):entry;new Ajax.Request(this.url,this.options)},onComplete:function(request){try{this.updateChoices(request.responseText);
var newHeight=this.update.firstChild.offsetHeight>200?200:this.update.firstChild.offsetHeight;if(this.entry_count>0)this.update.style.height=newHeight+"px";else this.update.style.display="none"}catch(e){this.update.style.display="none"}},select_entry:function(){try{this.active=false;var state=this.getAttriuteValue("state");var nameWithState=this.getAttriuteValue("duplicated");value=Element.collectTextNodesIgnoreClass(this.get_current_entry(),"informal").unescapeHTML();if(nameWithState=="true")value=
value.substring(0,value.length-state.length-1);this.updateElement(value);$("pstate").value=state;window.setTimeout(changeState($("pstate").options[$("pstate").selectedIndex].value),0);this.element.focus()}catch(e){}},getAttriuteValue:function(attrName){var node=this.get_current_entry();if(node.attributes)for(var j=0;j<node.attributes.length;j++)if(node.attributes[j].nodeName.toLowerCase()==attrName)return node.attributes[j].nodeValue;return""}}));Ajax.DropdownGroup=Class.create();
Ajax.DropdownGroup.prototype={initialize:function(){this.originalOnChange=null},register:function(groupName,dropdown){var dropdowns=this[groupName];if(!dropdowns){dropdowns=new Array;this[groupName]=dropdowns;var f=$(groupName).onchange;if(f)this.originalOnChange=f.bind($(groupName))}dropdowns.push(dropdown)},onChange:function(groupName){if(this.originalOnChange)this.originalOnChange();var dropdowns=this[groupName];if(dropdowns)for(var i=0;i<dropdowns.length;i++)dropdowns[i].onChange()}};
var __DropwdownManager=new Ajax.DropdownGroup;Ajax.Dropdown=Class.create();
Ajax.Dropdown.prototype=Object.extend(new Ajax.Base,{initialize:function(srcElementName,srcAlias,targetElementName,url){this.srcElementName=srcElementName;this.srcAlias=srcAlias;this.targetElementName=targetElementName;this.url=url;this.options={};this.options.onComplete=this.onComplete.bind(this);this.options.asynchronous=true;this.options.method="post";__DropwdownManager.register(srcElementName,this);$(srcElementName).onchange=function(){__DropwdownManager.onChange(srcElementName)}},onComplete:function(request){eval(request.responseText);
showHiddenOptions($(this.srcElementName),$(this.srcElementName).value!="")},onChange:function(){var selectedValue=$(this.srcElementName).value;if(selectedValue==null||selectedValue==""){showHiddenOptions($(this.srcElementName),false);return false}this.options.parameters=encodeURIComponent(this.srcAlias)+"="+encodeURIComponent(selectedValue)+"&targetUIID="+this.targetElementName;new Ajax.Request(this.url,this.options)}});Ajax.DynamicHTML=Class.create();
Ajax.DynamicHTML.prototype=Object.extend(new Ajax.Base,{initialize:function(url){this.url=url;this.options={};this.options.onComplete=this.onComplete.bind(this);this.options.asynchronous=true;this.options.method="post"},onComplete:function(request){eval(request.responseText)},submit:function(p){this.options.parameters=p;new Ajax.Request(this.url,this.options)}});
function browserInfo(){var browserName="Unknown";var browserCode="Unknown";var browserAgent="Unknown";var browserPlatForm="Unknown";var browserVersion="-1";if(navigator){browserName=navigator.appName;browserCode=navigator.appCodeName;browserAgent=navigator.userAgent;browserPlatForm=navigator.platform;browserVersion=navigator.appVersion}new Ajax.Request("/ajax/browserInfo?name="+browserName+"&version="+browserVersion+"&code="+browserCode+"&agent="+browserAgent+"&platform="+browserPlatForm,{})}
function makeHttpRequest(url,callback_function,return_xml,alertError){var http_request,response,i;var activex_ids=["MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];if(window.XMLHttpRequest){http_request=new XMLHttpRequest;if(http_request.overrideMimeType)http_request.overrideMimeType("text/xml")}else if(window.ActiveXObject)for(i=0;i<activex_ids.length;i++)try{http_request=new ActiveXObject(activex_ids[i])}catch(e){}if(!http_request){if(alertError)alert("Unfortunatelly you browser doesn't support this feature.");
return false}http_request.onreadystatechange=function(){if(http_request.readyState!==4)return false;if(http_request.status!==200){if(alertError)alert("There was a problem with the request.(Code: "+http_request.status+")");return false}if(return_xml)response=http_request.responseXML;else{response=http_request.responseText;if(response=="signin"){document.location="/memberSignInDisplay.do?topTabIndex=MyAccount";return false}}callback_function(response)};http_request.open("GET",url,true);http_request.send(null)}
function raParseXmlData(data){var xmlDoc=null;try{xmlDoc=new ActiveXObject("Msxml2.DOMDocument.3.0");xmlDoc.async="false";xmlDoc.loadXML(data)}catch(e){try{var parser=new DOMParser;xmlDoc=parser.parseFromString(data,"text/xml")}catch(e){}}return xmlDoc};function initTourStates(){updateNumberOfTickets(document.getElementById("numberOfTicketsSearched"))}var FLAT_BY_RANGE_KEY="F";var VARIABLE_BY_RANGE_KEY="V";
function updatePricingTable(){var theTable=document.getElementById("tourPricing");var pricing=new Array;var counter=0;var debug="";var regularPricing=false;var groupPricing=false;var totalNumberOfTickets=getTotalNumberOfTicketsRequested();var totalMoney=0;if(theTable&&theTable.rows){for(ndex=0;ndex<theTable.rows.length;ndex++)if(theTable.rows[ndex].className=="ticketTypeInfo"){var userEnteredQty;for(j=0;j<theTable.rows[ndex].cells.length;j++){var theCell=theTable.rows[ndex].cells[j];if(theCell.className==
"ticketQty"){userEnteredQty=getFirstChildByID(theCell,"qtyTickets").value;if(isNaN(userEnteredQty))userEnteredQty=0;userEnteredQty-=0;theList=getFirstChildByID(theCell,"tickPricing").value;var ticketTypePricing=parsePricing(theList);totalMoney+=ticketTypePricing.calculate(userEnteredQty,totalNumberOfTickets)}}}document.getElementById("totalNumberOfTickets").innerHTML=totalNumberOfTickets;document.getElementById("calcTotal").innerHTML="$"+addDecimals(totalMoney,2);changeTotalCellStatus()}}
function getTotalNumberOfTicketsRequested(){var theTable=document.getElementById("tourPricing");var totalNumberOfTickets=0;if(theTable)for(ndex=0;ndex<theTable.rows.length;ndex++)if(theTable.rows[ndex].className=="ticketTypeInfo"){var userEnteredQty;for(j=0;j<theTable.rows[ndex].cells.length;j++){var theCell=theTable.rows[ndex].cells[j];if(theCell.className=="ticketQty"){userEnteredQty=getFirstChildByID(theCell,"qtyTickets").value;if(isNaN(userEnteredQty))userEnteredQty=0;userEnteredQty-=0;totalNumberOfTickets+=
userEnteredQty}}}return totalNumberOfTickets}function TicketTypePricing(aGroupBaseNumber){this.regularPricing=new Array;this.groupPricing=new Array;this.groupBaseNumber=aGroupBaseNumber;this.debug=method_debug;this.calculate=method_calculate;this.currentRange=null}
function method_debug(){var output="test  ";output+="\n groupBaseNumber "+this.groupBaseNumber;if(this.regularPricing!=null){output+="\n REGULAR PRICING RANGES ";output+="\n aRangeType "+this.regularPricing["feeUnit"];for(i=0;i<this.regularPricing.length;i++){output+="\n rangeLowerLimit : "+this.regularPricing[i]["rangeLowerLimit"];output+=" rangePrice : "+this.regularPricing[i]["rangePrice"]}}if(this.groupPricing!=null){output+=" GROUP PRICING RANGES ";output+="\n aRangeType "+this.groupPricing["feeUnit"];
for(i=0;i<this.groupPricing.length;i++){output+="\n rangeLowerLimit : "+this.groupPricing[i]["rangeLowerLimit"];output+=" rangePrice : "+this.groupPricing[i]["rangePrice"]}}if(this.currentRange!=null){output+="\n currentRange price "+this.currentRange["rangePrice"];output+="\n currentRange lower limit "+this.currentRange["rangeLowerLimit"]}alert(output)}
function method_calculate(numberOfTicketsForTicketType,totalNumberOfTickets){if(this.groupBaseNumber<=totalNumberOfTickets&&this.groupPricing!=null)return calculatePrice(this.groupPricing,numberOfTicketsForTicketType);else return calculatePrice(this.regularPricing,numberOfTicketsForTicketType)}
function calculatePrice(pricingList,quantityRequested){if(quantityRequested==0)return 0;var priceRange=null;var result=null;for(i=0;i<pricingList.length;i++){var thisRange=pricingList[i];var nextRange=pricingList[i+1];if(nextRange==null||i==0&&quantityRequested<thisRange["rangeLowerLimit"]){priceRange=thisRange;break}else if(thisRange["rangeLowerLimit"]<=quantityRequested&&quantityRequested<nextRange["rangeLowerLimit"]){priceRange=thisRange;break}}this.currentRange=priceRange;if(priceRange==null)return null;
else if(pricingList["feeUnit"]==FLAT_BY_RANGE_KEY)return priceRange["rangePrice"];else return roundResult(priceRange["rangePrice"]*quantityRequested)}function roundResult(result){result=result*100;result=Math.round(result);return result/100}
function parsePricingRange(delimitedPricingList,thePriceArray){delimitedList=trimDelimitedList(delimitedPricingList.substring(2,delimitedPricingList.length));var ticketRangeIndicator=delimitedPricingList.substring(0,1);var pricingResults=new Array;thePriceArray["feeUnit"]=ticketRangeIndicator;var result=delimitedList.split(";");for(i=0;i<result.length;i++){var pricingResults=new Array;var pricingInstance=result[i].split("~");pricingResults["rangeLowerLimit"]=pricingInstance[0]-=0;pricingResults["rangePrice"]=
pricingInstance[1]-=0;thePriceArray[i]=pricingResults}return thePriceArray}function getGroupBaseRange(){return document.getElementById("baseNumTickets").innerHTML-=0}
function parsePricing(pricingInfo){var rateTypeList=pricingInfo.split(";|");regularRateDelimitedList=rateTypeList[0];groupRateDelimitedList=rateTypeList[1];var ticketTypePricing=new TicketTypePricing(getGroupBaseRange());var regularPriceArray=new Array;var groupPriceArray=new Array;ticketTypePricing.regularPricing=parsePricingRange(trimDelimitedList(regularRateDelimitedList),regularPriceArray);if(groupRateDelimitedList!=null&&groupRateDelimitedList.length>0)ticketTypePricing.groupPricing=parsePricingRange(trimDelimitedList(groupRateDelimitedList),
groupPriceArray);else ticketTypePricing.groupPricing=null;return ticketTypePricing}function trimDelimitedList(theList){if(theList.substring(0,1)=="|")theList=theList.substring(1,theList.length);if(theList.substring(theList.length-1)==";")return theList.substring(0,theList.length-1);return theList}
function changeTotalCellStatus(){var minNumberOfTicketsAllowed=document.getElementById("minimumNumberOfTickets").innerHTML-=0;var maxNumberOfTicketsAllowed=document.getElementById("maximumNumberOfTickets").innerHTML-=0;var enteredTotal=getCalculatedTotal();fewestAvailable=getFewestAvailable();if(fewestAvailable>-1&&enteredTotal>fewestAvailable||enteredTotal>maxNumberOfTicketsAllowed||enteredTotal<minNumberOfTicketsAllowed)document.getElementById("totalTicketQtyAmount").className="tooMany";else document.getElementById("totalTicketQtyAmount").className=
""}function getFewestAvailable(){var selects=getAllTimeCombos();var fewestAvailable=-1;var numberAvailable=-1;var firstPass=true;for(nDex=0;nDex<selects.length;nDex++)if(selects[nDex].selectedIndex>0){numberAvailable=getNumberAvailable(selects[nDex]);numberAvailable-=0;if(firstPass){fewestAvailable=numberAvailable;firstPass=false}if(numberAvailable<fewestAvailable)fewestAvailable=numberAvailable}return fewestAvailable}
function updateAllComboStatus(totalNumberOfTickets){var selects=getAllTimeCombos();for(test=0;test<selects.length;test++)updateCellStatus(selects[test],totalNumberOfTickets)}function getAllTimeCombos(){return getElementsByClassName(document,"select","timeSelect")}
function calculate(pricing){var total=0;var groupSize=10;var totalNumberOfTickets=calculateTotalTicketQty(pricing);var useGroupPricing=totalNumberOfTickets>=groupSize;var pricingType=null;if(useGroupPricing&&pricing["groupPricing"])pricingType="groupPrice";else if(pricing["regularPricing"])pricingType="regularPrice";else if(pricing["groupPricing"])pricingType="groupPrice";if(pricingType!=null)total=calculateByPricingType(pricing,pricingType);document.getElementById("totalNumberOfTickets").innerHTML=
totalNumberOfTickets;document.getElementById("calcTotal").innerHTML="$"+addDecimals(total,2)}function calculateByPricingType(pricing,pricingType){var total=0;for(i=0;i<pricing.length;i++)total+=pricing[i]["quantity"]*pricing[i][pricingType];return total}function calculateTotalTicketQty(pricing){var result=0;for(i=0;i<pricing.length;i++)result+=pricing[i]["quantity"];return result}
function updateSelect(tourId,cellId){theCombo=getTourTimeCombo(tourId);var theCell=document.getElementById(cellId);var initialSelectedIndex=theCombo.selectedIndex;var initialSelectedValue=theCombo.options[initialSelectedIndex].value;if(initialSelectedValue==cellId){theCombo.selectedIndex=0;appendClassName(theCell,"_slct",false)}else{theCombo.selectedIndex=getSelectedIndex(theCombo,cellId);appendClassName(theCell,"_slct",true)}if(initialSelectedIndex>0)appendClassName(document.getElementById(initialSelectedValue),
"_slct",false);changeTotalCellStatus();return false}
function updateNumberOfTickets(ticketField){if(ticketField==null)return;var numTx=ticketField.value;if(isNaN(numTx)){ticketField.value="";return}var selects=getElementsByClassName(document,"select","timeSelect");if(selects.length==0)return;for(theIndex=0;theIndex<selects.length;theIndex++)updateCellStatus(selects[theIndex],numTx);var maxNumberOfTicketsAllowed=document.getElementById("maximumNumberOfTickets").innerHTML;maxNumberOfTicketsAllowed-=0;if(maxNumberOfTicketsAllowed<numTx)appendClassName(ticketField,
" error",true);else appendClassName(ticketField," error",false)}
function updateButtons(targetSelectBox){var idx=targetSelectBox.options.length;if(idx>0)for(i=0;i<idx;i++)appendClassName(document.getElementById(targetSelectBox.options[i].value),"_slct",false);var theCell=null;if(targetSelectBox.selectedIndex>0){var theCell=document.getElementById(targetSelectBox.options[targetSelectBox.selectedIndex].value);appendClassName(document.getElementById(targetSelectBox.options[targetSelectBox.selectedIndex].value),"_slct",true)}changeTotalCellStatus()}
function getNumberAvailable(theCombo){return extractQtyAvailableFromOptionValue(theCombo.options[theCombo.selectedIndex].value)}function extractQtyAvailableFromOptionValue(theValue){if(theValue!="-1"&&theValue.length>0)return theValue.substring(theValue.indexOf("-")+1,theValue.length)}function unFormatCurrencyAmount(anAmount){var result=anAmount.replace("$","");result-=0;return result}
function updateCellStatus(theCombo,theNumberOfTickets){for(i=1;i<theCombo.options.length;i++){var theCell=document.getElementById(theCombo.options[i].value);if(theCell!=null)updateCell(theCell,theCombo.options[i].value,theNumberOfTickets)}if(theCombo.selectedIndex>0){selectedCell=document.getElementById(theCombo.options[theCombo.selectedIndex].value);appendClassName(selectedCell,"_slct",true)}return}
function updateCell(theCell,theComboValue,requestedNumberOfTickets){var numberOfAvailableTickets=extractQtyAvailableFromOptionValue(theComboValue);numberOfAvailableTickets-=0;var openTimeRange=theCell.className.indexOf("Open")>0?"Open":"";if(requestedNumberOfTickets>numberOfAvailableTickets)theCell.className="tourCell"+openTimeRange+"NotAvailable";else theCell.className="tourCell"+openTimeRange+"Available";return}
function getSearchedTotal(){return document.getElementById("numberOfTicketsSearched").value-=0}function getCalculatedTotal(){return document.getElementById("totalNumberOfTickets").innerHTML-=0}
function updateComboStatus(theCombo){var newClassName="validTime";messageContainer=theCombo.parentNode;messageText=getFirstChildByTagName(messageContainer,"SPAN","span");var totalNumberRequired=getSearchedTotal();var totalNumberAvailable=getNumberAvailable(theCombo);var message;if(totalNumberRequired>totalNumberAvailable){var plural=totalNumberAvailable>1?"s":"";newClassName="invalidTime";message=totalNumberAvailable+" ticket"+plural+" available"}else{newClassName="validTime";message=""}if(theCombo.selectedIndex>
0){resetComboIndicator(messageContainer,messageText);appendClassName(messageContainer,newClassName,true);messageText.innerHTML=message}else resetComboIndicator(messageContainer,messageText);return}function resetComboIndicator(messageContainer,messageText){appendClassName(messageContainer,"validTime",false);appendClassName(messageContainer,"invalidTime",false);messageText.innerHTML=""}function getTourTimeCombo(tourId){return document.getElementById(tourId+"timeSelect")}
function getSelectedIndex(targetSelectBox,theValue){var idx=targetSelectBox.options.length;if(idx>0)for(i=0;i<idx;i++)if(targetSelectBox.options[i].value==theValue)return i}
function getElementsByClassName(oElm,strTagName,strClassName){var arrElements=strTagName=="*"&&oElm.all?oElm.all:oElm.getElementsByTagName(strTagName);var arrReturnElements=new Array;strClassName=strClassName.replace(/\-/g,"\\-");var oRegExp=new RegExp("(^|\\s)"+strClassName+"(\\s|$)");var oElement;for(var i=0;i<arrElements.length;i++){oElement=arrElements[i];if(oRegExp.test(oElement.className))arrReturnElements.push(oElement)}return arrReturnElements}
function appendClassName(theNode,theClassName,doAdd){if(theNode!=null){existingClassName=theNode.className;theNode.className=appendWord(existingClassName,theClassName,doAdd)}return theNode!=null&&existingClassName!=theNode.className}function appendWord(thePhrase,theWord,doAdd){matchWordRegExpr=new RegExp("\\s?\\b"+theWord+"\\b");if(thePhrase==null)thePhrase="";if(doAdd==true){if(!matchWordRegExpr.test(thePhrase))thePhrase+=theWord}else thePhrase=thePhrase.replace(theWord,"");return thePhrase}
function getFirstChildByTagName(theNode,byTagName,orTagName){var theFirstChild=null;var theChildren=theNode.childNodes;for(nDex=0;nDex<theChildren.length;nDex++)if(theChildren[nDex].tagName==byTagName||theChildren[nDex].tagName==orTagName){theFirstChild=theChildren[nDex];break}return theFirstChild}
function getFirstChildByID(theNode,theId){var theChild=null;var theChildren=theNode.childNodes;for(nDex=0;nDex<theChildren.length;nDex++)if(theChildren[nDex].id==theId){theChild=theChildren[nDex];break}return theChild}DECIMAL_SEPARATOR=".";
function addDecimals(numberValue,decimalrequired){numberValue=new String(numberValue);var tmpDecimalPortion="";var tmpWholeNumberPortion="";if(numberValue==null||numberValue=="")return numberValue;if(decimalrequired==null||typeof decimalrequired=="string")decimalrequired=1;if(numberValue.lastIndexOf(DECIMAL_SEPARATOR)>-1){var numberLength=numberValue.length;var decimalPlacePos=numberValue.lastIndexOf(DECIMAL_SEPARATOR);tmpDecimalPortion=numberValue.substring(decimalPlacePos,numberLength);tmpWholeNumberPortion=
numberValue.substring(0,decimalPlacePos);var decimalPortion="";if(tmpDecimalPortion.length-1>decimalrequired)decimalPortion=tmpDecimalPortion.substring(0,decimalrequired+1);else if(tmpDecimalPortion.length-1<decimalrequired){var dec="";for(var i=0;i<decimalrequired-(tmpDecimalPortion.length-1);i++)dec+="0";decimalPortion=tmpDecimalPortion+dec}else decimalPortion=tmpDecimalPortion;return tmpWholeNumberPortion+decimalPortion}else{var dec=".";if(decimalrequired>0)for(var i=0;i<decimalrequired;i++)dec+=
"0";return numberValue+dec}}
function validateAndUpdatePricingTable(ticketTypeQtyField,ticketTypeID,ticketTypeName,passRequired){var ticketQty;var formTableId;if(isNaN(ticketTypeQtyField.value)||ticketTypeQtyField.value=="")return;else{ticketTypeQtyField.value=Math.round(Math.abs(ticketTypeQtyField.value));ticketQty=ticketTypeQtyField.value}if(passRequired){if(ticketTypeQtyField.value>99)show99LimitationError(ticketTypeQtyField,ticketTypeID,ticketTypeName,passRequired);formTableId="passNumbersTable_"+ticketTypeID;theFormTable=
document.getElementById(formTableId);if(theFormTable!=null){if(theFormTable.getElementsByTagName("TBODY").length>1){tableRows=theFormTable.getElementsByTagName("TBODY").item(1).getElementsByTagName("TR");changeInLength=ticketQty-tableRows.length;for(removeDex=0;removeDex<Math.abs(changeInLength);removeDex++)if(changeInLength>0)addFormRow_tour(formTableId,null,99);else deleteRow_tour(tableRows[tableRows.length-1])}if(ticketQty>0)theFormTable.style.display="";else theFormTable.style.display="none"}}updatePricingTable()}
function addFormRow_tour(formTableId,countInputId,maxRows){theFormTable=document.getElementById(formTableId);if(theFormTable!=null){allTableRows=theFormTable.getElementsByTagName("TR");entryCount=theFormTable.getElementsByTagName("TBODY").item(1).getElementsByTagName("TR").length;if(isNaN(maxRows))maxRows=30;var originalRow=allTableRows.item(1);if(originalRow!=null&&entryCount<maxRows){newRow=originalRow.cloneNode(true);newRow.style.display="";if(newRow.innerHTML!=null&&newRow.innerHTML!=originalRow.innerHTML){var selects=
originalRow.getElementsByTagName("SELECT");var newSelects=newRow.getElementsByTagName("SELECT");for(index=0;selects!=null&&index<selects.length;index++){var select=selects[index];var options=select.getElementsByTagName("OPTION");for(opIndex=0;options!=null&&opIndex<options.length;opIndex++)if(options[opIndex].getAttribute("selected"))newSelects[index].options[opIndex].setAttribute("selected",options[opIndex].getAttribute("selected"))}}addedRow=theFormTable.getElementsByTagName("TBODY").item(1).appendChild(newRow)}}}
function deleteRow_tour(rowObj){if(rowObj!=null)rowObj.parentNode.removeChild(rowObj)}
function show99LimitationError(ticketTypeQtyField,ticketTypeID,ticketTypeName,passRequired){theErrorDiv=document.getElementById("tourStatusJSMessage");if(theErrorDiv!=null){theErrorDiv.innerHTML="A maximum of 99 Pass Numbers can be input for ticket type: "+ticketTypeName+". <br>If you have more than 99 unique passes to enter, please input the pass numbers, click the Book Tour button to add the order to the Cart, and make another reservation once the order is in the Cart.";theErrorDiv.style.display=
""}ticketTypeQtyField.style.background="red";ticketTypeQtyField.value=99}
function disableEnterKey(ticketTypeQtyField,ticketTypeID,e,passRequired){var key;var returnValue=true;if(window.event)key=window.event.keyCode;else key=e.which;if(key==13&&passRequired)if(isNaN(ticketTypeQtyField.value)||ticketTypeQtyField.value=="")return false;else{ticketTypeQtyField.value=Math.round(Math.abs(ticketTypeQtyField.value));ticketQty=ticketTypeQtyField.value;formTableId="passNumbersTable_"+ticketTypeID;theFormTable=document.getElementById(formTableId);if(theFormTable!=null)if(theFormTable.getElementsByTagName("TBODY").length>
1){tableRows=theFormTable.getElementsByTagName("TBODY").item(1).getElementsByTagName("TR");if(ticketQty!=tableRows.length)returnValue=false}}return returnValue};function updatePermitPricingTable(personTypeQtyField){if(isNaN(personTypeQtyField.value)){personTypeQtyField.value="";return}calculateTotalPriceAndQty()}function calculateStayLength(){var entryDate=readDate(document.getElementById("entrydateid").value);var exitDate=readDate(document.getElementById("exitdateid").value);var days=(exitDate-entryDate)/(1E3*60*60*24)+1;document.getElementById("#ofdaysid").value=days}
function calculateTotalPriceAndQty(){var theTable=document.getElementById("formSection");var totalMoney=0;var totalPricePerPersonType=0;var totalNumberOfPeople=0;var personTypeId;var entryDateInput="";var exitDateInputValue="";var stayLenght="";var theCell;var groupSizePerPersonPerStay=false;var countEntryDateRows=0;var rates=null;var dayOfEntryDate=null;var atLeastOneNegative=false;if(theTable&&theTable.rows){for(ndex=0;ndex<theTable.rows.length;ndex++){if(theTable.rows[ndex].id=="entryRowId"){groupSizePerPersonPerStay=
true;countEntryDateRows++;var stayLenghtField;for(j=0;j<theTable.rows[ndex].cells.length;j++){theCell=theTable.rows[ndex].cells[j];if(getChildByID(theCell,"entrydateid"))entryDateInput=getChildByID(theCell,"entrydateid").value;if(getChildByID(theCell,"#ofdaysid")){stayLenghtField=getChildByID(theCell,"#ofdaysid");stayLenght=stayLenghtField.value}}var staylenghtInput=stayLenght.replace(/^\s+|\s+$/g,"");if(isNaN(staylenghtInput)){stayLenghtField.value="";return}var entryDate=readDate(entryDateInput);
if(entryDate&&staylenghtInput!=""){entryDate.setDate(entryDate.getDate()+Number(staylenghtInput)-1);exitDateInputValue=toDateString(entryDate);entryDate=readDate(entryDateInput)}else exitDateInputValue="";var allRowDivs=theTable.rows[ndex].getElementsByTagName("DIV");for(i=0;i<allRowDivs.length;i++){if(allRowDivs[i].id=="exitDateDivId")allRowDivs[i].innerHTML=exitDateInputValue;if(allRowDivs[i].id=="removebuttondiv")allRowDivs[i].style.display=countEntryDateRows>1?"":"none"}}if(theTable.rows[ndex].className==
"personTypeInfo"){var userEnteredQty=0;for(j=0;j<theTable.rows[ndex].cells.length;j++){theCell=theTable.rows[ndex].cells[j];if(theCell.className=="personQty"){userEnteredQty=getChildByID(theCell,"qtyPersonsId").value*1;if(userEnteredQty<0)atLeastOneNegative=true;totalNumberOfPeople+=userEnteredQty;if(getChildByID(theCell,"personPricing")){var personTypePricing=getChildByID(theCell,"personPricing").value;personTypeId=getChildByID(theCell,"personTypeId").value;var floatTotalPPPT=0;if(groupSizePerPersonPerStay==
true){if(entryDate!=null){var dayOfEntryDate=entryDate.getDay();rates=getChildByID(theCell,"personPricingPerStay").value.split(",");for(i=0;i<Number(staylenghtInput);i++)floatTotalPPPT+=rates[(dayOfEntryDate+i)%7]*userEnteredQty}}else floatTotalPPPT=personTypePricing*userEnteredQty;totalPricePerPersonType=Math.round(floatTotalPPPT*100)/100;totalMoney+=totalPricePerPersonType}}if(groupSizePerPersonPerStay==true&&theCell.id=="ratePerPerson"&&rates!=null){var allCellDivs=theCell.getElementsByTagName("DIV");
var multiRate=false;if(Number(staylenghtInput)>1){var rateForTheFirstDay=rates[0];for(m=0;m<rates.length;m++)if(multiRate==false&&rateForTheFirstDay!=rates[m]){multiRate=true;allCellDivs[0].innerHTML="Multi"}}if(multiRate!=true)allCellDivs[0].innerHTML="$"+addDecimals(rates[dayOfEntryDate%7],2)}if(theCell.id=="totalPerPerson")if(getChildByID(theCell,"totalPricePerPersonType"+personTypeId))getChildByID(theCell,"totalPricePerPersonType"+personTypeId).value="$"+addDecimals(totalPricePerPersonType,2)}}}if(document.getElementById("maxUseFee")){maxUseFeeValue=
document.getElementById("maxUseFee").value;if(maxUseFeeValue<totalMoney)totalMoney=maxUseFeeValue}document.getElementById("totalGroupSize").innerHTML=totalNumberOfPeople;if(document.getElementById("calcTotal"))document.getElementById("calcTotal").innerHTML="$"+addDecimals(totalMoney,2);if(atLeastOneNegative==false){changeTotalGroupSizeStatus();recalculateMaxStockQty()}}}
function getChildByID(theNode,theId){var theChild=null;var inputTypeChildren=theNode.getElementsByTagName("input");for(i=0;i<inputTypeChildren.length;i++)if(inputTypeChildren[i].id==theId){theChild=inputTypeChildren[i];break}return theChild}
function changeTotalGroupSizeStatus(){var maxGroupSizeAllowed=document.getElementById("maxSizeTotalAllowed").value;var inventoryOnHoldGroupSize=document.getElementById("onHoldInventory");var enteredTotal=document.getElementById("totalGroupSize").innerHTML-=0;if(maxGroupSizeAllowed>0&&enteredTotal>maxGroupSizeAllowed){document.getElementById("totalQuantity").className="overMaxGroupSize";document.getElementById("personTypeError").innerHTML="Your Group Size exceeds the maximum group size allowed. Please change your Group Size.";
document.getElementById("personTypeError").className="msg error"}else if(enteredTotal>0)if(inventoryOnHoldGroupSize==null||inventoryOnHoldGroupSize.value>=enteredTotal){document.getElementById("totalQuantity").className="totalQuantity";document.getElementById("personTypeError").innerHTML="";document.getElementById("personTypeError").className=""}}
function updateWaterCraftQtyTable(watercraftTypeQtyField){if(isNaN(watercraftTypeQtyField.value)){watercraftTypeQtyField.value="";return}calculateTotalWaterCraftQty()}
function calculateTotalWaterCraftQty(){var theTable=document.getElementById("watercraftFormSection");var totalNumberOfWaterCrafts=0;if(theTable&&theTable.rows){for(ndex=0;ndex<theTable.rows.length;ndex++)if(theTable.rows[ndex].className=="personTypeInfo"){var userEnteredQty=0;for(j=0;j<theTable.rows[ndex].cells.length;j++){var theCell=theTable.rows[ndex].cells[j];if(theCell.className=="personQty"){userEnteredQty=getChildByID(theCell,"qtyWaterCraftsId").value;totalNumberOfWaterCrafts+=userEnteredQty*
1}}}document.getElementById("totalWatercraft").innerHTML=totalNumberOfWaterCrafts;changeTotalWatercraftStatus();rebuildBoatGroupLeaderPanel()}}
function changeTotalWatercraftStatus(){var maxWatercraftAllowed=document.getElementById("maxWaterCraftTotalAllowed").value;var enteredTotal=document.getElementById("totalWatercraft").innerHTML-=0;if(maxWatercraftAllowed>0&&enteredTotal>maxWatercraftAllowed){document.getElementById("totalWatercraftQuantity").className="overMaxGroupSize";document.getElementById("watercraftTypeError").innerHTML="Your Total Number of Watercrafts exceeds the maximum watercraft number allowed. Please change your Watercraft Number.";
document.getElementById("watercraftTypeError").className="msg error"}else if(enteredTotal>0){document.getElementById("totalWatercraftQuantity").className="totalQuantity";document.getElementById("watercraftTypeError").innerHTML="";document.getElementById("watercraftTypeError").className=""}}
function recalculateMaxStockQty(){var stockRatio=document.getElementById("stockRatio");if(stockRatio!=null){var groupSize=document.getElementById("groupSize");if(groupSize!=null)groupSizeValue=groupSize.value;else groupSizeValue=document.getElementById("totalGroupSize").innerHTML-=0;if(groupSizeValue!=null){stockRatioValue=stockRatio.value;if(stockRatioValue>0&&groupSizeValue>0){ratioMax=Math.floor(stockRatioValue*groupSizeValue);var origMaxStockAllowed=document.getElementById("originalMaxStockTotalAllowed");
if(origMaxStockAllowed==null||ratioMax<origMaxStockAllowed.value){document.getElementById("maxStockTotalAllowed").value=ratioMax;document.getElementById("displayMaxStockTotal").innerHTML="(Max: "+ratioMax+"):"}else{document.getElementById("maxStockTotalAllowed").value=origMaxStockAllowed.value;document.getElementById("displayMaxStockTotal").innerHTML="(Max: "+origMaxStockAllowed.value+"):"}changeTotalStockStatus()}}}}
function rebuildBoatGroupLeaderPanel(){if(document.getElementById("watercraftTypeModel")){var theFormTable=document.getElementById("boatLeaderInfoTable");if(theFormTable!=null){var entryCount=0;var lastBoatRowIndx=0;allTableRows=theFormTable.getElementsByTagName("TR");for(ndex=0;ndex<allTableRows.length;ndex++)if(allTableRows[ndex].id=="boatLeaderInfoRow"){entryCount++;lastBoatRowIndx=ndex}var waterCraftTypeModel=document.getElementById("watercraftTypeModel").value;var totalQty=0;if(waterCraftTypeModel==
"true")totalQty=document.getElementById("totalWatercraft").innerHTML-=0;else totalQty=document.getElementById("numberofwatercraftid").value;if(totalQty==0)for(indx=0;indx<4;indx++)addFormRow("boatLeaderInfoTable","boatLeaderInfoRow",4);else{if(totalQty-1>entryCount)for(indx=0;indx<totalQty-entryCount-1;indx++)addFormRow("boatLeaderInfoTable","boatLeaderInfoRow",totalQty-1);if(totalQty-1<entryCount){var diff=entryCount-totalQty+1;if(totalQty==1)diff--;for(diffIndx=0;diffIndx<diff;diffIndx++)theFormTable.deleteRow(lastBoatRowIndx-
diffIndx)}}}}}function updateStockQtyTable(stockTypeQtyField){if(isNaN(stockTypeQtyField.value)){stockTypeQtyField.value="";return}calculateTotalStockQty()}
function calculateTotalStockQty(){var theTable=document.getElementById("stockFormSection");var totalNumberOfStock=0;if(theTable&&theTable.rows){for(ndex=0;ndex<theTable.rows.length;ndex++)if(theTable.rows[ndex].className=="personTypeInfo"){var userEnteredQty=0;for(j=0;j<theTable.rows[ndex].cells.length;j++){var theCell=theTable.rows[ndex].cells[j];if(theCell.className=="personQty"){userEnteredQty=getChildByID(theCell,"qtyStocksId").value;totalNumberOfStock+=userEnteredQty*1}}}document.getElementById("totalStock").innerHTML=
totalNumberOfStock;changeTotalStockStatus()}}function updatePetQtyTable(petTypeQtyField){if(isNaN(petTypeQtyField.value)){petTypeQtyField.value="";return}calculateTotalPetQty()}
function calculateTotalPetQty(){var theTable=document.getElementById("petFormSection");var totalNumberOfPet=0;if(theTable&&theTable.rows){for(ndex=0;ndex<theTable.rows.length;ndex++)if(theTable.rows[ndex].className=="personTypeInfo"){var userEnteredQty=0;for(j=0;j<theTable.rows[ndex].cells.length;j++){var theCell=theTable.rows[ndex].cells[j];if(theCell.className=="personQty"){userEnteredQty=getChildByID(theCell,"qtyPetsId").value;totalNumberOfPet+=userEnteredQty*1}}}document.getElementById("totalPet").innerHTML=
totalNumberOfPet;changeTotalPetStatus()}}
function changeTotalStockStatus(){if(document.getElementById("totalStock")){var maxStockAllowed=document.getElementById("maxStockTotalAllowed").value;var enteredTotal=document.getElementById("totalStock").innerHTML-=0;if(maxStockAllowed>0&&enteredTotal>maxStockAllowed){document.getElementById("totalStockQuantity").className="overMaxGroupSize";document.getElementById("stockTypeError").innerHTML="Your Total Number of Stock exceeds the maximum stock number allowed. Please change your Stock Number.";document.getElementById("stockTypeError").className=
"msg error"}else if(enteredTotal>0){document.getElementById("totalStockQuantity").className="totalQuantity";document.getElementById("stockTypeError").innerHTML="";document.getElementById("stockTypeError").className=""}}}
function changeTotalPetStatus(){if(document.getElementById("totalPet")){var maxPetAllowed=document.getElementById("maxPetTotalAllowed").value;var enteredTotal=document.getElementById("totalPet").innerHTML-=0;if(maxPetAllowed>0&&enteredTotal>maxPetAllowed){document.getElementById("totalPetQuantity").className="overMaxGroupSize";document.getElementById("petTypeError").innerHTML="Your Total Number of Pets exceeds the maximum pet number allowed. Please change your Pet Number.";document.getElementById("petTypeError").className=
"msg error"}else if(enteredTotal>0){document.getElementById("totalPetQuantity").className="totalQuantity";document.getElementById("petTypeError").innerHTML="";document.getElementById("petTypeError").className=""}}}
function setBringingAnimals(dropDownTravelMethod){var selectedMethod=dropDownTravelMethod.options[dropDownTravelMethod.selectedIndex].value;var animalFlag=selectedMethod.substring(selectedMethod.indexOf("_")+1);var bringingAnimalsRadio=document.getElementsByName("bringingAnimals");var isDisabled=false;if(bringingAnimalsRadio!=null&&bringingAnimalsRadio.length>0){if(animalFlag!=null)if(animalFlag=="mandatory"){bringingAnimalsRadio[0].checked=true;bringingAnimalsRadio[1].checked=false;isDisabled=true}else if(animalFlag==
"none"){bringingAnimalsRadio[0].checked=false;bringingAnimalsRadio[1].checked=true;isDisabled=true}else{bringingAnimalsRadio[0].checked=false;bringingAnimalsRadio[1].checked=true}bringingAnimalsRadio[0].disabled=isDisabled;bringingAnimalsRadio[1].disabled=isDisabled}}
function setIssuingStationVisibility(permitDeliveryMethodDropdown){var issuingStationTag=document.getElementById("issuing_station_row");var hiddenDefaultStation=document.getElementById("hidden_default_station");if(issuingStationTag!=null){var selectedMethod=permitDeliveryMethodDropdown.options[permitDeliveryMethodDropdown.selectedIndex].value;if(selectedMethod==2&&hiddenDefaultStation==null)issuingStationTag.style.display="";else issuingStationTag.style.display="none"}}
function rebuildTripItineraryInfoPanel(exitDate,itemId,update){var uri="/permitOrderDetails.do?action=rebuildTripItinerary&currentItemId="+itemId;if(update)uri="/updatePermitReservation.do?action=rebuildTripItinerary&currentItemId="+itemId;var ajax=new Ajax.DynamicHTML(uri);var period=document.getElementById("tripItineraryPeriod").value;var locationIds="";for(ndex=0;ndex<period;ndex++){var locationField=document.getElementById("tripitinerarypoint"+ndex+"id");if(locationField){var selectedLocationId=
locationField.options[locationField.selectedIndex].value;if(selectedLocationId=="")selectedLocationId="0";locationIds+=selectedLocationId;if(ndex<period-1)locationIds+="@"}}var exitPointField=document.getElementById("exitpointid");var exitPointId="";if(exitPointField)exitPointId=exitPointField.options[exitPointField.selectedIndex].value;ajax.submit("&exitDate="+exitDate+"&tripLocationIds="+locationIds+"&exitPointId="+exitPointId);return false}
function rebuildServiceTypePanel(commUseTypeId,itemId,update){var uri="/permitOrderDetails.do?action=rebuildServiceType&currentItemId="+itemId;if(update)uri="/updatePermitReservation.do?action=rebuildServiceType&currentItemId="+itemId;var ajax=new Ajax.DynamicHTML(uri);ajax.submit("commUseType="+commUseTypeId);return false}
function rebuildAlertsPanel(itemId,update){var uri="/permitOrderDetails.do?action=rebuildAlerts&currentItemId="+itemId;if(update)uri="/updatePermitReservation.do?action=rebuildAlerts&currentItemId="+itemId;var ajax=new Ajax.DynamicHTML(uri);var exitPointField=document.getElementById("exitpointid");var exitPointId="";if(exitPointField)exitPointId=exitPointField.options[exitPointField.selectedIndex].value;var exitDateField=document.getElementById("exitdateid");var exitDate="";if(exitDateField)exitDate=
exitDateField.value;ajax.submit("&exitDate="+exitDate+"&exitPointId="+exitPointId);return false}
function addFormRow(formTableId,clonedRowId,maxRows){theFormTable=document.getElementById(formTableId);if(theFormTable!=null){allTableRows=theFormTable.getElementsByTagName("TR");var originalRow=null;var entryCount=0;for(ndex=0;ndex<allTableRows.length;ndex++)if(allTableRows[ndex].id==clonedRowId){entryCount++;originalRow=allTableRows[ndex]}if(isNaN(maxRows))maxRows=10;if(originalRow!=null&&entryCount<maxRows){newRow=originalRow.cloneNode(true);var rowInputElements=newRow.getElementsByTagName("INPUT");
for(j=0;j<rowInputElements.length;j++)rowInputElements[j].value="";addedRow=theFormTable.getElementsByTagName("TBODY").item(0).appendChild(newRow);entryCount++}if(formTableId=="groupMemberInfoTable"){var allDivs=theFormTable.getElementsByTagName("DIV");var lineNumCount=0;for(i=0;i<allDivs.length;i++)if(allDivs[i].id=="groupMemberInfoLineNumber"){lineNumCount++;allDivs[i].innerHTML=lineNumCount}document.getElementById("groupMemberInfoRowCount").value=lineNumCount;if(entryCount==maxRows)document.getElementById("addGroupMemberLinkDiv").innerHTML=
""}if(formTableId=="boatLeaderInfoTable"){var allDivs=theFormTable.getElementsByTagName("DIV");var lineNumCount=0;for(i=0;i<allDivs.length;i++)if(allDivs[i].id=="boatLeaderInfoLineNumber"){lineNumCount++;allDivs[i].innerHTML=lineNumCount}}}}
function addEntryDateFormRow(formTableId,maxRows){theFormTable=document.getElementById(formTableId);if(theFormTable!=null){var allTableRows=theFormTable.getElementsByTagName("TR");var originalRow=null;var buildBlock=false;for(ndex=0;ndex<allTableRows.length;ndex++)if(allTableRows[ndex].className=="entryDateInfo"||allTableRows[ndex].className=="personTypeInfo"){if(allTableRows[ndex].id=="entryRowId"){if(buildBlock==true)break;buildBlock=true}originalRow=allTableRows[ndex];newRow=originalRow.cloneNode(true);
var rowInputElements=newRow.getElementsByTagName("INPUT");for(j=0;j<rowInputElements.length;j++)if(rowInputElements[j].type!="hidden")rowInputElements[j].value="";if(newRow.id=="entryRowId"){var allRowDivs=newRow.getElementsByTagName("DIV");for(i=0;i<allRowDivs.length;i++){if(allRowDivs[i].id=="exitDateDivId")allRowDivs[i].innerHTML="";if(allRowDivs[i].id=="removebuttondiv")allRowDivs[i].style.display=""}}addedRow=theFormTable.getElementsByTagName("TBODY").item(0).appendChild(newRow)}}}
function removeEntryDateRow(nodeElem,rowsToRemove){var theFormTable=document.getElementById("formSection");var buttonParent=nodeElem.parentNode;var buttonGrandParent=buttonParent.parentNode.parentNode;if(buttonGrandParent.id=="entryRowId"){var i=buttonGrandParent.rowIndex;var ndex=0;while(ndex<rowsToRemove){theFormTable.deleteRow(i);ndex++}}calculateTotalPriceAndQty();return false}
function readPastDate(inputDate){if(!isNaN(inputDate)){if(inputDate>1E3&&inputDate<9999)inputDate="Jan 1 ,"+inputDate}else inputDate=inputDate.replace(dashExpr,"/");var theDateInMilis=Date.parse(inputDate);var theDate=null;if(!isNaN(theDateInMilis))theDate=forceYearWithinWindow(new Date(theDateInMilis));return theDate};
