
function validateEmail(email) {
	var matches = email.match(/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/);
	return (matches != null && email == matches[0]);
}
function strTrim(str){
  str=str.replace(/(^\s*)|(\s*$)/g, "");
  if (str.length==0){
    return false;
  }
  return true;
} 
 
function checkForm(){
  if(!strTrim(document.all['FromName'].value) || !validateEmail(document.all['email'].value) ||  !validateEmail(document.all['to'].value)){
    alert(' *Please, fill in all mandatory fields and correct Email address');
    return false;
  }   
return true;
}

function SendContactForm(formname)
{
	
	
	if (document.getElementById("FirstName").value=="")
	{
			alert('חובה למלא שת שמך');
			document.getElementById("FirstName").focus();		
			return;
	}
	else if (document.getElementById("LastName").value=="")
	{
			alert('חובה למלא את שם המשפחה');
			document.getElementById("LastName").focus();		
			return;
	}
	
	if (document.getElementById("EmailAddress").value=="")
	{
			alert('חובה למלא את כתובת הדוא"ל');
			document.getElementById("EmailAddress").focus();		
			return;
	}	
		else if((document.getElementById("EmailAddress").value).match(/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/)==null)	
		{
		alert('כתובת הדוא"ל אינה תקינה');
			document.getElementById("EmailAddress").focus();		
			return;
		}
	
		else if (document.getElementById("Message").value=="")
	{
			alert('חובה למלא את ההודעה');
			document.getElementById("Message").focus();		
			return;
	}
	
	else
	{
		//alert(document.getElementById("Country").value);
		//alert ('xxx');
		eval("document.forms['"+formname+"'].submit()");
	}
}


function SendFriendForm(formname)
{
	if (document.getElementById("RecipientName").value=="")
	{
			alert('חובה למלא את שם החבר');
			document.getElementById("RecipientName").focus();		
			return;
	}
	
	
	if (document.getElementById("to").value=="")
	{
			alert('חובה למלא את כתובת הדוא"ל של חברך');
			document.getElementById("to").focus();		
			return;
	}	
		else if((document.getElementById("to").value).match(/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/)==null)	
		{
		alert('כתובת הדוא"ל של חברך אינה תקינה');
			document.getElementById("to").focus();		
			return;
		}
	if (document.getElementById("FromName").value=="")
	{
			alert('חובה למלא את שמך');
			document.getElementById("FromName").focus();		
			return;
	}
	if (document.getElementById("email").value=="")
	{
			alert('חובה למלא את כתובת הדוא"ל שלך');
			document.getElementById("email").focus();		
			return;
	}	
		else if((document.getElementById("email").value).match(/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/)==null)	
		{
		alert('כתובת הדוא"ל אינה תקינה');
			document.getElementById("email").focus();		
			return;
		}	
	else
	{
		//alert(document.getElementById("Country").value);
		//alert ('xxx');
		eval("document.forms['"+formname+"'].submit()");
	}
}
function nana(objitem,mycoubt)
{
		 for (var i=1 ; i <= mycoubt; i++)
		 {
		 document.getElementById('divContent' + i).style.display='none' ;
		 //document.getElementById('imgbtnContent' + i).src='files/homepage_buttons/button' + i + '.gif' ;
		 }
 		 document.getElementById('divContent' + objitem).style.display='block' ;
		 //document.getElementById('imgbtnContent' + objitem).src=img2 ;

}
