function glossary(txt)
{
	glossary_win=window.open("http://sharedic.snunit.k12.il/cgi-bin/search_results.pl?word="+txt+"&language=Spanish","an","toolbar=no,member=no,location=no,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=300,width=400");
    javascript:glossary_win.focus();

}

function online_dictionary(txt)
{
	//http://www.freedict.com/onldict/onldict.php
	online_dictionary_win=window.open("http://www.freedict.com/onldict/spa.html","an","toolbar=yes,member=yes,location=yes,directories=yes,scrollbars=yes,status=yes,copyhistory=yes,resizable=yes,height=600,width=770");
    javascript:online_dictionary_win.focus();
}

/////////////////////onmouseover image function///////////////////////
function change(imagename,imagesrc)
{
  document[imagename].src=imagesrc;
}


/////////////////////check for the user resolosion///////////////////////
var browser_version;   //what kind of version
var screen_width;      // screen resolosion
var screen_height;     // screen resolosion

browser_version=navigator.appVersion.split(".")[0];

screen_width=screen.width;
screen_height=screen.height;
//alert(browser_version);
if (browser_version<4)
{
document.write('<div id="onTop">    .</div>');
}
if (screen_width<700)
{
document.write('<div  id="onTop"><a href="http://www.snc.k12.il/javascript/reso_browser/reso_480.html">600X800</a>    </div>');
}
/////////////////////end resolosion checking//////////////////////////
/////////////////////window of hebre/arabic translation popup//////////////////////////
//--------------- function to open popup window------------------------

function sw(tx){
if (document.images)
  {
    swin=window.open(tx,"an","toolbar=no,member=no,location=no,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=350,width=300");
    javascript:swin.focus();
}
}

function linkOutSide(url){
if (document.images)
  {
    swin=window.open(url,"an","toolbar=no,member=no,location=no,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=600,width=650");
    javascript:swin.focus();
}
}
/////////////////////keyboard popup//////////////////////////
function keyboard(tx){
if (document.images)
  {
    swin=window.open(tx,"an","toolbar=no,member=no,location=no,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=370,width=570");
    javascript:swin.focus();
}
}

function nw(wi)
{
  nwin=window.open(wi,"an","toolbar=yes, member=yes, location=yes, directories=yes, scrollbars=yes, status=yes, copyhistory=yes, resizable=yes, height=250, width=600 ,top=160, left=30")
  javascript:nwin.focus();
}

function swn(tx)//for toy store windows only
{     
 swn = window.open (tx, "sc", "toolbar=yes, member=yes, location=no, directories=yes, scrollbars=yes, status=yes, copyhistory=yes, resizable=yes, height=150, width=570");
 javascript:swn.focus();
}

/////////////////////reset forms onload//////////////////////////
function rst() // reset form on loading of page
{
for(i=1 ; i < 6 ; i++)
    {
	 frm='tf'+i
	 document[frm].reset()
	}
}
/////////////////////peddy programing//////////////////////////
   var z = 0
   function addd(pt,sgl)
   {
	 Y1 = (pt + "/gifs/pidion_of_08.gif")
	 Y2 = (pt + "/gifs/kelim_of_08.gif")
	 Q1 = (pt + "/gifs/kelim_on_08.gif")
	 Q2 = (pt + "/gifs/pidion_on_08.gif")
	 if (sgl=='1')//onmouse over section
	    {
		  if(z==0)//if peedy is off
		    {
			  document['Image2'].src= Q2
			  document['Image2'].alt= "Turn Peedy On";
			}
		  else if(z==1)//if peedy is on
		     {
			    document['Image2'].src= Q1
			      document['Image2'].alt= "Turn Peedy Off";
			}
	    }
  if (sgl=='2')//onmouseout section
	    {
		  if(z==0)//if peedy is off
		    {
			  document['Image2'].src= Y1
			  document['Image2'].alt= "Turn Peedy On";
                          //alert(Y1);
			}
		  else if(z==1)//if peedy is on
		     {
			    document['Image2'].src= Y2
			    document['Image2'].alt= "Turn Peedy Off";
			}
	    }
  if(sgl=='0')//onclick section
  {
		if (z==0)//if peedy is off
		  {
		    z = z+1;
		    document['Image2'].src = Q1;
		    showhim()
		  }
		else if(z==1)//if peedy is on
		   {
		    z = z+1;
		    document['Image2'].src = Q2;
			 z = z+1;
			 z = 0;
			 hidehim();
		   }
	}
}

/////////////////////peddy programing READ//////////////////////////
   var zzz = 0
   function addd_read(pt,sgl)
   {
	 Y1 = (pt + "/gifs/read_header_05.gif")
	 Y2 = (pt + "/gifs/read_header_on_05.gif")
	 Q1 = (pt + "/gifs/read_header_on_05.gif")
	 Q2 = (pt + "/gifs/read_header_05.gif")
	 if (sgl=='1')//onmouse over section
	    {
		  if(zzz==0)//if peedy is off
		    {
			  document['Image2'].src= Q2
			  document['Image2'].alt= "Turn Peedy On";
			}
		  else if(zzz==1)//if peedy is on
		     {
			    document['Image2'].src= Q1
			      document['Image2'].alt= "Turn Peedy Off";
			}
	    }
  if (sgl=='2')//onmouseout section
	    {
		  if(zzz==0)//if peedy is off
		    {
			  document['Image2'].src= Y1
			  document['Image2'].alt= "Turn Peedy On";
                          //alert(Y1);
			}
		  else if(zzz==1)//if peedy is on
		     {
			    document['Image2'].src= Y2
			    document['Image2'].alt= "Turn Peedy Off";
			}
	    }
  if(sgl=='0')//onclick section
  {
		if (zzz==0)//if peedy is off
		  {
		    zzz = zzz+1;
		    document['Image2'].src = Q1;
		    showhim()
		  }
		else if(zzz==1)//if peedy is on
		   {
		    zzz = zzz+1;
		    document['Image2'].src = Q2;
			 zzz = zzz+1;
			 zzz = 0;
			 hidehim_read();
		   }
	}
}

/////////////////////Dictionary programing//////////////////////////
var numOfLetterCounter=0;
function checkLang()//check user input lang, block some options
{

myUseLang=document.onlineForm.word.value;
myLangCode=myUseLang.charAt(0);

numOfLetterCounter++;//checks 

if(myUseLang.length<1)
	{
	numOfLetterCounter=0;
	}
if(numOfLetterCounter>1)//more than one letter typed in textbox
  {return(false)}
else//first letter, identify the language the user is typing, change gifs&IMGmaps 
	{
	   if((myLangCode.charCodeAt(0)>=1570)&&(myLangCode.charCodeAt(0)<=1790))//if Arabic
         {
		  //myDictionaryImg.innerHTML="<IMG height=23 width=46  alt=Hebrew border=0 src=\"/gifs/arabic_and_heb_off.gif\" align=top value=\"14\" usemap=\"#dictionary_map\" selected>";
	      //myDictionaryMap.innerHTML="<map name=dictionary_map><area shape=\"rect\" coords=\"32,-1,47,23\" href=\"javascript:online_info(0);\" alt=\"English\"></map>";
         }
       else if((myLangCode.charCodeAt(0)>=1488)&&(myLangCode.charCodeAt(0)<=1514))//if Hebrew
         {
         // myDictionaryImg.innerHTML="<IMG height=23 width=46  alt=Hebrew border=0 src=\"/gifs/arabic_off.gif\" align=top value=\"14\" usemap=\"#dictionary_map\" selected>"
	     // myDictionaryMap.innerHTML="<map name=dictionary_map><area shape=\"rect\" coords=\"1,1,15,22\" href=\"javascript:online_info(10);\" alt=\"Hebrew\"><area shape=\"rect\" coords=\"32,-1,47,23\" href=\"javascript:online_info(0);\" alt=\"English\"></map>";
          if(e_name=="Hi Guest!")//if guest
	         {
             // myDictionaryImg.innerHTML="<IMG height=23 width=46  alt=Hebrew border=0 src=\"/gifs/arabic_heb_off.gif\" align=top value=\"14\" usemap=\"#dictionary_map_guest\" selected>";
	         //myDictionaryMap.innerHTML="<map name=dictionary_map_guest><area shape=\"rect\" coords=\"32,-1,47,23\" href=\"javascript:online_info(0);\" alt=\"English\"></map>";
	         }
		 }
       else if((myLangCode.charCodeAt(0)>=65)&&(myLangCode.charCodeAt(0)<=172))//if english
	     {
	      // myDictionaryImg.innerHTML="<IMG height=23 width=46  alt=Hebrew border=0 src=\"/gifs/eng_off.gif\" align=top value=\"14\" usemap=\"#dictionary_map\" selected>";
        //   myDictionaryMap.innerHTML="<map name=dictionary_map><area shape=\"rect\" coords=\"1,1,15,22\" href=\"javascript:online_info(10);\" alt=\"Hebrew\"><area shape=\"rect\" coords=\"17,-5,31,20\" href=\"javascript:online_info(15);\" alt=\"Arabic\"></map>";
	      } 
	  } 
}

var str_url;

function displayChooseBox(){
	/*window.open("http://www.mywaves.org/cgi-bin/gallery/myTex.pl","an","toolbar=no,member=no,location=no,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=150,width=570,top=0,left=0");
	var mytech = "shalom";
	for(i=0;i<1000000;i++);
	mytech = document.getElementById("schoolFlag").value;
	alert(mytech);
	
	if(mytech == "yes")
		online_info(15);
	else*/
		document.getElementById("chooseLng").style.display = "block";
}

function hideChooseBox(){
	document.getElementById("chooseLng").style.display = "none";
}

function online_info(lng)//open the dictionary pop-up window - Melingo and Babylon
{
myWord=document.onlineForm.word.value;
paramLang=myWord.charAt(0)
//*******Choose between languages***ANNA AUGUST 2007************************************
if (document.getElementById("chooseLng"))
	hideChooseBox();
//*******************************************************************
if(lng==15)//Arabic
  {
    if(document.onlineForm.word.value != "")//open babylon pop-up
	  {
       var zrg = paramLang
	   var str_url = "http://info.babylon.com/cgi-bin/info.cgi?word=" + document.onlineForm.word.value + "&lang=" + lng + "&type=1000968&layout=galim.html&n=1";
	   x=window.open (str_url, "online", "scrollbars=yes,status=no,width=390,height=250,top=190,left=480");
       x.focus();
       }
  }
else if(lng==10)//translate english to Hebrew
    {
	 if(document.onlineForm.word.value != "")
	  {
      str_url = showModelessDialog("/cgi-bin/gallery/melingo.pl?word="+document.onlineForm.word.value + "&act=hh", window ,"dialogHeight:300px; dialogWidth:440px;help:no;status:no;resizable: no;scroll:yes;dialogLeft:400;dialogTop:190; ");
	  }    
	 }
else if(lng==0)//English
	{
	  if((paramLang.charCodeAt(0)>=1570)&&(paramLang.charCodeAt(0)<=1790))//arabic to english
		{
         if(document.onlineForm.word.value != "")//open babylon pop-up
	      {
           var zrg = paramLang
	       var str_url = "http://info.babylon.com/cgi-bin/info.cgi?word=" + document.onlineForm.word.value + "&lang=" + lng + "&type=1000968&layout=galim.html&n=1";
	       x=window.open (str_url, "online", "scrollbars=yes,status=no,width=390,height=250,top=230,left=230");
           x.focus();
          }
		}
	 else
		{
         if(document.onlineForm.word.value != "")//open melingo - Hebrew to english
	      {
            str_url = showModelessDialog("/cgi-bin/gallery/melingo.pl?word="+document.onlineForm.word.value + "&act=ehe", window ,"dialogHeight:300px; dialogWidth:440px;help:no;status:no;resizable: no;scroll:yes;dialogLeft:300;dialogTop:100; ");
		  }
		}
	}
numOfLetterCounter=0;
document.getElementById("word").value = "";
}

function milon_nw(word,act)  // in case of wrong word opens window for new translation
{
	if(str_url)
	{
		str_url.close();
	}
	 str_url=showModelessDialog("/cgi-bin/gallery/melingo.pl?word="+word+"&act="+act, window ,"dialogHeight:300px; dialogWidth:440px;help:no;status:no;resizable: no;scroll:yes;dialogLeft:300;dialogTop:100; ");
	 
}
/////////////////////////////////////END DICTIONARY/////////////////////////////////////////////////////////////////////////////////////

function bbJump()
{
	if (document.selection.type=="Text" &&document.selection.createRange)
	  { 
		 bbstr = document.selection.createRange(); 
		 bbstr=bbstr.text ;
		if(bbstr.indexOf(' ')!=-1)
		bbstr=bbstr.substring(bbstr.charAt(0),bbstr.indexOf(' '));
		 if (document.onlineForm.word)
		 {
			 document.onlineForm.word.value=bbstr;
			document.onlineForm.word.select();
			//document.onlineForm.word.scrollIntoView();
		 }
	
	}
}

 document.ondblclick =bbJump;

/////////////////////document left bar//////////////////////////
var path = document.location.pathname;
var dir = path.substring(0,path.lastIndexOf("\/"));

if (dir.indexOf('snc') > -1) {
	dir=dir.substring(13,dir.length);
}
var x 
if(dir == ""){x = ""};

else if (dir == "/error" || dir == "/about" || dir == "/teachers" || dir == "/map" || dir == "/navat" || dir == "/ict"){x = "../"};

else if(dir == "/ict/com"){x = "../../"};

else if (dir == "/ict/com/c1" || dir == "/ict/com/c2" || dir == "/ict/com/c3"){x = "../../../"};

else if (dir == "/ict/com/c1/intro" || dir == "/ict/com/c1/step1" || dir == "/ict/com/c1/step2" || dir == "/ict/com/c1/step3" || dir == "/ict/com/c1/step4" || dir == "/ict/com/c1/check"){x = "../../../../"};

else if (dir == "/ict/com/c2/intro" || dir == "/ict/com/c2/step1" || dir == "/ict/com/c2/step2" || dir == "/ict/com/c2/step3" || dir == "/ict/com/c2/step4" || dir == "/ict/com/c2/check"){x = "../../../../"};

else if (dir == "/ict/com/c3/intro" || dir == "/ict/com/c3/step1" || dir == "/ict/com/c3/step2" || dir == "/ict/com/c3/step3" || dir == "/ict/com/c3/step4" || dir == "/ict/com/c3/check"){x = "../../../../"};
//-->

function translate(id)
{ 
	//tx="http://www.snunit.org.il/cgi-bin/langs/getTrans.pl?site=mw&Id="+id+"&lang="+readCookie("current_language")+""; 
	//tx="http://www.snunit.org.il/cgi-bin/langs/getTrans.pl?site=mw&Id="+id+"&lang=Arabic";
	//tx="http://www.snunit.org.il/cgi-bin/langs/getTrans.pl?site=mw&Id="+id;
	tx="http://www.mywaves.org/cgi-bin/gallery/getTrans.pl?site=mw&Id="+id;
	ww=window.open(tx,"an","toolbar=no,member=no,location=no,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=150,width=570,top=0,left=0");
    javascript:ww.focus();
}

//////////////////////////// COOKIES for store LANGUAGE parameter ///////////////////////////////// // // // // // //
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // // // //
