if (document.images)
	{
		
		signin_out = new Image();
		signin_out.src = "../images/signin_off.jpg";
		signin_over = new Image();
		signin_over.src = "../images/signin_on.jpg";

		cart_out = new Image();
		cart_out.src = "../images/cart_off.jpg";
		cart_over = new Image();
		cart_over.src = "../images/cart_on.jpg";

		order_out = new Image();
		order_out.src = "../images/order_off.jpg";
		order_over = new Image();
		order_over.src = "../images/order_on.jpg";

		profile_out = new Image();
		profile_out.src = "../images/profile_off.jpg";
		profile_over = new Image();
		profile_over.src = "../images/profile_on.jpg";

		signout_out = new Image();
		signout_out.src = "../images/signout_off.jpg";
		signout_over = new Image();
		signout_over.src = "../images/signout_on.jpg";

	}
						
function display(imgName, imgUrl) 
{
	if (document.images)
	{
		document[imgName].src = eval(imgUrl + ".src")
	}
}

function send()
{
	document.searchForm.submit();
}

function loginPost()
{
	document.loginForm.submit();
}

function loginReset()
{
	document.loginForm.reset();
}

function pwremindPost()
{
	document.forgotpwForm.submit();
}

function filterCatPost(dropval)
{
	document.filterByCat.submit();
}


 

NS4 = (document.layers) ? true : false;
function enterCheckDrop(event)
{ 	
	var code = 0;
	
	if (NS4)
		code = event.which;
	else
		code = event.keyCode;
	if (code==13)
	{
		if (document.searchForm.typeDrop.value == "--Please Select--")
		{
			alert("You must select a value from the dropdown list provided.")
			return false
		}
		else
		{
			document.searchForm.submit();
		}
	}
}


function takeEnter(e)
{ 		
	var value = 0;
	var browser
	browser = (document.layers) ? true : false;
	
	if (browser)
	{
		value = e.which;
	}
	else
	{
		value = e.keyCode;
	}
	
	if (value==13)
	{
		document.loginForm.submit();
	}

}





function checkDrop(dropval, searchtxt)
{
	if (dropval == "--Please Select--")
	{
		alert("You must select a value from the dropdown list provided.")
	}
	else
	{
		//if (searchtxt != "")
		if (isWhitespace(searchtxt))
		{
			document.searchForm.searchin.focus();
			document.searchForm.searchin.value = "enter criteria"			
			//document.searchForm.submit();
		}
		else
		{
			document.searchForm.submit();
			//document.searchForm.searchin.focus();
			//document.searchForm.searchin.value = "enter criteria"
		}
	}
}

function checkCatDrop(dropval)
{
	if (dropval == "--Please Select--")
	{
		alert("You must select a value from the dropdown list provided.")
	}
	else
	{
		document.catForm.submit();
	}
}

function checkInvDrop(dropval)
{
	if (dropval == "--Please Select--")
	{
		alert("You must select a value from the dropdown list provided.")
	}
	else
	{
		document.getOrder.submit();
	}
}

function prodCatDrop(dropval)
{
	if (dropval == "--Please Select--")
	{
		alert("You must select a value from the dropdown list provided.")
	}
	else
	{
		document.filterByCat.submit();
	}
}

function checkPass(pass)
{
var whattowrite
whattowrite = ""
	if (pass == "bill")
	{
	whattowrite = "TRY AGAIN BUDDY"
	
	}
	document.registerForm.id.value = whattowrite
	document.registerForm.idverify.value = ""
}

function registerReset()
{
	document.registerForm.reset();
}

function searchInPost(txt)
{
	if (txt != "")
	{
		document.searchInForm.submit();
	}
	else
	{
		document.searchInForm.searchin.focus();
		document.searchInForm.searchin.value = "enter key word(s)"
	}
}

//function updatePost(nameOfForm, fin)
//{
    //var o = nameOfForm.qtyVal;
	//var localfin = fin;
    //switch (isInteger(o.value))
    //{
    	//case true:
			//if (localfin = "true")
			//{
			 	  	//if ((nameOfForm.finishselection.value) != "--Please Select--")
				  	//{    	
				  		//nameOfForm.submit();
						//break;
        			//}
					//else
					//{
			 	 	 	//alert("Please choose a finish and click\"GO\"")
					//}
			//}
			//else
			//{
			 	//nameOfForm.submit();
				//break;			
			//}
       	//case false:
          	//alert("\"" + o.value + "\" is not a number.  Please enter a valid quantity and click\"GO\"")
			//nameOfForm.qtyVal.value = 1
    //}
 //}

 function copyupdatePost(nameOfForm)
{
    var o = nameOfForm.qtyVal;
    switch (isInteger(o.value))
    {
    	case true:
			if ((nameOfForm.finind.value) == "true")
			{
			   alert("trueistrue");
			}
			else
			{
			 	alert("false")
			}
			nameOfForm.submit();
          	break;
       	case false:
          	alert("\"" + o.value + "\" is not a number.  Please enter a valid quantity and click\"GO\"")
			nameOfForm.qtyVal.value = 1
    }
 }

function updatePost(nameOfForm)
{
   var o = nameOfForm.qtyVal;
   if (isInteger(o.value))
   {
		if ((nameOfForm.finind.value) == "True")
		{
			if ((nameOfForm.finishselection.value) != "--Please Select--")
			{    	
				nameOfForm.submit();
        	}
			else
			{
			 	 alert("Please choose a finish and click\"GO\"")
			}
     	}
		else
		{
			nameOfForm.submit();
		}
    }
	else
	{
		alert("\"" + o.value + "\" is not a number.  Please enter a valid quantity and click\"GO\"")
		nameOfForm.qtyVal.value = 1
	}
}

/*function ohtax(stateval)
{
    if ((stateval) == "OH")
    {
        document.orderform.countryrow.visible = "true";
    }
}
*/


function visi(nr,sval)
{
    //var s = new String (stateval.state.value);
    //var s = (stateval.value);
    //alert("this is s" + s)   

    
    //var s = new String (document.orderform.state.value);
    
    if ((sval) == "OH")
    {
	    if (document.layers)
	    {
		    vista = (document.layers[nr].visibility == 'show') ? 'hide' : 'show'
		    document.layers[nr].visibility = vista;
	    }
	    else if (document.all)
	    {
		    vista = (document.all[nr].style.visibility == 'visible') ? 'hidden'	: 'visible';
		    document.all[nr].style.visibility = vista;
	    }
	    else if (document.getElementById)
	    {
		    vista = (document.getElementById(nr).style.visibility == 'visible') ? 'hidden' : 'visible';
		    document.getElementById(nr).style.visibility = vista;

	    }
    }
    else
    {
	    if (document.layers)
	    {
		    vista = (document.layers[nr].visibility == 'hide') ? 'hide' : 'hide'
		    document.layers[nr].visibility = vista;
	    }
	    else if (document.all)
	    {
		    vista = (document.all[nr].style.visibility == 'hidden') ? 'hidden'	: 'hidden';
		    document.all[nr].style.visibility = vista;
	    }
	    else if (document.getElementById)
	    {
		    vista = (document.getElementById(nr).style.visibility == 'hidden') ? 'hidden' : 'hidden';
		    document.getElementById(nr).style.visibility = vista;

	    }    
    }
}

function blocking(nr)
{
	if (document.layers)
	{
		current = (document.layers[nr].display == 'none') ? 'block' : 'none';
		document.layers[nr].display = current;
	}
	else if (document.all)
	{
		current = (document.all[nr].style.display == 'none') ? 'block' : 'none';
		document.all[nr].style.display = current;
	}
	else if (document.getElementById)
	{
		vista = (document.getElementById(nr).style.display == 'none') ? 'block' : 'none';
		document.getElementById(nr).style.display = vista;
	}
}



function proddetailPost(nameOfForm)
{
   
   //var o = nameOfForm.qtyVal;
   var errorcount = 0;
   var errormsg;
   
		if ((nameOfForm.yncolor.value) == "True")
		{
			
			if ((nameOfForm.colorselection.value) == "--Please Select--")
			{    	
				errorcount = errorcount + 1;
				errormsg = "Please enter a color from list provided and click\"GO\""
        	}
     	}

		if ((nameOfForm.ynsize.value) == "True")
		{
		    
			if ((nameOfForm.sizeselection.value) == "--Please Select--")
			{    	
				errorcount = errorcount + 1;
				errormsg = "Please enter a size from list provided and click\"GO\""
        	}
     	}

		if ((nameOfForm.ynfinish.value) == "True")
		{
    
			if ((nameOfForm.finishselection.value) == "--Please Select--")
			{    	
				errorcount = errorcount + 1;
				errormsg = "Please enter a finish from list provided and click\"GO\""
        	}
     	}
     	
    if (errorcount > 0)
    {
        //alert("\"" + o.value + "\" is not a number.  Please enter a valid quantity and click\"GO\"")
        alert(errormsg)
    }
	else
	{
        nameOfForm.submit();
	}
}

//function fincheck(qty, ccart)
//{
   	//alert("in the function");
	//alert(ccart);
	//alert("qtyval is " + qty)
  // for (i = 0; i < ccart; i++)
   //{
		//alert (i);
	  //	var qform = qty + i
		//var bill
		//bill = qform.finishselection.value();
		//alert(bill)
		//alert(valuename)
		//var formname = document.qtyForm0.finishselection.value;
		//var formvalue = formname;
		//alert(formvalue);
		//alert("thad")
//if ((qform.finishselection.value) = "--Please Select--")
	  	//{
			//alert("Please select a finish and click \"GO\" to update the product information.  You can then checkout.")
	  		//return false;
	  	//}   
	//}

	//document.finform.submit();
//}

function checkCard(type)
{

	if (checkMonth())
	{

	var v = "Visa"
	var m = "MasterCard"

	if ((type == v) || (type == m))
	{
		if ((isInteger(document.orderForm.cn.value)) && (numberLen(16)))
		{
			if ((isInteger(document.orderForm.cv.value)) && (verifyLen(3)))
			{
				document.orderForm.submit();
				//ADD BY THAD
				document.orderForm.goImage.disabled = true;
				document.orderForm.resetImage.disabled = true;	
			}
			else
			{
				alert("The verification number must be a 3 digit number.")
				document.orderForm.cv.focus();
				document.orderForm.cv.select();
			}
		}
		else
		{
			alert("The credit card number must be a 16 digit number.")
			document.orderForm.cn.focus();
			document.orderForm.cn.select();
			document.orderForm.cv.value = ""
		}		
	
	}
	else
	{
		if ((isInteger(document.orderForm.cn.value)) && (numberLen(15)))
		{
			if ((isInteger(document.orderForm.cv.value)) && (verifyLen(4)))
			{
				//ADD BY THAD
				document.orderForm.goImage.disabled = true;
				document.orderForm.resetImage.disabled = true;				
				document.orderForm.submit();
			}
			else
			{
				alert("The verification number must be a 4 digit number.")
				document.orderForm.cv.focus();
				document.orderForm.cv.select();
			}
		}
		else
		{
			alert("The credit card number must be a 15 digit number.")
			document.orderForm.cn.focus();
			document.orderForm.cn.select();
			document.orderForm.cv.value = ""
		}	
	}
	}
}
 
function verifyLen(v)
{
	if ((document.orderForm.cv.value.length < v) || (document.orderForm.cv.value.length > v))
	{
		return false
	}
	return true
} 

function numberLen(n)
{
	if ((document.orderForm.cn.value.length < n) || (document.orderForm.cn.value.length > n))
	{
		return false
	}
	return true
} 
 
function isInteger (s)
{
   var i;

   if (isEmpty(s))
   if (isInteger.arguments.length == 1) return 0;
   else return (isInteger.arguments[1] == true);

   for (i = 0; i < s.length; i++)
   {
      var c = s.charAt(i);
      if (!isDigit(c)) return false;
   }

   return true;
}

function isEmpty(s)
{
   return ((s == null) || (s.length == 0))
}

function isDigit (c)
{
   return ((c >= "0") && (c <= "9"))
}

function addressSame()
{
	if (document.orderForm.same.checked)
	{
		document.orderForm.sfname.value = document.orderForm.fname.value
		document.orderForm.slname.value = document.orderForm.lname.value
		document.orderForm.sstreet1.value = document.orderForm.street1.value
		document.orderForm.sstreet2.value = document.orderForm.street2.value
		document.orderForm.scity.value = document.orderForm.city.value
		document.orderForm.sstate.value = document.orderForm.state.value
		document.orderForm.szip.value = document.orderForm.zip.value
	}
	else
	{
		document.orderForm.sfname.value = ""
		document.orderForm.slname.value = ""
		document.orderForm.sstreet1.value = ""
		document.orderForm.sstreet2.value = ""
		document.orderForm.scity.value = ""
		document.orderForm.sstate.value = ""
		document.orderForm.szip.value = ""
	}
}



// BEGINNING OF REGISTERSUBMIT FUNCTION -------------------------------------------------------------------------------------->
function registerSubmit(passOne, passTwo)
{
var invalidChars = "/:,;"
var keepGoing;
keepGoing = true;

message = "";

	if (checkFields())
	{
		 if (passOne != "")
		 {
		 	for (i=0; i<invalidChars.length; i++)
			{
				badChar = invalidChars.charAt(i)
				if (passOne.indexOf(badChar,0) > -1)
				{
					keepGoing = false
					message = "You can't use '/;,:'"
					document.registerForm.id.focus();
					document.registerForm.id.value = message
					document.registerForm.id.select();			
					document.registerForm.idverify.value = ""
					
				}
			}
			
			if (keepGoing != false)
			{
			
			atPos = passOne.indexOf("@",1)
			if (atPos == -1) //second if
			{
				keepGoing = false
				message = "You must use an '@' symbol"
				document.registerForm.id.focus();
				document.registerForm.id.value = message
				document.registerForm.id.select();			
				document.registerForm.idverify.value = ""
			}
			else //second if
			{
		
				if (passOne.indexOf("@",atPos+1) != -1) //third if
				{
					keepGoing = false
					message = "You must use only one '@' symbol"
					document.registerForm.id.focus();
					document.registerForm.id.value = message
					document.registerForm.id.select();			
					document.registerForm.idverify.value = ""	
				}
				else //third if
				{
					
					periodPos = passOne.indexOf(".", atPos)
					if (periodPos == -1) //fourth if
					{
						keepGoing = false
						message = "You must use a '.'"
						document.registerForm.id.focus();
						document.registerForm.id.value = message
						document.registerForm.id.select();			
						document.registerForm.idverify.value = ""			
					}
					else //forth if
					{
						periodPos = passOne.indexOf(".",atPos)
						if ((periodPos+3) < passOne.length)
						{	
								
								if (passOne == passTwo)
								{
									document.registerForm.submit();
								}
								else
								{
										//document.registerForm.id.value = ""
										//document.registerForm.idverify.value = ""
										//document.reload("register.asp");
					
									document.registerForm.id.focus();
									document.registerForm.id.value = "Must be the same"
									document.registerForm.id.select();
									document.registerForm.idverify.value = "Must be the same"
								}
		
						}
						else
						{
							keepGoing = false
							message = "You must include '.com' or equivalent"
							document.registerForm.id.focus();
							document.registerForm.id.value = message
							document.registerForm.id.select();
							document.registerForm.idverify.value = ""
						}
						
					} //fourth if
				} //third if
			} //second if
			
			}
			
		} //first if
		else
		{
					document.registerForm.id.focus();
					document.registerForm.id.value = "You must enter a valid email"
		}
		
	} //end of field validation
		
}
// END OF REGISTERSUBMIT FUNCTION -------------------------------------------------------------------------------------->

// BEGINNING OF FIELD VALIDATIUON FUNCTIONS ---------------------------------------------------------------------------->
function checkFields()
{

	if (isBlank())
	{	
		return false;	
	}

	return true;	
}

function isBlank()
{

	if (isWhitespace(document.registerForm.fname.value))
	{
		alert("First Name is a required field.")
		document.registerForm.fname.focus();
		return true;
	}
	if (isWhitespace(document.registerForm.lname.value))
	{
		alert("Last Name is a required field.")
		document.registerForm.lname.focus();		
		return true;
	}
	if (isWhitespace(document.registerForm.street1.value))
	{	
		alert("Street 1 is a required field.")	
		document.registerForm.street1.focus();			
		return true;
	}
	if (isWhitespace(document.registerForm.city.value))
	{
		alert("City is a required field.")	
		document.registerForm.city.focus();			
		return true;
	}
	if (document.registerForm.state.value == "Select")
	{
		alert("State is a required field.")	
		document.registerForm.state.focus();			
		return true;
	}
	
	if (zipCheck())
	{
		if (isWhitespace(document.registerForm.zip.value))
		{
			alert("Zip is a required field.")	
			document.registerForm.zip.focus();			
			return true;
		}		
	}
	else
	{
		return true;
	}

	return false;			

}

function zipCheck()
{
	var zipLen
	zipLen = document.registerForm.zip.value.length;
	
	if ((isInteger(document.registerForm.zip.value)))
	{
		if ((zipLen < 5) || (zipLen > 5))
		{
			alert("The zip code must be 5 digits long.")
			document.registerForm.zip.value = "";
			document.registerForm.zip.focus();
			return false
		}
	}
	else
	{
		alert("The zip code must be numeric.")
		document.registerForm.zip.value = "";
		document.registerForm.zip.focus();
		return false
	}		
		
	return true;
}

function isWhitespace (s)
{
    var i;

	var whitespace = " \t\n\r";
    // Is s empty?
    if (isEmpty(s)) return true;

    // Search through string's characters one by one
    // until we find a non-whitespace character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {
         // Check that current character isn't whitespace.
         var c = s.charAt(i);
         if (whitespace.indexOf(c) == -1) return false;
    }

    // All characters are whitespace.
    return true;
}


// END OF FIELD VALIDATIUON FUNCTIONS ---------------------------------------------------------------------------------->


// BEGINNING OF MAINTAIN SUBMIT FUNCTION -------------------------------------------------------------------------------------->
function maintainSubmit(passOne, passTwo)
{
var invalidChars = "/:,;"
var keepGoing;
keepGoing = true;

message = "";

	if (checkMaintFields())
	{
		 if (passOne != "")
		 {
		 	for (i=0; i<invalidChars.length; i++)
			{
				badChar = invalidChars.charAt(i)
				if (passOne.indexOf(badChar,0) > -1)
				{
					keepGoing = false
					message = "You can't use '/;,:'"
					document.maintainForm.id.focus();
					document.maintainForm.id.value = message
					document.maintainForm.id.select();			
					document.maintainForm.idverify.value = ""
					
				}
			}
			
			if (keepGoing != false)
			{
			
			atPos = passOne.indexOf("@",1)
			if (atPos == -1) //second if
			{
				keepGoing = false
				message = "You must use an '@' symbol"
				document.maintainForm.id.focus();
				document.maintainForm.id.value = message
				document.maintainForm.id.select();			
				document.maintainForm.idverify.value = ""
			}
			else //second if
			{
		
				if (passOne.indexOf("@",atPos+1) != -1) //third if
				{
					keepGoing = false
					message = "You must use only one '@' symbol"
					document.maintainForm.id.focus();
					document.maintainForm.id.value = message
					document.maintainForm.id.select();			
					document.maintainForm.idverify.value = ""	
				}
				else //third if
				{
					
					periodPos = passOne.indexOf(".", atPos)
					if (periodPos == -1) //fourth if
					{
						keepGoing = false
						message = "You must use a '.'"
						document.maintainForm.id.focus();
						document.maintainForm.id.value = message
						document.maintainForm.id.select();			
						document.maintainForm.idverify.value = ""			
					}
					else //forth if
					{
						periodPos = passOne.indexOf(".",atPos)
						if ((periodPos+3) < passOne.length)
						{	
								
								if (passOne == passTwo)
								{
									document.maintainForm.submit();
								}
								else
								{
										//document.maintainForm.id.value = ""
										//document.maintainForm.idverify.value = ""
										//document.reload("register.asp");
					
									document.maintainForm.id.focus();
									document.maintainForm.id.value = "Must be the same"
									document.maintainForm.id.select();
									document.maintainForm.idverify.value = "Must be the same"
								}
		
						}
						else
						{
							keepGoing = false
							message = "You must include '.com' or equivalent"
							document.maintainForm.id.focus();
							document.maintainForm.id.value = message
							document.maintainForm.id.select();
							document.maintainForm.idverify.value = ""
						}
						
					} //fourth if
				} //third if
			} //second if
			
			}
			
		} //first if
		else
		{
					document.maintainForm.id.focus();
					document.maintainForm.id.value = "You must enter a valid email"
		}
		
	} //end of field validation
		
}
// END OF REGISTERSUBMIT FUNCTION -------------------------------------------------------------------------------------->

// BEGINNING OF FIELD VALIDATIUON FUNCTIONS ---------------------------------------------------------------------------->
function checkMaintFields()
{

	if (isMaintBlank())
	{	
		return false;	
	}

	return true;	
}

function isMaintBlank()
{

	if (isWhitespace(document.maintainForm.fname.value))
	{
		alert("First Name is a required field.")
		document.maintainForm.fname.focus();
		return true;
	}
	if (isWhitespace(document.maintainForm.lname.value))
	{
		alert("Last Name is a required field.")
		document.maintainForm.lname.focus();		
		return true;
	}
	if (isWhitespace(document.maintainForm.street1.value))
	{	
		alert("Street 1 is a required field.")	
		document.maintainForm.street1.focus();			
		return true;
	}
	if (isWhitespace(document.maintainForm.city.value))
	{
		alert("City is a required field.")	
		document.maintainForm.city.focus();			
		return true;
	}
	if (document.maintainForm.state.value == "Select")
	{
		alert("State is a required field.")	
		document.maintainForm.state.focus();			
		return true;
	}
	
	if (zipMaintCheck())
	{
		if (isWhitespace(document.maintainForm.zip.value))
		{
			alert("Zip is a required field.")	
			document.maintainForm.zip.focus();			
			return true;
		}		
	}
	else
	{
		return true;
	}
	
	
	if (pwMaintCheckLen())
	{
		//if (pwMaintCheckChar())
		//{
			if (isWhitespace(document.maintainForm.pw.value))
			{
				alert("Password is a required field.")	
				document.maintainForm.pw.focus();			
				return true;
			}	
		//}
		//else
		//{
			//return true;
		//}
	}
	else
	{
		return true;
	}

	return false;			

}

function pwMaintCheckLen()
{
	var pass
	var passLen
	pass = document.maintainForm.pw.value
	passLen = pass.length;
	
	if (passLen < 6)
	{
		alert("Your password must be greater than 5 characters in length.")
		document.maintainForm.pw.value = ""
		document.maintainForm.pw.focus();
		return false;
	}
	
	return true;
}


function pwMaintCheckChar()
{

	var validChars = "!@#$%^&*'?~"
	var pass
	var goodChar
	pass = document.maintainForm.pw.value
		
 	for (i=0; i<validChars.length; i++)
	{
		goodChar = validChars.charAt(i)
		if (pass.indexOf(goodChar,0) > -1)
		{
			return true;
		}
	}
	
	alert("Your password must contain at least one of the following characters: " + validChars)
	document.maintainForm.pw.value = ""
	document.maintainForm.pw.focus();
	return false;
}	

function zipMaintCheck()
{
	var zipLen
	zipLen = document.maintainForm.zip.value.length;
	
	if ((isInteger(document.maintainForm.zip.value)))
	{
		if ((zipLen < 5) || (zipLen > 5))
		{
			alert("The zip code must be 5 digits long.")
			document.maintainForm.zip.value = "";
			document.maintainForm.zip.focus();
			return false
		}
	}
	else
	{
		alert("The zip code must be numeric.")
		document.maintainForm.zip.value = "";
		document.maintainForm.zip.focus();
		return false
	}		
		
	return true;
}

// END OF FIELD VALIDATIUON FUNCTIONS ---------------------------------------------------------------------------------->

//START OF ADDRESS VALIDATION ------------------------------------------------------------------------------------------>
function validAddress()
{
	if (isAddressBlank())
	{
		//alert("You must complete the form filling in all required fields")
	}
	else
	{
		document.orderForm.submit();
	}
}

function isAddressBlank()
{

	if (isWhitespace(document.orderForm.fname.value))
	{
		alert("First Name is a required field.")
		document.orderForm.fname.focus();
		return true;
	}
	if (isWhitespace(document.orderForm.lname.value))
	{
		alert("Last Name is a required field.")
		document.orderForm.lname.focus();		
		return true;
	}
	if (isWhitespace(document.orderForm.street1.value))
	{	
		alert("Street 1 is a required field.")	
		document.orderForm.street1.focus();			
		return true;
	}
	if (isWhitespace(document.orderForm.city.value))
	{
		alert("City is a required field.")	
		document.orderForm.city.focus();			
		return true;
	}
	if (document.orderForm.state.value == "Select")
	{
		alert("State is a required field.")	
		document.orderForm.state.focus();			
		return true;
	}

	if (zipAddressOneCheck())
	{
		if (isWhitespace(document.orderForm.zip.value))
		{
			alert("Zip is a required field.")	
			document.orderForm.zip.value = ""
			document.orderForm.zip.focus();			
			return true;
		}		
	}
	else
	{
		return true;
	}	

	//These are the shipping address validations
	
	if (isWhitespace(document.orderForm.sfname.value))
	{
		alert("First Name is a required field for shippment.")
		document.orderForm.sfname.value = ""
		document.orderForm.sfname.focus();
		return true;
	}
	if (isWhitespace(document.orderForm.slname.value))
	{
		alert("Last Name is a required field for shippment.")
		document.orderForm.slname.value = ""		
		document.orderForm.slname.focus();		
		return true;
	}
	if (isWhitespace(document.orderForm.sstreet1.value))
	{	
		alert("Street 1 is a required field for shippment.")	
		document.orderForm.sstreet1.value = ""		
		document.orderForm.sstreet1.focus();			
		return true;
	}
	if (isWhitespace(document.orderForm.scity.value))
	{
		alert("City is a required field for shippment.")	
		document.orderForm.scity.value = ""	
		document.orderForm.scity.focus();			
		return true;
	}
	if (document.orderForm.sstate.value == "Select")
	{
		alert("State is a required field for shippment.")	
		document.orderForm.sstate.focus();			
		return true;
	}	
	
	if (zipAddressTwoCheck())
	{
		if (isWhitespace(document.orderForm.szip.value))
		{
			alert("Zip is a required field.")	
			document.orderForm.szip.value = ""
			document.orderForm.szip.focus();			
			return true;
		}		
	}
	else
	{
		return true;
	}	

    //email check code - added 06252008 for guest email collection
    if ((document.orderForm.id.value != "registered") || (document.orderForm.id.value == ""))
	{

	    if (orderEmailCheck(document.orderForm.id.value, document.orderForm.idverify.value))
	    {			
			return true;
	    }
    //email check code
    }
    
	return false;			

}

function zipAddressOneCheck()
{
	var zipLen
	zipLen = document.orderForm.zip.value.length;
	
	if ((isInteger(document.orderForm.zip.value)))
	{
		if ((zipLen < 5) || (zipLen > 5))
		{
			alert("The zip code must be 5 digits long.")
			document.orderForm.zip.value = "";
			document.orderForm.zip.focus();
			return false
		}
	}
	else
	{
		alert("The zip code must be numeric.")
		document.orderForm.zip.value = "";
		document.orderForm.zip.focus();
		return false
	}		
		
	return true;
}

function zipAddressTwoCheck()
{
	var zipLen
	zipLen = document.orderForm.szip.value.length;
	
	if ((isInteger(document.orderForm.szip.value)))
	{
		if ((zipLen < 5) || (zipLen > 5))
		{
			alert("The zip code must be 5 digits long.")
			document.orderForm.szip.value = "";
			document.orderForm.szip.focus();
			return false
		}
	}
	else
	{
		alert("The zip code must be numeric.")
		document.orderForm.szip.value = "";
		document.orderForm.szip.focus();
		return false
	}		
		
	return true;
}

//END OF ADDRESS VALIDATION -------------------------------------------------------------------------------------------->

// BEGINNING OF EMAIL for ORDER FUNCTION -------------------------------------------------------------------------------------->
function orderEmailCheck(passOne, passTwo)
{
var invalidChars = "/:,;"
var keepGoing;
keepGoing = true;

message = "";

		 if (passOne != "")
		 {
		 	for (i=0; i<invalidChars.length; i++)
			{
				badChar = invalidChars.charAt(i)
				if (passOne.indexOf(badChar,0) > -1)
				{
					keepGoing = false
					message = "You can't use '/;,:'"
					document.orderForm.id.focus();
					document.orderForm.id.value = message
					document.orderForm.id.select();			
					document.orderForm.idverify.value = ""
					return true;
				}
			}
			
			if (keepGoing != false)
			{
			
			atPos = passOne.indexOf("@",1)
			if (atPos == -1) //second if
			{
				keepGoing = false
				message = "You must use an '@' symbol"
				document.orderForm.id.focus();
				document.orderForm.id.value = message
				document.orderForm.id.select();			
				document.orderForm.idverify.value = ""
				return true;
			}
			else //second if
			{
		
				if (passOne.indexOf("@",atPos+1) != -1) //third if
				{
					keepGoing = false
					message = "You must use only one '@' symbol"
					document.orderForm.id.focus();
					document.orderForm.id.value = message
					document.orderForm.id.select();			
					document.orderForm.idverify.value = ""	
					return true;
				}
				else //third if
				{
					
					periodPos = passOne.indexOf(".", atPos)
					if (periodPos == -1) //fourth if
					{
						keepGoing = false
						message = "You must use a '.'"
						document.orderForm.id.focus();
						document.orderForm.id.value = message
						document.orderForm.id.select();			
						document.orderForm.idverify.value = ""
						return true;			
					}
					else //forth if
					{
						periodPos = passOne.indexOf(".",atPos)
						if ((periodPos+3) < passOne.length)
						{	
								
								if (passOne == passTwo)
								{
									return false;
								}
								else
								{
				
									document.orderForm.id.focus();
									document.orderForm.id.value = "Must be the same"
									document.orderForm.id.select();
									document.orderForm.idverify.value = "Must be the same"
									return true;
								}
		
						}
						else
						{
							keepGoing = false
							message = "You must include '.com' or equivalent"
							document.orderForm.id.focus();
							document.orderForm.id.value = message
							document.orderForm.id.select();
							document.orderForm.idverify.value = ""
							return true;
						}
						
					} //fourth if
				} //third if
			} //second if
			
			}
			
		} //first if
		else
		{
					document.orderForm.id.focus();
					document.orderForm.id.value = "You must enter a valid email"
					return true;
		}
		

		
}
// END OF EMAIL for ORDER FUNCTION -------------------------------------------------------------------------------------->


function checkMonth()
{

	var monthCheck = new Date();
	var numberMonth;
	var d
	d = document.orderForm.expmonth.value
	
	var formYear
	formYear = document.orderForm.expyear.value
	formYear = "20" + formYear
	
		if (monthCheck.getYear() == formYear)
		{
			
			if (d == "01")
			{
				numberMonth = 0
			}
			if (d == "02")
			{
				numberMonth = 1
			}
			if (d == "03")
			{
				numberMonth = 2
			}	
			if (d == "04")
			{
				numberMonth = 3
			}	
			if (d == "05")
			{
				numberMonth = 4
			}	
			if (d == "06")
			{
				numberMonth = 5
			}	
			if (d == "07")
			{
				numberMonth = 6
			}
			if (d == "08")
			{
				numberMonth = 7
			}
			if (d == "09")
			{
				numberMonth = 8
			}
			if (d == "10")
			{
				numberMonth = 9
			}	
			if (d == "11")
			{
				numberMonth = 10
			}
			if (d == "12")
			{
				numberMonth = 11
			}			
		
			if (monthCheck.getMonth() > numberMonth)
			{
				alert("The expiration month must be equal to or greater than the current month.")
				
				return false
			}

		}
	return true	
}

function surveyFormSubmit()
{
	//correct single quote instances on submit form
	var myRegExp = /'/g;

	// Create the strings to check for "'"
	var commentString = new String (document.surveyForm.generalff.value);
	
	//Search for "'" and replace it with "''"

	var newcommentString = commentString.replace(myRegExp, "''");

	//Set form values to corrected values
	document.surveyForm.generalff.value = newcommentString

	document.surveyForm.submit();
}

function surveyFormReset()
{
	document.surveyForm.reset();
}