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 popupopen(src)
{
	 window.open (src,"mywindow","menubar=0,resizable=1,width=900,height=650"); 
}
function Validate_Form(frm)
{
	with(frm)
	{ 
		
		if(!IsEmpty(name,"Please enter name"))
			return false;
			
		if(!IsEmpty(email,"Please enter email"))
			return false;
		if(!IsEmail(email,"Please enter valid email"))
			return false;
		if(!IsEmpty(txt_from_date,"Please select Date of Cover start"))
			return false;	
			
		if(!IsEmpty(ConNo,"Please enter phone"))
			return false;	
		if(!IsEmpty(txt1,"Please enter Where are you travelling to?"))
			return false;
		/*if(!IsEmpty(txt_mobile,"Please enter your Mobile Number"))
			return false;
		if(!IsEmpty(txt_telephone,"Please enter your Telephone"))
			return false;
		
		if(!IsEmpty(dp_country,"Please enter your Destination"))
			return false;
		if(!IsEmpty(dp_city,"Please enter your City"))
			return false;
		if(!IsEmpty(dp_country2,"Please enter your Destination"))
			return false;
		if(!IsEmpty(dp_city2,"Please enter your City"))
			return false;
		
		if(!IsEmpty(txt_from_date,"Please enter your From Traveling date"))
			return false;
		if(!IsEmpty(txt_to_date,"Please enter your To Traveling date"))
			return false;
		if(!IsEmpty(dp_night,"Please enter your Number of Nights"))
			return false;
		if(!IsEmpty(Comments,"Please paste your cv"))
			return false;
*/
		submit();
		return true;
		
	}
}

function poorman_toggle(id)
{
	var tr = document.getElementById(id);
	
	
	if(id == 'trRow1')
	{
		tr.style.display = '';
		document.getElementById('trRow2').style.display = 'none';
		document.getElementById('trRow3').style.display = 'none';
		document.getElementById('trRow4').style.display = 'none';
	}
	else if(id == 'trRow2')
	{
		tr.style.display = '';
		document.getElementById('trRow1').style.display = 'none';
		document.getElementById('trRow3').style.display = 'none';
		document.getElementById('trRow4').style.display = 'none';
	}
	else if(id == 'trRow3')
	{
		tr.style.display = '';
		document.getElementById('trRow1').style.display = 'none';
		document.getElementById('trRow2').style.display = 'none';
		document.getElementById('trRow4').style.display = 'none';
	}
	else if(id == 'trRow4')
	{
		tr.style.display = '';
		document.getElementById('trRow1').style.display = 'none';
		document.getElementById('trRow2').style.display = 'none';
		document.getElementById('trRow3').style.display = 'none';
	}
}


function poorman_changeclass (elementID, newClass)
{
	var element = document.getElementById(elementID);
	
	if(elementID == 'column1')
	{
	document.getElementById('column1').setAttribute("class", 'currenttab'); //For Most Browsers
	document.getElementById('column1').setAttribute("className", 'currenttab'); //For IE; harmless to other browsers.
	document.getElementById('column2').setAttribute("class", 'searchlink'); //For Most Browsers
	document.getElementById('column2').setAttribute("className", 'searchlink'); //For IE; harmless to other browsers.
	document.getElementById('column3').setAttribute("class", 'searchlink'); //For Most Browsers
	document.getElementById('column3').setAttribute("className", 'searchlink'); //For IE; harmless to other browsers.
	document.getElementById('column4').setAttribute("class", 'searchlink'); //For Most Browsers
	document.getElementById('column4').setAttribute("className", 'searchlink'); //For IE; harmless to other browsers.
	}
	else if(elementID == 'column2')
	{
	document.getElementById('column2').setAttribute("class", 'currenttab'); //For Most Browsers
	document.getElementById('column2').setAttribute("className", 'currenttab'); //For IE; harmless to other browsers.
	document.getElementById('column1').setAttribute("class", 'searchlink'); //For Most Browsers
	document.getElementById('column1').setAttribute("className", 'searchlink'); //For IE; harmless to other browsers.
	document.getElementById('column3').setAttribute("class", 'searchlink'); //For Most Browsers
	document.getElementById('column3').setAttribute("className", 'searchlink'); //For IE; harmless to other browsers.
	document.getElementById('column4').setAttribute("class", 'searchlink'); //For Most Browsers
	document.getElementById('column4').setAttribute("className", 'searchlink'); //For IE; harmless to other browsers.
	}
	else if(elementID == 'column3')
	{
	document.getElementById('column3').setAttribute("class", 'currenttab'); //For Most Browsers
	document.getElementById('column3').setAttribute("className", 'currenttab'); //For IE; harmless to other browsers.
	document.getElementById('column1').setAttribute("class", 'searchlink'); //For Most Browsers
	document.getElementById('column1').setAttribute("className", 'searchlink'); //For IE; harmless to other browsers.
	document.getElementById('column2').setAttribute("class", 'searchlink'); //For Most Browsers
	document.getElementById('column2').setAttribute("className", 'searchlink'); //For IE; harmless to other browsers.
	document.getElementById('column4').setAttribute("class", 'searchlink'); //For Most Browsers
	document.getElementById('column4').setAttribute("className", 'searchlink'); //For IE; harmless to other browsers.
	}
	else if(elementID == 'column4')
	{
	document.getElementById('column4').setAttribute("class", 'currenttab'); //For Most Browsers
	document.getElementById('column4').setAttribute("className", 'currenttab'); //For IE; harmless to other browsers.
	document.getElementById('column1').setAttribute("class", 'searchlink'); //For Most Browsers
	document.getElementById('column1').setAttribute("className", 'searchlink'); //For IE; harmless to other browsers.
	document.getElementById('column2').setAttribute("class", 'searchlink'); //For Most Browsers
	document.getElementById('column2').setAttribute("className", 'searchlink'); //For IE; harmless to other browsers.
	document.getElementById('column3').setAttribute("class", 'searchlink'); //For Most Browsers
	document.getElementById('column3').setAttribute("className", 'searchlink'); //For IE; harmless to other browsers.
	}
}


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.External_FlightFareSearch_From.value=="")
 {
     alert("Please Enter From City");
	 theForm1.External_FlightFareSearch_From.focus();
	 return false;
  } 
if(theForm1.External_FlightFareSearch_To.value=="")
 {
     alert("Please Enter To City");
	theForm1.External_FlightFareSearch_To.focus();
	  return false;
  }
  if(theForm1.External_FlightFareSearch_DepartureDate.value=="")
  {
     alert("Please Enter Depature Date");
	 theForm1.External_FlightFareSearch_DepartureDate.focus();
	 return false;
  } 
 if(theForm1.External_FlightFareSearch_SearchType.value=='RoundTrip') 
/* if(radioValue(document.AIRSForm.air_rndtrip)=="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.External_HotelSearch_City.value=="")
  {
    alert("Plase Enter a City");
	 theForm2.External_HotelSearch_City.focus();
	 return false;
  }
  
   	/*if(theForm2.COUNTRY_CODE.value=="N1") 
{  		
  	alert("Plase Enter Country");
  	 theForm2.COUNTRY_CODE.focus();
	return false;
  }*/
  
   if(theForm2.External_HotelSearch_CheckInDate.value=="")
   {
   alert("Please Enter Check In Date");
    theForm2.External_HotelSearch_CheckInDate.focus();
    return false;
   }
        
    if(theForm2.External_HotelSearch_CheckOutDate.value=="")
   {
   alert("Please Enter Check Out Date");
   theForm2.External_HotelSearch_CheckOutDate.focus();
    return false;
   }
	if(theForm2.External_HotelSearch_Occupancy.value=="0")
   {
   alert("Please Enter Occupancy");
    theForm2.Occupancy.focus();
    return false;
   }
}

function validation_CARForm(theForm3)
{

 if(theForm3.External_CarSearch_PickUpLocation.value=="")
   {
    alert("Please Enter Pickup Location");
	theForm3.External_CarSearch_PickUpLocation.focus();
	 return false;
  }
  
  if(theForm3.External_CarSearch_DropOffLocation.value=="")
   {
    alert("Please Enter Drop-off Location");
	theForm3.External_CarSearch_DropOffLocation.focus();
	 return false;
  }
   if(theForm3.External_CarSearch_PickupDate.value=="")
 	{
   alert("Please Enter Car Pickup Date");
   theForm3.External_CarSearch_PickupDate.focus();
    return false;
   }
   
   if(theForm3.External_CarSearch_DropOffDate.value=="")
 	{
   alert("Please Enter Drop-ff Date");
   theForm3.External_CarSearch_DropOffDate.focus();
    return false;
   }
} 

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 IsEmpty(fld,msg)
{
	if((fld.value == "" || fld.value.length == 0) && (msg == ''))
	{
		return false;
	}
	if(fld.value == "" || fld.value.length == 0)
	{
		alert(msg);
		try {fld.focus();}catch(e){return true;}
		return false;
	}
	return true;
}

//====================================================================================================
//	Function Name	:	IsEmail
//----------------------------------------------------------------------------------------------------
function IsEmail(fld,msg)
{
	var regex = /^[\w]+(\.[\w]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/ ;
	if(!regex.test(fld.value))
	{
		alert(msg);
		fld.focus();
		return false;
	}
	return true;
}

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 + "";

}
