		function setValue(form, fieldname, fieldvalue) {
			eval("form." + fieldname + ".value = '" + fieldvalue + "'");
		}
		
		function FormatPhone(form, fieldname) {
			var strFieldValue;
			strFieldValue = eval("form." + fieldname + ".value");
			strFieldValue = FormatPhoneImp(strFieldValue);
			eval("form." + fieldname + ".value = '" + strFieldValue + "'");
		}	

		function FormatZip(form, fieldname) {
			var strFieldValue;
			strFieldValue = eval("form." + fieldname + ".value");
			strFieldValue = FormatNumberImp(strFieldValue,4);
			eval("form." + fieldname + ".value = '" + strFieldValue + "'");
		}

		function FormatPhoneImp(InitialValue) {
			var strInitial = InitialValue;
			var strFinal = new String();
			var j = 0 ;
			var rePhone = new RegExp("[(]\d\d\d[)][ ]\d\d\d[-]\d{4}$");
			
			if (strInitial.length > 2) {
				 strFinal = "(";
			};
			
			// here we check for the already formatted phone number and exit if true					
			if 	(rePhone.test(strInitial) == true) {
				return strInitial;
			}	

			// here we begin processing the field, placing the numbers into a new phone number string
			for (var i = 0; i < strInitial.length; ++i) {
				if ((strInitial.charAt(i) == '0') ||
					(strInitial.charAt(i) == '1') ||
					(strInitial.charAt(i) == '2') ||
					(strInitial.charAt(i) == '3') ||
					(strInitial.charAt(i) == '4') ||
					(strInitial.charAt(i) == '5') ||
					(strInitial.charAt(i) == '6') ||
					(strInitial.charAt(i) == '7') ||
					(strInitial.charAt(i) == '8') ||
					(strInitial.charAt(i) == '9')) {
					j = j + 1
					if (j == 4) {
						strFinal = strFinal + ") ";
					}

					if (j == 7) {
						strFinal = strFinal + "-";
					}
			
					if (j < 11) {
						strFinal = strFinal + strInitial.charAt(i);
					}
				}
			}
			return strFinal;
		}
		

		function FormatNumberImp(strInput,nLength) {
			var strResult;
			strResult = "";
			for (var i = 0; i < strInput.length; ++i) {
				if ((strInput.charAt(i) == '0') ||
					(strInput.charAt(i) == '1') ||
					(strInput.charAt(i) == '2') ||
					(strInput.charAt(i) == '3') ||
					(strInput.charAt(i) == '4') ||
					(strInput.charAt(i) == '5') ||
					(strInput.charAt(i) == '6') ||
					(strInput.charAt(i) == '7') ||
					(strInput.charAt(i) == '8') ||
					(strInput.charAt(i) == '9'))
				{	
					strResult = strResult + strInput.charAt(i);
					if (i >= nLength) return strResult;
				}
			}
			return strResult;
		}	
		function FormatAlphaNumeric(form, fieldname) {
			var strFieldValue;
			strFieldValue = eval("form." + fieldname + ".value");
			strFieldValue = FormatAlphaNumericImp(strFieldValue);
			eval("form." + fieldname + ".value = '" + strFieldValue + "'");
		}	

		function FormatAlphaNumericImp(strInput,nLength) {
			var strResult;
			strResult = "";
			for (var i = 0; i < strInput.length; ++i) {
				if ( 
				   ((strInput.charAt(i) >= '0') && (strInput.charAt(i) <= '9')) ||
				   ((strInput.charAt(i) >= 'A') && (strInput.charAt(i) <= 'Z')) ||
				   ((strInput.charAt(i) >= 'a') && (strInput.charAt(i) <= 'z'))
				)
				{	
					strResult = strResult + strInput.charAt(i);
					if (i >= nLength) return strResult;
				}
			}
			return strResult;
		}			
		function FormatAlphaNumericWithSpace(form, fieldname) {
			var strFieldValue;
			strFieldValue = eval("form." + fieldname + ".value");
			strFieldValue = FormatAlphaNumericWithSpaceImp(strFieldValue);
			eval("form." + fieldname + ".value = '" + strFieldValue + "'");
		}	

		function FormatAlphaNumericWithSpaceImp(strInput,nLength) {
			var strResult;
			strResult = "";
			for (var i = 0; i < strInput.length; ++i) {
				if ( 
				   ((strInput.charAt(i) >= '0') && (strInput.charAt(i) <= '9')) ||
				   (strInput.charAt(i) == ' ') ||
				   (strInput.charAt(i) == '.') ||
				   (strInput.charAt(i) == ',') ||
				   ((strInput.charAt(i) >= 'A') && (strInput.charAt(i) <= 'Z')) ||
				   ((strInput.charAt(i) >= 'a') && (strInput.charAt(i) <= 'z'))
				)
				{	
					strResult = strResult + strInput.charAt(i);
					if (i >= nLength) return strResult;
				}
			}
			return strResult;
		}			

		function FormatNumeric(form, fieldname) {
			var strFieldValue;
			strFieldValue = eval("form." + fieldname + ".value");
			strFieldValue = FormatNumericImp(strFieldValue);
			eval("form." + fieldname + ".value = '" + strFieldValue + "'");
		}	

		function FormatNumericImp(strInput,nLength) {
			var strResult;
			strResult = "";
			for (var i = 0; i < strInput.length; ++i) {
				if ( 
				   ((strInput.charAt(i) >= '0') && (strInput.charAt(i) <= '9'))
				)
				{	
					strResult = strResult + strInput.charAt(i);
					if (i >= nLength) return strResult;
				}
			}
			return strResult;
		}	

		function RemoveNumber(strInput, max) {
			var strResult;
			strResult = "";
			for (var i = 0; i < strInput.length; ++i) {
				if ((strInput.charAt(i) == '0') ||
					(strInput.charAt(i) == '1') ||
					(strInput.charAt(i) == '2') ||
					(strInput.charAt(i) == '3') ||
					(strInput.charAt(i) == '4') ||
					(strInput.charAt(i) == '5') ||
					(strInput.charAt(i) == '6') ||
					(strInput.charAt(i) == '7') ||
					(strInput.charAt(i) == '8') ||
					(strInput.charAt(i) == '9'))
				{	
					strResult = strResult + strInput.charAt(i);
				}
			}
					
			if (strResult.length > 4) {
				strResult = strResult.charAt(0) + strResult.charAt(1) + strResult.charAt(2) + strResult.charAt(3)
			}					
			if (strResult > max) {
				alert("Sorry, you have requested more of an item than we have in stock.\nPlease check the inventory column and adjust your order.\nThank you.")
				strResult = 0
			}
			if (strResult.length == 0) {
				strResult = 0
			}
			
			return strResult;
		}	


		function RemoveNumber2(strInput, max,strOldValue) {
			var strResult;
			strResult = "";
			for (var i = 0; i < strInput.length; ++i) {
				if ((strInput.charAt(i) == '0') ||
					(strInput.charAt(i) == '1') ||
					(strInput.charAt(i) == '2') ||
					(strInput.charAt(i) == '3') ||
					(strInput.charAt(i) == '4') ||
					(strInput.charAt(i) == '5') ||
					(strInput.charAt(i) == '6') ||
					(strInput.charAt(i) == '7') ||
					(strInput.charAt(i) == '8') ||
					(strInput.charAt(i) == '9'))
				{	
					strResult = strResult + strInput.charAt(i);
				}
			}
					
			if (strResult.length > 4) {
				strResult = strResult.charAt(0) + strResult.charAt(1) + strResult.charAt(2) + strResult.charAt(3)
			}					
			if (strResult > max) {
				alert("Sorry, you have requested more of an item than we have in stock.\nQuantity left is stock is " + max.toString() + ".\nThank you.")
				strResult = strOldValue
			}
			if (strResult.length == 0) {
				strResult = 0
			}
			
			return strResult;
		}			
		function FormatQty(form,fieldname,max) {
			var strQty;
			strQty = eval("form." + fieldname + ".value");
			strQty = RemoveNumber(strQty,max);
			eval("form." + fieldname + ".value = " + strQty + "");
		}

		function FormatQty2(form,fieldname,max,strOldQty) {
			var strQty
			strQty = eval("form." + fieldname + ".value");
			strQty = RemoveNumber2(strQty,max,strOldQty);
			eval("form." + fieldname + ".value = " + strQty + "");
		}

		function MM_openBrWindow(theURL,winName,features) {
		  window.open(theURL,winName,features);
		}		
		function pviiW3Cbg(obj, pviiColor) {
			obj.style.backgroundColor=pviiColor
		}

		function removeFromCart(sku) {
			window.open("CartDetail.asp?cmd=rm&sku=" + sku,"_parent")
		}	
		function CopyShippingToBilling() {
			document.confirm.ship_first_name.value = document.confirm.first_name.value ;
			document.confirm.ship_last_name.value = document.confirm.last_name.value ;
			document.confirm.ship_address.value = document.confirm.address.value ;
			document.confirm.ship_address2.value = document.confirm.address2.value ;
			document.confirm.ship_city.value = document.confirm.city.value ;
			document.confirm.ship_state.value = document.confirm.state.value ;
			document.confirm.ship_zip.value = document.confirm.zip.value ;
			document.confirm.ship_country.value = document.confirm.country.value ;
			document.confirm.ship_phone.value = document.confirm.phone.value ;
			document.confirm.ship_fax.value = document.confirm.fax.value ;
			document.confirm.ship_email.value = document.confirm.email.value ;
			document.confirm.ship_email2.value = document.confirm.email2.value ;
		}		
		function ClearFields2() {
			document.confirm.first_name.value = "";
			document.confirm.last_name.value = "";
			document.confirm.address.value = "";
			document.confirm.address2.value = "";
			document.confirm.city.value = "";
			document.confirm.state.value = "";
			document.confirm.zip.value = "";
			document.confirm.country.value = "";
			document.confirm.phone.value = "";
			document.confirm.fax.value = "";
			document.confirm.email.value = "";
			document.confirm.email2.value = "";

			document.confirm.ship_first_name.value = "";
			document.confirm.ship_last_name.value = "";
			document.confirm.ship_address.value = "";
			document.confirm.ship_address2.value = "";
			document.confirm.ship_city.value = "";
			document.confirm.ship_state.value = "";
			document.confirm.ship_country.value = "";
			document.confirm.ship_zip.value = "";
			document.confirm.ship_phone.value = "";
			document.confirm.ship_fax.value = "";
			document.confirm.ship_email.value = "";
			document.confirm.ship_email2.value = "";

			document.confirm.card_number.value = "";
			document.confirm.card_exp_month.value = "";
			document.confirm.card_exp_year.value = "";
			return false;
		}
		function reload2(form) {
			window.open("CartDetail.asp?st=" + form.st.value,"_parent")
		}		

		function reload3(form) {
			window.open("inventory_default.asp?st=" + form.st.value,"_parent")
		}		

		function DeleteConfirmation()
		{
  			if (confirm("Are you sure you want to delete?"))
  				return true;
  			else				
  				return false;
  		}
