<!-- Begin

function doClear(theText) {
     if (theText.value == theText.defaultValue) {
         theText.value = ""
     }
 }

/* This script is Copyright (c) Paul McFedries and 
Logophilia Limited (http://www.mcfedries.com/).
Permission is granted to use this script as long as 
this Copyright notice remains in place.*/

function round_decimals(original_number, decimals) {
    var result1 = original_number * Math.pow(10, decimals)
    var result2 = Math.round(result1)
    var result3 = result2 / Math.pow(10, decimals)
    return pad_with_zeros(result3, decimals)
}

function pad_with_zeros(rounded_value, decimal_places) {

    // Convert the number to a string
    var value_string = rounded_value.toString()
    
    // Locate the decimal point
    var decimal_location = value_string.indexOf(".")

    // Is there a decimal point?
    if (decimal_location == -1) {
        
        // If no, then all decimal places will be padded with 0s
        decimal_part_length = 0
        
        // If decimal_places is greater than zero, tack on a decimal point
        value_string += decimal_places > 0 ? "." : ""
    }
    else {

        // If yes, then only the extra decimal places will be padded with 0s
        decimal_part_length = value_string.length - decimal_location - 1
    }
    
    // Calculate the number of decimal places that need to be padded with 0s
    var pad_total = decimal_places - decimal_part_length
    
    if (pad_total > 0) {
        
        // Pad the string with 0s
        for (var counter = 1; counter <= pad_total; counter++) 
            value_string += "0"
        }
    return value_string
}

function calcSubtotal() {
    var _countChecked = 0;
    var err = 0;
     var subtotal = 0; 
    var checkbox_array = "";
    var numCheckboxes = document.form1.lineitemCheckbox.length;
    if (numCheckboxes>1) {
    } else {
        numCheckboxes = 1;
    }    
//alert(numCheckboxes); 
    /* iterate through all the elements in the checkbox array */
    if (numCheckboxes==1) {
        if (document.form1.lineitemCheckbox.checked) {
            checkbox_array=document.form1.lineitemCheckbox.value.split("#");
//alert(checkbox_array[0]); 
//alert(checkbox_array[1]); 
            subtotal = round_decimals((subtotal *1) + (checkbox_array[1] * 1), 2);
        } else {
            document.form1.subtotal.value='0.00';
        }    
        document.form1.subtotal.value = "$"+subtotal;
 //           document.form1.checkbox_array[0].value="X"; 
    } else {  
        for(i=0;i<numCheckboxes;i++)
        {
	        /* and check to see if each is checked */
	        if(document.form1.lineitemCheckbox[i].checked==true)
		        /* if it is, increment a counter */
		        { 
            checkbox_array=document.form1.lineitemCheckbox[i].value.split("#");
//alert("0:"+checkbox_array[0]); 
//alert("1:"+checkbox_array[1]); 
                    subtotal = round_decimals((subtotal *1) + (checkbox_array[1] * 1), 2);
//alert("sub:"+subtotal); 
		        }
	//	     document.form1.checkbox_array[0].value="X"; 
        }
//alert(subtotal); 
        document.form1.subtotal.value = "$"+subtotal;
    }

} 

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid e-mail address entered")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid e-mail address entered")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid e-mail address entered")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid e-mail address entered")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid e-mail address entered")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid e-mail address entered")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid e-mail address entered")
		    return false
		 }

 		 return true					
	}

function checkrequiredSelectProductCategory(which) {

var pass=true;
fieldlist = "";

  var bgBad = '#DDDDDD';
  var bgGood = "white";

if (document.images) {
	for (i=0;i<which.length;i++) {
		var tempobj=which.elements[i];
		if (tempobj.name=="productCategoryID" && tempobj.value=='X') {
			fieldlist = "Select a product category";
			pass=false;
			break;
		}
	}
}

if (!pass) {
	setColor(tempobj, bgBad);
//	alert(""+fieldlist+" is required.");
	alert(""+fieldlist);
	document.form1.submit.value = "Submit";
	tempobj.focus();
//	tempobj.blur();
	return false;
}
else
return true;
}


function checkrequired61(which) {

var pass=true;
fieldlist = "";

  var bgBad = '#DDDDDD';
  var bgGood = "white";
  
  var termID = document.form1.termID.value;
  var updateBilling = document.form1.updateBilling.value;

  if (updateBilling=='1') {
		var eml = document.form1.billingEmail;
		if (eml.value!='') {
			if (echeck(eml.value)==false){
		//		eml.value=""
				eml.focus()
				document.form1.submit.value = "Continue";
				return false
			}
		}
	}

if (document.images) {
	for (i=0;i<which.length;i++) {
		var tempobj=which.elements[i];
		if (updateBilling=='1') {
			if (tempobj.name=="billingFName" && tempobj.value=='') {
				fieldlist = "First Name";
				pass=false;
				break;
			}
			if (tempobj.name=="billingLName" && tempobj.value=='') {
				fieldlist = "Last Name";
				pass=false;
				break;
			}
			if (tempobj.name=="billingAddr" && tempobj.value=='') {
				fieldlist = "Address";
				pass=false;
				break;
			}
			if (tempobj.name=="billingCity" && tempobj.value=='') {
				fieldlist = "City";
				pass=false;
				break;
			}
			if (tempobj.name=="billingZip" && tempobj.value=='') {
				fieldlist = "Zip";
				pass=false;
				break;
			}
			if (tempobj.name=="billingPhone" && tempobj.value=='') {
				fieldlist = "Phone";
				pass=false;
				break;
			}
			if (tempobj.name=="billingEmail" && tempobj.value=='') {
				fieldlist = "E-Mail";
				pass=false;
				break;
			}
			if (tempobj.name=="billingStateID" && tempobj.value=='X') {
				fieldlist = "State";
				pass=false;
				break;
			}
		}
		if (tempobj.name=="termID" && tempobj.value=='X') {
			fieldlist = "Terms";
			pass=false;
			break;
		}
		if (termID=='5') {
			if (tempobj.name=="ccTypeID" && tempobj.value=='X') {
				fieldlist = "Credit Card Type";
				pass=false;
				break;
			}
			if (tempobj.name=="ccNameOnCard" && tempobj.value=='') {
				fieldlist = "Name on Card";
				pass=false;
				break;
			}
			if (tempobj.name=="ccNumber" && tempobj.value=='') {
				fieldlist = "Credit Card Number";
				pass=false;
				break;
			}
			if (tempobj.name=="ccExpMonth" && tempobj.value=='') {
				fieldlist = "Exp. Month";
				pass=false;
				break;
			}
			if (tempobj.name=="ccExpYear" && tempobj.value=='') {
				fieldlist = "Exp. Year";
				pass=false;
				break;
			}
			if (tempobj.name=="ccThreeDigit" && tempobj.value=='') {
				fieldlist = "3-digit Code";
				pass=false;
				break;
			}
		}
	}
}

if (!pass) {
	setColor(tempobj, bgBad);
	alert(""+fieldlist+" is required.");
	document.form1.submit.value = "Continue";
	tempobj.focus();
//	tempobj.blur();
	return false;
}
else
return true;
}

function checkrequired62(which) {

var pass=true;
fieldlist = "";

  var bgBad = '#DDDDDD';
  var bgGood = "white";
  
	var orderApprove = document.form1.orderApprove.checked;
	if (orderApprove == false) {
		alert("You must agree to the terms.");
		document.form1.orderApprove.focus();
        document.form1.submit.value = "Submit Order";
		return false;
	}

return true;
}


function showHide(which) {
	if (document.form1.termID.value != '5') {
		document.form1.ccNameOnCard.value = document.form1.hiddenccNameOnCard.value;
		document.form1.ccTypeID.value = document.form1.hiddenccTypeID.value;
		document.form1.ccNumber.value = document.form1.hiddenccNumber.value;
		document.form1.ccExpMonth.value = document.form1.hiddenccExpMonth.value;
		document.form1.ccExpYear.value = document.form1.hiddenccExpYear.value;
		document.form1.ccThreeDigit.value = document.form1.hiddenccThreeDigit.value;

		document.form1.ccNameOnCard.disabled = true;
		document.form1.ccTypeID.disabled = true;
		document.form1.ccNumber.disabled = true;
		document.form1.ccExpMonth.disabled = true;
		document.form1.ccExpYear.disabled = true;
		document.form1.ccThreeDigit.disabled = true;
	} else {
		document.form1.ccNameOnCard.disabled = false;
		document.form1.ccTypeID.disabled = false;
		document.form1.ccNumber.disabled = false;
		document.form1.ccExpMonth.disabled = false;
		document.form1.ccExpYear.disabled = false;
		document.form1.ccThreeDigit.disabled = false;
	}
}

function showHide2(which) {
	if (document.form1.shippingMethodID.value.substr(0,3)!='111') {
		document.form1.shipperName.disabled = true;
		document.form1.shipperAcctNum.disabled = true;
//		document.form1.shipperContactName.disabled = true;
//		document.form1.shipperContactAddress.disabled = true;
//		document.form1.shipperContactCity.disabled = true;
//		document.form1.shipperContactStateID.disabled = true;
//		document.form1.shipperContactZip.disabled = true;
//		document.form1.shipperContactPhone.disabled = true;
//		document.form1.shipperContactFax.disabled = true;
//		document.form1.shipperContactEmail.disabled = true;
		document.form1.shipperShippingMethod.disabled = true;
		document.form1.shipperRequestNumber.disabled = true;
	} else {
		document.form1.shipperName.disabled = false;
		document.form1.shipperAcctNum.disabled = false;
//		document.form1.shipperContactName.disabled = false;
//		document.form1.shipperContactAddress.disabled = false;
//		document.form1.shipperContactCity.disabled = false;
//		document.form1.shipperContactStateID.disabled = false;
//		document.form1.shipperContactZip.disabled = false;
//		document.form1.shipperContactPhone.disabled = false;
//		document.form1.shipperContactFax.disabled = false;
//		document.form1.shipperContactEmail.disabled = false;
		document.form1.shipperShippingMethod.disabled = false;
		document.form1.shipperRequestNumber.disabled = false;
	}
}


function checkrequired60(which) {

var pass=true;
fieldlist = "";

  var bgBad = '#DDDDDD';
  var bgGood = "white";
 
    var shippingMethodID = document.form1.shippingMethodID.value; 
    var shippingMethodChoice = "";  
    var shippingMethod_array = "";
    if (shippingMethodID!='') {
        shippingMethod_array=shippingMethodID.split("|");
        shippingMethodChoice =  shippingMethod_array[0];

        if (shippingMethodChoice=='111' && document.form1.shipperName.value=='') {
	        document.form1.submit.value = "Continue";
            alert("Shipping Company Name is required.");
            return false; 
        } 

        if (shippingMethodChoice=='111' && document.form1.shipperAcctNum.value=='') {
	        document.form1.submit.value = "Continue";
            alert("Account Number is required.");
            return false; 
        } 

        if (shippingMethodChoice=='111' && document.form1.shipperShippingMethod.value=='') {
	        document.form1.submit.value = "Continue";
            alert("Shipping Method.");
            return false; 
        } 

    } else {
        shippingMethodChoice = "";
    }    
 
if (document.images) {
	for (i=0;i<which.length;i++) {
		var tempobj=which.elements[i];
		if (tempobj.name=="shipFName" && tempobj.value=='') {
			fieldlist = "First Name";
			pass=false;
			break;
		}
		if (tempobj.name=="shipLName" && tempobj.value=='') {
			fieldlist = "Last Name";
			pass=false;
			break;
		}
		if (tempobj.name=="shipAddr" && tempobj.value=='') {
			fieldlist = "Address";
			pass=false;
			break;
		}
		if (tempobj.name=="shipCity" && tempobj.value=='') {
			fieldlist = "City";
			pass=false;
			break;
		}
		if (tempobj.name=="shipZip" && tempobj.value=='') {
			fieldlist = "Zip";
			pass=false;
			break;
		}
		if (tempobj.name=="shipPhone" && tempobj.value=='') {
			fieldlist = "Phone";
			pass=false;
			break;
		}
		if (tempobj.name=="shipEmail" && tempobj.value=='') {
			fieldlist = "E-Mail";
			pass=false;
			break;
		}
		if (tempobj.name=="shipStateID" && tempobj.value=='X') {
			fieldlist = "State";
			pass=false;
			break;
		}
	}
}

if (!pass) {
	setColor(tempobj, bgBad);
	alert(""+fieldlist+" is required.");
	document.form1.submit.value = "Update/Continue";
	tempobj.focus();
//	tempobj.blur();
	return false;
}
else
return true;
}

function checkrequiredQty(which) {

var pass=true;
fieldlist = "";

  var bgBad = '#DDDDDD';
  var bgGood = "white";

if (document.images) {
	for (i=0;i<which.length;i++) {
		var tempobj=which.elements[i];
		if (tempobj.name=="qty" && tempobj.value=='X') {
			fieldlist = "Quantity";
			pass=false;
			break;
		}
	}
}

if (!pass) {
	setColor(tempobj, bgBad);
	alert(""+fieldlist+" is required.");
	tempobj.focus();
//	tempobj.blur();
	return false;
}
else
return true;
}

function checkrequiredLoginTab(which) {

var pass=true;
fieldlist = "";

  var bgBad = '#DDDDDD';
  var bgGood = "white";

  var pwd = document.form1.clientPassword.value;
  var pwd2 = document.form1.clientPasswordVerify.value;

if (document.images) {
	for (i=0;i<which.length;i++) {
		var tempobj=which.elements[i];
	}
}

if (pwd != pwd2) {
	alert("Passwords do not match.");
	setColor(document.form1.clientPassword, bgBad);
	setColor(document.form1.clientPasswordVerify, bgBad);
	document.form1.clientPassword.focus();
	document.form1.submit.value = "Submit";
	return false;
}

if (!pass) {
	setColor(tempobj, bgBad);
	alert(""+fieldlist+" is required.");
	tempobj.focus();
//	tempobj.blur();
	document.form1.submit.value = "Submit";
	return false;
}
else
return true;
}

function checkrequiredPreReg(which) {

var pass=true;
fieldlist = "";

  var bgBad = '#DDDDDD';
  var bgGood = "white";
  
	var eml = document.form1.email;
	if (eml.value!='') {
		if (echeck(eml.value)==false){
			eml.focus()
			document.form1.submit.value = "Submit";
			return false
		}
    }

if (document.images) {
	for (i=0;i<which.length;i++) {
		var tempobj=which.elements[i];
		if (tempobj.name!="submit" && tempobj.name!="cancel") {
			setColor(tempobj, bgGood);
		}
		if (tempobj.name=="firstName" && tempobj.value=='') {
			fieldlist = "First Name";
			setColor(tempobj, bgBad);
			pass=false;
	//		break;
		}
		if (tempobj.name=="lastName" && tempobj.value=='') {
			fieldlist = "Last Name";
			setColor(tempobj, bgBad);
			pass=false;
	//		break;
		}
		if (tempobj.name=="email" && tempobj.value=='') {
			fieldlist = "E-Mail";
			setColor(tempobj, bgBad);
			pass=false;
	//		break;
		}
	}
}

if (!pass) {
//	setColor(tempobj, bgBad);
//	alert(""+fieldlist+" is required.");
	alert("Please complete all required fields");
	tempobj.focus();
	document.form1.submit.value = "Submit";
//	tempobj.blur();
	return false;
}
else
return true;
}

function checkrequiredReg(which) {

var pass=true;
fieldlist = "";

  var bgBad = '#DDDDDD';
  var bgGood = "white";

  var pwd = document.form1.clientPassword.value;
  var pwd2 = document.form1.clientPasswordVerify.value;

if (document.images) {
	for (i=0;i<which.length;i++) {
		var tempobj=which.elements[i];

		if (tempobj.name=="clientCompanyName" && tempobj.value=='') {
			fieldlist = "Company Name";
			pass=false;
			break;
		}
		if (tempobj.name=="clientFirstName" && tempobj.value=='') {
			fieldlist = "First Name";
			pass=false;
			break;
		}
		if (tempobj.name=="clientLastName" && tempobj.value=='') {
			fieldlist = "Last Name";
			pass=false;
			break;
		}
		if (tempobj.name=="clientEmail" && tempobj.value=='') {
			fieldlist = "E-Mail";
			pass=false;
			break;
		}
//		if (tempobj.name=="clientWeb" && tempobj.value=='') {
//			fieldlist = "Web Site";
//			pass=false;
//			break;
//		}
//		if (tempobj.name=="clientDirectPhone" && tempobj.value=='') {
//			fieldlist = "Direct Phone";
//			pass=false;
//			break;
//		}
//		if (tempobj.name=="clientCellPhone" && tempobj.value=='') {
//			fieldlist = "Cell Phone";
//			pass=false;
//			break;
//		}
		if (tempobj.name=="clientMainPhone" && tempobj.value=='') {
			fieldlist = "Main Phone";
			pass=false;
			break;
		}
//		if (tempobj.name=="clientFaxPhone" && tempobj.value=='') {
//			fieldlist = "Fax Phone";
//			pass=false;
//			break;
//		}
		if (tempobj.name=="clientAddress" && tempobj.value=='') {
			fieldlist = "Address";
			pass=false;
			break;
		}
		if (tempobj.name=="clientCity" && tempobj.value=='') {
			fieldlist = "City";
			pass=false;
			break;
		}
		if (tempobj.name=="stateID" && tempobj.value=='X') {
			fieldlist = "State";
			pass=false;
			break;
		}
		if (tempobj.name=="clientZip" && tempobj.value=='') {
			fieldlist = "Zip";
			pass=false;
			break;
		}
//		if (tempobj.name=="sameAsMailing" && tempobj.value=='') {
//			fieldlist = "Same as Mailing";
//			pass=false;
//			break;
//		}
//		if (tempobj.name=="ccTypeID" && tempobj.value=='') {
//			fieldlist = "Credit Card Type";
//			pass=false;
//			break;
//		}
//		if (tempobj.name=="ccNameOnCard" && tempobj.value=='') {
//			fieldlist = "Name on Card";
//			pass=false;
//			break;
//		}
//		if (tempobj.name=="ccNumber" && tempobj.value=='') {
//			fieldlist = "Credit Card Number";
//			pass=false;
//			break;
//		}
//		if (tempobj.name=="ccExpDate" && tempobj.value=='') {
//			fieldlist = "Expiration Date";
//			pass=false;
//			break;
//		}
//		if (tempobj.name=="ccThreeDigit" && tempobj.value=='') {
//			fieldlist = "Three Digit";
//			pass=false;
//			break;
//		}
//		if (tempobj.name=="billingAddress" && tempobj.value=='') {
//			fieldlist = "Address";
//			pass=false;
//			break;
//		}
//		if (tempobj.name=="billingCity" && tempobj.value=='') {
//			fieldlist = "City";
//			pass=false;
//			break;
//		}
//		if (tempobj.name=="billingStateID" && tempobj.value=='X') {
//			fieldlist = "State";
//			pass=false;
//			break;
//		}
//		if (tempobj.name=="billingZip" && tempobj.value=='') {
//			fieldlist = "Zip";
//			pass=false;
//			break;
//		}
		if (tempobj.name=="clientLoginName" && tempobj.value=='') {
			fieldlist = "Username";
			pass=false;
			break;
		}
		if (tempobj.name=="clientPassword" && tempobj.value=='') {
			fieldlist = "Password";
			pass=false;
			break;
		}
		if (tempobj.name=="clientPasswordVerify" && tempobj.value=='') {
			fieldlist = "Verify Password";
			pass=false;
			break;
		}

	}
}

if (pwd != pwd2) {
	alert("Passwords do not match.");
	setColor(document.form1.clientPassword, bgBad);
	setColor(document.form1.clientPasswordVerify, bgBad);
	document.form1.clientPassword.focus();
	document.form1.submit.value = "Submit";
	return false;
}

if (!pass) {
	setColor(tempobj, bgBad);
	alert(""+fieldlist+" is required.");
	tempobj.focus();
	document.form1.submit.value = "Submit";
//	tempobj.blur();
	return false;
}
else
return true;
}

function validateQty(field) {
var valid = "0123456789"
var ok1 = "yes";
var ok2 = "yes";
var temp;
if (field.value.length == 0) {
} else {
	for (var i=0; i<field.value.length; i++) {
	    temp = "" + field.value.substring(i, i+1);
	    if (valid.indexOf(temp) == "-1") ok1 = "no";
	}
	if (ok1 == "no") {
	    alert("Invalid entry!  Only numbers are accepted!");
	    field.focus();
        field.value="1"; 
	    field.select();
    }
    if (field.value < 1 || field.value > 20) {
        alert("Please enter a quantity between 1 and 20.");
        field.focus();
        field.value="1"; 
        field.select();
   }
}
}


function validateZip(field) {
var valid = "0123456789"
var ok1 = "yes";
var ok2 = "yes";
var temp;
if (field.value.length == 0) {
} else {
	for (var i=0; i<field.value.length; i++) {
	temp = "" + field.value.substring(i, i+1);
	if (valid.indexOf(temp) == "-1") ok1 = "no";
	}
	if (field.value.length == 5) {
	} else {
	  ok2 = "no";
	}
	if (ok1 == "no") {
	alert("Invalid entry!  Only numbers are accepted!");
	field.focus();
	field.select();
	   }
	if (ok2 == "no") {
	alert("Field must contain five numbers");
	field.focus();
	field.select();
	   }
	}
}

function copyFields(form) {
	form1.billingAddress.value = form1.clientAddress.value;
	form1.billingCity.value = form1.clientCity.value;
	form1.billingStateID.value = form1.stateID.value;
	form1.billingZip.value = form1.clientZip.value;
	return true;
}

function copyOrderFields(form) {
	form1.billingFName.value = form1.shipFName.value;;
	form1.billingLName.value = form1.shipLName.value;;
	form1.billingAddr.value = form1.shipAddr.value;
	form1.billingAddr2.value = form1.shipAddr2.value;
	form1.billingCity.value = form1.shipCity.value;
	form1.billingStateID.value = form1.shipStateID.value;
	form1.billingZip.value = form1.shipZip.value;
	form1.billingPhone.value = form1.shipPhone.value;
	form1.billingEmail.value = form1.shipEmail.value;
	return true;
}


//start text area character counter
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
countfield.value = maxlimit - field.value.length;
}

function checkrequiredArtfiles(which) {

var pass=true;
fieldlist = "";

  var bgBad = '#DDDDDD';
  var bgGood = "white";

if (document.images) {
	for (i=0;i<which.length;i++) {
		var tempobj=which.elements[i];
		if (tempobj.name=="file1" && tempobj.value=='') {
			fieldlist = "File";
			pass=false;
			break;
		}
	}
}

if (!pass) {
	setColor(tempobj, bgBad);
	alert(""+fieldlist+" is required.");
	tempobj.focus();
	document.form1.submit.value = "Upload";
//	tempobj.blur();
	return false;
}
else
return true;
}

function checkrequiredLogin(which) {

var pass=true;
fieldlist = "";

  var bgBad = '#DDDDDD';
  var bgGood = "white";

if (document.images) {
	for (i=0;i<which.length;i++) {
		var tempobj=which.elements[i];
		if (tempobj.name=="memberLogin" && tempobj.value=='') {
			fieldlist = "Username";
			pass=false;
			break;
		}
		if (tempobj.name=="memberPassword" && tempobj.value=='') {
			fieldlist = "Password";
			pass=false;
			break;
		}
	}
}

if (!pass) {
	setColor(tempobj, bgBad);
	alert(""+fieldlist+" is required.");
	tempobj.focus();
	document.form1.submit.value = "Log In";
//	tempobj.blur();
	return false;
}
else
return true;
}


function checkrequiredAdminLogin(which) {

var pass=true;
fieldlist = "";

  var bgBad = '#DDDDDD';
  var bgGood = "white";

if (document.images) {
	for (i=0;i<which.length;i++) {
		var tempobj=which.elements[i];
		if (tempobj.name=="loginName" && tempobj.value=='') {
			fieldlist = "Username";
			pass=false;
			break;
		}
		if (tempobj.name=="loginPassword" && tempobj.value=='') {
			fieldlist = "Password";
			pass=false;
			break;
		}
	}
}

if (!pass) {
	setColor(tempobj, bgBad);
	alert(""+fieldlist+" is required.");
	tempobj.focus();
//	tempobj.blur();
	return false;
}
else
return true;
}


function checkrequiredProduct(which) {

var pass=true;
fieldlist = "";

  var bgBad = '#DDDDDD';
  var bgGood = "white";

//  if (document.form4.cancel.value=="Canceling...") {
//	return true;
//  }
	
if (document.images) {
	for (i=0;i<which.length;i++) {
		var tempobj=which.elements[i];
		if (tempobj.name=="productName" && tempobj.value=='') {
			fieldlist = "Product Name";
			pass=false;
			break;
		}
		if (tempobj.name=="productWidth" && tempobj.value=='') {
			fieldlist = "Product Width";
			pass=false;
			break;
		}
		if (tempobj.name=="productHeight" && tempobj.value=='') {
			fieldlist = "Product Height";
			pass=false;
			break;
		}
		if (tempobj.name=="productProductionWidth" && tempobj.value=='') {
			fieldlist = "Production Width";
			pass=false;
			break;
		}
		if (tempobj.name=="productProductionHeight" && tempobj.value=='') {
			fieldlist = "Production Height";
			pass=false;
			break;
		}
		if (tempobj.name=="turnaroundDays" && tempobj.value=='') {
			fieldlist = "Turnaround (days)";
			pass=false;
			break;
		}
		if (tempobj.name=="zoomRatio" && tempobj.value=='') {
			fieldlist = "Zoom Ratio";
			pass=false;
			break;
		}
	}
}

if (!pass) {
	setColor(tempobj, bgBad);
	alert(""+fieldlist+" is required.");
	tempobj.focus();
//	tempobj.blur();
	return false;
}
else
return true;
}


function checkrequiredProductElement(which) {

var pass=true;
fieldlist = "";

  var bgBad = '#DDDDDD';
  var bgGood = "white";

if (document.images) {
	for (i=0;i<which.length;i++) {
		var tempobj=which.elements[i];
		if (tempobj.name=="productElementName" && tempobj.value=='') {
			fieldlist = "Content Name";
			pass=false;
			break;
		}
		if (tempobj.name=="transColor" && tempobj.value=='') {
			fieldlist = "Transparent Color";
			pass=false;
			break;
		}
	}
}

if (!pass) {
	setColor(tempobj, bgBad);
	alert(""+fieldlist+" is required.");
	tempobj.focus();
//	tempobj.blur();
	return false;
}
else
return true;
}



function setColor(el, bg) {
  if (el.style) el.style.backgroundColor = bg;
}

function validate(field) {
var valid = "0123456789"
var ok = "yes";
var temp;
for (var i=0; i<field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
alert("Invalid entry!  Only numbers are accepted!");
field.focus();
field.select();
   }
}

function validate2(field) {
var valid = "0123456789.-"
var ok = "yes";
var temp;
for (var i=0; i<field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
alert("Invalid entry!  Only numbers are accepted!");
field.focus();
field.select();
   }
}

function gtpage(url,frname,height,width) {

        var p1 = 'toolbar=no,'
        var p2 = 'location=no,'
        var p3 = 'directories=no,'
        var p4 = 'status=no,'
        var p5 = 'menubar=no,'
        var p6 = 'resizable=no,'
        var p7 = 'scrollbars=no,'
        var p8=  'copyhistory=no,'
        var p9 = 'width='+width+',';
        var p10 = 'height='+height
        var props = p1+p2+p3+p4+p5+p6+p7+p8+p9+p10;

        themainwindow = window.open(url,frname,props);
        themainwindow.focus();
}

function gtpage2(url,frname,height,width) {

        var p1 = 'toolbar=no,'
        var p2 = 'location=no,'
        var p3 = 'directories=no,'
        var p4 = 'status=no,'
        var p5 = 'menubar=no,'
        var p6 = 'resizable=yes,'
        var p7 = 'scrollbars=yes,'
        var p8=  'copyhistory=no,'
        var p9 = 'width='+width+',';
        var p10 = 'height='+height
        var props = p1+p2+p3+p4+p5+p6+p7+p8+p9+p10;

        themainwindow = window.open(url,frname,props);
        themainwindow.focus();

}   
   
function deleteFile(which) {

	var agree=confirm("Are you sure you want to delete this file?\n\nThis action cannot be undone.");
	if (agree)
		return true ;
	else
		return false ;
}

function removeItem(which) {

	var agree=confirm("Are you sure you want to remove this product from your shopping cart?\n\nThis action cannot be undone.");
	if (agree)
		return true ;
	else
		return false ;
}

function submitOrder(which) {

	var agree=confirm("Click OK to submit your order.");
	if (agree)
		return true ;
	else
		return false ;
}

function removeProductContent(which) {

	var agree=confirm("Are you sure you want to remove this content from this product?\n\nThis action cannot be undone.");
	if (agree)
		return true ;
	else
		return false ;
}

function removeProductPage(which) {

	var agree=confirm("Are you sure you want to delete this page?\n\nThis action cannot be undone.");
	if (agree)
		return true ;
	else
		return false ;
}

function removeProductContentPage(which) {

	var agree=confirm("Are you sure you want to remove this content from this page?\n\nThis action cannot be undone.");
	if (agree)
		return true ;
	else
		return false ;
}

function deleteProduct(which) {

	var agree=confirm("Are you sure you want to delete this product?\n\nThis action cannot be undone.");
	if (agree)
		return true ;
	else
		return false ;
}

function deleteProductElement(which) {

	var agree=confirm("Are you sure you want to delete this content?\n\nThis action cannot be undone.");
	if (agree)
		return true ;
	else
		return false ;
}

function deleteProductServiceGroup(which) {

	var agree=confirm("Are you sure you want to remove this service group from this product?\n\nThis action cannot be undone.");
	if (agree)
		return true ;
	else
		return false ;
}

function check_date(field){
var checkstr = "0123456789";
var DateField = field;
var Datevalue = "";
var DateTemp = "";
var seperator = ".";
var day;
var month;
var year;
var leap = 0;
var err = 0;
var i;
   err = 0;
   DateValue = DateField.value;
   /* Delete all chars except 0..9 */
   for (i = 0; i < DateValue.length; i++) {
	  if (checkstr.indexOf(DateValue.substr(i,1)) >= 0) {
	     DateTemp = DateTemp + DateValue.substr(i,1);
	  }
   }
   DateValue = DateTemp;
   /* Always change date to 8 digits - string*/
   /* if year is entered as 2-digit / always assume 20xx */
   if (DateValue.length == 6) {
      DateValue = DateValue.substr(0,4) + '20' + DateValue.substr(4,2); }
   if (DateValue.length != 8) {
      err = 19;}
   /* year is wrong if year = 0000 */
   year = DateValue.substr(4,4);
   if (year == 0) {
      err = 20;
   }
   /* Validation of month*/
   month = DateValue.substr(2,2);
   if ((month < 1) || (month > 12)) {
      err = 21;
   }
   /* Validation of day*/
   day = DateValue.substr(0,2);
   if (day < 1) {
     err = 22;
   }
   /* Validation leap-year / february / day */
   if ((year % 4 == 0) || (year % 100 == 0) || (year % 400 == 0)) {
      leap = 1;
   }
   if ((month == 2) && (leap == 1) && (day > 29)) {
      err = 23;
   }
   if ((month == 2) && (leap != 1) && (day > 28)) {
      err = 24;
   }
   /* Validation of other months */
   if ((day > 31) && ((month == "01") || (month == "03") || (month == "05") || (month == "07") || (month == "08") || (month == "10") || (month == "12"))) {
      err = 25;
   }
   if ((day > 30) && ((month == "04") || (month == "06") || (month == "09") || (month == "11"))) {
      err = 26;
   }
   /* if 00 ist entered, no error, deleting the entry */
   if ((day == 0) && (month == 0) && (year == 00)) {
      err = 0; day = ""; month = ""; year = ""; seperator = "";
   }
   /* if no error, write the completed date to Input-Field (e.g. 13.12.2001) */
   if (err == 0) {
      DateField.value = day + seperator + month + seperator + year;
   }
   /* Error-message if err != 0 */
   else {
      alert("Date is incorrect!\n\nMust use format: mm/dd/yyyy");
      DateField.select();
	  DateField.focus();
   }
}
//  End -->