// JavaScript Document
function emailverify(email)
	{
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	str=email;
	if(!filter.test(str))
		{
		return false
		}
	else return true;
	}
	
function getVal(id)
	{
		return document.getElementById(id).value;
	}
//-------------------------------------------

function Validate_toplogin(){
		if(!emailverify(getVal('userid')))
		{
			alert('Please enter your valid email address as username');
			document.getElementById('userid').focus();
			return false;
		}
		if(getVal('password')=='')
			{
				alert('Please enter your password');
				document.getElementById('password').focus();
				return false;
			}
		return true;
}
//------------------------------------------------------
function Validate_middlelogin(){
		if(!emailverify(getVal('email')))
		{
			alert('Please enter your valid email address as username');
			document.getElementById('email').focus();
			return false;
		}
		if(getVal('pwd')=='')
			{
				alert('Please enter your password');
				document.getElementById('pwd').focus();
				return false;
			}
		return true;
}

//--------------------------------------------------------

function Validate_registeraccount()
	{
		
		
		if(getVal('fname')=='')
			{
				alert('Please enter your first name');
				document.getElementById('fname').focus();
				return false;
			}
		if(getVal('lname')=='')
			{
				alert('Please enter your last name');
				document.getElementById('lname').focus();
				return false;
			}
		if(!emailverify(getVal('email')))
		{
			alert('Please enter your valid email address');
			document.getElementById('email').focus();
			return false;
		}
		
		if(getVal('password_1')=='')
			{
				alert("Please enter your  password");
				document.getElementById('password_1').focus();
				return false;				
			}
		if(getVal('password_2')=='')
			{
				alert("Please confirm your  password");
				document.getElementById('password_2').focus();
				return false;				
			}
			
		if(getVal('password_1')!=getVal('password_2'))
			{
				alert("The Confirmation password does not match");
				document.getElementById('password_2').focus();
				return false;
			}
			if(getVal('postalcode')=='')
			{
				alert('Please enter your postalcode');
				document.getElementById('postalcode').focus();
				return false;
			}
			
			if(getVal('pretecture')=='--Select--')
			{
				alert('Please select your pretecture');
				document.getElementById('pretecture').focus();
				return false;
			}
			if(getVal('address1')=='')
			{
				alert('Please select your address');
				document.getElementById('address1').focus();
				return false;
			}
		
			if(getVal('phone')=='')
			{
				alert('Please enter your phone number');
				document.getElementById('phone').focus();
				return false;
			}
			
				return true;
	}
//#########################################333
function Validate_changepwd(){
		if(getVal(getVal('oldpwd')))
		{
			alert('Please enter your old password');
			document.getElementById('oldpwd').focus();
			return false;
		}
		if(getVal('newpwd1')=='')
			{
				alert('Please enter your new password');
				document.getElementById('newpwd1').focus();
				return false;
			}
		if(getVal('newpwd2')=='')
			{
				alert('Please confirm your new password');
				document.getElementById('newpwd2').focus();
				return false;
			}
		if(getVal('newpwd2') != getVal('newpwd1'))
			{
				alert('Password Mismatch');
				document.getElementById('newpwd1').focus();
				return false;
			}
		return true;
}

//#########################################################################################################

function ValidateHotelbooking()
	{
		var err = false;
		
		var display = '';
		//alert(getVal('city2'));
		//return false;
		if(getVal('city2')=='')
			{
				//alert('a');
				//return false;
				err=true;
				display+='\n*City field is blank';
			}
			
		
		
		if(getVal('ci_month2')=='null'||getVal('ci_day2')=='null'||getVal('ci_year2')=='null')
			{
				err=true;
				display+='\n*Invalid Check in date';
			}
			
		
		
		if(getVal('co_month2')=='null'||getVal('co_day2')=='null'||getVal('co_year2')=='null')
			{
				err=true;
				display+='\n*Invalid Check out date';
			}
			
		if(getVal('guest_adult2')=='null')
			{
				err=true;
				display+='\n*Guest Adult not selected';
			}
			
			if(getVal('guest_child2')=='null')
			{
				err=true;
				display+='\n*Guest Child not selected';
			}
			
		if(getVal('room2')=='null')
			{
				err=true;
				display+='\n*Number of room not selected';
			}
		
		
		if(getVal('beds2')=='null')
			{
				err=true;
				display+='\n*No. of beds not selected';
			}
			
			
		if(getVal('fullname')=='')
			{
				err=true;
				display+='\n*Fullname field is empty';
			}
		
		if(getVal('address1')=='')
			{
				err=true;
				display+='\n*Address1 field is empty';
			}
			
		if(getVal('country')=='')
			{
				err=true;
				display+='\n*country field is empty';
			}
			
			
		if(!emailverify(getVal('email')))
			{
				err=true;
				display+='\n*Invalid Email';
			}
			
		
		if(err)
			{
				var displaymsg = '	Following Error Occored:-\n'+ display;
				
				alert(displaymsg);
				return false
				}
			
			
		
	}
	
	


//#########################################################################################################

function ValidateFlightbooking()
	{
		var err = false;
		
		
		var display = '';
		
		
		
		theForm=document.getElementById("flight_send");
	
	
	var checkvalue=false;
	for (i=0, n=theForm.type2.length; i<n; i++)
		{
   		if (theForm.type2[i].checked)
			{
      		var checkvalue = true;
      		break;
			}
		}
	
	
	if(!checkvalue)
		{
			err=true;
			display+='\n*Please choose the Roundtrip/Oneway';
			
			
		}
		
		
		//alert('a');
		//return false;
		
		//alert(getVal('city2'));
		if(getVal('from2')=='')
			{
				//alert('a');
				err=true;
				display+='\n*From field is blank';
			
			//return false;
			}
			
		if(getVal('to3')=='')
			{
				//alert('a');
				err=true;
				display+='\n*To field is blank';
				//return false;
			}
			
		
		
		if(getVal('d_day2')=='null'||getVal('d_month2')=='null'||getVal('d_year2')=='null')
			{
				err=true;
				display+='\n*Invalid Departure date';
			}
			
		
		
		if(getVal('r_day2')=='null'||getVal('r_month2')=='null'||getVal('r_year2')=='null')
			{
				err=true;
				display+='\n*Invalid Return date';
			}
			
		if(getVal('adult2')=='null')
			{
				err=true;
				display+='\n*Number of adult not selected';
			}
			
			if(getVal('child2')=='null')
			{
				err=true;
				display+='\n*Number of Child not selected';
			}
			
		
			
		if(getVal('fullname')=='')
			{
				err=true;
				display+='\n*Fullname field is empty';
			}
		
		if(getVal('address1')=='')
			{
				err=true;
				display+='\n*Address1 field is empty';
			}
			
		if(getVal('country')=='')
			{
				err=true;
				display+='\n*country field is empty';
			}
			
			
		if(!emailverify(getVal('email')))
			{
				err=true;
				display+='\n*Invalid Email';
			}
			
		
		if(err)
			{
				var displaymsg = '	Following Error Occored:-\n'+ display;
				
				alert(displaymsg);
				return false
				}		
	}
	
	

function ValidateTripPlanner()
	{
		
		
		
		theForm=document.getElementById("tripplanner");
	
	
	var checkvalue=false;
	for (i=0, n=theForm.destination.length; i<n; i++)
		{
   		if (theForm.destination[i].checked)
			{
      		var checkvalue = true;
      		break;
			}
		}
	
	
	if(!checkvalue)
		{
			alert('Please choose the destination');
			//document.getElementById('destination').focus();
			return false;
		}
		
	
	if(getVal('duration2')=='')
		{
			alert('Please enter the duration');
			document.getElementById('duration2').focus();
			return false;
		}
		
	if(getVal('number_persons')=='')
		{
			alert('Please enter the number of person');
			document.getElementById('number_persons').focus();
			return false;
		}
		
	
	
	if(getVal('age')=='')
		{
			alert('Please enter your age');
			document.getElementById('age').focus();
			return false;
		}
		
	if(getVal('fullname')=='')
		{
			alert('Please enter your fullname');
			document.getElementById('fullname').focus();
			return false;
		}
		
		
	if(getVal('address1')=='')
		{
			alert('Please enter your address');
			document.getElementById('address1').focus();
			return false;
		}
		
		
	if(getVal('country')=='')
		{
			alert('Please enter your country');
			document.getElementById('country').focus();
			return false;
		}
		
		
	if(!emailverify(getVal('email')))
		{
			alert('Invalid Email');
			document.getElementById('email').focus();
			return false;
		}
	
	
	
	}
