	function checkField()
	{
		if (document.getElementById('AD').value=="")
		{
			alert("Please specify a Check-in date");
			
		}
		else
			{
			document.InfoForm.submit()
			}
	}

	function appendOptionLast(num1, num2)
{
	
	 var elSel = document.getElementById('nights');
	
  if (elSel.length > 0)
  { 
  while(elSel.length > 0){
    elSel.remove(elSel.length - 1);
  }
  }


  //var elSel = document.getElementById('nights');
  
    //while(elSel>0)elSel.remove(elSel.length - 1);
  


	
	for(i=num1; i<=num2; i++){
		  var elOptNew = document.createElement('option');
		  elOptNew.text = i;
		  elOptNew.value =  i;
		  var elSel = document.getElementById('nights');
		
		  try {
			elSel.add(elOptNew, null); // standards compliant; doesn't work in IE
		  }
		  catch(ex) {
			elSel.add(elOptNew); // IE only
		  }
	}



}


		
		
		
		
		function datecalc(nights){
			var AD = document.getElementById('AD').value;
			var myDate = new Date(AD);
			newDate = new Date(myDate.setDate(myDate.getDate()+parseInt(nights)));
			var day = newDate.getDate();
                        if (day < 10){
			   day = "0" + day;
                        }
			var month = newDate.getMonth()+1;
                        if (month < 10){
                           month = "0" + month;
                        }
			var year = newDate.getFullYear();
			var dateFormated= month+'/'+day+'/'+year;
			document.getElementById('Dep_D').value = dateFormated;
			
																
															
}

function SelectCityNights () {

    var citynights = document.InfoForm.city.value;
    //alert (citynights);
    citynights_array= citynights.split ('*');
    var city_standard_id=citynights_array[0];
    var min_Nights=parseInt(citynights_array[1]);
    var max_Nights=parseInt(citynights_array[2]) + 1; 
    removeAllOptions(document.InfoForm.nights);
    

    for ( var i=min_Nights; i < max_Nights; i++ ) {
       //alert(i);
        addOption(document.InfoForm.nights,i, i);
    }
    document.InfoForm.city_standard_id.value=city_standard_id;
}

function removeAllOptions(selectbox)
{
        var i;
        for(i=selectbox.options.length-1;i>=0;i--)
        {
                selectbox.remove(i);
        }
}


function addOption(selectbox, value, text ) { var optn = document.createElement("OPTION");
   optn.text = text;
   optn.value = value;
   selectbox.options.add(optn);
} 
