$(document).ready(function() {
	$('a[href^="mailto"]').each(function (i) {
		var temp = $(this).html();
		temp = temp.replace("[atte]","@");
		temp = temp.replace("[p]",".");
		$(this).html(temp);
		if($(this).attr("href")){
				var temphref = $(this).attr("href");
				temphref = temphref.replace("[atte]","@");
				temphref = temphref.replace("[p]",".");
				$(this).attr("href",temphref);
		}
	});
});

function checkEmail(email){
	if ((email.indexOf("@")==-1) || (email.indexOf("@")==0) || (email.indexOf("@")!=email.lastIndexOf("@")) || (email.indexOf(".")==email.indexOf("@")-1) || (email.indexOf(".")==email.indexOf("@")+1) || (email.indexOf("@")==email.length-1) || (email.indexOf(".")==-1) || (email.lastIndexOf(".")==email.length-1)){
		return false;
	}else{
		return true;
	}
}

function checkMail(){
	if(document.getElementById("name").value == "")
	{
		alert("Please enter your Name");
		return false;
	}

	if(document.getElementById("email").value == "")
	{
		alert("Please enter your Email");
		return false;
	}

	testmail=document.getElementById("email").value;
	if(!checkEmail(testmail))
	{
		alert("Please enter a valid Email");
		return false;
	}
	
	if(document.getElementById("message").value == "")
	{
		alert("Please enter a Message");
		return false;
	}
}
