/* author:  */
/* Creation date: 05/06/2003 */
/*<script language='JavaScript'>*/
/* GLOBAL Functions ................*/

//links events
function Lmover(id,c)
{
	var d 
	  d=document.getElementById(id);
	  d.style.color=c
	  d.style.cursor='hand'		
}
function Lmout(id,c)
{
	var d 
	  d=document.getElementById(id);
	  d.style.color=c
}
function Lgoto(url)
{
	var d
	 
	window.open(url);
	 
	d.blur()
}
//---------------------------------------------
//main menu events handle
function mstop(mrq)
{
    var d 
	
	alert(mrq)
	  mrq = 'mrq' 				
	  d=document.getElementById(mrq);
	  alert(d.name)
	  d.stop
}

function mover(id)
{
	var d 
	  
	  d=document.getElementById(id);
	  d.style.borderBottomWidth = '3px';
	  d.style.borderRightWidth = '3px';
	  d.style.color = '#0000FF';
	  d.style.cursor='hand';		
	  
	  
}
function mout(id)
{
	var d 
	  d=document.getElementById(id);
	  d.style.borderBottomWidth = '1px';
	  d.style.borderRightWidth = '1px';
	  d.style.color = '#000000';
	  d.style.cursor='hand';		
}
//-------------------------------------
//------------------------ check if can start to search -------------
// use in the form in the status bar / ----------------
function starts(n)
{var d 
 var s 	
 var b 
	
	d = document.getElementById(n);
	s = new String(d.value);
    b = (s.length>0);
	//alert(b)
	return b ;
}

function openwin(url)
{
	//alert(url)
	window.open(url);
	
}

//-------------------------------------
//------------------------------------
//----------------
function CheckInput()
{
	var f1
	var f2 
	var bool 
	
	bool = true ;
	f1=document.getElementById('FindCat');
	f2=document.getElementById('FindName');
	if (f1.value == "" && f2.value == "") {bool=false; return bool;};
	return bool;
		
}

function resetv(f)
{
	var f1
	//alert(f);
	if (f=='FindCat')
	{f1=document.getElementById('FindName');f1.value='';}
	else 
	{f1=document.getElementById('FindCat');f1.value='';};
}

function setcat1(v,id)
{
 var sel 
 var l 
 var i 
 var op 
	
	mcat = v ;
	sel=document.getElementById(id);
	sel.options.length = 0  ;
	l=smarr.length;
	
	op = document.createElement("OPTION");
	sel.options.add(op);
	op.innerHTML = "&#1601;&#1574;&#1577; &#1579;&#1575;&#1606;&#1608;&#1610;&#1577; 1";
	op.value = 0;
	op.selected=true;
	
	for (i=0;i<l;i++)
	{ 
	  if (smarr[i][0]==v)
	  {
	  	op = document.createElement("OPTION");
		sel.options.add(op);
		op.innerText = smarr[i][2];
		op.value = smarr[i][1];
	  }
	 
	}
	
}

function setcat2(v,id)
{
 var sel 
 var l 
 var i 
 var op 
 var dstr 
 	
	
	sel=document.getElementById(id);
	sel.options.length = 0  ;
	l=sunarr.length;
	
	op = document.createElement("OPTION");
	sel.options.add(op);
	op.innerHTML = "&#1601;&#1574;&#1577; &#1579;&#1575;&#1606;&#1608;&#1610;&#1577; 2";
	op.value = 0;
	op.selected=true;
	
	for (i=0;i<l;i++)
	{ 
	  if (sunarr[i][0]==mcat && sunarr[i][1]==v)
	  {
	  	op = document.createElement("OPTION");
		sel.options.add(op);
		op.innerText = sunarr[i][3];
		op.value = sunarr[i][2];
	  }
	 
	}
}

//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
function setsel (id,code)
{ var sel  
  var op	
  var l 	
  var i
	
    sel=document.getElementById(id);
	l = sel.options.length ;
	for (i=0;i<l;i++)
	{			
		op=sel.options(i);
		//if (code == op){sel.options(i).};		
		if(op.value==code){op.selected=true}
	}
	

}
//----------------------------------------------------------------
//chech arabic string form none valid chars
function checkAstr(str)
{var s 
 var vs  
 var b 
 var i 
 var c 
 var l 
	
	s = new String(str);
	
	if (s.length>0)
	{ 
	  i  = 0;
	  vs = 0;
	  l = s.length;  
	  for (i=0 ; (i<l)&&(vs==0);i++ )
	  {
	  		c = s.charCodeAt(i);
			//alert(c);
			if (((c>=1569)&&(c<=1594))||((c>=1600)&&(c<=1610))||((c>=40)&&(c<=90))||((c>=97)&&(c<=122))||(c==32)||(c==13)||(c==10) || (c==1548)|| (c==95) )
			{ }else{vs=1};
	  }
	}  
	
	if (vs==1){b=false }else {b=true};
	return b; 
}
//chech telephone string form none valid chars
function checkTel(str)
{var s 
 var vs  
 var b 
 var i 
 var c 
 var l 
	
	s = new String(str);
	if (s.length>0)
	{ 
	  i  = 0;
	  vs = 0;
	  l = s.length;  
	  for (i=0 ; (i<l)&&(vs==0);i++ )
	  {
	  		c = s.charCodeAt(i);
			if ( ((c>=48)&&(c<=57)) || (c==32) ||(c==45)  )
			{ }else{vs=1};
	  }
	}  
	
	if (vs==1){b=false }else {b=true};
	return b; 
}
//check email  --------------------
function checkEmail(str)
{var s 
 var vs  
 var b 
 var i 
 var c 
 var l 
	
	vs = 1;
	s = new String(str);
	if (s.length>0)
	{ 
	  
	  l=s.indexOf('@');
	  if (l>-1)
	  {
					  i  = 0;
					  vs = 0;
					  l = s.length;  
					  for (i=0 ; (i<l)&&(vs==0);i++ )
					  {
					  		c = s.charCodeAt(i);
							if ( ((c>=48)&&(c<=57)) || ((c>=64)&&(c<=90)) || ((c>=97)&&(c<=122)) || (c==95) ||(c==46)|| (c==45)  )
							{ }else{vs=1};
					  }
		}
	}  
	
	if (vs==1){b=false }else {b=true};
	return b; 
}

//check email  -------------------------------------------------

function sethp(obj)
{
 	var browserName = navigator.appName
    var browserVer  = parseInt(navigator.appVersion);
	
	if (browserName == "Netscape")
        {
        alert("Netscape Navigator user!" + "\n\n" + "please see help to set Daleelak as home page")
        }
    else if (browserName == "Microsoft Internet Explorer")
        {
        var ver = navigator.appVersion
        var start = ver.indexOf("MSIE") + 5
        var end = ver.indexOf(";",start)
		
        browserVer = parseInt(ver.substring(start,end));
		if (browserVer >= 5)
		  { obj.style.behavior='url(#default#homepage)'; 
		    obj.setHomePage('http://www.Dlk.co.il');
		  }	
        }
    else
        {
        alert("");
        }

}

function cemail ()
{
	var em 	 
	em=document.MailList.email.value
	if (em==''){ return false} else {return checkEmail(em)}
}
