// Civil Eats Global JavaScript v1.0

$(document).ready(function(){

// fix IE6/7 dislike of :last-child
	$("#header ul#navigation_main li:last-child").css("border","none");
	
// Index image handler funtions

	if (process_images === true) {
		$("#column_left .post_right img").hide();
	
		// prep
		var post_count = $("#column_left > *").size();
		var post = $("#column_left div:first");
		var post_image;
		var post_permalink;
		var i = 0;
	
		for (i = 0; i <= post_count;i++) {
			// get image src
				post_image = $(post).find("img:first").attr("src");
				$(post).find(".entry div:first").css("marginRight","0");
				if (post_image === undefined) {
					post_image = "http://civileats.com/wp-content/themes/civileats/images/placeholder.gif";
				}
			// get post permalink
				post_permalink = $(post).find("h3:first a").attr("href");
			// insert image
				$(post).find(".post_left").append('<a href="'+post_permalink+'"><img style="width: 165px;" src="'+post_image+'" alt="" /></a>');
			// move to next and start over
				post = $(post).next();
		}
	}

// Global Search Input

	$("#s").click(function(){
		if($(this).val()==="Search") {
			$(this).focus().val("");
		}
	});
	
	$("#s").blur(function(){
		if($(this).val()==="") {
			$(this).val("Search");
		}
	});


// Global Newsletter Input

	$("#email_address").focus(function(){
		if($(this).val()==="Email Address") {
			$(this).val("");
		}
	});

	$("#email_address").blur(function(){
		if($(this).val()==="") {
			$(this).val("Email Address");
		}
	});
	
});