// http://www.java-scripts.net/javascripts/EMail-Address-Verification.phtml
function checkemail(str){
	var result;
	var filter=/^.+@.+..{2,3}$/;
	if (filter.test(str)) {
   		result=false
	} else {
		result=true
	}
	return (result)
}

$(document).ready(function(){
	$(".post:has(.page_entry)").css("border","none");
	if (($(".adsense *").size() == $(".adsense").size()*2) || ($(".adsense *").size() == 0)){
		$(".sidebar").prepend("<div class='sidebox adblock'><p><strong>Don't like ads? Me neither!</strong></p><p>You should know, though, that I don't make a lot of money through any of my websites. I'm mostly just kinda trying to break even... and I'm not even close so far.</p><p>Please consider disabling your browser's ad-blocking software for this site. In return, I will give you an appreciative high five if we ever meet in real life.</p><p>Thanks!</p></div>");
	};
	if (($.browser.msie && $.browser.version == "6.0") && (window.location == "http://iamnotagoodartist.com/")) {
		window.location = "http://iamnotagoodartist.com/page/1";
	};
 	$("#portfolio_nav a").click(function(event){
		$("#portfolio_nav a").removeClass("current");
		$(this).addClass("current");
		$(".portfolio").hide();
		var content_show = $(this).attr("title");
		$("#portfolio_"+content_show).show();
		return false;
	});
	$("#s").focus(function(){
		if ($("#s").val() == "Search...") { $("#s").val(""); }
	    this.select();
	});
 	$("#test").click(function(event){
 		alert("debugging");
		return false;
	});
	var position = $("#contact_form textarea.textinput").position();
	$("#contact_form textarea.textinput").css("height",$("ul.things").height()-position.top-$("#contact_form_minus").height()+30);
	$("#contact_form").submit(function(){
		$("#contact_form .ohno").fadeOut();
		var valid = 1;
		$("#contact_form .textinput").each(function (i) {
			if ($(this).val() == "") {
				$("#ohno_required_"+$(this).attr("name")).fadeIn();
				valid = 0;
			};
		});
		if (checkemail($("#contact_email").val()) && $("#contact_email").val() !== "") {
			$("#ohno_email").fadeIn();
			valid = 0;
		};
		if ($("#contact_captcha").val() !== "9" && $("#contact_captcha").val() !== "") {
			$("#ohno_captcha").fadeIn();
			valid = 0;
		}
		if (valid == 1) {
			return true;
		} else {
			return false;
		}
	});

});
