
function showroom(number)
{
	
	var replaceval="<table border='0' cellpadding='0' cellspacing='0' class='text'><tr><td width='78'>Select Room</td><td width='49'>Adults</td><td width='96'>Child With Bed</td><td width='113'>Child Without Bed</td></tr>";
						 
						  for(var i=0; i< parseInt(number); i++)
						  {
			replaceval+="<tr><td colspan='4' height='4'></td></tr><tr><td width='78'><select name='roomtype"+(i+1)+"' id='roomtype"+(i+1)+"' class='text' onChange='showhidechild"+(i+1)+"(this.value)' style='width:65px;'><option value='single'>Single</option><option value='double' selected='selected'>Double</option></select></td><td colspan='3'><div id='changeac"+(i+1)+"'><table cellpadding='0' cellspacing='0'><tr><td width='49'><select name='adult"+(i+1)+"' id='adult"+(i+1)+"' class='text' onChange='changeValuePassenger"+(i+1)+"(this.value);'><option value='1'>1</option><option value='2' selected='selected'>2</option><option value='3'>3</option></select></td><td width='96'><div id='childwith"+(i+1)+"'><select name='childwith"+(i+1)+"'  class='text'><option value='0' selected='selected'>0</option><option value='1'>1</option></select></div></td><td width='113'><select name='childwithout"+(i+1)+"' id='childwithout"+(i+1)+"' class='text'><option value='0' selected='selected'>0</option><option value='1'>1</option></select></td></tr></tr></table></div></td>";
						  }
						 replaceval+="</table>";
						 document.getElementById("noofrooms").innerHTML = replaceval;		
	
}

function showhidechild1(value)
{
	 if(value=='single')
	 {
		document.getElementById("changeac1").innerHTML="<table cellpadding='0' cellspacing='0'><tr><td width='49'><select name='adult1' id='adult1' class='text'><option value='1'>1</option></select></td><td width='96'><div id='childwith1'><select name='childwith1' class='text'><option value='0' selected='selected'>0</option></select></div></td><td width='113'><select name='childwithout1' id='childwithout1' class='text'><option value='0' selected='selected'>0</option></select></td></tr></table>"; 
	}
	
	else if(value=='double')
	{
		 document.getElementById("changeac1").innerHTML="<table cellpadding='0' cellspacing='0'><tr><td width='49'><select name='adult1' id='adult1' class='text' onChange='changeValuePassenger1(this.value);'><option value='1'>1</option><option value='2' selected='selected'>2</option><option value='3'>3</option></select></td><td width='96'><div id='childwith1'><select name='childwith1' class='text'><option value='0' selected='selected'>0</option><option value='1'>1</option></select></div></td><td width='113'><select name='childwithout1' id='childwithout1' class='text'><option value='0' selected='selected'>0</option><option value='1'>1</option></select></td></tr></table>";	
	}
}

function showhidechild2(value)
{
	if(value=='single')
	{
		 document.getElementById("changeac2").innerHTML="<table cellpadding='0' cellspacing='0'><tr><td width='49'><select name='adult2' id='adult2' class='text'><option value='1'>1</option></select></td><td width='96'><div id='childwith2'><select name='childwith2' class='text'><option value='0' selected='selected'>0</option></select></div></td><td width='113'><select name='childwithout2' id='childwithout2' class='text'><option value='0' selected='selected'>0</option></select></td></tr></table>";
	}
	
	if(value=='double')
	{
		 document.getElementById("changeac2").innerHTML="<table cellpadding='0' cellspacing='0'><tr><td width='49'><select name='adult2' id='adult2' class='text' onChange='changeValuePassenger2(this.value);'><option value='1'>1</option><option value='2' selected='selected'>2</option><option value='3'>3</option></select></td><td width='96'><div id='childwith2'><select name='childwith2' class='text'><option value='0' selected='selected'>0</option><option value='1'>1</option></select></div></td><td width='113'><select name='childwithout2' id='childwithout2' class='text'><option value='0' selected='selected'>0</option><option value='1'>1</option></select></td></tr></table>";	
	}
}
function showhidechild3(value)
{
	if(value=='single')
	{
		 document.getElementById("changeac3").innerHTML="<table cellpadding='0' cellspacing='0'><tr><td width='49'><select name='adult3' id='adult3' class='text'><option value='1'>1</option></select></td><td width='96'><div id='childwith3'><select name='childwith3' class='text'><option value='0' selected='selected'>0</option></select></div></td><td width='113'><select name='childwithout3' id='childwithout3' class='text'><option value='0' selected='selected'>0</option></select></td></tr></table>";
	}
	
	if(value=='double')
	{
		 document.getElementById("changeac3").innerHTML="<table cellpadding='0' cellspacing='0'><tr><td width='49'><select name='adult3' id='adult3' class='text' onChange='changeValuePassenger3(this.value);'><option value='1'>1</option><option value='2' selected='selected'>2</option><option value='3'>3</option></select></td><td width='96'><div id='childwith3'><select name='childwith3' class='text'><option value='0' selected='selected'>0</option><option value='1'>1</option></select></div></td><td width='113'><select name='childwithout3' id='childwithout3' class='text'><option value='0' selected='selected'>0</option><option value='1'>1</option></select></td></tr></table>";	
	}
}
function showhidechild4(value)
{
	if(value=='single')
	{
		 document.getElementById("changeac4").innerHTML="<table cellpadding='0' cellspacing='0'><tr><td width='49'><select name='adult4' id='adult4' class='text'><option value='1'>1</option></select></td><td width='96'><div id='childwith4'><select name='childwith4' class='text'><option value='0' selected='selected'>0</option></div></select></td><td width='113'><select name='childwithout4' id='childwithout4' class='text'><option value='0' selected='selected'>0</option></select></td></tr></table>";
	}
	
	if(value=='double')
	{
		 document.getElementById("changeac4").innerHTML="<table cellpadding='0' cellspacing='0'><tr><td width='49'><select name='adult4' id='adult4' class='text' onChange='changeValuePassenger4(this.value);'><option value='1'>1</option><option value='2' selected='selected'>2</option><option value='3'>3</option></select></td><td width='96'><div id='childwith4'><select name='childwith4' class='text'><option value='0' selected='selected'>0</option><option value='1'>1</option></div></select></td><td width='113'><select name='childwithout4' id='childwithout4' class='text'><option value='0' selected='selected'>0</option><option value='1'>1</option></select></td></tr></table>";	
	}
}
function showhidechild5(value)
{
	if(value=='single')
	{
		 document.getElementById("changeac5").innerHTML="<table cellpadding='0' cellspacing='0'><tr><td width='49'><select name='adult5' id='adult5' class='text'><option value='1'>1</option></select></td><td width='96'><div id='childwith5'><select name='childwith5' class='text'><option value='0' selected='selected'>0</option></select></div></td><td width='113'><select name='childwithout5' id='childwithout5' class='text'><option value='0' selected='selected'>0</option></select></td></tr></table>";
	}
	
	if(value=='double')
	{
		 document.getElementById("changeac5").innerHTML="<table cellpadding='0' cellspacing='0'><tr><td width='49'><select name='adult5' id='adult5' class='text' onChange='changeValuePassenger5(this.value);'><option value='1'>1</option><option value='2' selected='selected'>2</option><option value='3'>3</option></select></td><td width='96'><div id='childwith5'><select name='childwith5' class='text'><option value='0' selected='selected'>0</option><option value='1'>1</option></select></div></td><td width='113'><select name='childwithout5' id='childwithout5' class='text'><option value='0' selected='selected'>0</option><option value='1'>1</option></select></td></tr></table>";	
	}
}

function changeValuePassenger1(chi)
{
	//alert(chi);
	if(chi==3)
	{
		document.getElementById("childwith1").innerHTML="<select name='childwith1' class='text'><option value='0'>0</option></select>";
	}
	else
	{
		document.getElementById("childwith1").innerHTML="<select name='childwith1' class='text'><option value='0' selected='selected'>0</option><option value='1'>1</option></select>";
	}
}
function changeValuePassenger2(chi)
{
	if(chi==3)
	{
		document.getElementById("childwith2").innerHTML="<select name='childwith2' class='text'><option value='0'>0</option></select>";
	}
	else
	{
	    document.getElementById("childwith2").innerHTML="<select name='childwith2' class='text'><option value='0' selected='selected'>0</option><option value='1'>1</option></select>";
	}
}
function changeValuePassenger3(chi)
{
	if(chi==3)
	{
		document.getElementById("childwith3").innerHTML="<select name='childwith3' class='text'><option value='0'>0</option></select>";
	}
	else
	{
	    document.getElementById("childwith3").innerHTML="<select name='childwith3' class='text'><option value='0' selected='selected'>0</option><option value='1'>1</option></select>";
	}
}
function changeValuePassenger4(chi)
{
	if(chi==3)
	{
		document.getElementById("childwith4").innerHTML="<select name='childwith4' class='text'><option value='0'>0</option></select>";
	}
	else
	{
	    document.getElementById("childwith4").innerHTML="<select name='childwith4' class='text'><option value='0' selected='selected'>0</option><option value='1'>1</option></select>";
	}
}
function changeValuePassenger5(chi)
{
	if(chi==3)
	{
		document.getElementById("childwith5").innerHTML="<select name='childwith5' class='text'><option value='0'>0</option></select>";
	}
	else
	{
	    document.getElementById("childwith5").innerHTML="<select name='childwith5' class='text'><option value='0' selected='selected'>0</option><option value='1'>1</option></select>";
	}
}
function calculateNoOfNight()
{
	//alert(navigator.appName );//Microsoft Internet Explorer
 var date1=document.getElementById("Checkin2").value;	
			var where_is_mytool=date1;
			var mytool_array=where_is_mytool.split("-");
			var checkin0= mytool_array[0];
			var checkin1 =mytool_array[1];
			var checkin4 =mytool_array[2];
 			var checkin3=new Date();
				checkin3.setFullYear(checkin4,checkin1-1,checkin0);
			//var checkin3=checkin4+"-"+checkin1+"-"+checkin0; 
			var days_cin = Date.parse(checkin3);
			var ONE_DAY = 1000 * 60 * 60 * 24;
 	
	
	var date2=document.getElementById("Checkout2").value;	
  
  //alert(date2);
  			var where_is_mytool1=date2;
			var mytool_array1=where_is_mytool1.split("-");
			var Checkout0= mytool_array1[0];
			var Checkout1 =mytool_array1[1];
			var Checkout4 =mytool_array1[2];
			var Checkout3=new Date();
				Checkout3.setFullYear(Checkout4,Checkout1-1,Checkout0);
			//var Checkout3=Checkout4+"-"+Checkout1+"-"+Checkout0; 
			
			var days_cout=Date.parse(Checkout3);
			var diff1=days_cout - days_cin;
			var diff=diff1/ONE_DAY;
			//alert(date1+" : "+date2+" : "+days_cin+" : "+days_cout+" : "+diff1+" : "+diff);
			document.getElementById("noofnight").value=diff;
}

