﻿//<script>
//Trimming
String.prototype.trim = function(){
	return this.replace(/^\s*|\s*$/g, ""); 
}

//Validate Email
function isEmail(s) {
	var re = /^[a-z][\w\-\.]*@([a-z0-9\-]*\.)+[a-z]{2,}$/i;
	return re.test(s);
}

// Validate Phone
function isPhone(s) {
	var re = /^[\d\-]+$/;
	return re.test(s);
}

function CheckContact(){
	var str = lWrongitems + "\n\n";
	var err = false;
	var pErr = false;
		
	var email = document.forms["frmContact"].email;
	
	if(email.value.trim() == ""){
		str += lFrmEmailEmptyErr + "\n";
		err = true;
	}else{
		if(!isEmail(email.value)){
			str += lFrmEmailErr + "\n"
			err = true
		}
	}

	if(err)
		alert(str);
	else
		frmSubmit("frmContact");
}

//Submit Forms
function frmSubmit(el) {
	document.getElementById("cmdSubmit").disabled = true;
	document.forms[el].submit();
}
