/*!
 * Validate Form beta
 *
 * Copyright 2010, xiuy
 *
 * http://xiuy.net
 */
function Inputvalidation(id){
	var re = new RegExp("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");
	if(document.getElementById(id).id=="email"){
		if(document.getElementById(id).value.match(re)){
			$("#"+document.getElementById(id).id).css("background-color","#FFFFFF")
			return true
		}
		else{
			shake(id);
			return false
		}
	}
	else{
		if(document.getElementById(id).value){
			$("#"+document.getElementById(id).id).css("background-color","#FFFFFF")
			return true
		}
		else{
			shake(id);
			return false
		}		
	}
}
function shake(id){
	$(document).ready(function(){
	$("#"+document.getElementById(id).id).effect("bounce",{ times:5,distance:20 }, 100);
	$("#"+document.getElementById(id).id).css("background-color","#FF8080");
	$("#"+document.getElementById(id).id).animate({"background-color": "#FFFFFF"},"slow");
	});
}
function test(thisform){
	if(Inputvalidation(thisform.author.id)&&
		Inputvalidation(thisform.email.id)&&
		Inputvalidation(thisform.comment.id)){
			return true}
	else{
		return false
	}
}
