<!--
/*=====================================================================================================*/
function loopCheckboxes(){
	var boxSelected = false;
	//alert(isArray(form1.chkDelete));
	if (isArray(form1.chkDelete)) {
		for (var i=0; i<form1.chkDelete.length; i++) {  
			if (form1.chkDelete[i].checked) {
				boxSelected = true;
			}
		}
	}
	else {
		if (form1.chkDelete.checked) {
			boxSelected = true;
		}
	}
	if (!boxSelected) {  
		alert("Please select a checkbox.");  
		return false;
	}
	else {
		return(confirm('Are you sure you want to delete the selected record(s)?'));
	}
}

/*=====================================================================================================*/
function isArray(obj) {
 	if (typeof(obj.length)=="undefined") {
 		return false;
 	}
 	else {
		return true;
 	}
}

/*=====================================================================================================*/
function isBlank()
{
if (form1.blob.value == "")
{
alert("Please click the Browse... Button to Search for an Image to Upload or\nClose The Window to Continue");
form1.blob.focus();
return (false);
}
return (true);
}

/*=====================================================================================================*/
/*Check Out*/
/*=====================================================================================================*/
function checkcheckoutform() {
	if ((checkcontactsection()) && (checkshippingsection())) {
		return true;
	}
	else {
		return false;
	}
}
function checkcontactsection() {
	if (document.form.strFirst.value == "") {
		alert('Please enter your first name');
		return false;
	}
	if (document.form.strLast.value == "") {
		alert('Please enter your last name');
		return false;
	}
	if (document.form.strAddress1.value == "") {
		alert('Please enter your address');
		return false;
	}
	if (document.form.strCity.value == "") {
		alert('Please enter your city');
		return false;
	}
	if (document.form.strPostalCode.value == "") {
		alert('Please enter your postal code');
		return false;
	}
	if (document.form.strAreaCode.value == "") {
		alert('Please enter your area code');
		return false;
	}
	if (document.form.strPhoneNumber.value == "") {
		alert('Please enter your phone number');
		return false;
	}
	if (document.form.strEmail.value == "") {
		alert('Please enter your email address');
		return false;
	}
	else {
		if (!ValidEmailFormat(document.form.strEmail.value)) {
			alert('Please enter a valid e-mail\naddress to receive an automatic\nconfirmation of your order.');
			return false;
		}
	}
	return true;
}
function checkshippingsection() {
	if (document.form.strShipFirst.value == "") {
		alert('Please enter a first name for shipping address');
		return false;
	}
	if (document.form.strShipLast.value == "") {
		alert('Please enter a last name for shipping address');
		return false;
	}
	if (document.form.strShipAddress1.value == "") {
		alert('Please enter address for shipping address');
		return false;
	}
	if (document.form.strShipCity.value == "") {
		alert('Please enter city for shipping address');
		return false;
	}
	if (document.form.strShipState.value == "") {
		alert('Please enter province / state for shipping address');
		return false;
	}
	if (document.form.strShipPostalCode.value == "") {
		alert('Please enter postal code for shipping address');
		return false;
	}
	if (document.form.strShipCountry.value == "") {
		alert('Please enter country for shipping address');
		return false;
	}
	if (document.form.strShipPhoneNumber.value == "") {
		alert('Please enter your shipping phone number');
		return false;
	}
	if (document.form.strShipEmail.value == "") {
		alert('Please enter your shipping email address');
		return false;
	}
	else {
		if (!ValidEmailFormat(document.form.strShipEmail.value)) {
			alert('Please enter a valid e-mail address for your shipping section.');
			return false;
		}
	}
	return true;
}
function copyInfo() {
	if (document.form.Same.checked) {
		if (checkcontactsection()) {
			document.form.strShipFirst.value = document.form.strFirst.value;
			document.form.strShipLast.value = document.form.strLast.value;
			document.form.strShipAddress1.value = document.form.strAddress1.value;
			document.form.strShipAddress2.value = document.form.strAddress2.value;
			document.form.strShipCity.value = document.form.strCity.value;
			document.form.strShipState.value = document.form.strState.value;
			document.form.strShipPostalCode.value = document.form.strPostalCode.value;
			document.form.strShipCountry.value = document.form.strCountry.value;
			if (document.form.strShipDialCode && document.form.strDialCode) {
				document.form.strShipDialCode.value = document.form.strDialCode.value;
			}
			document.form.strShipAreaCode.value = document.form.strAreaCode.value;
			document.form.strShipPhoneNumber.value = document.form.strPhoneNumber.value;
			if (document.form.strShipFaxDialCode && document.form.strFaxDialCode) {
				document.form.strShipFaxDialCode.value = document.form.strFaxDialCode.value;
			}
			document.form.strShipFaxAreaCode.value = document.form.strFaxAreaCode.value;
			document.form.strShipFaxNumber.value = document.form.strFaxNumber.value;
			document.form.strShipEmail.value = document.form.strEmail.value;
		}
		else {
			document.form.Same.checked = false;
		}
	}
	else {
		document.form.strShipFirst.value = "";
		document.form.strShipLast.value = "";
		document.form.strShipAddress1.value = "";
		document.form.strShipAddress2.value = "";
		document.form.strShipCity.value = "";
		document.form.strShipState.value = "";
		document.form.strShipPostalCode.value = "";
		document.form.strShipCountry.value = "";
		if (document.form.strShipDialCode) {
			document.form.strShipDialCode.value = "";
		}
		document.form.strShipAreaCode.value = "";
		document.form.strShipPhoneNumber.value = "";
		if (document.form.strShipFaxDialCode) {
			document.form.strShipFaxDialCode.value = "";
		}
		document.form.strShipFaxAreaCode.value = "";
		document.form.strShipFaxNumber.value = "";
		document.form.strShipEmail.value = "";
	}
}

/*=====================================================================================================*/
/*Destination */
/*=====================================================================================================*/
 function AbortDestinationEntry()
 {
 if (document.form.strCountry.selectedIndex == 0)
 {
	alert('Please Select a Country');
	return false;
 }
 if (document.form.strState.selectedIndex == 0)
 {
	if (document.form.strCountry.selectedIndex == 1) {
		//Canada
		alert('Please Select a Province');
		return false;
	}
	if (document.form.strCountry.selectedIndex == 2) {
		//USA
		alert('Please Select a State');
		return false;
	}
 }
 if (document.form.strShipMethod.selectedIndex == 0)
 {
	if ((document.form.strCountry.selectedIndex == 1) || (document.form.strCountry.selectedIndex == 2)) {
		alert('Please Select Your Preferred Shipping Method');
		return false;
	}
 }
 return true;
}
/*===============================================
Double Combo Script Credit
By Website Abstraction (www.wsabstract.com)
Over 200+ free JavaScripts here!
===============================================*/
function redirect(){
var groups=document.form.strCountry.options.length
var group=new Array(groups)
var temp=document.form.strState
var ship=document.form.strShipMethod;
var x = document.forms[0].strCountry.selectedIndex;

for (i=0; i<groups; i++) {
	group[i]=new Array()
}

group[0][0]=new Option("Select Province/State:","0")

group[1][0]=new Option("Select Province:","0")
group[1][1]=new Option("Alberta","AB")
group[1][2]=new Option("British Columbia","BC")
group[1][3]=new Option("Manitoba","MB")
group[1][4]=new Option("New Brunswick","NB")
group[1][5]=new Option("Newfoundland and Labrador","NF")
group[1][6]=new Option("Northwest Territories","NT")
group[1][7]=new Option("Nova Scotia","NS")
group[1][8]=new Option("Nunavut","NU")
group[1][9]=new Option("Ontario","ON")
group[1][10]=new Option("Prince Edward Island","PE")
group[1][11]=new Option("Quebec","QB")
group[1][12]=new Option("Saskatchewan","SK")
group[1][13]=new Option("Yukon","YT")

/* COMMENTED OUT TO ONLY ACCEPT CANADIANS ORDERS
group[2][0]=new Option("Select State:","0")
group[2][1]=new Option("Alabama","Alabama")
group[2][2]=new Option("Alaska","Alaska")
group[2][3]=new Option("Arizona","Arizona")
group[2][4]=new Option("Arkansas","Arkansas")
group[2][5]=new Option("California","California")
group[2][6]=new Option("Colorado","Colorado")
group[2][7]=new Option("Connecticut","Connecticut")
group[2][8]=new Option("Delaware","Delaware")
group[2][9]=new Option("District of Columbia","District of Columbia")
group[2][10]=new Option("Florida","Florida")
group[2][11]=new Option("Georgia","Georgia")
group[2][12]=new Option("Hawaii","Hawaii")
group[2][13]=new Option("Idaho","Idaho")
group[2][14]=new Option("Illinois","Illinois")
group[2][15]=new Option("Indiana","Indiana")
group[2][16]=new Option("Iowa","Iowa")
group[2][17]=new Option("Kansas","Kansas")
group[2][18]=new Option("Kentucky","Kentucky")
group[2][19]=new Option("Louisiana","Louisiana")
group[2][20]=new Option("Maine","Maine")
group[2][21]=new Option("Massachusetts","Massachusetts")
group[2][22]=new Option("Michigan","Michigan")
group[2][23]=new Option("Minnesota","Minnesota")
group[2][24]=new Option("Mississippi","Mississippi")
group[2][25]=new Option("Missouri","Missouri")
group[2][26]=new Option("Montana","Montana")
group[2][27]=new Option("Nebraska","Nebraska")
group[2][28]=new Option("Nevada","Nevada")
group[2][29]=new Option("New Hampshire","New Hampshire")
group[2][30]=new Option("New Jersey","New Jersey")
group[2][31]=new Option("New Mexico","New Mexico")
group[2][32]=new Option("New York","New York")
group[2][33]=new Option("North Carolina","North Carolina")
group[2][34]=new Option("North Dakota","North Dakota")
group[2][35]=new Option("Ohio","Ohio")
group[2][36]=new Option("Oklahoma","Oklahoma")
group[2][37]=new Option("Oregon","Oregon")
group[2][38]=new Option("Pennsylvania","Pennsylvania")
group[2][39]=new Option("Rhode Island","Rhode Island")
group[2][40]=new Option("South Carolina","South Carolina")
group[2][41]=new Option("South Dakota","South Dakota")
group[2][42]=new Option("Tennessee","Tennessee")
group[2][43]=new Option("Texas","Texas")
group[2][44]=new Option("Utah","Utah")
group[2][45]=new Option("Vermont","Vermont")
group[2][46]=new Option("Virginia","Virginia")
group[2][47]=new Option("Washington","Washington")
group[2][48]=new Option("West Virginia","West Virginia")
group[2][49]=new Option("Wisconsin","Wisconsin")
group[2][50]=new Option("Wyoming","Wyoming")*/

for (m=temp.options.length-1;m>0;m--) {
	temp.options[m]=null
}
for (m=ship.options.length-1;m>0;m--) {
	ship.options[m]=null
}

if (x > 2) {
	temp.options[0] = new Option("International","International");
	ship.options[0] = new Option("UPS","UPS");
}
else {
	for (i=0;i<group[x].length;i++){
		temp.options[i]=new Option(group[x][i].text,group[x][i].value)
	}
	if (x == 0) {
		ship.options[0] = new Option("Shipping Method:","0");
	}
	else {
		ship.options[0] = new Option("Shipping Method:","0");
		ship.options[1] = new Option("Canada Post","Canada Post");
		//ship.options[2] = new Option("Greyhound","Greyhound");
		//ship.options[3] = new Option("FedEx","FedEx");
		//ship.options[4] = new Option("Purolator","Purolator");
		//ship.options[5] = new Option("UPS","UPS");
	}
}
temp.options[0].selected=true
}

/*=====================================================================================================*/
/*Payment */
/*=====================================================================================================*/

function checkpaymentform() {
	if (!document.form.chkTerms.checked) {
		alert('Please Accept Terms and Conditions to Continue');
		return false;
	}
	if (document.form.intTotal.value <= 250) {
		alert('You will be redirected to our Secure Service Provider to Complete Your Order')
	}
	return true;
}

/*=====================================================================================================*/
/*Product.asp */
/*=====================================================================================================*/
 function AbortProductEntry(sMsg, eSrc)
 {
  window.alert(sMsg);
  // set focus and highlight to the offending error
  eSrc.focus();
  //eSrc.select();
 }

 function HandleError(eSrc)
 {
  // make sure the input is a numeric value
  var val = parseInt(eSrc.value);
  if (isNaN(val))
  {
   return AbortProductEntry("Must be a number.", eSrc);
  }

  // make sure the value is not negative
  if (val <= 0)
  {
   return AbortProductEntry("Please enter a positive number.", eSrc);
  }
 }

/*=====================================================================================================*/
/*viewcart.asp */
/*=====================================================================================================*/

function checkviewcartform(objForm) {
	if ((objForm.intTotal.value < 20)) {
		alert("Online minimum purchase amount is $20.00, Please Continue Shopping...")
		return false; 
	}
	objForm.submit();
}
function removeitem(txtbox) {
	txtbox.value = 0;
	document.form1.control.value = 'Update Totals';
	document.form1.submit();
}

function updatetotal() {
	document.form1.control.value = 'Update Totals';
	document.form1.submit();
}

function proceedtocheckout() {
	document.form1.control.value = 'Proceed to Check Out';
	document.form1.submit();
}

 function AbortViewCartEntry(sMsg, eSrc)
 {
  window.alert(sMsg);
  // set focus and highlight to the offending error
  eSrc.focus();
  //eSrc.select();
 }

 function HandleKeyUp(eSrc)
 {
  // make sure the input is a numeric value
  var val = parseInt(eSrc.value);
  if (isNaN(val))
  {
   return AbortViewCartEntry("Must be a number.", eSrc);
  }

  // make sure the value is not negative
  if (val < 0)
  {
   return AbortViewCartEntry("Number cannot be less than zero.", eSrc);
  }
 }


/*=====================================================================================================*/
/*adminlogin.asp */
/*=====================================================================================================*/

function checkadminloginform(f) {
	var formOK = true;
	if (document.forms[0].username.value == "") {
		alert("Please enter a username.")
		formOK = false; 
	}
	else if (document.forms[0].password.value == "") {
		alert("Please enter a password.")
		formOK = false; 
	}
	return formOK;
}
/*=====================================================================================================*/
// productsByCategory.asp

function displayProductInfo(product_image,product_name,sku_number,price,num_in_stock, product_link) {
	document.product_image.src=product_image;
	document.getElementById('product_name').innerHTML = product_name;;

	document.getElementById('sku_number').innerHTML = sku_number;
	document.getElementById('price').innerHTML = price;
	if (num_in_stock > 0) {
		document.getElementById('in_stock').innerHTML = 'Yes';
	}
	else {
		document.getElementById('in_stock').innerHTML = 'Out of stock';
	}
	document.getElementById('product_link').setAttribute('href',product_link);
}
/*=====================================================================================================*/
// 

function checkForQuote(str) {
	str.replace(/\'/,"\&#39;");
	return str;
}
/*=====================================================================================================*/
//-->