/////////////////////////////////////////////////////////////////ONLOAD//////////////////////////////////////////////////////////////////////////////////////////
$(document).ready(function(){
	
	$("a").each(
		function(){
			if($(this).attr("href")=="#") $(this).attr("href","javascript:;");
		}
	);
						   
	if (jQuery.browser.msie) {
		if(parseInt(jQuery.browser.version) == 6) {
			var ie6=1;
		}
	}
	/*
	if(ie6){
		$(".general ul.menu li img").each(
			function(){
				var src = $(this).attr("src").split(".png").join(".gif");
				$(this).attr("src",src);
			}
		);
	}
	*/
	$('.general .header').ifixpng();
	$('.general .main').ifixpng();
	$('.general ul.menu li a').ifixpng();
	$('.general ul.menu li a img').ifixpng();
	$('.general .right .posts .post .date').ifixpng();
	

		
	$(".newsletterForm a").click(function(){$(".newsletterForm").submit();});
	
	$(".addthis_container a img").attr("src","http://localhost/verticalnotes.com/php/wp-content/themes/vnotes/images/btnShare.png");
	
	$(".addthis_container a").addClass("mo");
	
	if(!ie6){
	$(".mo").each(
		function(){
			var src = $(this).children().attr("src").split(".png").join("Hover.png").split(".gif").join("Hover.gif");
			var w = $(this).children().width();
			var h = $(this).children().height();
			$(this).css("background-image","url("+src+")");
			$(this).width(w);
			$(this).height(h);
		}
	);
	
		$(".mo").hover(
			function(){
				$(this).children().css("visibility","hidden");
			},
			function(){
				$(this).children().css("visibility","visible");
			}
		);
	}
	
	$(".searchForm input").focus(function(){
		if($(this).val() == "Search"){$(this).val("")}
	});
	
	$(".searchForm input").blur(function(){
		if($(this).val() == ""){$(this).val("Search")}
	});
	


	
	$(".newsletterForm input").focus(function(){
		if($(this).val() == "email"){$(this).val("")}
	});
	
	$(".newsletterForm input").blur(function(){
		if($(this).val() == ""){$(this).val("email")}
	});
	
	
	$(".newsletterForm").submit(function(){
		var email = $(this).children("input").val();
		if(email.length<7 || email.indexOf("@")<1 || (email.indexOf("@")+2)>email.lastIndexOf(".") || email.lastIndexOf(".")>(email.length-2)){$(this).children("input").val("error");$(this).children("input").focus();return false;}
		$.ajax({
			type: "POST",
			url: stylesheet_directory+"/ajax.php",
			data: "act=newsletter&email="+email,
			success: function(msg){
				if(msg=="err"){alert("You have already subscribed to my blog!");return false;}
				else{alert("Thanks for subscribing to my blog");}
			}
		});
		return false;
	});
	
	$(".commentlist").html("<p class='cap'>Comments</p>"+$(".commentlist").html());
	
	$("#commentform").html("<p class='cap'>Leave a comment</p>"+$("#commentform").html());
	
	
});
//////////////////////////////////////////////////////////////////ONLOAD//////////////////////////////////////////////////////////////////////////////////////////


function submitSearchForm(){
	var s = $(".searchForm").children("input").val();
	window.location = "?s=" + s ;
}



