function regExpSM(form) { 
	document.getElementById("email").style.background = "#fff";  
	var emailErrors = regExpSEmail(form.email.value); 
	if((emailErrors)!=""){
		if(emailErrors!="")
			document.getElementById("email").style.background = "red";		
		return false;
	}
	else{
		return true;
	}
}


function regExpS(form) { 	
	document.getElementById("name").style.background = "#fff";
	document.getElementById("mail").style.background = "#fff";
	document.getElementById("phone").style.background = "#fff";
	//document.getElementById("message").style.background = "#fff";
	var nameErrors = regExpSName(form.name.value);
	var emailErrors = regExpSEmail(form.mail.value);
	var phoneErrors = regExpSPhone(form.phone.value);
	//var messageErrors = regExpSMessage(form.message.value);
	if((nameErrors+emailErrors+phoneErrors/*+messageErrors*/)!=""){
		if(nameErrors!="")
			document.getElementById("name").style.background = "red";
		if(emailErrors!="")
			document.getElementById("mail").style.background = "red";		
		if(phoneErrors!="")
			document.getElementById("phone").style.background = "red";
		/*if(messageErrors!="")
			document.getElementById("message").style.background = "#f79521";*/
		return false;
	}
	else{
		return true;
	}
}
function regExpSName(name) {
	if(name=="")
		return "<li>חובה להזין שם</li>";
	var regExpS = /[^\A-Z\a-z\u05D0-\u05EA\ \']/;
	if(!regExpS.test(name))
		return "";
	else
		return "<li>שם לא חוקי</li>";
}
function regExpSEmail(email) {
	if(email=="")
		return "<li>חובה להזין אימייל</li>";	
	var regExpS = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	if(!regExpS.test(email))
		return "<li>אימייל לא חוקי</li>";
	else
		return "";		
}
function regExpSPhone(phone){
	if(phone=="")
		return "<li>חובה להזין טלפון</li>";		
	var regExpS = /[^\0-9\ \-]/;
	if(!regExpS.test(phone))
		return "";
	else
		return "<li>טלפון לא חוקי</li>";			
}	
function regExpSMessage(message){
	if(message=="")
		return "<li>חובה להזין הודעה</li>";
	else
		return "";
}
function color(id) {
	document.getElementById(id.id).style.background = "#fff";	
}
