						// CheckIn
						var calCheckIn= new CalendarPopup("calendarCheckIn");
						calCheckIn.setReturnFunction("showDateCheckIn");
						calCheckIn.setDayHeaders('Su','M','Tu','W','Th','F','Sa');
						
						var pos=new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
						//105,45,-105,45,-105,45,-105,45,-105,45,-105,45,-105,45,-105,45, // win-ie 800x600;1024x768;1152x864;1280x720 
									      812,527,890,527,916,527,1018,527,1018,527,1018,527,1018,527,1018,527,
						//-105,45,-105,45,-105,45,-105,45,-105,45,-105,45,-105,45,-105,45,  // win-op 800x600;1024x768;1152x864;1280x720
									      30,540,50,540,115,540,180,540,180,540,180,540,180,540,180,540,	// win-fx 800x600;1024x768;1152x864;1280x720 
									  	  30,540,50,540,115,540,180,540,180,540,180,540,180,540,180,540,	// win-ns 800x600;1024x768;1152x864;1280x720
									  	  30,540,50,540,115,540,180,540,180,540,180,540,180,540,180,540,	// win-mz 800x600;1024x768;1152x864;1280x720
										   
									      -105,-420,-105,-420,-155,-420,-220,-420,// mac-ie 800x600;1024x768;1152x864;1280x720 
										  -105,45,-105,45,-105,45,-105,45,   	           // mac-op 800x600;1024x768;1152x864;1280x720 
									      30,540,50,540,115,540,180,540,	// mac-fx 800x600;1024x768;1152x864;1280x720 
										  30,540,50,540,115,540,180,540,	// mac-ns 800x600;1024x768;1152x864;1280x720
										  30,540,50,540,115,540,180,540, // mac-sf 800x600;1024x768;1152x864;1280x720 		
										  180,180,180); 	
						setPos(pos);
						
						calCheckIn.offsetX = offsetX;
						calCheckIn.offsetY = offsetY;

						document.write(calCheckIn.getStyles());

						// CheckOut
						var calCheckOut= new CalendarPopup("calendarCheckOut");
						calCheckOut.setReturnFunction("showDateCheckOut");
						calCheckOut.setDayHeaders('Su','M','Tu','W','Th','F','Sa');
						var pos=new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
						//-100,45,-100,45,-100,45,-100,45,-100,45,0,0,-100,45,-100,45, // win-ie 800x600;1024x768;1152x864;1280x720 						
									      812,574,890,574,916,574,1018,574,1018,574,1018,574,1018,574,1018,574, 	// win-op 800x600;1024x768;1152x864;1280x720
									       175,540,195,540,260,540,320,540,320,540,320,540,320,540,320,540,	// win-fx 800x600;1024x768;1152x864;1280x720 
									  	   175,540,195,540,260,540,320,540,320,540,320,540,320,540,320,540,		// win-ns 800x600;1024x768;1152x864;1280x720
									  	   175,540,195,540,260,540,320,540,320,540,320,540,320,540,320,540,		// win-mz 800x600;1024x768;1152x864;1280x720
										   
									      -90,-420,-90,-420,-140,-420,-205,-420,// mac-ie 800x600;1024x768;1152x864;1280x720 
										  -100,45,-100,45,-100,45,-100,45,   	           // mac-op 800x600;1024x768;1152x864;1280x720 
									      175,540,195,540,260,540,320,540,	// mac-fx 800x600;1024x768;1152x864;1280x720 
										  175,540,195,540,260,540,320,540,	// mac-ns 800x600;1024x768;1152x864;1280x720
										  175,540,195,540,260,540,320,540, // mac-sf 800x600;1024x768;1152x864;1280x720 		
										  320,320,320); 	
						setPos(pos);
						
						calCheckOut.offsetX = offsetX;
						calCheckOut.offsetY = offsetY;

						document.write(calCheckOut.getStyles());


						// Function to get input back from calendar popup
						function showDateCheckIn(y,m,d) 
						{
							document.quicksearch.arrivalDay.value = d;
							
							if(m=="1")
							m="01";
							if(m=="2")
							m="02";
							 if(m=="3")
							m="03";
							 if(m=="4")
							m="04";
							 if(m=="5")
							m="05";
							 if(m=="6")
							m="06";
							 if(m=="7")
							m="07";
							 if(m=="8")
							m="08";
							 if(m=="9")
							m="09";
							if(m=="10")
							m="10";
							if(m=="11")
							m="11";
							if(m=="12")
							m="12";

							var date1=m+"/"+d+"/"+y;
							var currdate = new Date(date1);
							var showDate1=new Date(parseInt(currdate.getMonth()+1,10) + "/" + (currdate.getDate()+1) + "/" + currdate.getFullYear());
														
							js_CheckInMonthYear=m+"-"+y;
							for (var i=1; i < 12; i++) 
							{
								if (document.quicksearch.in_month.options[i].value==js_CheckInMonthYear) 
								{
									document.quicksearch.in_month.selectedIndex = i;
								}
							}
							var advmonth=showDate1.getMonth()+1;
						    if(advmonth==1)
							{
								advmonth="01";
							}
							else if(advmonth==2)
							{
								advmonth="02";
							}
							else if(advmonth==3)
							{
								advmonth="03";
							}
							else if(advmonth==4)
							{
								advmonth="04";
							}
							else if(advmonth==5)
							{
								advmonth="05";
							}
							else if(advmonth==6)
							{
								advmonth="06";
							}
							else if(advmonth==7)
							{
								advmonth="07";
							}
							else if(advmonth==8)
							{
								advmonth="08";
							}
							else if(advmonth==9)
							{
								advmonth="09";
							}
							var advyear=showDate1.getFullYear();
							window.document.quicksearch.out_month.value=advmonth+"-"+advyear;
							window.document.quicksearch.departureDay.value=showDate1.getDate();
						}


						// Function to get input back from calendar popup
						function showDateCheckOut(y,m,d) 
						{if(m=="1")
							m="01";
							 if(m=="2")
							m="02";
							 if(m=="3")
							m="03";
							 if(m=="4")
							m="04";
							 if(m=="5")
							m="05";
							 if(m=="6")
							m="06";
							 if(m=="7")
							m="07";
							 if(m=="8")
							m="08";
							 if(m=="9")
							m="09";
							if(m=="10")
							m="10";
							if(m=="11")
							m="11";
							if(m=="12")
							m="12";
							document.quicksearch.departureDay.value = d;
							js_CheckOutMonthYear=m+"-"+y;
								for (var i=1; i < 12; i++) 
								{
									if (document.quicksearch.out_month.options[i].value==js_CheckOutMonthYear) 
									{
										document.quicksearch.out_month.selectedIndex = i;
									}
								}
						}
												
						
							function fnMeetingroom()
							{
								if(document.quicksearch.selectedRooms.value > 4)
								{
									
									window.document.quicksearch.action = 'http:/\/\www.hilton.com/en/hi/hotels/search/groups/gm/index3.jhtml?ctyhocn=SANCCHH'
								}
								else
								{
								window.document.quicksearch.action = 'https:/\/\secure.hilton.com/en/hi/res/choose_dates.jhtml?hotel=SANCCHH'
									
								}
							}
							function fnSubmit()
							{
													
							if (navigator.userAgent.toString().indexOf("Safari") != -1) //this applies to Chrome and Safari
							{									
									setTimeout(function() { location="http://www.hiltonsandiegobayfront.com/index.php?page=thanks"; },500);
									
							} else {//this applies to all the other browsers
									location.href="http://www.hiltonsandiegobayfront.com/index.php?page=thanks";
							}
							
							
							var monthname=new Array("01","02","03","04","05","06","07","08","09","10","11","12");
							CheckInMonthYear=window.document.quicksearch.in_month.options[window.document.quicksearch.in_month.options.selectedIndex].value;
							CheckInDay=window.document.quicksearch.arrivalDay.value;
							
							var mon;
							for(var i=0;i<12;i++)
							{		 
								if(CheckInMonthYear.substring(0,2)==monthname[i])
								{
									mon=i+1;				 
									break;
								}
							}	
							
							var year=CheckInMonthYear.split("-");
							var CheckInMonth=parseInt(mon);
							window.document.quicksearch.arrivalMonth.value = parseInt(mon);
							 	
							var CheckInDay=window.document.quicksearch.arrivalDay.options[window.document.quicksearch.arrivalDay.options.selectedIndex].value;
							var CheckInYear=year[1];	
							window.document.quicksearch.arrivalYear.value  = year[1];
							var check_In=new Date(CheckInMonth+"/"+CheckInDay+"/"+CheckInYear);
							//window.document.quicksearch.arrive.value=year[0]+"/"+CheckInDay+"/"+CheckInYear;
							var strCurrentDate = new Date();
							var checkIn=new Date();
							checkIn = new Date(CheckInYear, CheckInMonth-1, CheckInDay, 23, 59, 59);  // set to midnight
							if(checkIn.getTime()<strCurrentDate.getTime())
							{			
								alert("Error. Date of check-in has already passed.");					 
								return false;
							}				
								
							var monthname1=new Array("01","02","03","04","05","06","07","08","09","10","11","12");
							CheckOutMonthYear=window.document.quicksearch.out_month.options[window.document.quicksearch.out_month.options.selectedIndex].value;
							CheckOutDay=window.document.quicksearch.departureDay.value;
							var mon1;
							for(var i=0;i<12;i++)
							{
								if(CheckOutMonthYear.substring(0,2)==monthname1[i])
								{
									mon1=i+1;			 
									break;
								}
							}	
							
							var year1=CheckOutMonthYear.split("-");	
							var CheckOutMonth=parseInt(mon1);
							window.document.quicksearch.departureMonth.value = parseInt(mon1);
							
							var CheckOutDay=window.document.quicksearch.departureDay.options[window.document.quicksearch.departureDay.options.selectedIndex].value;
							var CheckOutYear=year1[1];	 
							window.document.quicksearch.departureYear.value=year1[1];
							var check_Out=new Date(CheckOutMonth+"/"+CheckOutDay+"/"+CheckOutYear);
							//window.document.quicksearch.depart.value=year1[0]+"/"+CheckOutDay+"/"+CheckOutYear;
							 	  
							var checkOut=new Date();
							checkOut = new Date(CheckOutYear, CheckOutMonth-1, CheckOutDay, 23, 59, 59);  // set to midnight
							if(checkIn.getTime() >=checkOut.getTime())
								{			
									alert("Error. Date of check-out cannot preceed check-in date.");					 
									return false;
								}		 
								
								window.document.quicksearch.numRooms.value=window.document.quicksearch.selectedRooms.value;
								
								if(window.document.quicksearch.selectedRooms.value > 4)
									{
										window.document.quicksearch.action = 'http:/\/\www.hilton.com/en/hi/hotels/search/groups/gm/index3.jhtml?ctyhocn=SANCCHH';
										window.document.quicksearch.numRooms.value=window.document.quicksearch.selectedRooms.value;
											var monthname=new Array("01","02","03","04","05","06","07","08","09","10","11","12");
											CheckInMonthYear=window.document.quicksearch.in_month.options[window.document.quicksearch.in_month.options.selectedIndex].value;
											CheckInDay=window.document.quicksearch.arrivalDay.value;
											
											var mon;
											for(var i=0;i<12;i++)
											{		 
												if(CheckInMonthYear.substring(0,2)==monthname[i])
												{
													mon=i+1;				 
													break;
												}
											}	
											
											var year=CheckInMonthYear.split("-");
											var CheckInMonth=parseInt(mon);
											window.document.quicksearch.arrivalMonth.value = parseInt(mon);
							
											if(CheckInMonth<10)
											{	
												window.document.quicksearch.gstArrivalMonth.value = "0"+parseInt(mon);}
											else{
											window.document.quicksearch.gstArrivalMonth.value = parseInt(mon);
											}
											 	
											var CheckInDay=window.document.quicksearch.arrivalDay.options[window.document.quicksearch.arrivalDay.options.selectedIndex].value;
											var CheckInYear=year[1];	
											window.document.quicksearch.arrivalYear.value  = year[1];
											window.document.quicksearch.gstArrivalYear.value  = year[1];
											var check_In=new Date(CheckInMonth+"/"+CheckInDay+"/"+CheckInYear);
											var strCurrentDate = new Date();
											var checkIn=new Date();
											checkIn = new Date(CheckInYear, CheckInMonth-1, CheckInDay, 23, 59, 59);  // set to midnight
											if(checkIn.getTime()<strCurrentDate.getTime())
											{			
												alert("Error. Date of check-in has already passed.");					 
												return false;
											}				
												
											var monthname1=new Array("01","02","03","04","05","06","07","08","09","10","11","12");
											CheckOutMonthYear=window.document.quicksearch.out_month.options[window.document.quicksearch.out_month.options.selectedIndex].value;
											CheckOutDay=window.document.quicksearch.departureDay.value;
											var mon1;
											for(var i=0;i<12;i++)
											{
												if(CheckOutMonthYear.substring(0,2)==monthname1[i])
												{
													mon1=i+1;			 
													break;
												}
											}	
											window.document.quicksearch.numGstRooms.value=window.document.quicksearch.selectedRooms.value;
											var year1=CheckOutMonthYear.split("-");	
											var CheckOutMonth=parseInt(mon1);
											window.document.quicksearch.departureMonth.value = parseInt(mon1);
											if(CheckOutMonth<10)
											{window.document.quicksearch.gstDepartureMonth.value ="0"+ parseInt(mon1);}
											else{
											window.document.quicksearch.gstDepartureMonth.value = parseInt(mon1);
											}
											window.document.quicksearch.gstArrivalDay.value =window.document.quicksearch.arrivalDay.value;
											window.document.quicksearch.gstDepartureDay.value =window.document.quicksearch.departureDay.value;
											var CheckOutDay=window.document.quicksearch.departureDay.options[window.document.quicksearch.departureDay.options.selectedIndex].value;
											var CheckOutYear=year1[1];	 
											window.document.quicksearch.departureYear.value=year1[1];
											window.document.quicksearch.gstDepartureYear.value=year1[1];
											var check_Out=new Date(CheckOutMonth+"/"+CheckOutDay+"/"+CheckOutYear);
										}																	
							}
