						
							$(function(){
									   $(".formbtn").click(function(){
																			  
														$("#sidebarform").submit();	
														return false;
																			  });
									   			$("#sidebarform").submit(function(){
			 
						if (validateForm()){
														$("#thanks").show();
							 	return true;
						   
							}else{
							return false;
							}
														 });
									   
									   });
                            function IsEmail(email) {
            var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
            if (regex.test(email)) return true;
            else return false;
        } 
function validateForm(){
 if(lng==1){
			msg='יש למלות את השדות הבאים:\n';		
	mailError=' - כתובת המייל אינה תקינה ';
	//msg2='יש למלות לפחות מספר טלפון אחד';
 }else{
	 
	 		msg='Please fill the following fields:\n';		
	mailError=' -  Mail address is invalid';
	 
 }
	 rt=true; 
	 ro=false;
	 $(".reqOr").each(function() {
	 
	  if ($(this).val()) {
		  ro=true;
		  msg2='';
		  $("#validfieldc").hide();
		  $("#validfieldf").hide();
	  }
	 
							   });
	 if(!ro){
		 
		  $("#validfieldc").show();
		  $("#validfieldf").show();
	 }
	$(".req").each(function() {
							
			  if (!$(this).val()||($(this).attr("name")=="email"&&!IsEmail($(this).val()) ) ){
				 rt=false; 
				fName=$(this).attr("title");
			 
				msg+=fName;
				 
				if ($(this).attr("name")=="email"&&!IsEmail($(this).val()) &&$(this).val() )  msg+=mailError;
				 
				msg+="\n";
			  }
	 })
 
	if(!rt) alert(msg);
	return rt;
}

function clearForm(){
	
	
	$("#sidebarform").hide();
	$(".formttl").hide();
	$("#thanks").show();
	
	}	
                            
