/* Copyright (c) 1995-2008 Choice Hotels International, Inc. All Rights Reserved. */
var MeetingRFPLang={PlS_VALID:"Please enter a valid:",ROW:"row",ARRIVAL_MONTH:"Arrival Date - Month",ARRIVAL_DAY:"Arrival Date - Day",ARRIVAL_YEAR:"Arrival Date - Year",DEPART_MONTH:"Departure Date - Month",DEPART_DAY:"Departure Date - Day",DEPART_YEAR:"Departure Date - Year",ROOM_RES_METHOD:"Guest Room Reservation Method",ROOM_PAYMENT_METHOD:"Guest Room Payment Method",MEETING_PAYMENT_METHOD:"Meeting Room Payment Method",GR_DATE:"Guest Room Requirements - Date",GR_SINGLE:"Guest Room Requirements - # of Single",GR_DOUBLE:"Guest Room Requirements - # of Double",GR_QUAD:"Guest Room Requirements - # of Suite",MR_DATE:"Meeting Room and Catering Requirements - Date",MR_START_TIME:"Meeting Room and Catering Requirements - Event Start Time",MR_END_TIME:"Meeting Room and Catering Requirements - Event End Time",MR_EVENT_TYPE:"Meeting Room and Catering Requirements - Event Type",MR_NUM_PEOPLE:"Meeting Room and Catering Requirements - # of People",MR_SET_UP:"Meeting Room and Catering Requirements - Event Set-Up",MR_SIZE:"Meeting Room and Catering Requirements - Room Size Sq. Ft.",MR_EVENT_TIMES:"Event End and Start Time - The Event End Time cannot be before the Event Start Time.",SELECT_ADD_DAYS:"Please select the number of days to add.",MIN_HOTEL_SELECTION:"Please select at least one hotel.",MAX_HOTEL_SELECTION:"Please select no more than five hotels.",ONE_PHONE_REQUIRED:"Home or Business Phone Number",NEED_ARRIVAL:"Please enter a complete arrival date.",FUTURE_ARRIVAL:"The arrival date must be in the future.",NEED_DEPARTURE:"Please enter a complete departure date.",DEPART_AFTER_ARRIVAL:"The departure date must be after the arrival date.",MAX_20_DAY:"The length of stay is limited to a maximum of 20 days. Please adjust your arrival/departure dates."};function rmselected_chk(form_flds){var maxCheck=0;var hotelcount=form_flds.hotelcount.value;for(var i=0;i<hotelcount;i++){if(form_flds[i]&&form_flds[i].checked){maxCheck++}}if(maxCheck==0){alert(MeetingRFPLang.MIN_HOTEL_SELECTION);return false}if(maxCheck>5){alert(MeetingRFPLang.MAX_HOTEL_SELECTION);return false}return true};function js_link_hotelinfo(form_flds,refer,hotel){form_flds.refer.value=refer;form_flds.hotel.value=hotel;form_flds.submit()};function js_link_hotellist(form_flds){form_flds.ebprop.value="";form_flds.submit()};function js_contactinfo_chk(form_flds){var error_msg;var error="";error+=validateCustomerName(true,false,true,form_flds);error+=validateCustomerAddress(true,form_flds);fieldvalue=form_flds['home.phone.number'].value;fieldvalue2=form_flds['business.phone.number'].value;if((fieldvalue==null||fieldvalue=="")&&(fieldvalue2==null||fieldvalue2==""))error+="\n"+MeetingRFPLang.ONE_PHONE_REQUIRED;error+=validateCustomerContact(false,false,true,form_flds);if(!error){disableForm(form_flds);return true}error_msg=MeetingRFPLang.PlS_VALID+"\n";error_msg+=error+"\n";alert(error_msg);return false};function js_requirements_chk(form_flds,totalSleepDays,totalMeetDays){var error_msg;var e;var error="";if(form_flds['roomtype'].value=='meetingguest'){if(form_flds['arrival_month'].selectedIndex<1)error+="\n"+MeetingRFPLang.ARRIVAL_MONTH;if(form_flds['arrival_day'].selectedIndex<1)error+="\n"+MeetingRFPLang.ARRIVAL_DAY;if(form_flds['arrival_year'].selectedIndex<1)error+="\n"+MeetingRFPLang.ARRIVAL_YEAR;if(form_flds['depart_month'].selectedIndex<1)error+="\n"+MeetingRFPLang.DEPART_MONTH;if(form_flds['depart_day'].selectedIndex<1)error+="\n"+MeetingRFPLang.DEPART_DAY;if(form_flds['depart_year'].selectedIndex<1)error+="\n"+MeetingRFPLang.DEPART_YEAR}if(totalSleepDays>0){error+=checkSleepRows(totalSleepDays)}error+=checkMeetRows(totalMeetDays);if(document.getElementById("roomtype_id").value=='meetingguest'){e=document.getElementById("room_res_method_id");if(e.selectedIndex<1){error+="\n"+MeetingRFPLang.ROOM_RES_METHOD}e=document.getElementById("room_payment_method_id");if(e.selectedIndex<1){error+="\n"+MeetingRFPLang.ROOM_PAYMENT_METHOD}}e=document.getElementById("meeting_payment_method_id");if(e.selectedIndex<1){error+="\n"+MeetingRFPLang.MEETING_PAYMENT_METHOD}if(error){error_msg=MeetingRFPLang.PlS_VALID+"\n";error_msg+=error+"\n";alert(error_msg);return false}return true};function checkSleepRows(totalSleepDays){var error="";var e;var sleep_month;var sleep_day;var sleep_year;var single;var dbl;var quad;for(var i=1;i<=totalSleepDays;i++){e=document.getElementById("sleep"+i+"_month_id");sleep_month=e.selectedIndex;e=document.getElementById("sleep"+i+"_day_id");sleep_day=e.selectedIndex;e=document.getElementById("sleep"+i+"_year_id");sleep_year=e.selectedIndex;e=document.getElementById("single_"+i+"_id");single=e.value;e=document.getElementById("double_"+i+"_id");dbl=e.value;e=document.getElementById("quad_"+i+"_id");quad=e.value;if((sleep_month>0)||(sleep_day>0)||(sleep_year>0)||(single!="")||(dbl!="")||(quad!="")){if((sleep_month<1)||(sleep_day<1)||(sleep_year<1)){error+="\n"+MeetingRFPLang.GR_DATE+" ("+MeetingRFPLang.ROW+" "+i+")"}if(!validNumbers(single)){error+="\n"+MeetingRFPLang.GR_SINGLE+" ("+MeetingRFPLang.ROW+" "+i+")"}if(!validNumbers(dbl)){error+="\n"+MeetingRFPLang.GR_DOUBLE+" ("+MeetingRFPLang.ROW+" "+i+")"}if(!validNumbers(quad)){error+="\n"+MeetingRFPLang.GR_QUAD+" ("+MeetingRFPLang.ROW+" "+i+")"}}}return error};function checkMeetRows(totalMeetDays){var error="";var e;var event_month;var event_day;var event_year;var function_start_time;var function_end_time;var event_type;var function_attendees;var function_style;var function_roomsize;for(var i=1;i<=totalMeetDays;i++){e=document.getElementById("event"+i+"_month_id");event_month=e.selectedIndex;e=document.getElementById("event"+i+"_day_id");event_day=e.selectedIndex;e=document.getElementById("event"+i+"_year_id");event_year=e.selectedIndex;e=document.getElementById("function_start_time_"+i+"_id");function_start_time=e.selectedIndex;e=document.getElementById("function_end_time_"+i+"_id");function_end_time=e.selectedIndex;e=document.getElementById("event_type_"+i+"_id");event_type=e.selectedIndex;e=document.getElementById("function_attendees_"+i+"_id");function_attendees=e.value;e=document.getElementById("function_style_"+i+"_id");function_style=e.selectedIndex;e=document.getElementById("function_roomsize_"+i+"_id");function_roomsize=e.value;if((i==1)||(event_month>0)||(event_day>0)||(event_year>0)||(function_start_time>0)||(function_end_time>0)||(event_type>0)||(function_attendees!="")||(function_style>0)){if((event_month<1)||(event_day<1)||(event_year<1)){error+="\n"+MeetingRFPLang.MR_DATE+" ("+MeetingRFPLang.ROW+" "+i+")"}if(function_start_time<1){error+="\n"+MeetingRFPLang.MR_START_TIME+" ("+MeetingRFPLang.ROW+" "+i+")"}if(function_end_time<1){error+="\n"+MeetingRFPLang.MR_END_TIME+" ("+MeetingRFPLang.ROW+" "+i+")"}if(event_type<1){error+="\n"+MeetingRFPLang.MR_EVENT_TYPE+" ("+MeetingRFPLang.ROW+" "+i+")"}if(function_attendees==""){error+="\n"+MeetingRFPLang.MR_NUM_PEOPLE+" ("+MeetingRFPLang.ROW+" "+i+")"}if(function_style<1){error+="\n"+MeetingRFPLang.MR_SET_UP+" ("+MeetingRFPLang.ROW+" "+i+")"}if(!validNumbers(function_attendees)){error+="\n"+MeetingRFPLang.MR_NUM_PEOPLE+" ("+MeetingRFPLang.ROW+" "+i+")"}if(!validNumbers(function_roomsize)){error+="\n"+MeetingRFPLang.MR_SIZE+" ("+MeetingRFPLang.ROW+" "+i+")"}if((function_start_time>=1)&&(function_end_time>=1)){if(function_start_time>function_end_time){error+="\n"+MeetingRFPLang.MR_EVENT_TIMES}}}}return error};function addRooms(form_flds,numRows,name){var roomName=new String(name);var index=roomName.lastIndexOf("_");var finalRoomName=roomName.substring(0,index);var rowNumberChanged=roomName.substring(index+1);var rows=numRows;var bed_arr=new Array();bed_arr[0]="single";bed_arr[1]="double";bed_arr[2]="quad";var rowTotal=0;for(var i=1;i<=rows;i++){var rowVal=eval("form_flds."+finalRoomName+"_"+i+".value");if(rowVal!="")rowTotal=parseFloat(rowTotal)+parseFloat(rowVal)}var colTotal=0;for(var i=0;i<3;i++){var colVal=eval("form_flds."+bed_arr[i]+"_"+rowNumberChanged+".value");if(colVal!="")colTotal=parseFloat(colTotal)+parseFloat(colVal)}rowTotal=eval("form_flds."+"total_"+finalRoomName+".value="+rowTotal);colTotal=eval("form_flds."+"totals_day_"+rowNumberChanged+".value="+colTotal);var Totals=0;var totalsName=new String("totals_day");for(var i=1;i<=rows;i++){var dayTotal=eval("form_flds.totals_day_"+i+".value");if(dayTotal!=""){Totals=parseFloat(Totals)+parseFloat(dayTotal)}}dayTotal=eval("form_flds.all_totals.value="+Totals)};function addMoreMeetingRooms(frm_fields,meetDays){if(frm_fields.total_meet_rows.value==meetDays){error_msg=MeetingRFPLang.SELECT_ADD_DAYS;alert(error_msg)}else {frm_fields.addMoreMeetDays.value="Add";frm_fields.submit()}};function prefillSleepDates(rfpFormSelector,accessed_arrival_month,accessed_arrival_day,accessed_arrival_year,accessed_depart_month,accessed_depart_day,accessed_depart_year){if(accessed_arrival_month==true&&accessed_arrival_day==true&&accessed_arrival_year==true&&accessed_depart_month==true&&accessed_depart_day==true&&accessed_depart_year){var $rfpForm=$(rfpFormSelector);var arr_month=$("select[@name='arrival_month']",$rfpForm).val();var arr_day=$("select[@name='arrival_day']",$rfpForm).val();var arr_year=$("select[@name='arrival_year']",$rfpForm).val();var dept_month=$("select[@name='depart_month']",$rfpForm).val();var dept_day=$("select[@name='depart_day']",$rfpForm).val();var dept_year=$("select[@name='depart_year']",$rfpForm).val();var arr_time=new Date(arr_year,arr_month-1,arr_day);var dept_time=new Date(dept_year,dept_month-1,dept_day);var current=arr_time;var row=1;var element;while(row<=20){maskElement('sleep_row_'+row);row++}$("select[@name^='sleep']",$rfpForm).val("");$("input[@name^='single_']",$rfpForm).val("");$("input[@name^='double_']",$rfpForm).val("");$("input[@name^='quad_']",$rfpForm).val("");$("input[@name^='totals_day_']",$rfpForm).val("");$("input[@name='total_single']",$rfpForm).val("");$("input[@name='total_double']",$rfpForm).val("");$("input[@name='total_quad']",$rfpForm).val("");$("input[@name='all_totals']",$rfpForm).val("");row=1;if(arr_month==''||arr_day==''||arr_year==''){alert(MeetingRFPLang.NEED_ARRIVAL);return false}var today=new Date();if(today.getTime()>=arr_time.getTime()){alert(MeetingRFPLang.FUTURE_ARRIVAL);return false}if(dept_month==''||dept_day==''||dept_year==''){alert(MeetingRFPLang.NEED_DEPARTURE);return false}if(arr_time.getTime()>=dept_time.getTime()){alert(MeetingRFPLang.DEPART_AFTER_ARRIVAL);return false}if(dept_time.getTime()>(arr_time.getTime()+20*86400000)){alert(MeetingRFPLang.MAX_20_DAY);return false}while(current.getTime()<dept_time.getTime()&&row<=20){setDisabledSelect("#sleep"+row+"_month_id",current.getMonth()+1);setDisabledSelect("#sleep"+row+"_day_id",current.getDate());setDisabledSelect("#sleep"+row+"_year_id",current.getFullYear());showElement('sleep_row_'+row);row++;current.setTime(current.getTime()+86400000)}}return true};function setDisabledSelect(selectSelector,optionValue){$(selectSelector).children("option[@value='"+optionValue+"']").attr("selected","selected")};