function check_query()
{
	searchForm = document.getElementById('search_form');
	theField = searchForm.q;
	theQuery = searchForm.q.value;
	
	
	if(theQuery.length<3)
	{
		alert('המילה קצרה מדי');
		theField.focus();
	}
	else
		{
			searchForm.submit();
		}
}









function handleForm()
{
	theForm = document.contactForm;
	nameValue = theForm.Name.value
	emailValue = theForm.Email.value
	
	if(trim(nameValue)=='')
	{
		alert('מלאו שם');
		theForm.Name.focus();
		return false;
	}
	
	if(trim(emailValue)=='')
	{
		alert('מלאו דוא"ל');
		theForm.Email.focus();
		return false;
	}
	
	if(checkMail(trim(emailValue))==false)
	{
		alert('תקנו דוא"ל');
		theForm.Email.focus();
		return false;
	}
	
	theForm.submit();
	wait();
	

}

function trim(stringToTrim) 
{
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}


function checkMail(emailVal)
{
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(emailVal)) 
	return true;
	return false;
}

function wait()
{
	document.getElementById('wait').innerHTML='<INPUT class="send" TYPE="button" value="המתן...">';
}