$(window).load(function () { //safari height() fix; http://snipurl.com/do2lv
	
	$(".post-photos-entry, .post-more-info, .comment-spilled-guts").each(function(){
		var welkeClass = $(this).attr("class");
		var divHeight = $(this).height();
		var afkHeight = (Math.round(divHeight / 95));
		
		var newHeight = (afkHeight * 95);
		
		if (welkeClass == "post-photos-entry"){
			if (divHeight > newHeight){
				$(this).height(newHeight + 94);
			}
			else{
				$(this).height(newHeight - 1);
			}
		}

		if (welkeClass == "comment-spilled-guts"){
			if ((divHeight + 16) > newHeight){
				$(this).height(divHeight + (newHeight - divHeight) + 76);
			}
			else{
				$(this).height(divHeight + (newHeight - divHeight) - 19);
			}
		}
		
		if (welkeClass == "post-more-info"){
			if ((divHeight + 9) > newHeight){
				$(this).height(divHeight + (newHeight - divHeight) + 86);
			}
			else{
				$(this).height(newHeight - 9);
			}
		}
		
	});


	$(".post-photos").each(function(){
		var divHeight = $(this).height();
		var divVgl = (Math.round(divHeight / 95*100)/100);			
		var nummerOmgezet = divVgl.toString();					
		var nummerStr = nummerOmgezet.charAt(2);			
		var divDeel = (Math.round(divHeight / 95));
		if (nummerStr < "5"){
			var divDeel = (divDeel + 1);
		};
		var divMaal = (divDeel * 95);
		$(this).height(divMaal - 1);
	});

	$(".post-questions a").click(function(){
		$("#post-contact-form").animate({opacity: 'toggle', height: 'toggle'}, 200);
		return false;
	});


	$("#comment-top a, #comment-bottom a").click(function(){
		$("#comment-form").fadeTo(100, 0.1).fadeTo(100, 1).fadeTo(100, 0.1).fadeTo(100, 1);//highlight form
	});


	$("textarea, #comment-form-details input, #contact-form-details input, #contact-email-us-details input").focus(function(){
		$(this).css({"background-color":"#ed1c24", color:"#fff"});
		}).blur(function(){
		$(this).css({"background-color":"#fff", color:"#000"});
	});


	$("#nav-mailing a").click(function(){
		$("#search").hide();
		$("#mailing").animate({height: 'toggle'}, 200);
		return false;
	});


	$("#nav-search a").click(function(){
		$("#mailing").hide();
		$("#search").animate({height: 'toggle'}, 200);
		return false;
	});


	$("#search input#google").focus(function(){
		$(this).css({"background-image":"none"});
		}).blur(function(){
		$(this).css({"background-image":"url('http://www.google.com/images/poweredby_transparent/poweredby_FFFFFF.gif')"});
	});
	
	$("#contact-details a").click(function(){
		$("#contact-email-us").animate({height: 'toggle'}, 400);
		return false;
	});
	
});
