// General scripts for laemmle-holz.de
// Needs jQuery >= 1.3.2
// @author Mario Volke

$(document).ready(function() {

	// equal column height

	function equalHeight(elements, min_height) {
		var tallest = min_height;
		elements.each(function() {
			var h = $(this).height();
			if(h > tallest) {
				tallest = h;
			}
		});
		elements.height(tallest);
	}

	$(window).load(function() {
		equalHeight($("#bd > .body, #bd > .sidebar-right"), 300);
	});

	// labels in input values
	
	function inputLabel(elements) {
		elements.each(function() {
			var label = $(this).attr("value");
			$(this).focus(function() {
				if($(this).attr("value") == label) {
					$(this).attr("value", "");
				}
			});
			$(this).blur(function() {
				if($(this).attr("value") == "") {
					$(this).attr("value", label);
				}
			});
		});
	}

	inputLabel($("input.search"));

	// gallery slider
	$("#bd .sidebar-right .gallery").easySlider({
		prevText: '&lt;&lt;',
		nextText: '&gt;&gt;',
		auto: false,

		continuous: false 
	});

	// fancybox
	$("#bd .sidebar-right .gallery a, #bd .body a.image").fancybox();
});

