$(document).ready(function() {
	// Focus form fields
	$('.focus').focus();
	
	// Preload hover images
	$(".hover img").each(function() {
		// Set the original src
		hoversrc = $(this).attr("src");
		hoverActive = hoversrc.replace(/.png$/ig,"-hover.png");
		$("<img>").attr("src", hoverActive);
	});
		
	// Hover effect
	$(".hover").mouseover(function(){
		imgsrc = $(this).children("img").attr("src");
		matches = imgsrc.match(/-hover/);
		// don't do the hover if state is already ACTIVE
		if (!matches) {
		imgsrcActive = imgsrc.replace(/.png$/ig,"-hover.png"); // strip off extension
		$(this).children("img").attr("src", imgsrcActive);
	}
	});
	$(".hover").mouseout(function(){
		$(this).children("img").attr("src", imgsrc);
	});
	// SJEKK: http://www.shopdev.co.uk/blog/jquery-rollovers-using-this/

	// Equal height function
	function equalHeight(group) {
		var tallest = 0;
		group.each(function() {
			var thisHeight = $(this).height();
			if(thisHeight > tallest) {
				tallest = thisHeight;
			}
		});
		group.height(tallest);
	}

	// Set equal heights
	//$('body.Presse .equalOne').removeClass('equalOne'); //debug-test
	equalHeight($(".equalOne"));

	// Clickable (big targets)
	$(".clickable").fitted();

});


