function ToggleDisplay(itemId, state)
{
	var item = document.getElementById(itemId);
	
	if (item.className == 'show')
	{
		item.className = 'hide';
	}
	else
	{
		item.className = 'show';
	}
}


function OpenWin(url, label, w, h, conf) {
	popwin = window.open(url, label, "width=" + w + ",height=" + h + conf);
	popwin.focus();
	if (navigator.appVersion.substring(0, 1) >= 4) {
		popwin.resizeTo(w, h);
	}
}


function ToggleShipping(F) {

	if ( F.useShipping.checked == true ) {
		F.bill_first_name.value = F.ship_first_name.value;			F.bill_first_name.disabled = true;
		F.bill_last_name.value = F.ship_last_name.value;			F.bill_last_name.disabled = true;
		F.bill_address1.value = F.ship_address1.value;				F.bill_address1.disabled = true;
		F.bill_address2.value = F.ship_address2.value;				F.bill_address2.disabled = true;
		F.bill_city.value = F.ship_city.value;						F.bill_city.disabled = true;
		F.bill_state.selectedIndex = F.ship_state.selectedIndex;	F.bill_state.disabled = true;
		F.bill_zip.value = F.ship_zip.value;						F.bill_zip.disabled = true;				
		F.bill_phone1.value = F.ship_phone1.value;					F.bill_phone1.disabled = true;
		F.bill_phone2.value = F.ship_phone2.value;					F.bill_phone2.disabled = true;							
	}
	else {
		F.bill_first_name.disabled = false;
		F.bill_last_name.disabled = false;
		F.bill_address1.disabled = false;
		F.bill_address2.disabled = false;
		F.bill_city.disabled = false;
		F.bill_state.disabled = false;
		F.bill_zip.disabled = false;				
		F.bill_phone1.disabled = false;
		F.bill_phone2.disabled = false;	
	}
}	


function FillOrderForm(F) {

	F.ship_first_name.value = "Kevin";
	F.ship_last_name.value = "DeCapite";
	F.ship_address1.value = "14901 Newport Avenue, #113";
	F.ship_address2.value = "";
	F.ship_city.value = "Tustin";
	F.ship_state.value = "CA";
	F.ship_zip.value = "92780";				
	F.ship_phone1.value = "216.577.2026";
	F.ship_phone2.value = "";	
	
	F.bill_first_name.value = "Joe";
	F.bill_last_name.value = "Rohan";
	F.bill_address1.value = "Creationsite";
	F.bill_address2.value = "3001 Bridge Avenue";
	F.bill_city.value = "Cleveland";
	F.bill_state.value = "OH";
	F.bill_zip.value = "44113";				
	F.bill_phone1.value = "216.538.7576";
	F.bill_phone2.value = "216.577.2026";
	
	F.cc_name.value = "Joe Rohan";
	F.cc_number.value = "1234123412341234";
	F.cc_security_code.value = "852";
	
}


function VerifyTerms(F) {
	var submitForm = 1;
	var errMsg = "";
	
	if ( (F.accept_terms.checked == false) ) {
		submitForm = 0;
		errMsg = "You must read and accept our Terms and Conditions before proceeding.";
	}
	
	if ( submitForm != 1 ) {
		alert(errMsg);
	}
	else {
		F.submit();
	}
}


function SelectPayment(F, paymentType) {
	if ( paymentType == "PO" ) {
		F.cc_name.value = "";
		F.cc_number.value = "";
		F.cc_security_code.value = "";
		F.cc_type.selectedIndex = 0;
		F.cc_exp_month.selectedIndex = 0;
		F.cc_exp_year.selectedIndex = 0;	
	}
	else if ( paymentType == "CC" ) {
		F.purchase_order.value = "";
	}
}