Event.observe(window, "load", function() 
{
	var imagedis = $("imagedisplay");
	if (imagedis)
	{
		var image1 = $("smallimage1");
		var image2 = $("smallimage2");
		var image3 = $("smallimage3");
		var image4 = $("smallimage4");
		if (image1)
		{
			image1.observe("mouseover", function() { imagedis.setAttribute("src", image1.src); });
		}
		if (image2)
		{
			image2.observe("mouseover", function() { imagedis.setAttribute("src", image2.src); });
		}
		if (image3)
		{
			image3.observe("mouseover", function() { imagedis.setAttribute("src", image3.src); });
		}
		if (image4)
		{
			image4.observe("mouseover", function() { imagedis.setAttribute("src", image4.src); });
		}
	}
});

function updateShippingTaxes()
{
	var btn = $("checkout_button");
	var form = $("checkout_form");
	if (btn && form)
	{
		//LoadingImage.open({element: "order_summary"});
		var params = form.serialize(true);
		params.submit = true;
		//btn.disable();
		var request = new Ajax.Request("https://www.vindictive-apparel.com/store/updatecheckout.php", {parameters: params, onComplete: closeLoading.bind(null, btn)});
	}
}
function closeLoading(btn, t)
{
	updater(t);
	LoadingImage.close();
	btn.enable();
}
function updateAddress()
{
	var checkbox = $("sameasbilling");
	if (checkbox && $F(checkbox))
	{
		var shipping = {first_name: $("shipping_first_name"), last_name: $("shipping_last_name"),
			address1: $("shipping_address1"), address2: $("shipping_address2"), city: $("shipping_city"),
			state: $("shipping_state"), zip: $("shipping_zip"), country: $("shipping_country"),
			company: $("shipping_company")};
		var billing = {first_name: $("billing_first_name"), last_name: $("billing_last_name"),
			address1: $("billing_address1"), address2: $("billing_address2"),
			city: $("billing_city"), state: $("billing_state"),
			zip: $("billing_zip"), country: $("billing_country"),
			company: $("billing_company")};
		shipping.first_name.value = billing.first_name.getValue();
		shipping.last_name.value = billing.last_name.getValue();
		shipping.address1.value = billing.address1.getValue();
		shipping.address2.value = billing.address2.getValue();
		shipping.city.value = billing.city.getValue();
		shipping.state.value = billing.state.getValue();
		shipping.zip.value = billing.zip.getValue();
		shipping.country.value = billing.country.getValue();
		shipping.company.value = billing.company.getValue();
		updateShippingTaxes();
	}
}
