jQuery.noConflict(); // Fix in case prototype or other libraries are used besides jQuery.

jQuery(document).ready(function($) {
	
	
	$("a#btnSubmitSearch").click(function() {
		document.frmSearch.submit();
		return false;
	});
	
	$("a#btnSubmitLogon").click(function() {
		document.frmLogon.submit();
		return false;
	});
	
	$("a#btnSubmitNews").click(function() {
		document.frmNewsletter.submit();
		return false;
	});
	
	$("input#txtNewsEmail")
		.focus(function() {
			if (this.value == "Uw emailadres")
				this.value = "";
		})
		.blur(function() {
			if ($.trim(this.value) == "")
				this.value = "Uw emailadres";
	});
	
	
	if ($("form[@name=contactUs]").size() > 0) {
		if ($("form[@name=contactUs] select[@name=emailSubject]")[0].selectedIndex > 0)
			$("div#customerInfo").show();
		else
			$("div#customerInfo").hide();
	}
	
	$("form[@name=contactUs] select[@name=emailSubject]").change(function() {
		if (this.selectedIndex > 0)
			$("div#customerInfo").show();
		else
			$("div#customerInfo").hide();
	});
	
	$("a#bulk-show-img").toggle(
		function() {
			$(this).text("Hide all images");
			$("img.bulk-prod-image").show();
		},
		function() {
			$(this).text("Show all images");
			$("img.bulk-prod-image").hide();
		}
	);
	
	$("img.bulk-prod-image").hide();
	$("tr.bulk-prod-row").hover(
		function() {
			if ($("a#bulk-show-img").text() == "Show all images") {
				$(this)
				.find("td").css({"background-color": "#D8EBFE", "border-bottom": "1px solid #333333"})
				.find("img.bulk-prod-image")
				.show()
				.css({
					"position": "absolute",
					"top": "8px",
					"left": "8px",
					"padding": "10px",
					"border": "1px solid #333333",
					"border-top-width": "0",
					"background-color": "#D8EBFE"
				});
			}
		},
		function() {
			if ($("a#bulk-show-img").text() == "Show all images") {
				var sOldCss = $(this).find("td").attr("bgcolor");
				$(this).find("td").css({"background-color": sOldCss, "border-width": "0"})
				.find("img.bulk-prod-image").removeAttr("style").hide();
			}
		}
	);
	
	$("a[rel*=facebox]").facebox();
});

getPageHeight = function() {
	var hL = jQuery("div#column-left").height();
	var hR = jQuery("div#column-right").height();
	var hM = jQuery("div#shop-content").height();

	var newHeight = (hM < hL || hM < hR) ? (hL < hR	? hR : hL) : (hM + 10);
	
	return newHeight;
}