<!--general_functions.js-->
<!--start-->
function wv_WinOpen(url, wname, wdth, hgt, status, resizable, scrollbars, location) {
  if (hgt) { hgt = ",height=" + hgt; }
  if (wdth) { wdth = ",width=" + wdth; }
  if (status) {status = "status=" + status;} else {status="status=no";}
  if (resizable) {resizable = ",resizable=" + resizable;}
  if (scrollbars) {scrollbars = ",scrollbars=" + scrollbars;}
  if (location) {location = ",location=" + location;}
  var spec = status + wdth + hgt + resizable + scrollbars + location +",top=100,left=100,screenX=100,screenY=100";
  popupWin = window.open(url, wname, spec);
  popupWin.focus(); 
}

function wv_WinOpenB(url, wname, wdth, hgt, status, resizable, scrollbars, location, toolbar) {
  if (hgt) { hgt = ",height=" + hgt; }
  if (wdth) { wdth = ",width=" + wdth; }
  if (status) {status = "status=" + status;} else {status="status=no";}
  if (resizable) {resizable = ",resizable=" + resizable;}
  if (scrollbars) {scrollbars = ",scrollbars=" + scrollbars;}
  if (location) {location = ",location=" + location;}
   if (toolbar) {toolbar = ",toolbar=" + toolbar;}
  var spec = status + wdth + hgt + resizable + scrollbars + location + toolbar +",top=100,left=100,screenX=100,screenY=100";
  popupWin = window.open(url, wname, spec);
  popupWin.focus(); 
}

function ValidateEmail(email){
	//Check email address to make sure it's valid.
	//all 2 letter extensions are ok - these refer to countries
	//For 3 letters and above, check specifically.
	email +=""
	var goodEmail = email.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.biz)|(\.gov)|(\.org)|(\.web)|(\.store)|(\.nato)|(\.nom)|(\.firm)|(\..{2,2}))$)\b/gi);
	
	if (!goodEmail){
//		alertMsg +='\nPlease enter a valid e-mail address.\n'
		return false;
	} else {
		return true;
	}
}

function AddSlashes( str ) {
  return str.replace(/(['"\\\x00])/g, "\\$1");
}

function StripSlashes( str ) {
  return str.replace(/\\(['"\\\x00])/g, "$1");
}

//Added 1/31/2005 - first use is to trim the state value in the checkoutpage, so people
//cannot escape from paying taxes by putting a space before the ca, i.e " ca", as opposed to
//"ca".
function trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

//Function - CheckFeedbackForm - 6/28/2006 added.
//This function is used by the feedback.html and the contactinfo.html, which share
//some identical fields which will be checked here.
function CheckFeedbackForm( theform, page_to_check )
{
	if (page_to_check=='') {
		page_to_check='Feedback';  //The other possibility is 'ContactInfo'
	}
	//Check for each of the 3 required fields before allowing user to submit form.
	var bMissingFields = false;
	var strFields = "";
	
	//1. Check name
	if( theform.realname.value == '' ){
		bMissingFields = true;
		strFields += "     Name\n";
	}

	//2. Check email.
	//Check the email - make sure it's in the correct format, not just if it's blank
	email =theform.email.value;
	if( email == '' ){
		bMissingFields = true;
		strFields += "     Email\n";
	} else {
		if(!ValidateEmail(email)){
			bMissingFields = true;
			strFields += "     Email - invalid address\n";
		}
	}	
	
	//3. Check how the customer found us.  Only do this check if checking the Feedback form
	//   The contactinfo form doesn't need to check this.
	if (page_to_check=='Feedback') { 
		if( theform.How_Found_Us.value == '' ){
			bMissingFields = true;
			strFields += "     How did you find us\n";
		}
	}
	//If any missing fields, then pop-up alert message and return to form.
	if( bMissingFields ) {
		alert( "I'm sorry, but you must correct the following field(s) before continuing:\n" + strFields );
		return false;
	}
	
	//Fill in the hidden fields Customer_Name and Customer_Email so they'll be
	//shown in the feedback email to WV
	theform.Customer_Name.value=theform.realname.value;
	theform.Customer_Email.value=theform.email.value;
	
	return true;
}
<!--end-->

