if (document.images) {

	btnHomeOn = new Image
	btnHomeOff = new Image

	btnHomeOn.src = '/images/homebtnover.jpg'
	btnHomeOff.src = '/images/homebtn.jpg'
	
	btnAboutOn = new Image
	btnAboutOff = new Image

	btnAboutOn.src = '/images/aboutbtnover.jpg'
	btnAboutOff.src = '/images/aboutbtn.jpg'
	
	btnContactOn = new Image
	btnContactOff = new Image

	btnContactOn.src = '/images/contactbtnover.jpg'
	btnContactOff.src = '/images/contactbtn.jpg'
	
	btnCatalogOn = new Image
	btnCatalogOff = new Image

	btnCatalogOn.src = '/images/catalogover.jpg'
	btnCatalogOff.src = '/images/catalogbtn.jpg'
	
	btnPhotoOn = new Image
	btnPhotoOff = new Image

	btnPhotoOn.src = '/images/photobtnover.jpg'
	btnPhotoOff.src = '/images/photobtn.jpg'
	
	btnFAQOn = new Image
	btnFAQOff = new Image

	btnFAQOn.src = '/images/faqbtnover.jpg'
	btnFAQOff.src = '/images/faqbtn.jpg'
	
}

function swapImage(imageName, onOff) {
	
	eval("document." + imageName + ".src = " + imageName + onOff + ".src");

}

function validateAccountInfo() {
	
	var strErr;
	strErr = "";
	var blnValidAccountInfo;
	blnValidAccountInfo = true;
	
	if (document.account_info.first_name.value == "") {
		strErr = strErr + "Please complete the First Name field.\n"
		blnValidAccountInfo = false;
	}
	
	if (document.account_info.last_name.value == "") {
		strErr = strErr + "Please complete the Last Name field.\n"
		blnValidAccountInfo = false;
	}
		
	if (document.account_info.phone.value == "") {
		strErr = strErr + "Please complete the Phone Number field.\n"
		blnValidAccountInfo = false;
	}		
		
	if (document.account_info.address1.value == "") {
		strErr = strErr + "Please complete the Street Address field.\n"
		blnValidAccountInfo = false;
	}

	if (document.account_info.city.value == "") {
		strErr = strErr + "Please complete the City field.\n"
		blnValidAccountInfo = false;
	}
	
	if (document.account_info.state.options[document.account_info.state.selectedIndex].value == "") {
		strErr = strErr + "Please select a State.\n"
		blnValidAccountInfo = false;
	}	
	
	if (document.account_info.zip.value == "") {
		strErr = strErr + "Please complete the Zip Code/Postal Code field.\n"
		blnValidAccountInfo = false;
	}
	
	if (! blnValidAccountInfo) {
		alert(strErr);
		return false;
	}
	
	return true;
}

function validateProductInfo() {
	
	var strErr;
	strErr = "";
	var blnValidProductInfo;
	blnValidProductInfo = true;
	
	if (document.product_info.product_name.value == "") {
		strErr = strErr + "Please complete the Product Name field.\n"
		blnValidProductInfo = false;
	}
	
	if (document.product_info.sku.value == "") {
		strErr = strErr + "Please complete the SKU field.\n"
		blnValidProductInfo = false;
	}
		
	if (document.product_info.long_description.value == "") {
		strErr = strErr + "Please complete the Description field.\n"
		blnValidProductInfo = false;
	}		
		
	if (document.product_info.vendor_name.value == "") {
		strErr = strErr + "Please complete the Vendor Name field.\n"
		blnValidProductInfo = false;
	}

	if (document.product_info.price.value == "") {
		strErr = strErr + "Please complete the Price field.\n"
		blnValidProductInfo = false;
	}
	
	if (isNaN(document.product_info.price.value)) {
		strErr = strErr + "Price must be a numeric value.\n"
		blnValidProductInfo = false;
	}
	
	if (! blnValidProductInfo) {
		alert(strErr);
		return false;
	}
	
	return true;
}


function validateSourceCodeInfo() {

	var strErr;
	strErr = "";
	var blnValidProductInfo;
	blnValidProductInfo = true;

	
	if (document.source_info.source_code.value == "") {
		strErr = strErr + "Please complete the Source Code field.\n"
		blnValidProductInfo = false;
	}

	if (document.source_info.source_description.value == "") {
		strErr = strErr + "Please complete the Description field.\n"
		blnValidProductInfo = false;
	}
	
	if (document.source_info.discount.value == "") {
		strErr = strErr + "Please complete the Discount field. It must be a numeric value.\n"
		blnValidProductInfo = false;
	}
	
	if (! blnValidProductInfo) {
		alert(strErr);
		return false;
	}
	
	return true;
}


function init() {
  if (!document.getElementById) return
  var imgOriginSrc;
  var imgTemp = new Array();
  var imgarr = document.getElementsByTagName('img');
  for (var i = 0; i < imgarr.length; i++) {
    if (imgarr[i].getAttribute('hsrc')) {
        imgTemp[i] = new Image();
        imgTemp[i].src = imgarr[i].getAttribute('hsrc');
        imgarr[i].onmouseover = function() {
            imgOriginSrc = this.getAttribute('src');
            this.setAttribute('src',this.getAttribute('hsrc'))
        }
        imgarr[i].onmouseout = function() {
            this.setAttribute('src',imgOriginSrc)
        }
    }
  }
}

function validatePayment() {
	
	var strErr;
	strErr = "";
	var blnValidPayment;
	blnValidPayment = true;
	
	if (isNaN(document.payment.account_number.value) || document.payment.account_number.value == "") {
		strErr = strErr + "Please enter a valid account number.\n"
		blnValidPayment = false;
	}
		
	if (! blnValidPayment) {
		alert(strErr);
		return false;
	}
	
	return true;
}