/*
  Christine Alberts
  Copyright (C) 2009 by Systemantics, Bureau for Informatics

  Lutz Issler
  Mauerstr. 10-12
  52064 Aachen
  GERMANY

  Web:    www.systemantics.net
  Email:  mail@systemantics.net

  Permission granted to use the files associated with this
  website only on your webserver.

  Changes to these files are PROHIBITED due to license restrictions.
*/



$(function() {
	$("#shippingaddress input[type=text], #shippingaddress select")
		.attr("disabled", $("#shipping_to_billing").attr("checked"));
	$("#shipping_to_billing").click(function() {
		$("#shippingaddress input[type=text], #shippingaddress select")
			.attr("disabled", $(this).attr("checked"));
		if (!$(this).attr("checked")) {
			$("#shippingaddress input[type=text]").eq(0).focus();
		}
	});

	$("#submit").click(function() {
		$(this).parents("form").submit();
	});

	if ($("#continue").length>0 && $("#continue").offset().top<522) {
		$("#continue").css({
			position: "absolute",
			top: 522-$("#cart").offset().top
		});
	}

	$('<div id="zoom-overlay"></div>')
		.click(function() {
			location.href = $("#image a").attr("href");
		})
		.appendTo("#image:not(.info)");

	$(window).resize();
});

$(window).resize(function() {
	$("#container").css("left", ($(window).width()-$("#container").width())/2);
	var img = $("#zoomedimage img");
	if (img.length==1) {
		var ratio = img.attr("width")/img.attr("height");
		$("#zoomedimage img")
			.width($(window).width())
			.height($(window).width()/ratio);
	}
});

