
function checkalreadyselected(field)
{
	if(document.frmregistration.field.checked==true)
	{
		alert("You Have Already Selected This");
		return false;
	}
	return true;
}

function checkalreadyselected() 
{
if(document.frmregistration.custom3.checked== true)
	{
if(document.frmregistration.custom4.checked == true)
{ 
alert("You Have Already Selected All Panels");
//document.frmregistration.custom4.checked=true;
return false;
}
if(document.frmregistration.custom5.checked == true)
{ 
alert("You Have Already Selected All Panels"); 
return false;
}
if(document.frmregistration.custom6.checked == true)
{ 
alert("You Have Already Selected All Panels"); 
return false;
}
if(document.frmregistration.custom7.checked == true)
{ 
alert("You Have Already Selected All Panels"); 
return false;
}
if(document.frmregistration.custom8.checked == true)
{ 
alert("You Have Already Selected All Panels"); 
return false;
}
}
return true;

}

function checkAllPannel() 
{ 
  if(document.frmregistration.custom3.checked== true) 
    { 
    	document.frmregistration.custom4.checked=true;
		document.frmregistration.custom5.checked=true;
		document.frmregistration.custom6.checked=true;
		document.frmregistration.custom7.checked=true;
		document.frmregistration.custom8.checked=true;
	} 
	else 
	 { 
	   document.frmregistration.custom4.checked=false;
		document.frmregistration.custom5.checked=false;
		document.frmregistration.custom6.checked=false;
		document.frmregistration.custom7.checked=false;
		document.frmregistration.custom8.checked=false;
	 } 
} 



function emptyValue2(x,y) {
  if (x.value == y) {
    
    x.value = '';
   }
  }

function fillValue2(x,y) {
 if (x.value == '') {
   
    x.value = y;
   }
 }
 
 function emptyValue(x,y) {
  if (x.value == y) {
    x.value = '';
  }
}

function fillValue(x,y) {
 if (x.value == '') {
   
    x.value = y;
  }
}

function mytrim(val)
{
		val1 = "";
		val2="";
		ctrr = 0;
		lngth = val.length;
		for (i=0; i<lngth; i++)
		{
		if (val.charCodeAt(i) != 32)
		{
		for(j=i;j<lngth;j++)
		{
		if (val.charCodeAt(j) != 13 && val.charCodeAt(j) != 10 )
			{
			val1 += val.charAt(j);
			}
		}
		break;
		}
		}
		if (val1 != "")
		{
		lngth = val1.length
		ctrr=lngth;
		for (k=0; k<lngth; k++)
		{
		ctrr=ctrr-1;
		if (val1.charCodeAt(ctrr) != 32)
		{
		for(l=0;l<lngth-k;l++)
		{
		val2 += val1.charAt(l);
		}
		val1=val2;
		break;
		}
		}
		}
		return val1;
}


function IsNumeric(sText)
 {
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;


   for (i = 0; i < sText.length && IsNumber == true; i++)
      {
      Char = sText.charAt(i);
      if (ValidChars.indexOf(Char) == -1)
         {
         IsNumber = false;
         }
      }
   return IsNumber;

 }
 
function isNumberWith3(sText1)
{
	j=0
	if(IsNumeric(sText1))
	{
		char1=sText1.charAt(j);
		
		if(char1=='3')
		{
			return true;
			
		}
		else
		{
			return false;
		}
	}
	else
	{
		return false;
	}
}
function checkStringforNumber(sText2)
{
	var InValidChars = "0123456789";
	var Output=true;
	var char;
	
	for (i = 0; i < sText2.length ; i++)
    {
      Char = sText2.charAt(i);
      if (InValidChars.indexOf(Char) != -1)
      {
         return false;
      }
    }
   return Output;
	
}
 function chkemail(email)
{
	var emailvalid=true;

		if (email.value.length < 5)
		{
			emailvalid=false;
		}
		else
		{

			var flag = "false";
			var flag1 = "false";
			var flag2="true";
			for (var i = 1; i < email.value.length; i++)
			{
				var ch = email.value.substring(i, i + 1);
				if (ch == ".")
				{
					flag = "true";
				}
				if (ch == "@")
				{
					flag1 = "true";
				}
				if (ch==" ")
				{
					flag2="false";
				}

			}
			if (flag == "false" || flag1 == "false" || flag2 == "false")
			{
				emailvalid=false;
			}
		}
		return emailvalid;
}

  	function validateSearch()
	{
		if(mytrim(document.frmsearch.txtsearch.value)=="" || mytrim(document.frmsearch.txtsearch.value)=="Enter Your Search")
		{
			alert("Please enter search criteria");
			document.frmsearch.txtsearch.focus();
			return false;
			
		}
	} 
	
	
	function validateSignup()
{


	if ((mytrim(document.frmSignup.firstname.value) == "") || (mytrim(document.frmSignup.firstname.value) == "Name")) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frmSignup.firstname.focus();
	  return false;
	}
	else
	{
	 var chkFilter=/^[a-zA-Z ]+$/;
	 if (!(chkFilter.test(mytrim(document.frmSignup.firstname.value)))) 
	 {
	  alert("Something is wrong. Please, check your data") ;
	  document.frmSignup.firstname.focus();
	  return false;
	 }
	}
	
	if ((mytrim(document.frmSignup.lastname.value) == "") || (mytrim(document.frmSignup.lastname.value) == "Surname")) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frmSignup.lastname.focus();
	  return false;
	}
	else
	{
	 var chkFilter=/^[a-zA-Z ]+$/;
	 if (!(chkFilter.test(mytrim(document.frmSignup.lastname.value)))) 
	 {
	  alert("Something is wrong. Please, check your data") ;
	  document.frmSignup.lastname.focus();
	  return false;
	 }
	}

	var chkFilter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	if (!(chkFilter.test(document.frmSignup.email.value))) {
			 alert("Something is wrong. Please, check your data");
			 document.frmSignup.email.focus();
			 return false;
	}
	 
	 if ((mytrim(document.frmSignup.phone.value) == "") || (mytrim(document.frmSignup.phone.value) == "Phone") ) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frmSignup.phone.focus();
	  return false;
	}
	if (document.frmSignup.phone.length < 15)
	{
	  alert("Something is wrong. Please, check your data");
	  document.frmSignup.phone.focus();
	  return false;
	}
	if (!IsNumeric(document.frmSignup.phone.value))
	{
	  alert("Something is wrong. Please, check your data");
	  document.frmSignup.phone.focus();
	  return false;
	}

}

function validateVolunteer()
{


	if ((mytrim(document.frmvolunteer.firstname.value) == "") || (mytrim(document.frmvolunteer.firstname.value) == "Name")) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frmvolunteer.firstname.focus();
	  return false;
	}
	else
	{
	 var chkFilter=/^[a-zA-Z ]+$/;
	 if (!(chkFilter.test(mytrim(document.frmvolunteer.firstname.value)))) 
	 {
	  alert("Something is wrong. Please, check your data") ;
	  document.frmvolunteer.firstname.focus();
	  return false;
	 }
	}
	
	if ((mytrim(document.frmvolunteer.lastname.value) == "") || (mytrim(document.frmvolunteer.lastname.value) == "Surname")) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frmvolunteer.lastname.focus();
	  return false;
	}
	else
	{
	 var chkFilter=/^[a-zA-Z ]+$/;
	 if (!(chkFilter.test(mytrim(document.frmvolunteer.lastname.value)))) 
	 {
	  alert("Something is wrong. Please, check your data") ;
	  document.frmvolunteer.lastname.focus();
	  return false;
	 }
	}

	 
	 if ((mytrim(document.frmvolunteer.phone.value) == "") || (mytrim(document.frmvolunteer.phone.value) == "Phone") ) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frmvolunteer.phone.focus();
	  return false;
	}
	if (document.frmvolunteer.phone.length < 15)
	{
	  alert("Something is wrong. Please, check your data");
	  document.frmvolunteer.phone.focus();
	  return false;
	}
	if (!IsNumeric(document.frmvolunteer.phone.value))
	{
	  alert("Something is wrong. Please, check your data");
	  document.frmvolunteer.phone.focus();
	  return false;
	}
	
	var chkFilter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	if (!(chkFilter.test(document.frmvolunteer.email.value))) {
			 alert("Something is wrong. Please, check your data");
			 document.frmvolunteer.email.focus();
			 return false;
	}
	 
	/* if ((mytrim(document.frmvolunteer.comments.value)=="") || (mytrim(document.frmvolunteer.comments.value) == "Message"))
		{
			alert("Something is wrong. Please, check your data");
			document.frmvolunteer.comments.focus();
			return false;
			
		}*/
	/*if (document.frmvolunteer.comments.value.length>1000)
	{
		alert("Something is wrong. Please, check your data");
		document.frmvolunteer.comments.focus();
		return false;
	}*/
}

function validateVolunteer1()
{


	if ((mytrim(document.frmvolunteer.firstname.value) == "") || (mytrim(document.frmvolunteer.firstname.value) == "Name")) 
	{
	  alert("Please Enter Your Firstname");
	  document.frmvolunteer.firstname.focus();
	  return false;
	}
	else
	{
	 var chkFilter=/^[a-zA-Z ]+$/;
	 if (!(chkFilter.test(mytrim(document.frmvolunteer.firstname.value)))) 
	 {
	  alert("Please Enter Your Firstname.\nNo Numerals Are Allowed.") ;
	  document.frmvolunteer.firstname.focus();
	  return false;
	 }
	}
	
	if ((mytrim(document.frmvolunteer.lastname.value) == "") || (mytrim(document.frmvolunteer.lastname.value) == "Surname")) 
	{
	  alert("Please Enter Your Surname");
	  document.frmvolunteer.lastname.focus();
	  return false;
	}
	else
	{
	 var chkFilter=/^[a-zA-Z ]+$/;
	 if (!(chkFilter.test(mytrim(document.frmvolunteer.lastname.value)))) 
	 {
	  alert("Please Enter Your Surname.\nNo Numerals Are Allowed.") ;
	  document.frmvolunteer.lastname.focus();
	  return false;
	 }
	}


 	var chkFilter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	if (!(chkFilter.test(document.frmvolunteer.email.value))) {
			 alert("Please Enter Valid Email ");
			 document.frmvolunteer.email.focus();
			 return false;
	}
	 
	 if ((mytrim(document.frmvolunteer.phone.value) == "") || (mytrim(document.frmvolunteer.phone.value) == "Phone") ) 
	{
	  alert("Please Enter Your Phone No.");
	  document.frmvolunteer.phone.focus();
	  return false;
	}
	if (document.frmvolunteer.phone.length < 12)
	{
	  alert("Please Enter Correct Phone No.");
	  document.frmvolunteer.phone.focus();
	  return false;
	}
	if (!IsNumeric(document.frmvolunteer.phone.value))
	{
	  alert("Please Enter Correct Phone No.");
	  document.frmvolunteer.phone.focus();
	  return false;
	}
	 
	 if ((mytrim(document.frmvolunteer.comments.value)=="") || (mytrim(document.frmvolunteer.comments.value) == "Comments"))
		{
			alert("Please enter comments below 1000 words.");
			document.frmvolunteer.comments.focus();
			return false;
			
		}
	if (document.frmvolunteer.comments.value.length>1000)
	{
		alert("Please Enter Comments Below 1000 Words.");
		document.frmvolunteer.comments.focus();
		return false;
	}
}

function validateVolunteer2()
{


	if ((mytrim(document.frmvolunteer.firstname.value) == "") || (mytrim(document.frmvolunteer.firstname.value) == "Name")) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frmvolunteer.firstname.focus();
	  return false;
	}
	else
	{
	 var chkFilter=/^[a-zA-Z ]+$/;
	 if (!(chkFilter.test(mytrim(document.frmvolunteer.firstname.value)))) 
	 {
	  alert("Something is wrong. Please, check your data") ;
	  document.frmvolunteer.firstname.focus();
	  return false;
	 }
	}
	
	if ((mytrim(document.frmvolunteer.lastname.value) == "") || (mytrim(document.frmvolunteer.lastname.value) == "Surname")) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frmvolunteer.lastname.focus();
	  return false;
	}
	else
	{
	 var chkFilter=/^[a-zA-Z ]+$/;
	 if (!(chkFilter.test(mytrim(document.frmvolunteer.lastname.value)))) 
	 {
	  alert("Something is wrong. Please, check your data") ;
	  document.frmvolunteer.lastname.focus();
	  return false;
	 }
	}


 	var chkFilter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	if (!(chkFilter.test(document.frmvolunteer.email.value))) {
			 alert("Something is wrong. Please, check your data");
			 document.frmvolunteer.email.focus();
			 return false;
	}
	 
	 if ((mytrim(document.frmvolunteer.phone.value) == "") || (mytrim(document.frmvolunteer.phone.value) == "Phone") ) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frmvolunteer.phone.focus();
	  return false;
	}
	if (document.frmvolunteer.phone.length < 15)
	{
	  alert("Something is wrong. Please, check your data");
	  document.frmvolunteer.phone.focus();
	  return false;
	}
	if (!IsNumeric(document.frmvolunteer.phone.value))
	{
	  alert("Something is wrong. Please, check your data");
	  document.frmvolunteer.phone.focus();
	  return false;
	}
	 
	 if ((mytrim(document.frmvolunteer.comments.value)=="") || (mytrim(document.frmvolunteer.comments.value) == "Comments"))
		{
			alert("Something is wrong. Please, check your data");
			document.frmvolunteer.comments.focus();
			return false;
			
		}
	if (document.frmvolunteer.comments.value.length>1000)
	{
		alert("Something is wrong. Please, check your data");
		document.frmvolunteer.comments.focus();
		return false;
	}
}


function validateRegistration()
{


	if ((mytrim(document.frmregistration.firstname.value) == "") || (mytrim(document.frmregistration.firstname.value) == "Name")) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frmregistration.firstname.focus();
	  return false;
	}
	else
	{
	 var chkFilter=/^[a-zA-Z ]+$/;
	 if (!(chkFilter.test(mytrim(document.frmregistration.firstname.value)))) 
	 {
	  alert("Something is wrong. Please, check your data") ;
	  document.frmregistration.firstname.focus();
	  return false;
	 }
	}
	
	if ((mytrim(document.frmregistration.lastname.value) == "") || (mytrim(document.frmregistration.lastname.value) == "Surname")) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frmregistration.lastname.focus();
	  return false;
	}
	else
	{
	 var chkFilter=/^[a-zA-Z ]+$/;
	 if (!(chkFilter.test(mytrim(document.frmregistration.lastname.value)))) 
	 {
	  alert("Something is wrong. Please, check your data") ;
	  document.frmregistration.lastname.focus();
	  return false;
	 }
	}

	var chkFilter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	if (!(chkFilter.test(document.frmregistration.email.value))) {
			 alert("Something is wrong. Please, check your data");
			 document.frmregistration.email.focus();
			 return false;
	}
	
	if ((mytrim(document.frmregistration.custom1.value) == "") || (mytrim(document.frmregistration.custom1.value) == "Organisation")) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frmregistration.custom1.focus();
	  return false;
	}

	if ((mytrim(document.frmregistration.country.value) == "") || (mytrim(document.frmregistration.country.value) == "Country")) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frmregistration.country.focus();
	  return false;
	}
	
	if ((mytrim(document.frmregistration.custom2.value) == "") || (mytrim(document.frmregistration.custom2.value) == "Position")) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frmregistration.custom2.focus();
	  return false;
	}
	
 	if ( document.frmregistration.custom4.checked == false && document.frmregistration.custom5.checked == false && document.frmregistration.custom6.checked == false && document.frmregistration.custom7.checked == false && document.frmregistration.custom8.checked == false) 
	{
		alert ('You didn\'t choose any of the panels!\n Please choose atleast one panel');
		return false;
	}

	 
	 	 
	
}


function validateIternationalVisitor()
{


	if ((mytrim(document.frm1.firstname.value) == "") || (mytrim(document.frm1.firstname.value) == "Name")) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frm1.firstname.focus();
	  return false;
	}
	else
	{
	 var chkFilter=/^[a-zA-Z ]+$/;
	 if (!(chkFilter.test(mytrim(document.frm1.firstname.value)))) 
	 {
	  alert("Something is wrong. Please, check your data") ;
	  document.frm1.firstname.focus();
	  return false;
	 }
	}
	
	if ((mytrim(document.frm1.lastname.value) == "") || (mytrim(document.frm1.lastname.value) == "Surname")) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frm1.lastname.focus();
	  return false;
	}
	else
	{
	 var chkFilter=/^[a-zA-Z ]+$/;
	 if (!(chkFilter.test(mytrim(document.frm1.lastname.value)))) 
	 {
	  alert("Something is wrong. Please, check your data") ;
	  document.frm1.lastname.focus();
	  return false;
	 }
	}
	
	if ((mytrim(document.frm1.custom1.value) == "")) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frm1.custom1.focus();
	  return false;
	}
	if ((mytrim(document.frm1.custom2.value) == "")) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frm1.custom2.focus();
	  return false;
	}
	if ((mytrim(document.frm1.country.value) == "")) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frm1.country.focus();
	  return false;
	}

	var chkFilter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	if (!(chkFilter.test(document.frm1.email.value))) {
			 alert("Something is wrong. Please, check your data");
			 document.frm1.email.focus();
			 return false;
	}
	 
	 if ((mytrim(document.frm1.phone.value) == "") || (mytrim(document.frm1.phone.value) == "Phone") ) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frm1.phone.focus();
	  return false;
	}
	if (document.frm1.phone.length < 10)
	{
	  alert("Something is wrong. Please, check your data");
	  document.frm1.phone.focus();
	  return false;
	}
	if (!IsNumeric(document.frm1.phone.value))
	{
	  alert("Something is wrong. Please, check your data");
	  document.frm1.phone.focus();
	  return false;
	}

}

function validateIternationalVisitor2()
{
 if ( document.getElementById('chk1').checked == false && document.getElementById('chk2').checked == false && document.getElementById('chk3').checked == false && document.getElementById('chk4').checked == false) 
	{
		alert ('You didn\'t choose any of the option!\n Please choose atleast one option');
		return false;
	}
	
}

function validateIternationalVisitor3()
{
	if ((mytrim(document.frm3.city.value) == "")) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frm3.city.focus();
	  return false;
	}
	if ((mytrim(document.frm3.eventdate.value) == "") || (mytrim(document.frm3.eventdate.value)=="Arrival Date")) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frm3.eventdate.focus();
	  return false;
	}
	if ( document.getElementById('chkM').checked == false && document.getElementById('chkO').checked == false)
	{
	  alert("Something is wrong. Please, check your data");	  
	  return false;	
	}
	if(document.getElementById('chkO').checked == true)
	{
		if ((mytrim(document.frm3.address1.value) == "")) 
		{
		  alert("Something is wrong. Please, check your data");
		  document.frm3.address1.focus();
		  return false;
		}
	}	
	if ((mytrim(document.frm3.custom4.value) == "") || (mytrim(document.frm3.custom4.value) =="Airline Name")) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frm3.custom4.focus();
	  return false;
	}
	
	if ((mytrim(document.frm3.custom5.value) == "") || (mytrim(document.frm3.custom5.value)=="Flight Number")) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frm3.custom5.focus();
	  return false;
	}
	
	if ( document.getElementById('chkYT').checked == false && document.getElementById('chkNT').checked == false)
	{
	  alert("Please Choose Option For Transfer Arrival.");	  
	  return false;	
	}
	
	if ((mytrim(document.frm3.electiondate.value) == "") || (mytrim(document.frm3.electiondate.value)=="Departure Date")) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frm3.electiondate.focus();
	  return false;
	}
	
	var arrivalDate = new Date(document.frm3.eventdate.value);
	var departureDate = new Date(document.frm3.electiondate.value);
	if (departureDate < arrivalDate )
	{
		alert("Departure Date Must Be Greater Than Arrival Date.");
		return false;
	}
	
	if ( document.getElementById('chkDM').checked == false && document.getElementById('chkDO').checked == false)
	{
	  alert("Please Choose Option For Transfer."); 
	  return false;	
	}
	
	if(document.getElementById('chkDO').checked == true)
	{
		if ((mytrim(document.frm3.address2.value) == "")) 
		{
		  alert("Something is wrong. Please, check your data");
		  document.frm3.address2.focus();
		  return false;
		}
	}
	if ((mytrim(document.frm3.custom8.value) == "")) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frm3.custom8.focus();
	  return false;
	}
	
	if ((mytrim(document.frm3.custom9.value) == "") || (mytrim(document.frm3.custom9.value) == "Airline Name")) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frm3.custom9.focus();
	  return false;
	}
	
	if ((mytrim(document.frm3.custom10.value) == "") || (mytrim(document.frm3.custom10.value)=="Flight Number")) 
	{
	  alert("Something is wrong. Please, check your data");
	  document.frm3.custom10.focus();
	  return false;
	}
	
	if ( document.getElementById('ChkDY').checked == false && document.getElementById('ChkDN').checked == false)
	{
	  alert("Please Choose Option Departure For Transfer.");	  
	  return false;	
	}
	
	
	
	 
}

