// the code below calls the init function as soon as the dom is loaded.
// from http://dean.edwards.name/weblog/2006/06/again/?full

/* for Mozilla */
if (document.addEventListener) {
	document.addEventListener("DOMContentLoaded", init, false);
}

/* for Internet Explorer */
/*@cc_on @*/
/*@if (@_win32)
document.write("<script id=__ie_onload defer src=//0><\/script>");
var script = document.getElementById("__ie_onload");
script.onreadystatechange = function() {
if (this.readyState == "complete") {
init(); // call the onload handler
}
};
/*@end @*/

/* for other browsers */
window.onload = init;

// end dean edwards code

function init() {
	doShippingAddress();
}

function doShippingAddress() {
	if ($("sameasbilling")) {
		var d = $("sameasbilling").checked;
		$("sname").disabled     = d;
		$("saddress1").disabled = d;
		$("saddress2").disabled = d;
		$("scity").disabled     = d;
		$("sstate").disabled    = d;
		$("szip").disabled      = d;
		$("scountry").disabled  = d;
		if (d) {
			Element.addClassName($("sname"), "disabled");
			Element.addClassName($("saddress1"), "disabled");
			Element.addClassName($("saddress2"), "disabled");
			Element.addClassName($("scity"), "disabled");
			Element.addClassName($("sstate"), "disabled");
			Element.addClassName($("szip"), "disabled");
			Element.addClassName($("scountry"), "disabled");
		} else {
			Element.removeClassName($("sname"), "disabled");
			Element.removeClassName($("saddress1"), "disabled");
			Element.removeClassName($("saddress2"), "disabled");
			Element.removeClassName($("scity"), "disabled");
			Element.removeClassName($("sstate"), "disabled");
			Element.removeClassName($("szip"), "disabled");
			Element.removeClassName($("scountry"), "disabled");
		}
	}
}
