$(document).ready(function(){
	//Link to Home in header
	$(".homelink").click(function() {  
	window.location = "/";
	}); 

	//Projects list
	$('div#show_hide > div').hide();  
	$('div#show_hide > h3.slider').click(function() {
		$(this).toggleClass('opened');
		$(this).next('div').slideToggle('fast')
		.siblings('div:visible').slideUp('fast');
		$(this).siblings('h3.opened').removeClass('opened');
	});

	$('div#show_hide > h3.opened').each(function(){
	$(this).next('div').slideToggle('fast')
		.siblings('div:visible').slideUp('fast');
		$(this).siblings('h3.opened').removeClass('opened');
	});	

	//Projects list
	$('div#sample_poems > div').hide();  
	$('div#sample_poems > h4').click(function() {
		$(this).toggleClass('opened');
		$(this).next('div').slideToggle('fast')
		.siblings('div:visible').slideUp('fast');
		$(this).siblings('h4.opened').removeClass('opened');
	});

	$(".alternating:odd").addClass("alt");

	$(".project_container img").each(function(){
    		var imgPath = $(this).attr("src");
		var pathIndex = imgPath.indexOf("/wp-content/blogs.dir");
		var pathEnd = imgPath.indexOf("&aoe");
		var imgPath = (imgPath.slice(pathIndex,pathEnd));
		var imgHeight = $(this).attr("height");
		var imgWidth = $(this).attr("width");
		var altText = $(this).attr("alt");
		//var phpThumb = '/wp-content/plugins/phpThumb/phpThumb.php?src=' + imgPath + '&aoe=1&q=100&w=' + imgWidth + '&h=' + imgHeight;
		$(this).wrap("<a class=\"thickbox\" href=\"" + imgPath + "\" title=\"" + altText + "\"></a>");
		//$(this).attr({ src: phpThumb });
	});

	//Firefox puts <br> tags in the list, lets remove them
	$(".detail_list br").remove();

});
