function NoBlanksGlobal(MyData) {
	foundError=false;
	// Check all fields for empty or blank
	if(foundError==false&&(MyData.txtFirstName&&isFieldBlank(MyData.txtFirstName)==true)) {
		alert("Please enter your name.");
		foundError=true;
		MyData.txtFirstName.focus();
	}
	
	if(foundError==false&&(MyData.txtEmail&&isFieldBlank(MyData.txtEmail)==true)) {
		alert("Please enter your email address.");
		foundError=true;
		MyData.txtEmail.focus();
	}
	
	if(foundError==false&&(MyData.txtPhone&&isFieldBlank(MyData.txtPhone)==true)) {
		alert("Please enter your phone number.");
		foundError=true;
		MyData.txtPhone.focus();
	}
	
	if(foundError==false&&MyData.txtEmail&&isValidEmail(MyData.txtEmail)==false) {
		alert("You have not entered a valid email address. Please check your email address and submit again.");
		MyData.txtEmail.focus();
		foundError=true;
   	}
	
	
	if(foundError==false&&(MyData.txtStateCountry&&isFieldBlank(MyData.txtStateCountry)==true)) {
		alert("Please enter the company's state and country.");
		foundError=true;
		MyData.txtStateCountry.focus();
	}
	
	
	// Check for a blank field
	function isFieldBlank(theField) {
		if(theField.value=="")
			return true;
		else
			return false;
	}

	// Check for a valid email address
	function isValidEmail(theField) {
		if(isEmail(theField.value)==true) {
			return true;
		}
		else {
			return false;
		}
	}

	function isEmail(addr) {
		var i,nAt,nDot;
	   // check for length: minimum valid would be a@b.cd
	   if(addr.length < 6) {
	      return(false);
	   }
	   
	   // find the @
	   nAt=addr.indexOf('@',0);
	   if(nAt < 1) {
	      return(false);    // at must be after first character
	   }
	   
	   // make sure . is AFTER @ by at least 1 character
	   nDot=addr.indexOf('.',nAt);
	   if(nDot < nAt+2) {
	      return(false);
	   }
	   
	   // dot must be before second from last character
	   if(nDot > addr.length-3) {
	      return(false);
	   }
	   
		// now verify all the characters
		for(i=0; i < addr.length; i++) {
			if(i != nAt&&i != nDot)
			if(!isEMChar(addr.charAt(i))) {
	            return(false);
	         }
	   }
		return true;
	}

	function isEMChar(c) {
		// checks to see if a valid email address char
		var s="@ /#%^$!*'`+;:,;|\<>=()[]{}~?"
		if(s.indexOf(c) != -1)
			return(false);
		else 
			return(true);
	}

	// returning false when using the form onsubmit stops the form from being submitted
	if(foundError==false) {
		return true;   
		}
		else {
		return false;
   }
}

var pageform;

function ajaxSubmit() {
	var returnValue = jQuery.ajax({
		type: "GET",
	   	url: "/account/contact_action.asp",
	   	dataType: "text",
	   	data: "txtFirstName="+pageform.txtFirstName.value+"&txtEmail="+pageform.txtEmail.value+"&txtPhone="+pageform.txtPhone.value+"&txtStateCountry="+pageform.txtStateCountry.value+"&comment="+pageform.comment.value+"",
	   	success: function(msg){
	   		if(msg.indexOf('success')!=-1) {
	   			jQuery('#global-contact-form').html("Your request has been submitted! You'll be hearing from us soon.");
   			} else {
   				jQuery('#global-contact-form').html("There was a problem submitting your request. Please call us so that we may help you sooner.");
   			}
	     	
	   	}
	}).responseText;
}

function SubmitFormPullDown(MyData) {    
	pageform = MyData;
	if (NoBlanksGlobal(MyData)) {
		//pageform.submit();
		var loadingGraphic = $('<img />').attr('src','/images/loadingAnimation.gif');
		jQuery('#global-contact-form').html("<br />submitting...");
		jQuery('#global-contact-form').append(loadingGraphic);
		
		var theTO = setTimeout("ajaxSubmit()",1000);
	}   
	
}






