function IsEmailValid(checkThisEmail)
{
var myEMailIsValid = true;
var myAtSymbolAt = checkThisEmail.indexOf('@');
var myLastDotAt = checkThisEmail.lastIndexOf('.');
var mySpaceAt = checkThisEmail.indexOf(' ');
var myLength = checkThisEmail.length;

if (myAtSymbolAt < 1 )
 {myEMailIsValid = false}

if (myLastDotAt < myAtSymbolAt)
 {myEMailIsValid = false}

if (myLength - myLastDotAt <= 2)
 {myEMailIsValid = false}

if (mySpaceAt != -1)
 {myEMailIsValid = false}

return myEMailIsValid
}

function link_hover(field,pic)
{
	document.all(field).src = "images/" + pic;
}
function change_page(src)
{
	document.all('main_frame').src = src;
}
function change_pic(field,pic)
{
	document.all(field).src = "images/" + pic;
}
function login()
{
	TheForm = document.frm_login;
	
	if (TheForm.username.value == '')
	{
		alert("נא הזן שם משתמש");
		TheForm.username.focus();
		return;
	}
	if (TheForm.password.value == '')
	{
		alert("נא הזן סיסמא");
		TheForm.password.focus();
		return;
	}
	if (IsEmailValid(TheForm.username.value) == false)
	{
		alert("דואר אלקטרוני שגוי");
		TheForm.username.focus();
		return;
	}
	
	TheForm.action = "index.php?page=login&cmd=login";
	TheForm.submit();
}
function send_mail()
{
	TheForm = document.contact1;
	
	if (TheForm.first_name.value == '')
	{
		alert("נא הזן שם");
		TheForm.first_name.focus();
		return;
	}
	if (TheForm.phone1.value == '')
	{
		alert("נא הזן מס טלפון");
		TheForm.phone1.focus();
		return;
	}
	
	TheForm.action = "index.php?page=contact&cmd=send";
	TheForm.submit();
}
function check_contact_info()
{
	TheForm = document.contact1;
	if (TheForm.info.value == 'אחר')
	{
		document.all("other1").style.display = "block";
	}
	else
	{
		document.all("other1").style.display = "none";
	}
}
function open_weapon(URL)
{
	window.open(URL,'_blank','toolbar=no,location=center,center=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=600,height=600');
}