﻿<!--


var forms_ENGLISH = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ -";
var forms_HEBREW = "אבגדהוזחטיכלמנסעפצקרשתךףןםץ -";
var forms_DIGITS = "0123456789 -";

  
 
var  nameErrMsg ="אנא הכנס את שמך";
var  contactErrMsg ="אנא הכנס טלפון או דוא\"ל";
var  siteErrMsg;
var  emailErrMsg;
var  phoneErrMsg;

 
function chkinput(){
	if (document.forms[0].searchinput.value==''){
		document.getElementById('searchmsg').style.visibility='visible';
		document.forms[0].searchinput.focus();
		return false;	
	}
}
	
function IsNumeric(sText){
	return (ChkStrBy(sText,forms_DIGITS));
}


function IsHebrew(sText){
	return (ChkStrBy(sText,forms_HEBREW));
}

function IsEnglish(sText){
	return (ChkStrBy(sText,forms_ENGLISH));
}

function ChkStrBy(sText, sValidChars){
	var ret = true;
	if (sText.length<9) return (false);
	for (i = 0 ; i < (sText.length) && (ret==true) ; i++){ 
		if (sValidChars.indexOf(sText.charAt(i)) == -1){
			ret = false;
		}
	}
	return (ret);
}

function IsEmail(sText) 
{
	var at="@"
	var dot="."
	var lat=sText.indexOf(at)
	var lstr=sText.length
	var ldot=sText.indexOf(dot)
	if (sText=="" || sText==null){ return false }
	if (sText.indexOf(at)==-1 || sText.indexOf(at)==0 || sText.indexOf(at)==lstr){ return false }
	if (sText.indexOf(dot)==-1 || sText.indexOf(dot)==0 || sText.indexOf(dot)==lstr){ return false }
	if (sText.indexOf(at,(lat+1))!=-1){ return false }
	if (sText.substring(lat-1,lat)==dot || sText.substring(lat+1,lat+2)==dot){ return false }
	if (sText.indexOf(dot,(lat+2))==-1){ return false }
	if (sText.indexOf(" ")!=-1){ return false }
 	return true					
}

function IsPhone(sText){
	return (ChkStrBy(sText,"0123456789-"));
}

function validateForm()
{
	
	if (document.formcontact.name.value == "") 
	{
		document.formcontact.name.focus();
		alert(nameErrMsg);
		return false;
	}
	if (document.formcontact.email.value != "")
	{
		if (!IsEmail(document.formcontact.email.value))
		{
			alert("אנא הכנס דוא\"ל חוקי");	
			return false;
		}
	}
	
	if (document.formcontact.phone.value != "")
	{
		if (!IsPhone(document.formcontact.phone.value))
		{
			alert("אנא הכנס מספר טלפון חוקי");
			return false;
		}

	}

	if (document.formcontact.email.value == "" && document.formcontact.phone.value == "") 
	{
		alert(contactErrMsg);
		document.formcontact.email.focus();
		return false;
	}
	
	return true;
}

function validateContactForm()
{
	if (document.frmContact.name.value == "") 
	{
		document.frmContact.name.focus();
		alert(nameErrMsg);
		return false;
	}
	if (document.frmContact.email.value != "")
	{
		if (!IsEmail(document.frmContact.email.value))
		{
			alert("אנא הכנס דוא\"ל חוקי");	
			return false;
		}
	}
	if (document.frmContact.email.value == "")
	{
		if (!IsEmail(document.frmContact.email.value))
		{
			alert("אנא הכנס דוא\"ל");	
			return false;
		}
	}
}

function preloadImage(imgName)
{
	if (!document.myimages ) document.myimages=new Array();
	var d = document;
	d.myimages[imgName] = new Image();
	d.myimages[imgName].src = imgName;	
}


function OpenWindow(mypage,myname,w,h,scroll){
	var pos="center";
	var LeftPosition;
	var TopPosition;
	if (typeof pos == 'undefined') pos='center';
	if (typeof scroll == 'undefined') scroll='auto';
	if(pos=="random")
	{
		LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
		TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
	}
	if(pos=="center")
	{
		LeftPosition=(screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100;
	}
	else if((pos!="center" && pos!="random") || pos==null)
	{
		LeftPosition=0;TopPosition=20
	}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=window.open(mypage,myname,settings);
}

function CloseWindow(win)
{ 
	win.opener='x';
	win.close();
}


function checkTrialForm()
{
	
	if (document.DownloadTrial.name.value  == '')
	{
		alert("Please enter your name!");
		document.DownloadTrial.name.focus();
		return false;
	}	

	if (IsEmail(document.DownloadTrial.email.value) == false)
	{
		alert("Please enter valid email!");
		document.DownloadTrial.email.focus();
		return false;
	}
	
	//document.DownloadTrial.action = "Download.php";
	//document.DownloadTrial.submit();

	return true;
}

function checkSpanishForm()
{
	if (document.frmSendEmail.name.value=='')
	{
		alert("Falta su nombre !");
		document.frmSendEmail.name.focus();
		return false;
	}
    if (document.frmSendEmail.email.value=='')
	{
		alert("Falta su email !");
		document.frmSendEmail.email.focus();
		return false;
	}
	else if (IsEmail(document.frmSendEmail.email.value) == false)
	{
		alert("Por favor, inserte un email válido !");
		document.frmSendEmail.email.focus();
		return false;
	}
 
    return true;
}

function checkSpanishForm2()
{
	if (document.frmSendEmail2.name.value=='')
	{
		alert("Falta su nombre !");
		document.frmSendEmail2.name.focus();
		return false;
	}
    if (document.frmSendEmail2.email.value=='')
	{
		alert("Falta su email !");
		document.frmSendEmail2.email.focus();
		return false;
	}
	else if (IsEmail(document.frmSendEmail2.email.value) == false)
	{
		alert("Por favor, inserte un email válido!");
		document.frmSendEmail2.email.focus();
		return false;
	}
 
    return true;
}



//-->