
	$(document).ready(function() {
		$("form").submit(function() {
			if ($("form .url").val() == "http://")
				$("form .url").val("");
		});
		$("form").validate();

		$("form .screenshots a.new").click(function(event) {
			event.preventDefault();
			$(this).blur();

			$("form").attr("action", '/SiteNovo/Screenshot/Upload/' + $("#ID").val()).submit();
		});

		$("form .screenshots a.save").click(function(event) {
			var desc = $("#Description-" + this.id).val();

			this.href += "/" + this.id + "?description=" + desc;
		});

		$(".products .screenshots a").fancybox();

		$("form .screenshots div img").load(function() {
			$(this).parents(".holder").width($(this).width());
			$(this).parents(".holder").height($(this).height());
		});

		$("form .screenshots div").each(function() {
			$(this).width($(this).find("img").width());
			$(this).height($(this).find("img").height());
		});

		$("div.container").css({
			minHeight: ($(window).height() - 106 - 48) + "px"
		});

		// Must set the height to the window's height and then to the document's height or weird things will happen
		$("div.body").css({
			height: $(window).height() + "px"
		});
		$("div.body").css({
			height: $(document).height() + "px"
		});

		$(window).resize(function() {
			$("div.container").css({
				minHeight: ($(window).height() - 106 - 48) + "px"
			});

			// Must set the height to the window's height and then to the document's height or weird things will happen
			$("div.body").css({
				height: $(window).height() + "px"
			});
			$("div.body").css({
				height: $(document).height() + "px"
			});
		});
	});
	//
