
	function checkLoad(img){
	var pics=document.images
	for (var i_tem = 0; i_tem < pics.length; i_tem++)
	if (pics[i_tem]==img)
	loads[i_tem]=img.src
	}

	var loads=new Array()

	function isLoaded(){
	var pics=document.images
	for (var i_tem = 0; i_tem < pics.length; i_tem++)
	if (loads[i_tem]==undefined&&pics[i_tem].lowsrc)
	pics[i_tem].src=pics[i_tem].lowsrc
	}

	if ( typeof window.addEventListener != "undefined" )
		window.addEventListener( "load", isLoaded, false );
	else if ( typeof window.attachEvent != "undefined" ) {
		window.attachEvent( "onload", isLoaded );
	}
	else {
		if ( window.onload != null ) {
			var oldOnload = window.onload;
			window.onload = function ( e ) {
				oldOnload( e );
				isLoaded();
			};
		}
		else
			window.onload = isLoaded;
	}

	
	function uncheckCity()
	{
		cbGetElement("RadioButtonList1_0").checked=false;
		for (i=0;i<100;i++) {
			if(cbGetElement("RadioButtonList1_" + i) == null)
				break;
			cbGetElement("RadioButtonList1_" + i).checked=false;
		}

		cbGetElement("RadioButton1").checked=true;	
	}

	function clearTxtDestCity()
	{				
		cbGetElement("RadioButton1").checked=false;		
		//cbGetElement("DropDownList1").selectedIndex=0;
		cbGetElement('txtCity').value='';
		
	}

	function clearselection1()  // select city in US
	{				
		cbGetElement("RadioButton1").checked=false;		
		cbGetElement('txtCity').value='';

		cbGetElement("RadioButtonList2_0").checked=false;
		for (i=0;i<100;i++) {
			if(cbGetElement("RadioButtonList2_" + i) == null)
				break;
			cbGetElement("RadioButtonList2_" + i).checked=false;
		}
	}

	function clearselection2()  // select internationa city in US
	{				
		cbGetElement("RadioButton1").checked=false;		
		cbGetElement('txtCity').value='';

		cbGetElement("RadioButtonList1_0").checked=false;
		for (i=0;i<100;i++) {
			if(cbGetElement("RadioButtonList1_" + i) == null)
				break;
			cbGetElement("RadioButtonList1_" + i).checked=false;
		}
	}

	function clearselection3()  // select city in US from autofill dropdown
	{				
		
		cbGetElement("RadioButton1").checked=true;	
		cbGetElement("RadioButtonList1_0").checked=false;
		for (i=0;i<100;i++) {
			if(cbGetElement("RadioButtonList1_" + i) == null)
				break;
			cbGetElement("RadioButtonList1_" + i).checked=false;
		}

		cbGetElement("RadioButtonList2_0").checked=false;
		for (i=0;i<100;i++) {
			if(cbGetElement("RadioButtonList2_" + i) == null)
				break;
			cbGetElement("RadioButtonList2_" + i).checked=false;
		}
	}
	
	function replacestring(eName)
	{
		rExp = /:/gi;
		var newstr = eName.replace(rExp, '_') ;
		return newstr;
	}			
			// Cross-browser get element 
			
	function cbGetElement(eName)
	{
		
		return document.getElementById(replacestring(eName)); 	
	}
	

	function SelectedRooms(el)
	{
		var code = el.value;
		var DropDownList= cbGetElement("DropDownList4");
		var Dropdownlist5= cbGetElement("Dropdownlist5");
		var Dropdownlist6= cbGetElement("Dropdownlist6");
		var Dropdownlist7= cbGetElement("Dropdownlist7");
		var Dropdownlist8= cbGetElement("Dropdownlist8");
		var room1 = cbGetElement("room1");		
		var room2 = cbGetElement("room2");	
		var room3 = cbGetElement("room3");
		var adult2 = cbGetElement("adult2");
		var adult3 = cbGetElement("adult3");
		var child2 = cbGetElement("child2");
		var child3 = cbGetElement("child3");	

        var Dropdownlist3= cbGetElement("DropDownList3");
		cbGetElement("DropDownList3").options.selectedIndex = 0
		cbGetElement("Dropdownlist5").options.selectedIndex = 0
        cbGetElement("Dropdownlist6").options.selectedIndex = 0
        cbGetElement("Dropdownlist7").options.selectedIndex = 0
        cbGetElement("Dropdownlist8").options.selectedIndex = 0
         
		cbGetElement("ca_1_Room1").options.selectedIndex = 0
        cbGetElement("ca_2_Room1").options.selectedIndex = 0
		cbGetElement("ca_3_Room1").options.selectedIndex = 0
		cbGetElement("ca_4_Room1").options.selectedIndex = 0
		cbGetElement("ca_5_Room1").options.selectedIndex = 0
		cbGetElement("ca_6_Room1").options.selectedIndex = 0
		cbGetElement("ca_1_Room2").options.selectedIndex = 0
		cbGetElement("ca_2_Room2").options.selectedIndex = 0
		cbGetElement("ca_3_Room2").options.selectedIndex = 0
		cbGetElement("ca_4_Room2").options.selectedIndex = 0
		cbGetElement("ca_5_Room2").options.selectedIndex = 0
		cbGetElement("ca_6_Room2").options.selectedIndex = 0
		cbGetElement("ca_1_Room3").options.selectedIndex = 0
		cbGetElement("ca_2_Room3").options.selectedIndex = 0
		cbGetElement("ca_3_Room3").options.selectedIndex = 0
		cbGetElement("ca_4_Room3").options.selectedIndex = 0
		cbGetElement("ca_5_Room3").options.selectedIndex = 0
		cbGetElement("ca_6_Room3").options.selectedIndex = 0
		

        
        
		room1.style.fontFamily = 'Arial, Verdana, Helvetica, sans-serif';
		room2.style.fontFamily = 'Arial, Verdana, Helvetica, sans-serif';
		room3.style.fontFamily = 'Arial, Verdana, Helvetica, sans-serif';
		adult2.style.fontFamily = 'Arial, Verdana, Helvetica, sans-serif';
		adult3.style.fontFamily = 'Arial, Verdana, Helvetica, sans-serif';
        child2.style.fontFamily = 'Arial, Verdana, Helvetica, sans-serif';
		child3.style.fontFamily = 'Arial, Verdana, Helvetica, sans-serif';

		if(code == 2){ 
		    room1.style.display = 'inline';	
		    room2.style.display = 'inline';
		    adult2.style.display = 'inline';
		    child2.style.display = 'inline';
			Dropdownlist5.style.display = 'inline';
			Dropdownlist6.style.display = 'inline';
			
			room3.style.display = 'none';
		    adult3.style.display = 'none';
		    child3.style.display = 'none';
			Dropdownlist7.style.display = 'none';
			Dropdownlist8.style.display = 'none';
			
		}else if(code == 3){
		    room1.style.display = 'inline';	
		    room2.style.display = 'inline';
		    adult2.style.display = 'inline';
		    child2.style.display = 'inline';
		    room3.style.display = 'inline';
		    adult3.style.display = 'inline';
		    child3.style.display = 'inline';
		    Dropdownlist5.style.display = 'inline';
			Dropdownlist6.style.display = 'inline';
			Dropdownlist7.style.display = 'inline';
			Dropdownlist8.style.display = 'inline';
		}else{
			Dropdownlist5.style.display = 'none';
			Dropdownlist6.style.display = 'none';
			Dropdownlist7.style.display = 'none';
			Dropdownlist8.style.display = 'none';
			room2.style.display = 'none';
		    adult2.style.display = 'none';
		    child2.style.display = 'none';
		    room3.style.display = 'none';
		    adult3.style.display = 'none';
		    child3.style.display = 'none';
		}
/*
		var room1Childern= cbGetElement("ChildrenAge1");
		if (room1Childern != null)
			cleanElement(room1Childern);
		var room1Childern= cbGetElement("ChildrenAge2");
		if (room1Childern != null)
			cleanElement(room1Childern);
		var room1Childern= cbGetElement("ChildrenAge3");
		if (room1Childern != null)
			cleanElement(room1Childern);*/

		initialChildrenAgeInfo();


	}
	
	    // Create a drop-down list
 

    function CreateDropDown(num,el,roomNo)
	{   
		var cnt = num.value;
		
		var txt_name1 = cbGetElement('ca_txt_' + roomNo + '1');
		var txt_name2 = cbGetElement('ca_txt_' + roomNo + '2');

		txt_name1.style.display = 'none';
		txt_name2.style.display = 'none';

		if(cnt>3){
			txt_name1.style.display = 'inline';
			txt_name2.style.display = 'inline';
		}else if(cnt>0 && cnt<=3){
			txt_name1.style.display = 'inline';
			txt_name2.style.display = 'none';
		}else if(cnt==0){
			txt_name1.style.display = 'none';
			txt_name2.style.display = 'none';
		}
			
        for (var n = 1;  n<=6; n++) {   
			var name = cbGetElement('ca_' + n + "_" + roomNo);
			name.style.display = 'none';
			name.options.selectedIndex = 0
		} 

		for (var n = 1;  n<=cnt; n++) {   
			var name = cbGetElement('ca_' + n + "_" + roomNo);
			name.style.display = 'inline';
			
		}
		
		//cbGetElement("pleaseInputAge").style.display = 'inline';

        
			
		
	}

	function cleanElement(el)
	{
		while(el.firstChild) {
			// nothing too fancy or fast here - removing all child elements to clean it out
			el.removeChild(el.firstChild);
		}
	}
