﻿// JScript File

function clear_textbox(Id)
	{			
		document.getElementById(Id).value = "";
	} 
	
	
var gAutoPrint = true; // Flag for whether or not to automatically call the print function
function printSpecial(titre, rpsernum, logo)
{
	if (document.getElementById != null)
	{
		var html = '<HTML>\n<HEAD>\n';

		if (document.getElementsByTagName != null)
		{
			var headTags = document.getElementsByTagName("head");
		
			if (headTags.length > 0)
				html += headTags[0].innerHTML;
			var hh = html;
			hh.replace('DEVIS','CAP UNIVERS - DEVIS RECAPITULATIF');	
			html = hh;
		}
		
		html += '\n</HE' + 'AD>\n<BO' + 'DY bgcolor="#FFFFFF">\n';
		
		var printReadyElem = document.getElementById("printReady");
			
		if (printReadyElem != null)
		{
		
			if(typeof(titre) != 'undefined') 
				{
				
				html += '<table bgcolor="#FFFFFF"  borderColor="#97d2f0" cellSpacing="0" cellPadding="0" width="640" border="0">';
				html += '<TR>';
				html += '<TD class="bleufoncemaj" colSpan="2" height="110" >';
				html += '<img  src="Images/TopBanner.jpg" border="0"/>';
				html += '<TABLE id="Table6" cellSpacing="0" cellPadding="0" width="100%" border="0">';
				html += '<TR>';
				html += '<TD width="10%"></TD>'; /* <img  src="../CVFiles/Logo/'+ logo +'" border="0"/> */
				html += '<TD align="center" width="25%" Class="bleufoncemaj">';
				html += '<asp:Label id="Label4" runat="server" >'+ titre +'</asp:Label></TD>';
				html += '<TD width="45%" class="bleufoncemaj"> ' + rpsernum + '</TD>';
				html += '</TR>';
				html += '</TABLE>';
				html += '</TD>';
				html += '<TD class="bleufoncemaj"></TD>';
				html += '</TR>';
//				html += '</table>';
				}
				
//				html += printReadyElem.innerHTML.replace('width=820','width=640');
                html += '<td>';
				html += printReadyElem.innerHTML.replace('width=900','width=640');
				html += '</td>';
//				html += '</tr>';
				html += '</table>';
				

			
				
		}
		else

		{

			alert("Could not find the printReady section in the HTML");
			return;

		}
/*
	html += '<table width="820" height="100" border="0" cellpadding="10" cellspacing="0" >';
    html += '<tr><td height="05"></td></tr>';
    html += '<tr>';
    html += '<td valign="top" align=center>';
    html += '<div align="center"><span class="gris"><center>Pour mieux pr&eacute;parer votre voyage,</center> <span class="footertxt"><center>INFORMATIONS & RESERVATIONS 6J/7J de 9h00 &agrave; 20h00</center></span></div>';
    html += '<center><span class="gris">Notre conseiller vous r&eacute;pond au &nbsp;&nbsp;</span><span class="footertxt"> 0 892 707170</span><span class="gris">&nbsp;&nbsp; ou le &nbsp;&nbsp;</span><span class="footertxt"> 32 23  et dites CAPUNIVERS</span><br></center>';
	
    html += '</td>';
    html += '</tr>';
	html += '</table>';
*/

		html += '\n</BO' + 'DY>\n</HT' + 'ML>';		

		var printWin =window.open("","printSpecial");

		printWin.document.open();

		printWin.document.write(html);

		printWin.document.close();

		if (gAutoPrint)

			printWin.print();

	}

	else

	{

		alert("Sorry, the print ready feature is only available in modern browsers.");

	}

}



///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function printDescriptif()
{
	if (document.getElementById != null)
	{
		var html = '<HTML>\n<HEAD>\n';

		if (document.getElementsByTagName != null)
		{
			var headTags = document.getElementsByTagName("head");
		
			if (headTags.length > 0)
				html += headTags[0].innerHTML;
			var hh = html;
			hh.replace('DEVIS','CAP UNIVERS - DEVIS RECAPITULATIF');	
			html = hh;
		}
		
		html += '\n</HEAD>\n<BODY>\n';
		
		var PrintCountry = document.getElementById("PrintCountry");
		var PrintTitle = document.getElementById("PrintTitle");
		var PrintPrix = document.getElementById("PrintPrix");
		var PrintDescription = document.getElementById("PrintDescription");
			
		if (PrintDescription != null)
		{
			
				
				html += '<table bgcolor="#FFFFFF"  borderColor="#97d2f0" cellspacing="0" cellpadding="0" width="650" border="0">';
				html += '<tr>';
				html += '<td colspan="2" height="110" >'; 
				html += '<img  src="Images/TopBanner.jpg" border="0"/>';
				html += '<table cellspacing="0" cellpadding="0" width="100%" border="0">';
				html += '<tr>';
				html += '<td width="291px">';
				html += '<td><a href="mailto:informations@capunivers.com" class="underBC">informations@capunivers.com</a></td>';
				html += '</tr>';
				html += '</table>';
				html += '</td>';
				html += '</tr>';
			
				html += '<tr>';
				html += '<td style="padding-left:5px">';
				html += PrintCountry.innerHTML;
				html += '</td>';
				html += '<td>';
				html += PrintDiscount.innerHTML;
				html += '</td>';
				html += '</tr>';
				
				html += '<tr>';
				html += '<td style="padding-left:5px">';
				html += PrintTitle.innerHTML;
				html += '</td>';
				html += '<td>';
				html += PrintPrix.innerHTML;
				html += '</td>';
				html += '</tr>';
				
				html += '<tr>';
                html += '<td colspan="2" style="padding-left:5px; padding-right:5px"><br>';
				html += PrintDescription.innerHTML.replace('width=900','width=640');
				html += '</td>';
				html += '</tr>';
				html += '</table>';		
				
		}
		else

		{
			alert("Could not find the printReady section in the HTML");
			return;
		}


		html += '\n</BODY>\n</HTML>';		

		var printWin =window.open("","printDescriptif");

		printWin.document.open();

		printWin.document.write(html);

		printWin.document.close();

		if (gAutoPrint)

			printWin.print();

	}

	else

	{
		alert("Sorry, the print ready feature is only available in modern browsers.");
	}

}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////










function changePhoto(no,w,h)
{
window.document.monimage.src= no;
window.document.monimage.width= w;
window.document.monimage.height= h;
}	

	function TestSelectChambre()
	{
	    //var var_DD_NBRC = document.getElementById(GetClientId("DD_NBRC"));
		var var_RoomType1 = document.getElementById(GetClientId("RoomType1"));
	    var var_RoomType2 = document.getElementById(GetClientId("RoomType2"));
	    var var_RoomType3 = document.getElementById(GetClientId("RoomType3"));
	    var var_RoomType4 = document.getElementById(GetClientId("RoomType4"));
	    var var_RoomType5 = document.getElementById(GetClientId("RoomType5"));
	    
		//var nombre=document.Form1.DD_NBRC.options[document.Form1.DD_NBRC.options.selectedIndex].value;
		//var nombre= var_DD_NBRC.value;
		//var lst = document.getElementById('DD_NBRC1');
		var lst = document.getElementById(GetClientId("DD_NBRC1"));
	    var nombre = lst.options[lst.selectedIndex].text;
	    
		if(nombre == 1)
		{
			//var selRoomType1 = document.Form1.RoomType1.options.selectedIndex;
			var selRoomType1 = var_RoomType1.value;
			
			if (selRoomType1 == 0) 
			{
				dispHandle(DD1R2);
			}  
			else 
			{
				hideHandle(DD1R2);
			}
		} 
		
		else if(nombre == 2)
		{
			//var selRoomType1 = document.Form1.RoomType1.options.selectedIndex;
			//var selRoomType2 = document.Form1.RoomType2.options.selectedIndex;
			var selRoomType1 = var_RoomType1.value;
			var selRoomType2 = var_RoomType2.value;
			if (selRoomType1 == 0 || selRoomType2 == 0) 
			{
				dispHandle(DD1R2);
			}  
			else 
			{
				hideHandle(DD1R2);
			}
		} 
		
		else if(nombre == 3)
		{
			//var selRoomType1 = document.Form1.RoomType1.options.selectedIndex;
			//var selRoomType2 = document.Form1.RoomType2.options.selectedIndex;
			//var selRoomType3 = document.Form1.RoomType3.options.selectedIndex;
			var selRoomType1 = var_RoomType1.value;
			var selRoomType2 = var_RoomType2.value;
			var selRoomType3 = var_RoomType3.value;
			if (selRoomType1 == 0 || selRoomType2 == 0 || selRoomType3 == 0) 
			{
				dispHandle(DD1R2);
			}  
			else 
			{
				hideHandle(DD1R2);
			}
		} 
		else if(nombre == 4)
		{
			//var selRoomType1 = document.Form1.RoomType1.options.selectedIndex;
			//var selRoomType2 = document.Form1.RoomType2.options.selectedIndex;
			//var selRoomType3 = document.Form1.RoomType3.options.selectedIndex;
			//var selRoomType4 = document.Form1.RoomType4.options.selectedIndex;
			
			var selRoomType1 = var_RoomType1.value;
			var selRoomType2 = var_RoomType2.value;
			var selRoomType3 = var_RoomType3.value;
            var selRoomType4 = var_RoomType4.value;
			
			if (selRoomType1 == 0 || selRoomType2 == 0 || selRoomType3 == 0 || selRoomType4 == 0) 
			{
				dispHandle(DD1R2);
			}  
			else 
			{
				hideHandle(DD1R2);
			}
		} 
		else if(nombre == 5)
		{
			//var selRoomType1 = document.Form1.RoomType1.options.selectedIndex;
			//var selRoomType2 = document.Form1.RoomType2.options.selectedIndex;
			//var selRoomType3 = document.Form1.RoomType3.options.selectedIndex;
			//var selRoomType4 = document.Form1.RoomType4.options.selectedIndex;
			//var selRoomType5 = document.Form1.RoomType5.options.selectedIndex;
			
			var selRoomType1 = var_RoomType1.value;
			var selRoomType2 = var_RoomType2.value;
			var selRoomType3 = var_RoomType3.value;
            var selRoomType4 = var_RoomType4.value;
            var selRoomType5 = var_RoomType5.value;
            
			if (selRoomType1 == 0 || selRoomType2 == 0 || selRoomType3 == 0 
							|| selRoomType4 == 0 || selRoomType5 == 0) 
			{
				dispHandle(DD1R2);
			}  
			else 
			{
				hideHandle(DD1R2);
			}
		} 


	}

    function dispHandle(obj) 
							{
			obj.style.display = "";
							}
  
    function hideHandle(obj) 
					{
				obj.style.display = "none";
					}


 function validate_submitLocal1()
       {
       
            //var var_DD_NBRA = document.getElementById(GetClientId("DD_NBRA"));
            //var var_DD_NBRE = document.getElementById(GetClientId("DD_NBRE"));
            //var var_DD_NBRB = document.getElementById(GetClientId("DD_NBRB"));
            //var var_DD_NBRC = document.getElementById(GetClientId("DD_NBRC"));
            
            var var_RoomType1P = document.getElementById(GetClientId("RoomType1P"));
	        var var_RoomType2P = document.getElementById(GetClientId("RoomType2P"));
	        var var_RoomType3P = document.getElementById(GetClientId("RoomType3P"));
	        var var_RoomType4P = document.getElementById(GetClientId("RoomType4P"));
	        var var_RoomType5P = document.getElementById(GetClientId("RoomType5P"));
	        var var_RoomType6P = document.getElementById(GetClientId("RoomType6P"));
	        var var_RoomType7P = document.getElementById(GetClientId("RoomType7P"));
	        var var_RoomType8P = document.getElementById(GetClientId("RoomType8P"));
	        var var_RoomType9P = document.getElementById(GetClientId("RoomType9P"));
	        var var_RoomType10P = document.getElementById(GetClientId("RoomType10P"));
	        
	        var var_RoomType1 = document.getElementById(GetClientId("RoomType1"));
	        var var_RoomType2 = document.getElementById(GetClientId("RoomType2"));
	        var var_RoomType3 = document.getElementById(GetClientId("RoomType3"));
	        var var_RoomType4 = document.getElementById(GetClientId("RoomType4"));
	        var var_RoomType5 = document.getElementById(GetClientId("RoomType5"));
	        var var_RoomType6 = document.getElementById(GetClientId("RoomType6"));
	        var var_RoomType7 = document.getElementById(GetClientId("RoomType7"));
	        var var_RoomType8 = document.getElementById(GetClientId("RoomType8"));
	        var var_RoomType9 = document.getElementById(GetClientId("RoomType9"));
	        var var_RoomType10 = document.getElementById(GetClientId("RoomType10"));
       
			//var dd_adulte = document.Form1.DD_NBRA.options[document.Form1.DD_NBRA.options.selectedIndex].value;
			//var dd_enfant = document.Form1.DD_NBRA.options[document.Form1.DD_NBRE.options.selectedIndex].value;
			//var dd_bebe = document.Form1.DD_NBRB.options[document.Form1.DD_NBRB.options.selectedIndex].value;
			//var dd_chambre = document.Form1.DD_NBRC.options[document.Form1.DD_NBRC.options.selectedIndex].value;
			
			var dd_adulte = var_DD_NBRA.value;
			var dd_enfant = var_DD_NBRE.value;
			var dd_bebe = var_DD_NBRB.value;
			//var dd_chambre = var_DD_NBRC.value;
			//var lst = document.getElementById('DD_NBRC1');
			var lst = document.getElementById(GetClientId("DD_NBRC1"));
	        var dd_chambre = lst.options[lst.selectedIndex].text;
			
			if (dd_adulte == 0) 
            {
				alert("Veuillez indiquer le nombre de participant");
				return false;
            }
			
			if (dd_chambre == 0) 
            {
				
				alert("Merci de bien vouloir nous indiquer le nombre de chambres dont vous avez besoin");
				return false;
				
            }
            
            
			var nbrpers = parseInt(dd_adulte) + parseInt(dd_enfant) + parseInt(dd_bebe);
			var countperchambre = 0;
			if (dd_chambre == 1)
			{
				//countperchambre = parseInt(document.Form1.RoomType1P.options[document.Form1.RoomType1P.options.selectedIndex].value);
				countperchambre = parseInt(var_RoomType1P.value);
				
			}
			
			if (dd_chambre == 2)
			{
				//countperchambre = parseInt(document.Form1.RoomType1P.options[document.Form1.RoomType1P.options.selectedIndex].value)
				//				+ parseInt(document.Form1.RoomType2P.options[document.Form1.RoomType2P.options.selectedIndex].value);
				countperchambre = parseInt(var_RoomType1P.value)
				                + parseInt(var_RoomType2P.value);
			}
			
			
			if (dd_chambre == 3)
			{
			//	countperchambre = parseInt(document.Form1.RoomType1P.options[document.Form1.RoomType1P.options.selectedIndex].value)
			//					+ parseInt(document.Form1.RoomType2P.options[document.Form1.RoomType2P.options.selectedIndex].value)
			//					+ parseInt(document.Form1.RoomType3P.options[document.Form1.RoomType3P.options.selectedIndex].value);
			countperchambre =   parseInt(var_RoomType1P.value)
			                    + parseInt(var_RoomType2P.value)
				                + parseInt(var_RoomType3P.value);
			}
			
			if (dd_chambre == 4)
			{
//				countperchambre = parseInt(document.Form1.RoomType1P.options[document.Form1.RoomType1P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType2P.options[document.Form1.RoomType2P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType3P.options[document.Form1.RoomType3P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType4P.options[document.Form1.RoomType4P.options.selectedIndex].value);
			countperchambre =   parseInt(var_RoomType1P.value)
			                    + parseInt(var_RoomType2P.value)
			                    + parseInt(var_RoomType3P.value)
				                + parseInt(var_RoomType4P.value);

			}
			
			if (dd_chambre == 5)
			{
//				countperchambre = parseInt(document.Form1.RoomType1P.options[document.Form1.RoomType1P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType2P.options[document.Form1.RoomType2P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType3P.options[document.Form1.RoomType3P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType4P.options[document.Form1.RoomType4P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType5P.options[document.Form1.RoomType5P.options.selectedIndex].value);
			countperchambre =   parseInt(var_RoomType1P.value)
			                    + parseInt(var_RoomType2P.value)
			                    + parseInt(var_RoomType3P.value)
				                + parseInt(var_RoomType4P.value)
				                + parseInt(var_RoomType5P.value);
			}
			
			if (dd_chambre == 6)
			{
	//			countperchambre = parseInt(document.Form1.RoomType1P.options[document.Form1.RoomType1P.options.selectedIndex].value)
	//							+ parseInt(document.Form1.RoomType2P.options[document.Form1.RoomType2P.options.selectedIndex].value)
	//							+ parseInt(document.Form1.RoomType3P.options[document.Form1.RoomType3P.options.selectedIndex].value)
	//							+ parseInt(document.Form1.RoomType4P.options[document.Form1.RoomType4P.options.selectedIndex].value)
	//							+ parseInt(document.Form1.RoomType5P.options[document.Form1.RoomType5P.options.selectedIndex].value)
	//							+ parseInt(document.Form1.RoomType6P.options[document.Form1.RoomType6P.options.selectedIndex].value);
			countperchambre =   parseInt(var_RoomType1P.value)
			                    + parseInt(var_RoomType2P.value)
			                    + parseInt(var_RoomType3P.value)
				                + parseInt(var_RoomType4P.value)
				                + parseInt(var_RoomType5P.value)
				                + parseInt(var_RoomType6P.value);
			}


			if (dd_chambre == 7)
			{
	//			countperchambre = parseInt(document.Form1.RoomType1P.options[document.Form1.RoomType1P.options.selectedIndex].value)
	//							+ parseInt(document.Form1.RoomType2P.options[document.Form1.RoomType2P.options.selectedIndex].value)
	//							+ parseInt(document.Form1.RoomType3P.options[document.Form1.RoomType3P.options.selectedIndex].value)
	//							+ parseInt(document.Form1.RoomType4P.options[document.Form1.RoomType4P.options.selectedIndex].value)
	//							+ parseInt(document.Form1.RoomType5P.options[document.Form1.RoomType5P.options.selectedIndex].value)
	//							+ parseInt(document.Form1.RoomType6P.options[document.Form1.RoomType6P.options.selectedIndex].value)
	//							+ parseInt(document.Form1.RoomType7P.options[document.Form1.RoomType7P.options.selectedIndex].value);
			countperchambre =   parseInt(var_RoomType1P.value)
			                    + parseInt(var_RoomType2P.value)
			                    + parseInt(var_RoomType3P.value)
				                + parseInt(var_RoomType4P.value)
				                + parseInt(var_RoomType5P.value)
				                + parseInt(var_RoomType6P.value)
				                + parseInt(var_RoomType7P.value);
			}


			if (dd_chambre == 8)
			{
//				countperchambre = parseInt(document.Form1.RoomType1P.options[document.Form1.RoomType1P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType2P.options[document.Form1.RoomType2P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType3P.options[document.Form1.RoomType3P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType4P.options[document.Form1.RoomType4P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType5P.options[document.Form1.RoomType5P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType6P.options[document.Form1.RoomType6P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType7P.options[document.Form1.RoomType7P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType8P.options[document.Form1.RoomType8P.options.selectedIndex].value);
			countperchambre =   parseInt(var_RoomType1P.value)
			                    + parseInt(var_RoomType2P.value)
			                    + parseInt(var_RoomType3P.value)
				                + parseInt(var_RoomType4P.value)
				                + parseInt(var_RoomType5P.value)
				                + parseInt(var_RoomType6P.value)
				                + parseInt(var_RoomType7P.value)
				                + parseInt(var_RoomType8P.value);
			}
			
			if (dd_chambre == 9)
			{
//				countperchambre = parseInt(document.Form1.RoomType1P.options[document.Form1.RoomType1P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType2P.options[document.Form1.RoomType2P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType3P.options[document.Form1.RoomType3P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType4P.options[document.Form1.RoomType4P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType5P.options[document.Form1.RoomType5P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType6P.options[document.Form1.RoomType6P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType7P.options[document.Form1.RoomType7P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType8P.options[document.Form1.RoomType8P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType9P.options[document.Form1.RoomType9P.options.selectedIndex].value);
			countperchambre =   parseInt(var_RoomType1P.value)
			                    + parseInt(var_RoomType2P.value)
			                    + parseInt(var_RoomType3P.value)
				                + parseInt(var_RoomType4P.value)
				                + parseInt(var_RoomType5P.value)
				                + parseInt(var_RoomType6P.value)
				                + parseInt(var_RoomType7P.value)
				                + parseInt(var_RoomType8P.value)
				                + parseInt(var_RoomType9P.value);
			}

			if (dd_chambre == 10)
			{
//				countperchambre = parseInt(document.Form1.RoomType1P.options[document.Form1.RoomType1P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType2P.options[document.Form1.RoomType2P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType3P.options[document.Form1.RoomType3P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType4P.options[document.Form1.RoomType4P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType5P.options[document.Form1.RoomType5P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType6P.options[document.Form1.RoomType6P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType7P.options[document.Form1.RoomType7P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType8P.options[document.Form1.RoomType8P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType9P.options[document.Form1.RoomType9P.options.selectedIndex].value)
//								+ parseInt(document.Form1.RoomType10P.options[document.Form1.RoomType10P.options.selectedIndex].value);
			countperchambre =   parseInt(var_RoomType1P.value)
			                    + parseInt(var_RoomType2P.value)
			                    + parseInt(var_RoomType3P.value)
				                + parseInt(var_RoomType4P.value)
				                + parseInt(var_RoomType5P.value)
				                + parseInt(var_RoomType6P.value)
				                + parseInt(var_RoomType7P.value)
				                + parseInt(var_RoomType8P.value)
				                + parseInt(var_RoomType9P.value)
				                + parseInt(var_RoomType10P.value);
			}

			if (dd_chambre >= 1) 
			{
				var roomType1 = var_RoomType1.value;
				if (roomType1 == 0)
				{
					//alert("Merci de bien vouloir nous indiquer le type de la chambre (1)")
					alert("Sélectionner le type de chambre désiré.")
					return false;
				}
				var roomType1_array=roomType1.split("|");
				
				if ((var_RoomType1P.value - dd_bebe) > roomType1_array[2])
				{
					alert("Le type de chambre que vous avez sélectionné n'accepte pas plus d’une personne (adultes et enfants compris).");
					return false;
				}
				
				if ((var_RoomType1P.value - dd_bebe) < roomType1_array[1])
				{
					alert("Le type de chambre que vous avez sélectionné accepte plus de personnes (adultes et enfants compris).");
					return false;
				}
			}
			
			if (dd_chambre >= 2) 
			{
				var roomType2 =var_RoomType2.value;
				if (roomType2 == 0)
				{
					//alert("Merci de bien vouloir nous indiquer le type de la chambre (2)")
					alert("Sélectionner le type de chambre désiré.")
					return false;
				}
				var roomType2_array=roomType2.split("|");
				if (var_RoomType2P.value > roomType2_array[2])
				{
					//alert("Le type de chambre(2) que vous avez choisi n'accepte pas plus de " + roomType2_array[2] + " personnes (adultes et enfants compris).")
					alert("Le type de chambre que vous avez sélectionné n'accepte pas plus d’une personne (adultes et enfants compris).");
					return false;
				}
				if (var_RoomType2P.value < roomType2_array[1])
				{
					alert("Le type de chambre que vous avez sélectionné accepte plus de personnes (adultes et enfants compris).");
					return false;
				}
			}
			
			if (dd_chambre >= 3) 
			{
				var roomType3 =var_RoomType3.value;
				if (roomType3 == 0)
				{
					//alert("Merci de bien vouloir nous indiquer le type de la chambre (3)")
					alert("Sélectionner le type de chambre désiré.")
					return false;
				}
				var roomType3_array=roomType3.split("|");
				if (var_RoomType3P.value > roomType3_array[2])
				{
					//alert("Le type de chambre(3) que vous avez choisi n'accepte pas plus de " + roomType3_array[2] + " personnes (adultes et enfants compris).")
					alert("Le type de chambre que vous avez sélectionné n'accepte pas plus d’une personne (adultes et enfants compris).");
					return false;
				}
				if (var_RoomType3P.value < roomType3_array[1])
				{
					alert("Le type de chambre que vous avez sélectionné accepte plus de personnes (adultes et enfants compris).");
					return false;
				}
			}
			
			if (dd_chambre >= 4) 
			{
				var roomType4 = var_RoomType4.value;
				if (roomType4 == 0)
				{
					//alert("Merci de bien vouloir nous indiquer le type de la chambre (2)")
					alert("Sélectionner le type de chambre désiré.")
					return false;
				}
				var roomType4_array=roomType4.split("|");
				if (var_RoomType4P.value > roomType4_array[2])
				{
					//alert("Le type de chambre(4) que vous avez choisi n'accepte pas plus de " + roomType4_array[2] + " personnes (adultes et enfants compris).")
					alert("Le type de chambre que vous avez sélectionné n'accepte pas plus d’une personne (adultes et enfants compris).");
					return false;
				}
				if (var_RoomType4P.value < roomType4_array[1])
				{
					alert("Le type de chambre que vous avez sélectionné accepte plus de personnes (adultes et enfants compris).");
					return false;
				}
			}
			
			
			if (dd_chambre >= 5) 
			{
				var roomType5 = var_RoomType5.value;
				if (roomType5 == 0)
				{
					//alert("Merci de bien vouloir nous indiquer le type de la chambre (5)")
					alert("Sélectionner le type de chambre désiré.")
					return false;
				}
				var roomType5_array=roomType5.split("|");
				if (var_RoomType5P.value > roomType5_array[2])
				{
					//alert("Le type de chambre(5) que vous avez choisi n'accepte pas plus de " + roomType5_array[2] + " personnes (adultes et enfants compris).")
					alert("Le type de chambre que vous avez sélectionné n'accepte pas plus d’une personne (adultes et enfants compris).");
					return false;
				}
				if (var_RoomType5P.value < roomType5_array[1])
				{
					alert("Le type de chambre que vous avez sélectionné accepte plus de personnes (adultes et enfants compris).");
					return false;
				}
			}
			
			if (dd_chambre >= 6) 
			{
				var roomType6 = var_RoomType6.value;
				if (roomType6 == 0)
				{
					//alert("Merci de bien vouloir nous indiquer le type de la chambre (6)")
					alert("Sélectionner le type de chambre désiré.")
					return false;
				}
				var roomType6_array=roomType6.split("|");
				if (var_RoomType6P.value > roomType6_array[2])
				{
					//alert("Le type de chambre(6) que vous avez choisi n'accepte pas plus de " + roomType6_array[2] + " personnes (adultes et enfants compris).")
					alert("Le type de chambre que vous avez sélectionné n'accepte pas plus d’une personne (adultes et enfants compris).");
					return false;
				}
				if (var_RoomType6P.value < roomType6_array[1])
				{
					alert("Le type de chambre que vous avez sélectionné accepte plus de personnes (adultes et enfants compris).");
					return false;
				}
			}
			
			if (dd_chambre >= 7) 
			{
				var roomType7 = var_RoomType7.value;
				if (roomType7 == 0)
				{
					//alert("Merci de bien vouloir nous indiquer le type de la chambre (7)")
					alert("Sélectionner le type de chambre désiré.")
					return false;
				}
				var roomType7_array=roomType7.split("|");
				if (var_RoomType7P.value > roomType7_array[2])
				{
					//alert("Le type de chambre(7) que vous avez choisi n'accepte pas plus de " + roomType7_array[2] + " personnes (adultes et enfants compris).")
					alert("Le type de chambre que vous avez sélectionné n'accepte pas plus d’une personne (adultes et enfants compris).");
					return false;
				}
				if (var_RoomType7P.value < roomType7_array[1])
				{
					alert("Le type de chambre que vous avez sélectionné accepte plus de personnes (adultes et enfants compris).");
					return false;
				}
			}
			
			if (dd_chambre >= 8) 
			{
				var roomType8 = var_RoomType8.value;
				if (roomType8 == 0)
				{
					//alert("Merci de bien vouloir nous indiquer le type de la chambre (8)")
					alert("Sélectionner le type de chambre désiré.")
					return false;
				}
				var roomType8_array=roomType8.split("|");
				if (var_RoomType8P.value > roomType8_array[2])
				{
					//alert("Le type de chambre(8) que vous avez choisi n'accepte pas plus de " + roomType8_array[2] + " personnes (adultes et enfants compris).")
					alert("Le type de chambre que vous avez sélectionné n'accepte pas plus d’une personne (adultes et enfants compris).");
					return false;
				}
				if (var_RoomType8P.value < roomType8_array[1])
				{
					alert("Le type de chambre que vous avez sélectionné accepte plus de personnes (adultes et enfants compris).");
					return false;
				}
			}
			
			if (dd_chambre >= 9) 
			{
				var roomType9 = var_RoomType9.value;
				if (roomType9 == 0)
				{
					//alert("Merci de bien vouloir nous indiquer le type de la chambre (9)")
					alert("Sélectionner le type de chambre désiré.")
					return false;
				}
				var roomType9_array=roomType9.split("|");
				if (var_RoomType9P.value > roomType9_array[2])
				{
					//alert("Le type de chambre(9) que vous avez choisi n'accepte pas plus de " + roomType9_array[2] + " personnes (adultes et enfants compris).")
					alert("Le type de chambre que vous avez sélectionné n'accepte pas plus d’une personne (adultes et enfants compris).");
					return false;
				}
				if (var_RoomType9P.value < roomType9_array[1])
				{
					alert("Le type de chambre que vous avez sélectionné accepte plus de personnes (adultes et enfants compris).");
					return false;
				}
			}
			
			if (dd_chambre >= 10) 
			{
				var roomType10 = var_RoomType10.value;
				if (roomType10 == 0)
				{
					//alert("Merci de bien vouloir nous indiquer le type de la chambre (10)")
					alert("Sélectionner le type de chambre désiré.")
					return false;
				}
				var roomType10_array=roomType10.split("|");
				if (var_RoomType10P.value > roomType10_array[2])
				{
					//alert("Le type de chambre(10) que vous avez choisi n'accepte pas plus de " + roomType10_array[2] + " personnes (adultes et enfants compris).")
					alert("Le type de chambre que vous avez sélectionné n'accepte pas plus d’une personne (adultes et enfants compris).");
					return false;
				}
				if (var_RoomType10P.value < roomType10_array[1])
				{
					alert("Le type de chambre que vous avez sélectionné accepte plus de personnes (adultes et enfants compris).");
					return false;
				}
			}
			
			
            
            if (nbrpers == countperchambre)
			{
				CustomValidator2.IsValid = true;
				return true;
			//	ValidatorEnable(ValidationSummary1,true);
            } 
            else 
            {
				//CustomValidator2.IsValid = false;
				alert("Le nombre total de personne doit être égal au nombre de personnes réparties dans les chambres");
				return false;
				//document.Form1.ValidationSummary1.showmessagebox = false;
				//return;
            }
       }
       
    function showRdBtn()
    {
        hideHandle(RBL2);
        	var radio = document.forms[0].elements["RadioButtonList1"];
        	for (var j = 0; j < radio.length; j++)
            {
                if (radio[j].checked)
                    {
                        if (radio[j].value == 1 || radio[j].value == 3){dispHandle(RBL2);}
                    }
                    
            }


    }
    
    /// start Date Validate

var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}
    
function ValidateDate(oSrc, args)
{
		var dty= document.getElementById(GetClientId("rp_carte_exY")); //Form1.rp_carte_exY
		var dtm=document.getElementById(GetClientId("rp_carte_exM")); //Form1.rp_carte_exM
		//var dtd=document.getElementById(GetClientId("rp_carte_exD")); //Form1.rp_carte_exD
		
		if (isDate(dtm.value+'/01/20'+ dty.value)==false)
		{
			dt.focus()
			args.IsValid = false
		} else {
			args.IsValid = true
		}
 }

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}
function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		alert("The date format should be : mm/dd/yyyy")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		alert("Please enter a valid month")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		alert("Please enter a valid day")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		alert("Please enter a valid date")
		return false
	}

return true
}

/// END Date Validate

function StartAnim()
{
    defilimg();
}
	function showAll()
	{
	   //var lst = document.getElementById('DD_NBRC1');
	   var lst = document.getElementById(GetClientId("DD_NBRC1"));
	   var nombre = lst.options[lst.selectedIndex].text;
       
	    //var var_DD_NBRC = document.getElementById(GetClientId("DD_NBRC"));
	    var var_RoomType1 = document.getElementById(GetClientId("RoomType1"));
	    var var_RoomType2 = document.getElementById(GetClientId("RoomType2"));
	    var var_RoomType3 = document.getElementById(GetClientId("RoomType3"));
	    var var_RoomType4 = document.getElementById(GetClientId("RoomType4"));
	    var var_RoomType5 = document.getElementById(GetClientId("RoomType5"));
	    
	    var var_RoomType1P = document.getElementById(GetClientId("RoomType1P"));
	    var var_RoomType2P = document.getElementById(GetClientId("RoomType2P"));
	    var var_RoomType3P = document.getElementById(GetClientId("RoomType3P"));
	    var var_RoomType4P = document.getElementById(GetClientId("RoomType4P"));
	    var var_RoomType5P = document.getElementById(GetClientId("RoomType5P"));
	    
	    //var nombre = var_DD_NBRC.value;
	  	   
						hideHandle(DD1R1);	
						hideHandle(DD1R2);	
					
						hideHandle(ch1);	
						hideHandle(ch2);
						hideHandle(chA2);
						hideHandle(chE2);
						hideHandle(chB2);
	
						hideHandle(DD1);
						hideHandle(DD2);
						hideHandle(DD3);
						hideHandle(DD4);
						hideHandle(DD5);
												
						hideHandle(DP1);
						hideHandle(DE1);
						hideHandle(DB1);
												
						hideHandle(DP2);
						hideHandle(DE2);
						hideHandle(DB2);						
						    
						hideHandle(DP3);
						hideHandle(DE3);
						hideHandle(DB3);						
						
						hideHandle(DP4);
						hideHandle(DE4);
						hideHandle(DB4);						
						
						hideHandle(DP5);
						hideHandle(DE5);
						hideHandle(DB5);						
						
				if(nombre>=1)
					{
						dispHandle(DD1R1);
						TestSelectChambre();
						dispHandle(ch1);
						dispHandle(ch2);
						dispHandle(chA2);
						dispHandle(chE2);
						dispHandle(chB2);
                        
						dispHandle(DD1);
						hideHandle(DD2);
						hideHandle(DD3);
						hideHandle(DD4);
						hideHandle(DD5);
						
						dispHandle(DP1);
						dispHandle(DE1);
						dispHandle(DB1);
						
						hideHandle(DP2);
						hideHandle(DE2);
						hideHandle(DB2);
						
						hideHandle(DP3);
						hideHandle(DE3);
						hideHandle(DB3);
						
						hideHandle(DP4);
						hideHandle(DE4);
						hideHandle(DB4);
						
						hideHandle(DP5);
						hideHandle(DE5);
						hideHandle(DB5);
						
					}

					if(nombre>=2)
					{
						dispHandle(DD1);
						dispHandle(DD2);
						hideHandle(DD3);
						hideHandle(DD4);
						hideHandle(DD5);
						
						dispHandle(DP1);
						dispHandle(DE1);
						dispHandle(DB1);
												
						dispHandle(DP2);
						dispHandle(DE2);
						dispHandle(DB2);
						
						hideHandle(DP3);
						hideHandle(DE3);
						hideHandle(DB3);
						
						hideHandle(DP4);
						hideHandle(DE4);
						hideHandle(DB4);
						
						hideHandle(DP5);
						hideHandle(DE5);
						hideHandle(DB5);
					}
					if(nombre>=3)
					{
						dispHandle(DD1);
						dispHandle(DD2);
						dispHandle(DD3);
						hideHandle(DD4);
						
						dispHandle(DP1);
						dispHandle(DE1);
						dispHandle(DB1);
						
						dispHandle(DP2);
						dispHandle(DE2);
						dispHandle(DB2);
						
						dispHandle(DP3);
						dispHandle(DE3);
						dispHandle(DB3);
						
						hideHandle(DP4);
						hideHandle(DE4);
						hideHandle(DB4);
						
						hideHandle(DP5);
						hideHandle(DE5);
						hideHandle(DB5);
					}
					if(nombre>=4)
					{
						dispHandle(DD1);
						dispHandle(DD2);
						dispHandle(DD3);
						dispHandle(DD4);
						hideHandle(DD5);
						
						dispHandle(DP1);
						dispHandle(DE1);
						dispHandle(DB1);
												
						dispHandle(DP2);
						dispHandle(DE2);
						dispHandle(DB2);
						
						dispHandle(DP3);
						dispHandle(DE3);
						dispHandle(DB3);
						
						dispHandle(DP4);
						dispHandle(DE4);
						dispHandle(DB4);
						
						hideHandle(DP5);
						hideHandle(DE5);
						hideHandle(DB5);
					}
					if(nombre>=5)
					{
						dispHandle(DD1);
						dispHandle(DD2);
						dispHandle(DD3);
						dispHandle(DD4);
						dispHandle(DD5);
						
						dispHandle(DP1);
						dispHandle(DE1);
						dispHandle(DB1);
												
						dispHandle(DP2);
						dispHandle(DE2);
						dispHandle(DB2);

						dispHandle(DP3);
						dispHandle(DE3);
						dispHandle(DB3);
						
						dispHandle(DP4);
						dispHandle(DE4);
						dispHandle(DB4);
						
						dispHandle(DP5);
						dispHandle(DE5);
						dispHandle(DB5);
					}
				
	}
	
	
function DisableNonNumericCharacters(fld, e, allowSpace,isDouble)
{
	var space='';
	var strCheck;
	if(allowSpace!=null && allowSpace==true)
		space=' ';
	if (isDouble !=null && isDouble == true)
	 strCheck = '0123456789.' + space;
	else
	 strCheck = '0123456789' + space;
	 
	var aux = aux2 = '';
	
	var whichCode = (window.Event) ? e.which : e.keyCode; //.charCode
	if (whichCode == 13) return true;  // Enter
	//if (whichCode == 8) return true;  // BackSpace
	//if (whichCode == 9) return true;  // Tab
	key = String.fromCharCode(whichCode);  // Get key value from key code
	
	if (strCheck.indexOf(key) == -1)
		return false;  // Not a valid key
	return true;
}

    
    
	function enableTableLivraison()
	{
		dispHandle(Div_TableLivraison);
		ValidatorEnable(document.getElementById(GetClientId("RequiredFieldValidator68")),true);
		ValidatorEnable(document.getElementById(GetClientId("RequiredFieldValidator69")),true);
		ValidatorEnable(document.getElementById(GetClientId("RequiredFieldValidator70")),true);
		ValidatorEnable(document.getElementById(GetClientId("RequiredFieldValidator71")),true);
		ValidatorEnable(document.getElementById(GetClientId("RequiredFieldValidator72")),true);
		ValidatorEnable(document.getElementById(GetClientId("RequiredFieldValidator73")),true);
		ValidatorEnable(document.getElementById(GetClientId("Customvalidator1")),true);
		ValidatorEnable(document.getElementById(GetClientId("Customvalidator5")),true);
		ValidatorEnable(document.getElementById(GetClientId("Customvalidator6")),true);
		//var monFormulaire10 = document.Form1;
		//monFormulaire10.TxtAge.value= "Enable";
		
	}
	
	
		function disableTableLivraison()
	{
		hideHandle(Div_TableLivraison);
		
		ValidatorEnable(document.getElementById(GetClientId("RequiredFieldValidator68")),false);
		ValidatorEnable(document.getElementById(GetClientId("RequiredFieldValidator69")),false);
		ValidatorEnable(document.getElementById(GetClientId("RequiredFieldValidator70")),false);
		ValidatorEnable(document.getElementById(GetClientId("RequiredFieldValidator71")),false);
		ValidatorEnable(document.getElementById(GetClientId("RequiredFieldValidator72")),false);
		ValidatorEnable(document.getElementById(GetClientId("RequiredFieldValidator73")),false);
		ValidatorEnable(document.getElementById(GetClientId("Customvalidator1")),false);
		ValidatorEnable(document.getElementById(GetClientId("Customvalidator5")),false);
		ValidatorEnable(document.getElementById(GetClientId("Customvalidator6")),false);
		//var monFormulaire10 = document.Form1;
		//monFormulaire10.TxtAge.value= "Disable";
		
	}
	
	function MaxPaxChambre(e,r) 
    {
	alert(r.value);
    }
    
    function Upper(e,r)
{
	r.value = r.value.toUpperCase();
} 
   
function Lower(e,r)
{
	r.value = r.value.toLowerCase();
} 


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function closeIt() {
top.window.opener = top;
top.window.open('','_parent','');
top.window.close();
 // window.close();
}

function DDLink(dropdown){
    
    var lst = document.getElementById(GetClientId("DD_Destination"));
	var nombre = lst.options[lst.selectedIndex].text;
	var baseURL  = 'companyair.aspx#' + nombre;
    top.location.href = baseURL;
    return true;
}

function showText()
{
    hideHandle(Div_Login);
    hideHandle(Div_Insc);
    dispHandle(Div_Text);    
}
function showLogin()
{    
    hideHandle(Div_Text);
    hideHandle(Div_Insc);
    dispHandle(Div_Login);
    ValidatorEnable(document.getElementById("RequiredFieldValidator1"),false);
    ValidatorEnable(document.getElementById("RequiredFieldValidator2"),false);
    ValidatorEnable(document.getElementById("RequiredFieldValidator3"),false);
    ValidatorEnable(document.getElementById("RequiredFieldValidator4"),false);
    ValidatorEnable(document.getElementById("RequiredFieldValidator5"),false);
    ValidatorEnable(document.getElementById("MaskedEditValidator1"),false);


}

function showInsc()
{
    hideHandle(Div_Login);
    hideHandle(Div_Text);
    dispHandle(Div_Insc);
    ValidatorEnable(document.getElementById("RequiredFieldValidator1"),true);
    ValidatorEnable(document.getElementById("RequiredFieldValidator2"),true);
    ValidatorEnable(document.getElementById("RequiredFieldValidator3"),true);
    ValidatorEnable(document.getElementById("RequiredFieldValidator4"),true);
    ValidatorEnable(document.getElementById("RequiredFieldValidator5"),true);
    ValidatorEnable(document.getElementById("MaskedEditValidator1"),true);


}
