//Swap Images On Home Page
function swap_images(imgname, status, dir){
	document.images[imgname].src=dir+"images/"+imgname+status+".jpg";
}

function same_info(){

	if(document.checkout.sameinfo.checked){
		document.checkout.s_f_name.value=document.checkout.b_f_name.value;
		document.checkout.s_l_name.value=document.checkout.b_l_name.value;
		document.checkout.s_address.value=document.checkout.b_address.value;
		document.checkout.s_address2.value=document.checkout.b_address2.value;
		document.checkout.s_company.value=document.checkout.b_company.value;
		document.checkout.s_city.value=document.checkout.b_city.value;
		document.checkout.s_zip.value=document.checkout.b_zip.value;
		sid=document.checkout.b_id_state.selectedIndex;
		document.checkout.s_id_state.options[sid].selected=true;
		sid=document.checkout.b_id_country.selectedIndex;
		document.checkout.s_id_country.options[sid].selected=true;
		document.checkout.s_phone.value=document.checkout.b_phone.value;
	}
}
	
function isValidZipCode(value) {
   var re = /^\d{5}([\-]\d{4})?$/;
   return (re.test(value));
}
function checkout_submit(){
	check=document.checkout.b_f_name.value;
	check=check.replace(/(^\s*)|(\s*$)/g,''); 
	if(check==""){alert("Please enter the First Name for Billing Info."); document.checkout.b_f_name.focus(); return false;}

	check=document.checkout.b_l_name.value;
	check=check.replace(/(^\s*)|(\s*$)/g,''); 
	if(check==""){alert("Please enter the Last Name for Billing Info."); document.checkout.b_l_name.focus(); return false;}

	check=document.checkout.b_address.value;
	check=check.replace(/(^\s*)|(\s*$)/g,''); 
	if(check==""){alert("Please enter the Billing Address."); document.checkout.b_address.focus(); return false;}

	check=document.checkout.b_city.value;
	check=check.replace(/(^\s*)|(\s*$)/g,''); 
	if(check==""){alert("Please enter the City for Billing Info."); document.checkout.b_city.focus(); return false;}

	check=document.checkout.b_zip.value;
	check=check.replace(/(^\s*)|(\s*$)/g,''); 
	if(check==""){alert("Please enter the Zip Code for Billing Info."); document.checkout.b_zip.focus(); return false;}

	check=document.checkout.b_phone.value;
	check=check.replace(/(^\s*)|(\s*$)/g,''); 
	if(check==""){alert("Please enter the Phone # for Billing Info."); document.checkout.b_phone.focus(); return false;}

	
	
	check=document.checkout.s_f_name.value;
	check=check.replace(/(^\s*)|(\s*$)/g,''); 
	if(check==""){alert("Please enter the First Name for Shipping Info."); document.checkout.s_f_name.focus(); return false;}

	check=document.checkout.s_l_name.value;
	check=check.replace(/(^\s*)|(\s*$)/g,''); 
	if(check==""){alert("Please enter the Last Name for Shipping Info."); document.checkout.s_l_name.focus(); return false;}

	check=document.checkout.s_address.value;
	check=check.replace(/(^\s*)|(\s*$)/g,''); 
	if(check==""){alert("Please enter the Shipping Address."); document.checkout.s_address.focus(); return false;}

	check=document.checkout.s_city.value;
	check=check.replace(/(^\s*)|(\s*$)/g,''); 
	if(check==""){alert("Please enter the City for Shipping Info."); document.checkout.s_city.focus(); return false;}

	check=document.checkout.s_zip.value;
	check=check.replace(/(^\s*)|(\s*$)/g,''); 
	if(check==""){alert("Please enter the Zip Code for Shipping Info."); document.checkout.s_zip.focus(); return false;}

	check=document.checkout.s_phone.value;
	check=check.replace(/(^\s*)|(\s*$)/g,''); 
	if(check==""){alert("Please enter the Phone # for Shippig Info."); document.checkout.s_phone.focus(); return false;}
}

function setBG(element, imgname, dir){
	element.style.backgroundImage='url('+dir+'images/'+imgname+'.jpg)';
	element.style.cursor="pointer";
}


function updateValues(id){

	sel=document.getElementById("sel"+id);
	sel_idx=sel.selectedIndex;
	document.getElementById("theprice"+id).innerHTML = pd_price[sel.options[sel_idx].value];

}
