function preloadImages() {
if (document.images)
	{
	var btn_retailers_roll = new Image
		btn_retailers_roll.src = "images/btn_retailers_over.jpg"
	var btn_ordernow2_roll = new Image
		btn_ordernow2_roll.src = "images/btn_ordernow2_over.jpg"
	var btn_ordernow_roll = new Image
		btn_ordernow_roll.src = "images/btn_ordernow_over.gif"
	var btn_faqs_roll = new Image
		btn_faqs_roll.src = "images/btn_faqs_over.gif"
	var btn_testimonials_roll = new Image
		btn_testimonials_roll.src = "images/btn_testimonials_over.gif"
	var btn_home_roll = new Image
		btn_home_roll.src = "images/btn_home_over.gif"
	var btn_about_roll = new Image
		btn_about_roll.src = "images/btn_about_over.gif"
	var btn_naming_roll = new Image
		btn_naming_roll.src = "images/btn_naming_over.gif"
	}
}

function changeImages(sName,sImage)
	{
	if (document.images)
		{
		document.images[sName].src = sImage
		}
	}

function openWindow(theURL,winName,features)
	{
	window.open(theURL,winName,features).focus();
	}

function closeWindow()
	{
	window.close();
	}

if (document.layers)
	{
	origWidth = window.innerWidth;
	origHeight = window.innerHeight;
	}
function reloadPage()
	{
	if (window.innerWidth != origWidth || window.innerHeight != origHeight)
	location.reload();
	}
if (document.layers)
	onresize=reloadPage;
	
function goHistory()
	{
	window.history.go(-1);
	}
	
function calculateCost(num)
	{
	item_num=Math.floor(num);
	shipping_amount=Math.floor(document.formContainer.Shipping.value);
	
	if (item_num>=0)
		{
		currCost=itemPrice*item_num;
		prev_value=item_num;
		}
	else
		{
		item_num=prev_value;
		document.formContainer.Quantity.value=item_num;
		currCost=itemPrice*item_num;
		}

	if (shipping_amount>=0)
		{
		shipping_amount=eval(document.formContainer.Shipping.value);
		prev_shipping=shipping_amount;
		}
	else
		{
		shipping_amount=prev_shipping;
		document.formContainer.Shipping.value=shipping_amount;
		}
		
	document.formContainer.Quantity.value=item_num;
	document.formContainer.SubTotal.value=currCost;
	document.formContainer.Handling.value=item_num*handling_fee;

	if (shipping_amount>0)
		{
		document.formContainer.TotalCost.value=eval(shipping_amount*item_num)+eval(document.formContainer.SubTotal.value)+eval(document.formContainer.Handling.value);
		}
	else
		{
		document.formContainer.TotalCost.value=0;
		}
	}
	
function checkValue(currNumber)
	{
	if (currNumber==0)
		{
		document.formContainer.Quantity.value="";
		}
	}
	
function checkShipping(currShipping)
	{
	if (currShipping==0)
		{
		document.formContainer.Shipping.value="";
		}
	}
	
function printCommand()
	{
	if (window.print)
		{
		window.print();  
		}
	else
		{
		var WebBrowser = '<object id="WebBrowser1" width="0" height="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>';
		document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
		WebBrowser1.ExecWB(6, 2);
		}
	}
	
function printIt()
	{
	alert_message="";
	alert_text="";
	error=0;
	if (!eval(document.formContainer.Quantity.value)>0)
		{
		error+=1;
		alert_text+="\n* Quantity";
		}
	
	if (!eval(document.formContainer.Shipping.value)>0)
		{
		error+=1;
		alert_text+="\n* Shipping";
		}
	
	if (document.formContainer.Name.value=="")
		{
		error+=1;
		alert_text+="\n* Name";
		}
	
	if (document.formContainer.Address.value=="")
		{
		error+=1;
		alert_text+="\n* Address";
		}
	
	if (document.formContainer.City.value=="")
		{
		error+=1;
		alert_text+="\n* City";
		}
	
	if (document.formContainer.State.value=="")
		{
		error+=1;
		alert_text+="\n* State";
		}
	
	if (document.formContainer.ZipCode.value=="")
		{
		error+=1;
		alert_text+="\n* ZipCode";
		}
	
	if (document.formContainer.AreaCode.value=="")
		{
		error+=1;
		alert_text+="\n* AreaCode";
		}
	
	if (document.formContainer.Phone1.value=="" || document.formContainer.Phone2.value=="")
		{
		error+=1;
		alert_text+="\n* Phone Number";
		}
	
	if (document.formContainer.Email.value=="")
		{
		error+=1;
		alert_text+="\n* Email";
		}
		
	if (error>0)
		{
		alert("Please fill in the following fields before this page is printed: "+alert_text);
		}
	else
		{
		printCommand();
		}
	}
	
function printBlank()
	{
	document.formContainer.Shipping.value="";
	document.formContainer.Name.value="";
	document.formContainer.Address.value="";
	document.formContainer.City.value="";
	document.formContainer.State.value="";
	document.formContainer.ZipCode.value="";
	document.formContainer.AreaCode.value="";
	document.formContainer.Phone1.value="";
	document.formContainer.Email.value="";
	document.formContainer.Quantity.value="";
	document.formContainer.SubTotal.value="";
	document.formContainer.Handling.value="";
	document.formContainer.TotalCost.value="";
	setCheckedValue(document.formContainer.resident, '');
	document.formContainer.State.selectedIndex=1;
	printCommand();
	}

function setCheckedValue(radioObj, newValue) {
	if(!radioObj)
		return;
	var radioLength = radioObj.length;
	if(radioLength == undefined) {
		radioObj.checked = (radioObj.value == newValue.toString());
		return;
	}
	for(var i = 0; i < radioLength; i++) {
		radioObj[i].checked = false;
		if(radioObj[i].value == newValue.toString()) {
			radioObj[i].checked = true;
		}
	}
}


function checkAreaCode(num)
	{
	if (num.length>=3)
		{
		document.formContainer.Phone1.focus();
		}
	}
	
function checkPhone1(num)
	{
	if (num.length>=3)
		{
		document.formContainer.Phone2.focus();
		}
	}
