function getValidationsResult(){
	
	// if(document.form_paypal.rdl_amountEntry[7].checked){
		// if(document.form_paypal.amount.value==""){
			// alert("Enter your donation Amount");
			// document.form_paypal.amount.focus();
			// return false;
		// }
		// if(!isInteger(document.form_paypal.amount.value)){
			// alert("Enter Valid donation Amount");
			// document.form_paypal.amount.focus();
			// return false;
		// }
	// }
	// if(document.form_paypal.rdl_donation_type_one[1].checked){
		// if(document.form_paypal.cmb_recurring_interval.value==""){
			// alert("Select Recurring donation");
			// document.form_paypal.cmb_recurring_interval.focus();
			// return false;
		// }
	// }
	
	
	if(document.form_paypal.amount.value==""){
		alert("Enter your donation Amount");
		document.form_paypal.amount.focus();
		return false;
	}
	if(!isInteger(document.form_paypal.amount.value)){
		alert("Enter Valid donation Amount");
		document.form_paypal.amount.focus();
		return false;
	}
	
	if(document.form_paypal.first_name.value==""){
		alert("Enter your first Name");
		document.form_paypal.first_name.focus();
		return false;
	}
	if(document.form_paypal.last_name.value==""){
		alert("Enter your last Name");
		document.form_paypal.last_name.focus();
		return false;
	}
	if ((document.form_paypal.email.value==null)||(document.form_paypal.email.value=="")){
		alert("Please Enter your Email Field")
		document.form_paypal.email.focus()
		return false
	}
	if (echeck(document.form_paypal.email.value)==false){
		alert("Please Enter Valid Email Field")
		document.form_paypal.email.value=""
		document.form_paypal.email.focus()
		return false
	}
	if ((document.form_paypal.txt_confirm_user_email.value==null)||(document.form_paypal.txt_confirm_user_email.value=="")){
		alert("Please Enter your Confirm Email Field")
		document.form_paypal.txt_confirm_user_email.focus()
		return false
	}
	if (echeck(document.form_paypal.txt_confirm_user_email.value)==false){
		alert("Invalid Confirm Email Field");
		document.form_paypal.txt_confirm_user_email.value=""
		document.form_paypal.txt_confirm_user_email.focus()
		return false
	}
	if ((document.form_paypal.txt_confirm_user_email.value!=document.form_paypal.email.value)){
		//alert("Confirm Email Field must be equal to Eamil Field")
		alert("We are unable to process your donation form. Please go back and check that all the required fields have been entered. If you encounter further problems please contact:  kimberly@hekhshertzedek.org")
		document.form_paypal.txt_confirm_user_email.focus()
		return false
	}
	if ((document.form_paypal.txt_user_phone.value==null)||(document.form_paypal.txt_user_phone.value=="")){
		alert("Please Enter your Phone Number")
		document.form_paypal.txt_user_phone.focus()
		return false
	}
	if (checkInternationalPhone(document.form_paypal.txt_user_phone.value)==false){
		alert("Please Enter a Valid Phone Number")
		document.form_paypal.txt_user_phone.value=""
		document.form_paypal.txt_user_phone.focus()
		return false
	}
	
	if (document.form_paypal.txt_user_phone_ext.value.length != 0) {
		if (IsNumeric(document.form_paypal.txt_user_phone_ext.value) == false){
			alert("Please check - non numeric extension!");
			document.form_paypal.txt_user_phone_ext.focus();
			return false;
		}
    } 
	
	
	
	if(document.form_paypal.address1.value==""){
		alert("Enter your Address 1");
		document.form_paypal.address1.focus();
		return false;
	}
	// if(document.form_paypal.txt_user_address2.value==""){
		// alert("Enter your Address 2");
		// document.form_paypal.txt_user_address2.focus();
		// return false;
	// }
	
	if(document.form_paypal.city.value==""){
		alert("Enter your City");
		document.form_paypal.city.focus();
		return false;
	}
	
	if(document.form_paypal.state.value==""){
		alert("Enter your State");
		document.form_paypal.state.focus();
		return false;
	}
	if(document.form_paypal.zip.value==""){
		alert("Enter your Postal Code");
		document.form_paypal.zip.focus();
		return false;
	}
	
	if (validateZipCode(document.form_paypal.zip.value) == false){
		alert("Please check - the length of zip code!");
		document.form_paypal.zip.focus();
		return false;
    }
	// if(document.form_paypal.txt_billing_name.value==""){
		// alert("Enter your Card Name");
		// document.form_paypal.txt_billing_name.focus();
		// return false;
	// }
	
	// if(document.form_paypal.cmb_billing_card_type.value==""){
		// alert("Select Card Type");
		// document.form_paypal.cmb_billing_card_type.focus();
		// return false;
	// }
	// if(document.form_paypal.txt_billing_card_number.value==""){
		// alert("Enter your Card Number");
		// document.form_paypal.txt_billing_card_number.focus();
		// return false;
	// }
	// if(isNaN(document.form_paypal.txt_billing_card_number.value)){
		// alert("Credit Card number is not numeric."+document.form_paypal.txt_billing_card_number.length);
		// document.form_paypal.txt_billing_card_number.focus();
		// return false;
	// }
	// if(!isNaN(document.form_paypal.txt_billing_card_number.value)){
		// var CCnumber = document.form_paypal.txt_billing_card_number.value;
		// if((CCnumber.length!=16) && (CCnumber.length!=18)){
			// alert("Incorrect number of digits in credit card number.");
			// document.form_paypal.txt_billing_card_number.focus();
			// return false;
		// }
		
	// }
	// if(document.form_paypal.cmb_billing_expiration_month.value==""){
		// alert("Select Expire Date Month");
		// document.form_paypal.cmb_billing_expiration_month.focus();
		// return false;
	// }
	if(document.form_paypal.cmb_billing_expiration_year.value==""){
		alert("Select Expire Date Year");
		document.form_paypal.cmb_billing_expiration_year.focus();
		return false;
	}
	// if(document.form_paypal.txt_scrty_code.value==""){
		// alert("Enter Security Code");
		// document.form_paypal.txt_scrty_code.focus()
		// return false;
	// }
	
}

function getContactValidationsResult(){
	
	if(document.frm_contact_us.txtFirstName.value==""){
		alert("Enter your First Name");
		document.frm_contact_us.txtFirstName.focus();
		return false;
	}
	if(document.frm_contact_us.txtLastName.value==""){
		alert("Enter your Last Name");
		document.frm_contact_us.txtLastName.focus();
		return false;
	}
	if ((document.frm_contact_us.txtEmail.value==null)||(document.frm_contact_us.txtEmail.value=="")){
		alert("Please Enter your Email")
		document.frm_contact_us.txtEmail.focus()
		return false
	}
	if (echeck(document.frm_contact_us.txtEmail.value)==false){
		//alert("Please Enter Valid Email")
		document.frm_contact_us.txtEmail.focus()
		return false
	}
	if(document.frm_contact_us.txtMessage.value==""){
		alert("Enter your Message");
		document.frm_contact_us.txtMessage.focus();
		return false;
	}
	document.frm_contact_us.submit();
}

function getSignSupportValidationsResult(){
	
	if(document.frm_signSupport.txtFirstName.value==""){
		alert("Enter your First Name");
		document.frm_signSupport.txtFirstName.focus();
		return false;
	}
	if(document.frm_signSupport.txtLastName.value==""){
		alert("Enter your Last Name");
		document.frm_signSupport.txtLastName.focus();
		return false;
	}
	
	
	if ((document.frm_signSupport.txtEmail.value==null)||(document.frm_signSupport.txtEmail.value=="")){
		alert("Please Enter your Email")
		document.frm_signSupport.txtEmail.focus()
		return false
	}
	if (echeck(document.frm_signSupport.txtEmail.value)==false){
		//alert("Please Enter Valid Email")
		document.frm_signSupport.txtEmail.focus()
		return false
	}
	
	
	if ((document.frm_signSupport.txt_user_phone.value==null)||(document.frm_signSupport.txt_user_phone.value=="")){
		alert("Please Enter your Phone Number")
		document.frm_signSupport.txt_user_phone.focus()
		return false
	}
	if (checkInternationalPhone(document.frm_signSupport.txt_user_phone.value)==false){
		alert("Please Enter a Valid Phone Number")
		document.frm_signSupport.txt_user_phone.value=""
		document.frm_signSupport.txt_user_phone.focus()
		return false
	}
	
	if (document.frm_signSupport.txt_user_phone_ext.value.length != 0) {
		if (IsNumeric(document.frm_signSupport.txt_user_phone_ext.value) == false){
			alert("Please check - non numeric extension!");
			document.frm_signSupport.txt_user_phone_ext.focus();
			return false;
		}
    } 
	
	
	if(document.frm_signSupport.txtMessage.value==""){
		alert("Enter your Message");
		document.frm_signSupport.txtMessage.focus();
		return false;
	}
	document.frm_signSupport.submit();
	
}

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail")
		    return false
		 }

 		 return true					
	}


	
	
	
// Declaring required variables
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()- ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 10;

function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}
function trim(s)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not a whitespace, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (c != " ") returnString += c;
    }
    return returnString;
}
function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function checkInternationalPhone(strPhone){
var bracket=3
strPhone=trim(strPhone)
if(strPhone.indexOf("+")>1) return false
if(strPhone.indexOf("-")!=-1)bracket=bracket+1
if(strPhone.indexOf("(")!=-1 && strPhone.indexOf("(")>bracket)return false
var brchr=strPhone.indexOf("(")
if(strPhone.indexOf("(")!=-1 && strPhone.charAt(brchr+2)!=")")return false
if(strPhone.indexOf("(")==-1 && strPhone.indexOf(")")!=-1)return false
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}


function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }

   
	function isValidZipCode(value) {
		var re = /^\s{5}([\-]\d{4})?$/;
		return (re.test(value));
	}

	function validateZipCode(elementValue){
		var zipCodePattern = /^\d{5}$|^[a-zA-Z0-9_]{5}$|^[a-zA-Z0-9_]{5}-[a-zA-Z0-9_]{4}$|^\d{5}-\d{4}$/;
		return zipCodePattern.test(elementValue);
	}
	function validateZIP(field) {
		var valid = "0123456789-";
		var hyphencount = 0;

		if (field.length!=5 && field.length!=10) {
		//alert("Please enter your 5 digit or 5 digit+4 zip code.");
		return false;
		}
		for (var i=0; i < field.length; i++) {
		temp = "" + field.substring(i, i+1);
		if (temp == "-") hyphencount++;
		if (valid.indexOf(temp) == "-1") {
		//alert("Invalid characters in your zip code.  Please try again.");
		return false;
		}
		if ((hyphencount > 1) || ((field.length==10) && ""+field.charAt(5)!="-")) {
		//alert("The hyphen character should be used with a properly formatted 5 digit+four zip code, like '12345-6789'.   Please try again.");
		return false;
		   }
		}
		return true;
	}
   
   
 
