// Check e-mail validates
function checkMail(fld) {
	email = fld.value;
	if((/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))||(email="")){
		return (true);
	} else {
		error = "Please enter a valid email address.\n";
		alert(error);
		setTimeout(function() {
			 fld.focus();
		}, 1);
		return (false);
	}
}



function checkMailCart(str) {

        email = str;
        if((/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))||(email=""))
                return true;
        else
                return false;

}

// Check the imput text
function checkField(event,el,tp) {
	var t = (typeof event.which!="undefined"&& event.which!=null?event.which:event.keyCode),key;
	if (tp == 'none' || t < 20)return true;
	
	key = removeSpcChars(String.fromCharCode(t),el.type);
	switch (tp) {
	  case "text": case "full_name": return isAlfa(key)|| /[ ]/.test(key);
	}
}

// Remove Special chars
function removeSpcChars(vr,type) {
	var ret="",re=/197|198|208|215|216|222|223|229|230|240|247|248/,c=0,s=String(vr);
	for (var i=0;i<s.length;i++) {
 		c = s.charCodeAt(i);
		if ((c > 31&&c < 253&&(c < 127||c > 191)&&!re.test(c)) || (type=="textarea"&& (c==9||c==13||c==10)))ret+=s.charAt(i);
	}
	return ret;
}
function isAlfa(v) {return /^[a-zA-ZαινσϊηγυβκτΰΑΙΝΣΪΗΓΥΒΚΤΐ]+$/.test(v);}

