function displaycategory(level,id) {
	if (document.getElementById('tl'+level+id)==null) {
	} else {
		if (document.getElementById('tl'+level+id).style.display=='') {
			document.getElementById('tl'+level+id).style.display='none';
		} else {
			document.getElementById('tl'+level+id).style.display='';
		}
	}
}
function validateloginformsubmit() {
	emailaddress=document.getElementById('emailaddress').value;
	password=document.getElementById('password').value;
	document.getElementById('loginform').submit();
}
function isValidEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}
function validateregistrationform() {
	var formvalidation=true;
	emailaddress=document.getElementById('emailaddress').value;
	emailaddress=isValidEmail(emailaddress);	
	if (emailaddress==false) {
		formvalidation=false;
		alert('כתבות הדוא"ל שהוזנה אינה תקינה');
	} else {
		password=document.getElementById('password').value;
		if (password.length<6) {
			formvalidation=false;
			alert('הסיסמא חייבת להכיל לפחות 6 תווים');
		} else {
			var firstname=document.getElementById('firstname').value;
			var lastname=document.getElementById('lastname').value;
			if ((firstname=='')||(lastname=='')) {
				formvalidation=false;
				alert('שם פרטי ושם משפחה שדות חובה');
			} else {
				formvalidation=true
			}
		}
	}	
	if (formvalidation==true) {
	  document.getElementById('registrationform').submit();
	}
}