
/* פונקציות לתפריט ימני    */


function refresh(){
location.reload()
}



function back(){
history.back()
}

function fdate(a){
re = /^(\d{1,2})\/(\d{1,2})\/(\d{1,2})\ (\d{1,2})\:(\d{1,2})\:(\d{1,2})$/;
fromMDY = a.replace(re, "$2/$1/$3 $4:$5:$6");
alert (fromMDY)
}

function showRightClick()
	{
	rightClick.style.visibility="visible";
	rightClick.style.display="";
	rightClick.style.top=event.y;
	rightClick.style.left=event.x;
	
	}
	
function hideRightClick()
	{
	rightClick.style.display="none";
	
	}


document.write('<DIV id=rightClick > ');
document.write('<div style="BORDER-BOTTOM: #663300 1px solid; BACKGROUND-COLOR: gold" align=center>  ');
document.write('<b>תפריט ימני</b></div> ');
document.write('<div  id=sm2 onclick=refresh() onmouseover=color(this.id)  ');
document.write('onmouseout=uncolor(this.id)> רענן</div> ');
document.write('<div  id=sm3 onclick=back() onmouseover=color(this.id) onmouseout=uncolor(this.id)> ');
document.write(' חזור לדף קודם</div> ');
document.write('<div  id=sm4 onclick=window.print() onmouseover=color(this.id) onmouseout=uncolor(this.id)>  ');
document.write('הדפס</div> ');
document.write('<div  id=sm5  onmouseover=color(this.id) onmouseout=uncolor(this.id)>  ');
document.write('<A target=_blank href="index.asp">דף הבית</A></div> ');
document.write('</DIV> ');


/* פונקציות לבדיקת שדות    */

function hebs(str) {
	for (var i=0; i<str.length; i++) {
	
		if (	(str.charAt(i) <'א' || str.charAt(i)>'ת') 
		         && (str.charAt(i)!=' '))
		{
			return false;
		}
	}
	return true;
		
}


function engs(str) {
	for (var i=0; i<str.length; i++) {
	
		if (	(str.charAt(i) <'A' || str.charAt(i)>'Z')   
				&& (str.charAt(i)<'a' || str.charAt(i)>'z')
				&& (str.charAt(i)<'0' || str.charAt(i)>'9')
		        && (str.charAt(i)!='-') 
		        && (str.charAt(i)!='_'))
		{
			return false;
		}
	}
	return true;
		
}


function legal(str)
{	

	for (var i=0; i<str.length; i++) {
		if (	(str.charAt(i) <'A' || str.charAt(i)>'Z')   
				&& (str.charAt(i)<'a' || str.charAt(i)>'z')
				&& (str.charAt(i)<'א' || str.charAt(i)>'ת')
				&& !(str.charAt(i)<'9' || str.charAt(i)>'0')
				&& str.charAt(i)!='-'
				&& str.charAt(i)!='_'
				&& str.charAt(i)!='.'
				&& str.charAt(i)!=','
				&& str.charAt(i)!=' '
				&& str.charAt(i)!='/'    
				 )  {
			return false;
		}
	}	
	return true;
}

function s_legal(str)
{	

	for (var i=0; i<str.length; i++) {
		if (	(str.charAt(i) <'A' || str.charAt(i)>'Z')   
				&& (str.charAt(i)<'a' || str.charAt(i)>'z')
				&& (str.charAt(i)<'א' || str.charAt(i)>'ת')
				&& str.charAt(i)!=' '
   
				 )  {
			return false;
		}
	}	
	return true;
}

function nums(str)
{
	for (var i=0; i<str.length; i++) {
		if 	(!(str.charAt(i)<"9" || str.charAt(i)>"0") && str.charAt(i)!='-' && str.charAt(i)!='_' )  
		  {	
			return false;
		  }
		}	
	
	return true	;
}



function validEmail (email)
{
var pos = 0;
var eLen = 0;
var ehost='';
eLen = email.length;

for (var i=0; i<email.length; i++) {
		if 	(email.charAt(i) == " "  )  
		 {
		
			return false;
		}
	}	
	
pos = email.indexOf("@");
if (pos <= 0) 
		return false;
if (eLen - pos < 3) 
    return false;
if ( email.indexOf("@",pos+1) > -1)  
		return false;		
ehost = email.substr(pos+1);
eLen = ehost.length;
pos = ehost.indexOf(".");
if (pos <= 0) 
		return false;
if (eLen <= pos+2 ) 
		return false;		
		
return true;		
}


function Chk_no_spc(form){
	
	if (form.value=="") {
			alert ("יש למלא את השדה בו נמצא הסמן")
			form.focus();
			form.select();
			return false;
	} }     
  
function Chk_no_engs(form){


      if (!engs(form.value)) {
            alert("! יש להזין אותיות אנגליות ספרות או את התווים -_  השימוש ברווח אסור");
			form.focus();
			form.select();
			return false;
       }
    }     
    

function Chk_no_mail(form){
      

	if (!validEmail(form.value)) {
			alert("כתובת הדואל שהוקשה, שגויה");
			form.focus();
			form.select();
			return false;
	}	
} 

function Chk_no_nums(form){

	

    if (!nums(form.value)) {
            alert("יש להזין מספרים או את התווים הבאים: -_ בלבד");
			form.focus();
			form.select();
			return false;
       }
}  


function Chk_slegal(form){

	

    if (!s_legal(form.value)) {
            alert("יש להזין אותיות עבריות או אנגליות, ניתן להשתמש ברווח");
			form.focus();
			form.select();
			return false;
       }
}  

function Chk_no_legal(form){

	
      if (!legal(form.value)) {
            alert("יש להזין אותיות אנגליות, עבריות, מספרים, רווח או את התווים הבאים: /,-._ בלבד");
			form.focus();
			form.select();
			return false;
       }
   }  
   
   function Chk_no_hebs(form){


      if (!hebs(form.value)) {
             alert("יש להזין אותיות עבריות / רווחים בלבד");
			form.focus();
			form.select();
			return false;
       }
       } 
       
       
  function min_length(form,x){


      if (!(form.value.length>x-1)) {
            str="אורך מינימלי לשדה הינו "+ x +" תווים";
            alert( str);
			form.focus();
			form.select();
			return false;
       }
       } 
       
     function select(dropdown){
       
       
   
   if ((dropdown.value=="")) {
			alert("יש לבחור ערך כלשהו מתיבת הגלילה");
			dropdown.focus();
			
			return false;
			
			
			}
			}
			
function cheq(ck){
       
       
   
   if (!(ck(1).checked || ck(2).checked )) {
			alert("יש לבחור ערך זכר/נקבה");
			
			
			return false;
			
			
			}
			}