function Tab_Click(tab, panel, totalCnt)
{
	for(var i=1; i<=totalCnt; i++)
	{
		if('tab'+i.toString() == tab.toString())
		{
			document.getElementById(panel).style.display = '';
			document.getElementById(tab).setAttribute("class", 'current'); //For most browsers
			document.getElementById(tab).setAttribute("className", 'current'); //For IE, harmless to other browsers
		}
		else
		{
			document.getElementById('panel'+i).style.display = 'none';
			document.getElementById('tab'+i).setAttribute("class", ''); //For most browsers
			document.getElementById('tab'+i).setAttribute("className", ''); //For IE, harmless to other browsers
		}
	}
}

function Toggle_trGrpHeader1(rowId,colId)
{
	poorman_toggle(rowId);
	poorman_changeclass(colId);
}
function sign_up(frm)
{ 
	with(frm)
	{
		if(!IsEmpty(email_addr,"Please enter email"))
			return false;
		if(!IsEmail(email_addr,"Please enter valid email"))
			return false;
		frm.submit();
	}
}

//====================================================================================================
//	Function Name	:	typeCheck
//----------------------------------------------------------------------------------------------------
function typeCheck(id)
{	
	if(document.getElementById('air_rndtrip').value == 'O')
	{
		showHide(id, 'none');
		id=id+1;
		showHide(id, 'none');
	}
	else
	{
		showHide(id, '');
		id=id+1;
		showHide(id, '');
	}
}

//====================================================================================================
//	Function Name	:	ShowHide
//----------------------------------------------------------------------------------------------------
function showHide(div, display)
{	
	document.getElementById(div).style.display = display;
}

//====================================================================================================
//	Function Name	:	Insurance Section
//----------------------------------------------------------------------------------------------------
function Validate_Insurance(frm)
{
	with(frm)
    {
		if(!IsEmpty(ins_name, 'Please enter Name.'))
		{
			return false;
		}
		
		if(!IsEmpty(ins_email, 'Please enter Email Address.'))
		{
			return false;
		}
		else if(!IsEmail(ins_email, 'Oppsss!!! Invalid Email Address specified.'))
		{
			return false;
		}
		
		if(!IsEmpty(ins_cover_date, 'Please enter Date of Cover Start.'))
		{
			return false;
		}
		
		if(!IsEmpty(ins_mobile, 'Please enter Tel / Mobile.'))
		{
			return false;
		}
		else if(!IsPhone(ins_mobile, 'Oppsss!!! Invalid input. \nPlease re-check Tel / Mobile.'))
		{
			return false;
		}
		
		if(!IsEmpty(ins_travel, 'Please enter Where are you Travelling to?'))
		{
			return false;
		}
	}
	
	return true;
}


function SetHiddenValues_Car()
{			
	document.CARSForm.B_DATE.value = formDate(document.CARSForm.car_pickup_date.value) + document.CARSForm.car_pickup_dateTime.value ;
	document.CARSForm.E_DATE.value = formDate(document.CARSForm.car_dropoff_date.value)  + document.CARSForm.car_dropoff_dateTime.value ;
	
}
function SetHiddenValues_Air()

{				
	document.AIRSForm.B_DATE_1.value = formDate(document.AIRSForm.External_FlightFareSearch_DepartureDate.value)  +  document.AIRSForm.External_FlightFareSearch_DepartureTime.value ;	
	
		document.AIRSForm.E_DATE_1.value = formDate(document.AIRSForm.External_FlightFareSearch_ReturnDate.value)  +  document.AIRSForm.External_FlightFareSearch_ArrivalTime.value ;	

	
}
function SetHiddenValues_Hotel()
{ 
	document.HOTELSForm.B_DATE.value = formDate(document.HOTELSForm.hotel_chkin_date.value) + "0000" ;
	document.HOTELSForm.E_DATE.value = formDate(document.HOTELSForm.hotel_chkout_date.value)  +  "0000" ;
}


function validation_AIRForm(theForm1)
{	
	if(theForm1.B_LOCATION_1.value=="")
	 {
		 alert("Please Enter From City");
		 theForm1.B_LOCATION_1.focus();
		 return false;
	  } 
	
	if(theForm1.E_LOCATION_1.value=="")
	 {
		 alert("Please Enter To City");
		theForm1.E_LOCATION_1.focus();
		  return false;
	  }
 
	if(theForm1.External_FlightFareSearch_DepartureDate.value=="")
	  {
		 alert("Please Enter Depature Date");
		 theForm1.External_FlightFareSearch_DepartureDate.focus();
		 return false;
	  } 
  
	 if(theForm1.air_rndtrip.value=="R")
	 {	
		 if(theForm1.External_FlightFareSearch_ReturnDate.value=="")
		  {
			 alert("Please Enter Return Date");
			 theForm1.External_FlightFareSearch_ReturnDate.focus();
			 return false;
		  }
	 }
}

function radioValue(radio) {
var i;
for (i=0; i<radio.length; i++)
if (radio[i].checked)
return radio[i].value;
// otherwise no radio button of the radio button group is selected
return "undefined";
}

function validation_HOTELForm(theForm2)
{

 if(theForm2.B_LOCATION.value=="")
  {
    alert("Plase Enter a From City");
	 theForm2.B_LOCATION.focus();
	 return false;
  }
  
   	/*if(theForm2.COUNTRY_CODE.value=="N1") 
{  		
  	alert("Plase Enter Country");
  	 theForm2.COUNTRY_CODE.focus();
	return false;
  }*/
  
   if(theForm2.hotel_chkin_date.value=="")
   {
   alert("Please Enter Check In Date");
    theForm2.hotel_chkin_date.focus();
    return false;
   }
        
    if(theForm2.hotel_chkout_date.value=="")
   {
   alert("Please Enter Check Out Date");
   theForm2.hotel_chkout_date.focus();
    return false;
   }
	if(theForm2.Occupancy.value=="0")
   {
   alert("Please Enter Occupancy");
    theForm2.Occupancy.focus();
    return false;
   }
}


//====================================================================================================
//	Function Name	:	Insurance Section
//----------------------------------------------------------------------------------------------------
function Validate_Insurance(frm)
{
	with(frm)
    {
		if(!IsEmpty(ins_name, 'Please enter Name.'))
		{
			return false;
		}
		
		if(!IsEmpty(ins_email, 'Please enter Email Address.'))
		{
			return false;
		}
		else if(!IsEmail(ins_email, 'Oppsss!!! Invalid Email Address specified.'))
		{
			return false;
		}
		
		if(!IsEmpty(ins_mobile, 'Please enter Tel / Mobile.'))
		{
			return false;
		}
		else if(!IsPhone(ins_mobile, 'Oppsss!!! Invalid input. \nPlease re-check Tel / Mobile.'))
		{
			return false;
		}
		
		if(!IsEmpty(ins_cover_date, 'Please enter Date of Cover Start.'))
		{
			return false;
		}
		
		if(!IsEmpty(ins_travel, 'Please enter Where are you Travelling to?'))
		{
			return false;
		}
	}
	
	return true;
}

function validation_CARForm(theForm3)
{

 if(theForm3.B_LOCATION.value=="")
   {
    alert("Please Enter Pickup Location");
	theForm3.B_LOCATION.focus();
	 return false;
  }
  
  if(theForm3.E_LOCATION.value=="")
   {
    alert("Please Enter Drop-off Location");
	theForm3.E_LOCATION.focus();
	 return false;
  }
   if(theForm3.car_pickup_date.value=="")
 	{
   alert("Please Enter Car Pickup Date");
   theForm3.car_pickup_date.focus();
    return false;
   }
   
   if(theForm3.car_dropoff_date.value=="")
 	{
   alert("Please Enter Drop-ff Date");
   theForm3.car_dropoff_date.focus();
    return false;
   }
} 

function formDate(date){
	var dt = new Date(date);
		var month = dt.getMonth() + 1;
			if(month <=9)
		month = '0' + month;
		
	var year = dt.getFullYear();
	var day = dt.getDate();
	if(day <=9)
		day = '0' + day;
		
	
 return year + "" + month + "" +  day + "";

}
