// JavaScript Document
function flightadd(z,y){
	if(z == 'True'){
		$('#AirParam').show();
		$('#wair').attr('class','Text_Arial12_BlueBold')
		$('#woair').attr('class','Text_Arial12_Blue')
		
	}
	if(z =='False'){
		$('#AirParam').hide();
		$('#wair').attr('class','Text_Arial12_Blue')
		$('#woair').attr('class','Text_Arial12_BlueBold')
		$('#iDepCity').val('US city airport');
	}
}
function showChild(qty){
	for (i=0;i<=2;i++){
		if (i<=qty){
			$('#divChild'+ i +'').show();
		}
		else{
			$('#divChild'+ i +'').hide();
		}
	}
}
function priceIt(){
	var iRet
	myOption = -1;
	for (i=Form1.addFlight.length-1; i > -1; i--){
		if (Form1.addFlight[i].checked){
		myOption = i; i = -1;
		}
	}
	
	p = Form1.addFlight[myOption].value;
	
	if (p == 'True'){
		
		if ($('#iDepCity').val() == -1){
			alert('Please Select a Departure City   ')
			return;
		}
		$('#iRetCity').val($('#iDepCity').val());
		//document.Form1.iRetCity.value = document.Form1.iDepCity.value
	}
	if (p == 'False'){
		$('#iRetCity').val(-1);
		$('#iDepCity').val(-1);
		//document.Form1.iRetCity.value = -1
		//document.Form1.iDepCity.value = -1
	}
	//alert($('#iRetCity').val())
	var sele = $('#InDate1').val()
	if (sele.indexOf('mm/dd/yy') == 0)
	{
		alert('Please Select a Valid Date   ')
		return;
	}
	sele = $('#OutDate1').val()
	if (sele.indexOf('mm/dd/yy') == 0)
	{
		alert('Please Select a Valid Date   ')
		return;
	}
	
	var ziCabin
		ziCabin = $('#Cabin').val(); //document.Form1.Cabin.value // findObj('Cabin').value;
		if (ziCabin=='C' || ziCabin=='F'){
			//findObj('AirVendorAPI').value
			//document.Form1.AirVendorAPI.value = '3|6-7-26-17-53-55';
			$('#Cabin').val('3|6-7-26-17-53-55');
		}
	
	var pckType
	var booProcess = 'javascript:alert("Type Of Packages is not difine");return false;'
	pckType = 'MC' //$('#PackType').val(); //document.Form1.PackType.value
	var pckID
	pckID = $('#Pkgid').val(); //document.Form1.Pkgid.value
	//alert(pckType)
	switch (pckType)
			{
			case 'TP3':
				bookProcess="http://latindestinations.bookingprocess.com/TVLAPI/TourPackage3/TP_ComponentList.ASP?" + pckID 
			break;
			case 'MC':
				bookProcess="http://latindestinations.bookingprocess.com/TVLAPI/Multicity3/MC_ComponentList.ASP?" + pckID 
			break;
			}
			
	document.Form1.action=bookProcess
	document.Form1.submit()
	//__utmLinkPost(bookProcess)

 }
 function onChangeSelAdult(ad,na){
	 
			if (ad > 4){
				alert("Please, adults can't be more than 4");
				document.getElementById(na).value = 4;
				document.getElementById(na).focus();
				document.getElementById(na).select();
				return false;
			} 
		return true;
		}
		
  var childw1=new Array('0','1','2')
var code1=new Array(0,1,2);
var show1=new Array(0,1,1); 
  
var childw2=new Array('0','1','2','3','4');
var code2=new Array(0,1,2,3,4);
var show2=new Array(0,1,1,1,1); 

function showHowChild(n)
{   
	if (n==1)
	{
		var childw=childw1; 
		var code=code1; 
		var show=show1;
	}

	if (n>1)
	{
		var childw=childw2; 
		var code=code2; 
		var show=show2;
	}
	var objChildw=document.getElementById("iChildren")
	objChildw.options.length=0;
	var j=0;
    for(i=0;i<show.length;i++)
    { 
		objChildw.options[i]=new Option(childw[i],code[i]);
		if (childw[i]==0)
		{
			objChildw.options[j]=new Option(childw[i],code[i]);
			j++;
		}
    }
	showChild(objChildw.value);
}

	
    
function showChild(n)
{
	var objChild0=document.getElementById("divChild0");
	var objChild1=document.getElementById("divChild1");
	var objChild2=document.getElementById("divChild2");
	var objChild3=document.getElementById("divChild3");
	var objChild4=document.getElementById("divChild4");

	if (n>0)
      objChild0.style.display=''

    if (n==0)
      objChild0.style.display='none'
 
    for(i=1;i<=n;i++)
      eval("objChild"+i+".style.display=''")  
      
     for(;i<=4;i++)
     {
      eval("objChild"+i+".style.display='none'")
      //eval("document.Form1.iChild"+i+".value=''")
     }

}
