

function include(file)   
{   
  var script  = document.createElement('script');   
  script.src  = file;   
  script.type = 'text/javascript';   
  script.defer = true;   
  
  document.getElementsByTagName('head').item(0).appendChild(script);   
}

function includeinbody(file)   
{   
  var script  = document.createElement('script');   
  script.src  = file;   
  script.type = 'text/javascript';   
  script.defer = true;   
  document.getElementsByTagName('body').item(0).appendChild(script);   
} 

function includeStyle(file)   
{   
  var style  = document.createElement('link');   
  style.href  = file;   
  style.type = 'text/css';   
  style.defer = true;
  style.rel = 'stylesheet';  
  document.getElementsByTagName('head').item(0).appendChild(style);   
}  
/* include any js files here */
includeStyle('http://www.quickbooker.com/style/InnerDesign.css');
includeStyle('http://www.quickbooker.com/style/style.css');
includeStyle('http://www.quickbooker.com/style/QbHm.css');
includeStyle('http://www.quickbooker.com/qbsearch/Style/calendar1.css');
include('http://www.quickbooker.com/qbsearch/Scripts/calendar_Single.js');
include('http://www.quickbooker.com/qbsearch/Scripts/actb.js'); 
include('http://www.quickbooker.com/qbsearch/Scripts/common.js');
include('http://www.quickbooker.com/jScript.js');
//include('http://www.quickbooker.com/app_theme/scripts/AC_RunActiveContent.js');
//include('http://www.quickbooker.com/app_theme/scripts/AC_ActiveX.js');
//include('CountryCityArray.asp');


function ExtraBedDropDown(elem)
   {
   
      var SelectElem =  document.frmQBSearch.extraBed; 
      SelectElem.options.length = 0;
      opt1	=	document.createElement('option')
	  opt1.innerHTML	=	"0";
	  opt1.value		=	"0";
	  SelectElem.appendChild(opt1,null);
	  
      for(i=1;i<=parseInt(elem);i++)
      {
          var option = document.createElement("option");
          option.value = i;
          option.innerHTML = i;
          SelectElem.appendChild(option,null);
      }
   }

function validatePage()
{
	var checkin;
    var checkout;
    var result;
    checkin=document.frmQBSearch.checkin.value;
    checkout=document.frmQBSearch.checkout.value;        
    var date1=new Date(checkin.substring(6, 10), parseInt(checkin.substring(3, 5),10)-1, checkin.substring(0, 2));
    var date2=new Date(checkout.substring(6, 10), parseInt(checkout.substring(3, 5),10)-1, checkout.substring(0, 2));
    var new_Date = new Date();
    var currentdate= new Date();
    new_Date = addDays(currentdate,2);
    //alert("Please enter your destination!");
    if((document.frmQBSearch.txtDestination.value)=="" ||(document.frmQBSearch.txtDestination.value)==" " )
    {
        alert("Please enter the destination/city which you are looking for!");
        return false;
    }
            
        
        if(date1 <= new_Date)
        {
        alert("Check In date starts with Current Date + 3!");
        return false;
        }
      
        var year1 =    parseInt(checkin.substring(6, 10));
        var year2 =    parseInt(checkout.substring(6, 10));
        var c_date = new Date();
        var currentYear1 = parseInt(c_date.getFullYear());
        var currentYear = currentYear1 + 2
        var currentDay= c_date.getDate();
        var currentDay1= currentDay + 1;
        var currentDay2 = currentDay + 2;
        var Datevar= date1.getDate();
        
      
      if((date1 == "Invalid Date") || (date1 == "NaN"))
      {
        alert("Please select Check In Date");
        document.frmQBSearch.checkin.select();
        return false;
      }
       if((date2 == "Invalid Date") || (date2 == "NaN"))
       {
        alert("Please select Check Out Date");
        document.frmQBSearch.checkout.select();
        return false;
       }
        if(date1 >= date2)
        {
            alert("Check out date should be greater than check in date !");
            return false;
        }
      /*  if((date1 < c_date) || (date2 < c_date))
        {
            alert("Check in / Check out date can not be less than current date !");
            return false;
        }   */
        
       /* if((Datevar <= currentDay2))
        {
        alert("Check In date starts with Current Date + 3!");
            return false;
        } */ 
        
         if((year1 > currentYear) || (year2 > currentYear))
        {
            alert("Check In or Check Out Year can not be greater than "+currentYear);
            return false;
        }
        var result = days_between(date1,date2);
        if(result>365)
        {
            alert("Difference between checkout and checkin date should be less than 365 !");
            return false;
        }
        
        
        
      return true;
    }
    
   function CalendarDisappear()
   {
        var div = document.getElementById("CalendarControl1");
   
   }
   function AppearCalendar()
   {
        var div = document.getElementById("CalendarControl1");
        div.style.display = "block";
   }
    
   function days_between(date1, date2)
    {

        // The number of milliseconds in one day
        var ONE_DAY = 1000 * 60 * 60 * 24

        // Convert both dates to milliseconds
        var date1_ms = date1.getTime()
        var date2_ms = date2.getTime()

        // Calculate the difference in milliseconds
        var difference_ms = Math.abs(date1_ms - date2_ms)
        
        // Convert back to days and return
        return Math.round(difference_ms/ONE_DAY)

    }
    
    function ChangeCheckOutDate()
    {
      var checkin;
        var checkout;
        var result;
        checkin=document.frmQBSearch.checkin.value;
        checkout=document.frmQBSearch.checkout.value;
        var date1=new Date(checkin.substring(6, 10), parseInt(checkin.substring(3, 5),10)-1, checkin.substring(0, 2));
       // var date2=new Date(checkout.substring(6, 10), parseInt(checkout.substring(3, 5),10)-1, checkout.substring(0, 2));
        var newDate = addDays(date1,2);
        
        //var date = new Date();
        var newmonth = 0;
        var newday = 0;
        newmonth = parseInt(newDate.getMonth())+1
        if(newmonth <= 9)
        {
         newmonth = "0"+newmonth;
        }
        else
        {
            newmonth = newmonth;
        }
        if(parseInt(newDate.getDate()) <= 9)
        {
          newday = "0"+newDate.getDate(); 
        }
        else
        {
            newday = newDate.getDate(); 
        }
        var finalDate = (newday+"/"+newmonth+"/"+newDate.getFullYear());
        alert(finalDate)
        checkout.value = finalDate;
        
    }
    
    function addDays(myDate,days) {
    return new Date(myDate.getTime() + days*24*60*60*1000);
    }
document.write('</script>');

document.write('<div id="CalendarControl1"></div>');



      
      document.write('<div id="home_Int_Col_1">'); 
              document.write('<div id="home_QBENG_Box">'); 
                  document.write('<div id="home_QBENG_Box_Int">'); 
                        
                      document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0" class="txt_11_Wht">'); 
                          document.write('<tr>'); 
                              document.write('<td>'); 
                                  document.write('<img src="http://www.quickbooker.com/App_Theme/images/home_BE_FYT.gif" width="296" height="57" /></td>'); 
                          document.write('</tr>'); 
                          document.write('<tr>'); 
                              document.write('<td>'); 
                                  document.write('<img src="images/home_BE_RB_ln.gif" width="296" height="1" /></td>'); 
                          document.write('</tr>'); 
                          document.write('<tr>'); 
                              document.write('<td height="19" style="background-image: url(images/home_BE_RB_GRb.gif);padding: 3px 3px 1px 10px;">'); 
                                  document.write('<table class="txtWht11" width="250" border="0" cellspacing="0" cellpadding="0">'); 
                                      document.write('<tr>'); 
                                          document.write('<td width="24">'); 
                                              document.write('<input id="radHotel" type="radio" name="radOption" value="radHotel" checked="checked"  /></td>'); 
                                          document.write('<td width="81">Hotels</td>'); 
                                          document.write('<td width="19">&nbsp;</td>'); 
                                          document.write('<td width="24" valign="top"></td>'); 
                                          document.write('<td width="122"></td>'); 
                                      document.write('</tr>'); 
                                  document.write('</table>');    
								  document.write('</td>'); 
                          document.write('</tr>'); 
                            
                            
                          document.write('<tr>'); 
                              document.write('<td>'); 
                                  document.write('<img src="images/home_BE_RB_ln.gif" width="296" height="1" />'); 
                                                              
								  document.write('</td>');
                          document.write('</tr>');
                          document.write('<tr id="Hotel">');
						document.write('<td id="homeBE">');
                                 document.write(' <table width="100%" border="0" cellspacing="0" cellpadding="2">');
                                        
                                      document.write('<tr>');
                                          document.write('<td>');
                                              document.write('<strong>Destination :</strong></td>');
                                      document.write('</tr>');
                                     document.write('<tr>');
                                          document.write('<td style="padding: 4px 0px 2px 6px;">');
                                              document.write('<input name="txtDestination" type="text" style="width:250px;" />');
                                                                                    
											   document.write('</td>');
                                      document.write('</tr>');
                                      document.write('<tr>');
                                          document.write('<td style="padding: 4px 0px 2px 6px;">');
                                              <!-- Add by Debanand Start -->
                                              document.write('<table width="175" border="0" cellspacing="0" cellpadding="1">');
                                                  document.write('<tr>');
                                                      document.write('<td width="82">');
                                                          document.write('<strong>Check In </strong>');                                                    
														    document.write(':</td>');
                                                      document.write('<td width="6">');
                                                          document.write(':</td>');
                                                      document.write('<td width="57">');
                                                          document.write('<input type="text" runat="server" id="checkin" onfocus="$(\'checkin\').select();showCalendarControl($(\'checkin\'),\'1\',\'1\');" tabindex="3" size="9" value="dd/mm/yyyy" name="checkin" maxlength="10" /></td>');
                                                      document.write('<td width="22">');
                                                          document.write('<a onclick="$(\'checkin\').select();showCalendarControl($(\'checkin\'),\'1\');return false" href="#">');
		   												  document.write(' <img src="http://www.quickbooker.com/QBSearch/images/cal.gif" alt="Calendar" name="calendar_icon1" width="14" height="14" id="calendar_icon1" title="Click to open calendar" align="absmiddle" border="0">');
															document.write('</a>');
															document.write('</td>');
                                                  document.write('</tr>');
                                                  document.write('<tr>');
                                                      document.write('<td>');
                                                         document.write('<strong>Check Out</strong>');                                                     
														  document.write('</td>');  
                                                      document.write('<td>');
                                                          document.write(':</td>');
                                                      document.write('<td>');
                                                           document.write(' <input type="text" id="checkout" runat="server" onfocus="$(\'checkout\').select();showCalendarControl($(\'checkout\'),\'1\',\'1\');" tabindex="3" size="9" value="dd/mm/yyyy" name="checkout" maxlength="10" /></td>');
                                                      document.write('<td>');
                                                         document.write('<a onclick="$(\'checkout\').select();showCalendarControl($(\'checkout\'),\'1\');return false" href="#">');
														document.write(' <img src="http://www.quickbooker.com/QBSearch/images/cal.gif" alt="Calendar" name="calendar_icon2" width="14" height="14" id="calendar_icon2" title="Click to open calendar" align="absmiddle" border="0">');
           												 document.write('</a></td>');
                                                  document.write('</tr>');
                                              document.write('</table>');
                                              <!-- Add by Debanand End -->                                          
											  document.write('</td>');  
                                      document.write('</tr>');
                                      document.write('<tr>');
                                          document.write('<td>');
                                              document.write('<strong>Rooms and Guest Details:</strong></td>');
                                      document.write('</tr>');
                                     document.write(' <tr>');
                                          document.write('<td style="padding: 4px 0px 2px 6px;">');
                                              document.write('<div style="width: 200px; padding: 3px; border: 1px solid #96B5C7;">');
                                                  document.write('<table width="200" border="0" cellpadding="2" cellspacing="0">');
                                                      document.write('<tr>');
                                                          document.write('<td width="136">');
                                                              document.write('<strong>Single</strong> (1 sleep)');                                                          
															  document.write('</td>');  
                                                          document.write('<td width="9">');
                                                              document.write(':</td>');
                                                          document.write('<td width="40">');
                                                              document.write('<select name="cboSingle" id="cboSingle" runat="server" >');
		document.write('<option value="0">0</option>');
		document.write('<option value="1">1</option>');
		document.write('<option value="2">2</option>');
		document.write('<option value="3">3</option>');
		document.write('<option value="4">4</option>');
		document.write('<option value="5">5</option>');
	document.write('</select>');                                                          document.write('</td>');
                                                      document.write('</tr>');
                                                     document.write(' <tr>');
                                                          document.write('<td>');
                                                              document.write('<strong>Double</strong> (2 sleep)</td>');
                                                          document.write('<td>');
                                                              document.write(':</td>');
                                                          document.write('<td>');
                                                              document.write('<select name="cboDouble" id="cboDouble" runat="server" onchange="ExtraBedDropDown(this.value);">');
		document.write('<option value="0">0</option>');
		document.write('<option value="1">1</option>');
		document.write('<option value="2">2</option>');
		document.write('<option value="3">3</option>');
		document.write('<option value="4">4</option>');
		document.write('<option value="5">5</option>');
	document.write('</select> ');                                                         document.write('</td>');
                                                      document.write('</tr>');
                                                       
                                                      document.write('<tr>');
                                                          document.write('<td>');
                                                              document.write('<strong>Triple</strong> (3 sleep)');                                                          
															 document.write(' </td>');
                                                          document.write('<td>');
                                                              document.write(':</td>');
                                                          document.write('<td>');
                                                              document.write('<select name="cboTriple" id="cboTriple" runat="server">');
		document.write('<option value="0">0</option>');
		document.write('<option value="1">1</option>');
		document.write('<option value="2">2</option>');
		document.write('<option value="3">3</option>');
		document.write('<option value="4">4</option>');
		document.write('<option value="5">5</option>');
	document.write('</select> ');                                                         document.write('</td>');
                                                      document.write('</tr>');
                                                     document.write('<tr>');
                                                          document.write('<td>');
                                                              document.write('<strong>Extra Bed</strong>');                                                          
															   document.write('</td>');
                                                          document.write('<td>');
                                                              document.write(':</td>');
                                                          document.write('<td>');
                                                              document.write('<select name="extraBed" id="extraBed" runat="server">');
		document.write('<option value="0">0</option>');
	document.write('</select>  ');                                                        document.write('</td>');
                                                      document.write('</tr>');
                                                        document.write('<tr>');
                                                          document.write('<td>');
                                                              document.write('<strong>Child</strong> </td>');
                                                          document.write('<td>');
                                                              document.write(':</td>');
                                                          document.write('<td>');
                                                              document.write('<select name="cboDoubleChild" id="cboDoubleChild" runat="server">');
		document.write('<option value="0">0</option>');
		document.write('<option value="1">1</option>');
		document.write('<option value="2">2</option>');
		document.write('<option value="3">3</option>');
		document.write('<option value="4">4</option>');
		document.write('<option value="5">5</option>');
	document.write('</select>  ');                                                        document.write('</td>');
                                                      document.write('</tr>');
                                                  document.write('</table>');
                                             document.write(' </div>');
                                             document.write(' <br />');
                                   
                                              document.write('<div style="width: 200px; padding: 3px; border:">');
                                                  document.write('<table width="200" border="0" cellpadding="2" cellspacing="0">');
                                                      document.write('<tr id="TripleChild" style="display: none;">');
		document.write('<td nowrap="nowrap">&nbsp;</td>');
	document.write('</tr>');
                                                  document.write('</table>');
                                              document.write('</div>');                                       
											  document.write(' </td>');   
                                      document.write('</tr>');
                                      document.write('<tr>');
                                        document.write('<td>&nbsp;</td>');
                                     document.write(' </tr>');
                                      document.write('<tr>');
                                         document.write(' <td style="padding: 6px 0px 2px 6px;">');
                                              document.write('<div id="nrSearch" style="display: none; width: 200px; padding: 3px;">');
                                                  document.write('<table width="200" border="0" cellspacing="0" cellpadding="2">');
                                                     document.write(' <tr>');
                                                         document.write(' <td nowrap>');
                                                              document.write('<strong>Hotel Name </strong> ');                                                         
															  document.write('</td>');
                                                         document.write('<td>');
                                                             document.write(':</td>');
                                                        document.write('  <td>');
                                                            document.write('  <input name="txtHotelName" type="text" id="txtHotelName" OnBlur="return SecurityDrop(this)" /></td>');
                                                      document.write('</tr>');
                                                     document.write(' <tr>');
                                                          document.write('<td nowrap>');
                                                              document.write('<strong>Hotel Class </strong>');                                                          
															  document.write('</td>');
                                                         document.write(' <td>');
                                                           document.write('   :</td>');
                                                         document.write(' <td>');
                                                              document.write('<select name="cboHotelClass" id="cboHotelClass">');
		document.write('<option value="All">Show All</option>');
		document.write('<option value="1">1 Star &amp; above</option>');
		document.write('<option value="2">2 Star &amp; above</option>');
		document.write('<option value="3">3 Star &amp; above</option>');
		document.write('<option value="4">4 Star &amp; above</option>');
		document.write('<option value="5">5 Star &amp; above</option>');
	document.write('</select>');                                                          document.write('</td>');
                                                      document.write('</tr>');
                                                      document.write('<tr>');
                                                         document.write(' <td nowrap>');
                                                             document.write(' <strong>Price Range </strong> ');                                                         
															document.write(' </td>');
                                                        document.write('  <td>');
                                                             document.write(' :</td>');
                                                          document.write('<td>');
                                                            document.write(' <select name="cboPriceRange" id="cboPriceRange">');
		document.write('<option value="All">Select Range</option>');
		document.write('<option value="1">Up To $100</option>');
		document.write('<option value="2">$100 - $200</option>');
		document.write('<option value="3">$200 - $300</option>');
		document.write('<option value="4">$300 - $500</option>');
		document.write('<option value="5">$500 - $1000</option>');
		document.write('<option value="6">$1000 &amp; above</option>');
	document.write('</select>    ');                                                      document.write('</td>');
                                                      document.write('</tr>');
                                                  document.write('</table>');
                                              document.write('</div>  ');                                        
											  document.write('</td>');
                                      document.write('</tr>');
                                  document.write('</table>');                      
								  
								          document.write('</td>');
document.write('</tr>');
                      document.write('</table>');
                  document.write('</div>');
              document.write('</div>');
              document.write('<div style="width: 318px; height: 31px; margin:opx;">');
                  document.write('<table width="318" border="0" cellspacing="0" cellpadding="0">');
                      document.write('<tr>');
                          document.write('<td width="203" align="left" style="background-image:url(http://www.quickbooker.com/QBSearch/images/home_BE_botLeft_back.gif);">');
                              document.write('<img src="http://www.quickbooker.com/App_Theme/images/home_BE_botLeft.gif" width="203" height="31" /></td>');
                          document.write('<td width="84" valign="bottom" align="left" style="background-image:url(http://www.quickbooker.com/QBSearch/images/home_BE_botLeft_back.gif);">');
                             document.write('<input name="btnsubmit" type="image" src="http://www.quickbooker.com/App_Theme/images/home_BE_botASubmit.gif" height="31" width="84" value="" onclick="javascript:return validatePage();" style="border:0px;" />');
                              document.write('</td>');
                          document.write('<td width="27" align="right">');
                             document.write(' <img src="http://www.quickbooker.com/App_Theme/images/home_BE_botRight.gif" width="27" height="31" /></td>');
                      document.write('</tr>');
                  document.write('</table>');
              document.write('</div>');
             document.write(' <div class="globalMargin"></div>');
        
          document.write('</div>');
     
   


