resizeElements = function() {
	var height = $(window).height();
	$('#concontainer').css("height",(height - 107) +"px");
	$('#searchcontainer').css("margin-top", ((height - 100) / 3) - 137 +"px");
}

this.imagePreview = function(){	
	$("a.preview").hover(function(e){
		this.t = this.title;
		var c = (this.t != "") ? this.t + "<br/>" : "";
		$("body").append("<p id='preview'>"+ c +"<img src='"+ this.rel +"' alt='Image preview' /></p>");								 
		$("#preview")
			.css("top", "55px")
			.css("right",($(window).width() - e.pageX - 15) + "px")
			.fadeIn();						
    },
	function(){
		this.title = this.t;	
		$("#preview").remove();
    });	
};

$(document).ready(function(){
imagePreview();

 $('.box h2').corners("bottom 9px");
	$(window).bind('resize', resizeElements);
	resizeElements();
	
	$('#searchcontainer').corners("16px no-mozilla");
	$('#searchform').corners("12px no-mozilla");

	$("#spanplace").hide();
	$("#spancategory").hide();

	document.getElementById("fpdropdown").size=7
	if ($("#placeinput").val() == 'Plaats of postcode') $("#placeinput").addClass('grayclass');

	
	$("#placeinput")
	.focus(function() {
		if ($(this).val() == 'Plaats of postcode') {
			$(this).removeClass('grayclass').val('');
		}
	})
	.blur(function() {
		if ($(this).val() == '') {
			$(this).addClass('grayclass').val('Plaats of postcode');
		}
	});
		
    $("form").submit(function() {
		if ($("input:first").val() == "Plaats of postcode" || $("#placeinput").val() == "") {
			$("#spanplace").slideDown("slow");
		} else $("#spanplace").slideUp();
		
		if ($("#fpdropdown option:selected").val() == "") {
			$("#spancategory").slideDown("slow");
		} else $("#spancategory").slideUp();
		
		
		if (($("#placeinput").val() != "Plaats of postcode") && ($("#placeinput").val() != "") && ($("#fpdropdown option:selected").val() != "")) {
			shop = $("#fpdropdown option:selected").val().replace(/ /g,"+");
			window.location = "/" + shop + "/" + $("input:first").val().replace(/ /g,"+");
			return false;
		} else return false;
    });


});

function placesearchfrm(shop,place) {
	shop = shop.replace(/ /g,"+");
	place = place.replace(/ /g,"+");
	window.location = "/" + shop + "/" + place;
}
  
   
