function isProper(string, CheckEmpty)
	{

   		if ((!string) && (CheckEmpty != "Empty"))
		{
			alert("proper 1");
			 return false;
		}
		else
		{	 
	   		var iChars = "*|<>[]{}`;";

	   		for (var i = 0; i < string.length; i++)
	   		{	
	   	   		if (iChars.indexOf(string.charAt(i)) != -1)
		         	return false;
		   	}
		   	return true;
		}	
	}                      


	function VerifyText(field, AlertText, CheckEmpty)
	{
	   var iChars = "*|<>[]{}`;";

		if ((field.value == "") && (CheckEmpty != "Empty"))
	  	{
			alert(AlertText);
			field.focus(field.value);
			return false;
		}

		for (j = 0; j < field.value.length ; j++)
		{
			if (field.value.substring(j,j+1) == " ")
		  	{
				if (j == 0)
				{
					alert("Please remove the blank space at the beginning of the field");
					field.focus(field.value);
					return false;
				}
				
				if (j == field.value.length -1)
				{
					alert("Please remove the blank space at the end of the field");
					field.focus(field.value);
					return false;
				}
			}
		}
		
    	if (isProper(field.value, CheckEmpty))
		{
			return true;
		}
		else	
		{
       		alert("Please enter valid text. You can not use *|\<:>[]{}`\; " + CheckEmpty);
			field.focus(field.value);
       		return false;
    	}
		
		return true;
	}




	function VerifyDropDown(field, fieldname)
	{
	
		if (field.value == "NO")
	  	{
			alert("Please " + fieldname);
			field.focus(field.value);
			return false;
		}

		return true;

	}


	


	function VerifyEmail(field, AlertMessage)
	{
    	if (field.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
		{
			return true;
		}
		else	
		{
        	alert(AlertMessage);
			field.focus(field.value);
        	return false;
    	}
    	return true;
	}	
	
	
			
	function FormOne(form)
	{
	 	
	 	if (!VerifyDropDown(form.ac_listingtype, 'Please choose a listing type'))  return false;
		if (!VerifyText(form.ac_price, 'Please enter the Asking Price'))  return false;
		//if (!VerifyText(form.ac_city, 'Please enter the Aircraft Location (City)'))  return false;
		if (!VerifyDropDown(form.ac_province, 'Please enter the Airplane\'s Province'))  return false;
		if (!VerifyDropDown(form.ac_country, 'Please enter the Airplane\'s Country'))  return false;
		if (!VerifyText(form.o_name, 'Please enter the Owner\'s Name'))  return false;
		if (!VerifyText(form.o_city, 'Please enter the Owner\'s City'))  return false;
		if (!VerifyDropDown(form.o_province, 'Please enter the Owner\'s Province'))  return false;
		if (!VerifyDropDown(form.o_country, 'Please enter the Owner\'s Country'))  return false;
		if (!VerifyEmail(form.o_email, 'Please enter a valid Email Address'))  return false;
		if (!VerifyText(form.o_wp007, 'Please enter a password'))  return false;
	  	return true;
	}
	
		function FormTwo(form)
	{
	 	if (!VerifyText(form.ac_year, 'Please enter the aircraft\'s year'))  return false;
		if (!VerifyText(form.ac_make, 'Please enter the aircraft\'s make'))  return false;
		if (!VerifyText(form.ac_type, 'Please enter the aircraft\'s type'))  return false;
	 	if (!VerifyDropDown(form.ac_category, 'Please indicate catagory'))  return false;
	 	if (!VerifyDropDown(form.ac_category2, 'Please indicate additional category'))  return false;
		if (!VerifyText(form.ac_ttaf, 'Please enter the TTAF'))  return false;
	  	return true;
	}
	
	
		function FormConfirm(form)
	{
	 	
	 	if (!VerifyDropDown(form.ac_listingtype, 'Please choose a listing type'))  return false;
		if (!VerifyText(form.ac_tail, 'Please enter the Aircraft Registration (Tail #)'))  return false;
		if (!VerifyText(form.ac_city, 'Please enter the Aircraft Location (City)'))  return false;
		if (!VerifyDropDown(form.ac_province, 'Please enter the Airplane\'s Province'))  return false;
		if (!VerifyText(form.o_city, 'Please enter the Owner\'s City'))  return false;
		if (!VerifyDropDown(form.o_province, 'Please enter the Owner\'s Province'))  return false;
		if (!VerifyEmail(form.o_email, 'Please enter a valid Email Address'))  return false;
		if (!VerifyText(form.ac_year, 'Please enter the aircraft\'s year'))  return false;
		if (!VerifyText(form.ac_make, 'Please enter the aircraft\'s make'))  return false;
		if (!VerifyText(form.ac_type, 'Please enter the aircraft\'s type'))  return false;
	 	if (!VerifyDropDown(form.ac_category, 'Please indicate catagory'))  return false;
	 	if (!VerifyDropDown(form.ac_category2, 'Please indicate additional category'))  return false;
		if (!VerifyText(form.ac_ttaf, 'Please enter the TTAF'))  return false;
		if (!VerifyDropDown(form.ac_damage, 'Please indicate if you have a damage history'))  return false;
		if (!VerifyDropDown(form.ac_logs, 'Please indicate if you have logs since aircraft was new'))  return false;
		if (!VerifyText(form.ac_annual, 'Please enter Annual'))  return false;
		if (!VerifyText(form.ac_smohL, 'Please enter SMOH Main/Left'))  return false;
		if (!VerifyText(form.ac_propssmohL, 'Please enter Props SMOH Main/Left'))  return false;
		if (!VerifyText(form.ac_damagedes, 'Please enter a description of the damage history'))  return false;
	  	return true;
	}
	
			function FormUser(form)
	{
	 	
	 	if (!VerifyDropDown(form.ac_listingtype, 'Please choose a listing type'))  return false;
		if (!VerifyText(form.ac_price, 'Please enter the Asking Price'))  return false;
		if (!VerifyText(form.ac_tail, 'Please enter the Aircraft RegistrationReference (Tail #)'))  return false;
		if (!VerifyText(form.ac_city, 'Please enter the Aircraft Location (City)'))  return false;
		if (!VerifyDropDown(form.ac_province, 'Please enter the Airplane\'s Province'))  return false;
		if (!VerifyDropDown(form.ac_country, 'Please enter the Airplane\'s Country'))  return false;
	  	return true;
	}

		function FormPass(form)
	{
	 	
	 	if (!VerifyText(form.passaaa, 'Please Enter Your Current Password'))  return false;
		if (!VerifyText(form.passbbb, 'Please Enter Your New Password'))  return false;
		if (!VerifyText(form.passccc, 'Please Confirm Your New Password'))  return false;
	  	return true;
	}
