
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 MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_openBrWindow(theURL,winName,features) {
	newwindow=window.open(theURL,winName,features);
	if (window.focus) {newwindow.focus()}
}

// function for the shopping cart
function checkQty(qtyvalue) {
	//if(qtyvalue!=1&&qtyvalue!=2&&qtyvalue!=3&&qtyvalue!=4&&qtyvalue!=5&&qtyvalue!=10&&qtyvalue!=15&&qtyvalue!=20&&qtyvalue!=25) {
	//	alert("Qty must be 1-4, 5, 10, 15, 20 or 25");
	//	document.cartadd.qty.value="1";
	//	return false;
	//}
}

// test function for cart quantity
function qtyCheck(qtyValue) {
	alert("current quantity is "+qtyValue);
}

// dynamically add flash code to bypass IE ActiveX security
function NewHomeFlash()
{
   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="760" height="200">\n');
   document.write(' <param name="movie" value="images/intro_new.swf">\n');
   document.write(' <param name="quality" value="high">\n');
   document.write(' <param name="wmode" value="transparent">\n');
   document.write(' <embed src="images/intro_new.swf" width="760" height="200" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>\n');
   document.write('</object>\n');
}

function buildHomeFlash()
{
   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="760" height="384">\n');
   document.write(' <param name="movie" value="images/intro.swf">\n');
   document.write(' <param name="quality" value="high">\n');
   document.write(' <param name="wmode" value="transparent">\n');
   document.write(' <embed src="images/intro.swf" width="760" height="384" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>\n');
   document.write('</object>\n');
}

function buildProFlash()
{
   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="760" height="384">\n');
   document.write(' <param name="movie" value="../images/intro_prof.swf">\n');
   document.write(' <param name="quality" value="high">\n');
   document.write(' <param name="wmode" value="transparent">\n');
   document.write(' <embed src="../images/intro_prof.swf" width="760" height="384" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>\n');
   document.write('</object>\n');
}
function buildProFlash2()
{
   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="760" height="384">\n');
   document.write(' <param name="movie" value="../images/intro_prof2.swf">\n');
   document.write(' <param name="quality" value="high">\n');
   document.write(' <param name="wmode" value="transparent">\n');
   document.write(' <embed src="../images/intro_prof2.swf" width="760" height="384" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>\n');
   document.write('</object>\n');
}




// ************************
//  show/hide block script
// ************************

function showHide(block_name,status){ 
	if((status==0)){ 
		document.getElementById(block_name).style.position='absolute'; 
		document.getElementById(block_name).style.visibility='hidden'; 
		document.getElementById(block_name).style.display='none'; 
	}else{ 
		document.getElementById(block_name).style.position=''; 
		document.getElementById(block_name).style.visibility=''; 
		document.getElementById(block_name).style.display=''; 
	} 
}

/*
function survey1(v)
{
	//alert(v);
	if(v==0) {
		showHide('didnotmeetneeds',0);
	} else {
		showHide('didnotmeetneeds',1);
	}
}

function switchLink(curStep,loc)
{
		if(curStep==1) {
			showHide('step1',1);showHide('step2',0);showHide('step3',0);showHide('step4',0);showHide('step5',0);
		} else if(curStep==2) {
			showHide('step1',0);showHide('step2',1);showHide('step3',0);showHide('step4',0);showHide('step5',0);
		} else if(curStep==3){
			showHide('step1',0);showHide('step2',0);showHide('step3',1);showHide('step4',0);showHide('step5',0);
		} else if(curStep==4){
			showHide('step1',0);showHide('step2',0);showHide('step3',0);showHide('step4',1);showHide('step5',0);
		} else if(curStep==5){
			showHide('step1',0);showHide('step2',0);showHide('step3',0);showHide('step4',0);showHide('step5',1);
		}
}
*/

// *****************





// ********** Form validation scripts **********

function validateEmpty(data,fieldname) {

	// initial variable states
    var blankErr = "";

	// check for a blank entry in the firstname field
	if (data == "") {
	    blankErr = "- " + fieldname + " must not be blank\n";
	}
	return blankErr;

}

function validateEmail(email,fieldname) {

	// initial variable states
    var emailErr = "";

	if (email == "") {
	    emailErr = "- " + fieldname  + " must not be blank\n";
	} else {
		// check for invalid characters in the email address
		var email = email.toLowerCase();
		var validchars = "abcdefghijklmnopqrstuvwxyz0123456789@.-_";  
		for (var i=0; i < email.length; i++) {
			var letter = email.charAt(i);
			if (validchars.indexOf(letter) == -1) { emailErr = "- " + fieldname  + " must be a valid email address\n"; }
		}
		// check to make sure there is an (@) and a following (.)
		if (email.indexOf("@") < 1) { emailErr = "- " + fieldname  + " must be a valid email address\n"; }
		if (email.indexOf(".",(email.indexOf("@")+2)) < 1) { emailErr = "- " + fieldname  + " must be a valid email address\n"; }
	}
	return emailErr;
}

function validateZip(zipcode) {

	// initial variable states
    var zipErr = "";

	if (zipcode == "") {
	    zipErr = "- [Zip Code] must not be blank\n";
	} else if (zipcode.length > 5) {
		zipErr = "- [Zip Code] must be a valid 5-digit number\n";
	} else {
		var validchars = "0123456789";
		for (var i=0; i < zipcode.length; i++) {
			var nmbr = zipcode.charAt(i);
			if (validchars.indexOf(nmbr) == -1) { zipErr = "- [Zip Code] must be a valid 5-digit number\n"; }
		}
	}
	return zipErr;

}

function validatePhone(phonenumber) {

	// initial variable states
    var phoneErr = "";

	if (phonenumber == "") {
	    phoneErr = "- [Phone Number] must not be blank\n";
	} else if (phonenumber.length < 7) {
		phoneErr = "- [Phone Number] must be a valid number\n";
	} else {
		var validchars = "0123456789-";
		for (var i=0; i < phonenumber.length; i++) {
			var nmbr = phonenumber.charAt(i);
			if (validchars.indexOf(nmbr) == -1) { phoneErr = "- [Phone Number] must be a valid number\n"; }
		}
	}
	return phoneErr;

}

function validateMonth(data,type) {

	// initial variable states
    var vErr = "";

	if (data == "") {
	    vErr = "- " + type + " must not be blank\n";
	} else if (data.length < 2) {
		vErr = "- " + type + " must be a valid 2-digit number within 01-12\n";
	} else if (data < 1 || data > 12) {
		vErr = "- " + type + " must be a valid 2-digit number within 01-12\n";
	} else {
		var validchars = "0123456789";
		for (var i=0; i < data.length; i++) {
			var nmbr = data.charAt(i);
			if (validchars.indexOf(nmbr) == -1) { vErr = "- " + type + " must be a valid 2-digit number within 01-12\n"; }
		}
	}
	return vErr;

}

function validateDay(data,type) {

	// initial variable states
    var vErr = "";

	if (data == "") {
	    vErr = "- " + type + " must not be blank\n";
	} else if (data.length < 2) {
		vErr = "- " + type + " must be a valid 2-digit number within 01-31\n";
	} else if (data < 1 || data > 31) {
		vErr = "- " + type + " must be a valid 2-digit number within 01-31\n";
	} else {
		var validchars = "0123456789";
		for (var i=0; i < data.length; i++) {
			var nmbr = data.charAt(i);
			if (validchars.indexOf(nmbr) == -1) { vErr = "- " + type + " must be a valid 2-digit number within 01-31\n"; }
		}
	}
	return vErr;

}

function validateYear(data,type) {

	// initial variable states
    var vErr = "";

	if (data == "") {
	    vErr = "- " + type + " must not be blank\n";
	} else if (data.length < 4) {
		vErr = "- " + type + " must be a valid 4-digit number\n";
	} else {
		var validchars = "0123456789";
		for (var i=0; i < data.length; i++) {
			var nmbr = data.charAt(i);
			if (validchars.indexOf(nmbr) == -1) { vErr = "- " + type + " must be a valid 4-digit number\n"; }
		}
	}
	return vErr;

}

// ******************************************************


