/**
 * Author 	: Ihsan Baris Bikmaz
 * Copyright (c) namics.ag
 * requires 	: jQuery
 */

function checkSubmit ( me )
{
	var blnSend = true;
	var Check	= new Checking();
	var $J 		= jQuery.noConflict();
	
	$J(":text", me).each ( function ()
	{
		if ( this.id.indexOf("email") != -1 )
		{
			if ( Check.Mail( this.value ) == false )
			{
				$J(this).parent(":first").children(".error").html("<p>Ihre Email Adresse ist nicht korrekt</p>").show("slow");
				blnSend = false;
			}
			else
			{
				$J(this).parent(":first").children(".error").html("<p>Ihre Email Adresse ist nicht korrekt</p>").hide("slow");
			}
			
		}
		else if (this.value == "")
		{
			$J(this).parent(":first").children(".error").show("slow");
			blnSend = false;
		}
		else
			$J(this).parent(":first").children(".error").hide("slow");
	});
	
	return blnSend;
}


var Checking = function() {

	this.Mail = function ( strEmail )
	{
		var x = strEmail;
		var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})$/;
		if (filter.test(x)) 
			return true;
		else
			return false;
	}
}