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();
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function hlp(x)
{
Z=window.open(x,"nme", "toolbar=no,member=no,location=no,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=495, width=480, top=0, left=310");
javascript:Z.focus();
}


function picWinOpn(x)
{
PicWin=window.open(x,"PicWn", "toolbar=yes,member=yes,location=yes,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=495, width=480, top=0, left=310");
PicWin.focus();
}

function more(x)
{
Z=window.open(x,"nmee", "toolbar=yes,member=no,location=yes,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=400, width=700, top=0, left=0");
Z.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.snunit.k12.il/javascript/reso_browser/reso_480.html">600X800</a>    </div>');
}
/////////////////////end resolosion checking//////////////////////////
/////////////////////window of hebre/arabic translation popup//////////////////////////
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=150,width=570");
    javascript:swin.focus();
}
}
//////////////////////open a new site//////////////////////////
function openSite(tx,size,high)
{
  swin=window.open(tx,"an","toolbar=yes,member=no,location=yes,directories=no,scrollbars=yes,status=yes,copyhistory=no,resizable=yes,height="+high+",width="+size);
  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();
		   }
	}
}
/////////////////////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(){
	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 total = document.location.href;
var place = total.split("act")[1];
var point;
var path = document.location.pathname;
var exact = path.split("/")[3];
var dir = path.substring(0,path.lastIndexOf("\/"));

var path2 = document.location.pathname;
     var script_name = path.substring(path.lastIndexOf("\/")+1,path.length);
     script_name=script_name.split("?")[0];

if (dir.indexOf('snunit') > -1) {
	dir=dir.substring(13,dir.length);
}

if(place!=null){point = place.substring(0,place.lastIndexOf("&"));}
//var x 
if(dir == ""){x = ""};

else if (dir == "/guest" || dir == "/error" || dir == "/about" || dir == "/teachers" || dir == "/map" || dir == "/navat" || dir == "/tales" || dir == "/portfolio" || dir == "/onboard" || dir == "/cgi-bin/gallery" || dir == "/cgi-bin/waves" || dir == "/cgi-bin/gallery_dev" || dir == "portfolio/my_scrapbook") {
	if (script_name=="onboard.pl") 
	   x = "../../";
        else 
	   x = "../"
}

else if(dir == "/tales/cinderella" || dir=="/portfolio/scrapbooks" || dir == "/portfolio/pictures" || dir == "/portfolio/links" || dir == "/portfolio/forum" || dir == "/portfolio/mailbox" || dir == "/portfolio/works" || dir == "/portfolio/check_works" || dir == "/portfolio/dictionary" || dir == "/portfolio/teachers"){x = "../../"};

else if (dir == "/tales/cinderella/unit1" || dir == "/tales/cinderella/unit2" || dir == "/tales/cinderella/unit3" ){x = "../../../"};

else if (dir == "/tales/cinderella/unit1/intro" || dir == "/tales/cinderella/unit1/step1" || dir == "/tales/cinderella/unit1/step2" || dir == "/tales/cinderella/unit1/step3" || dir == "/tales/cinderella/unit1/step4" || dir == "/tales/cinderella/unit1/check"){x = "../../../../"};

else if (dir == "/tales/cinderella/unit2/intro" || dir == "/tales/cinderella/unit2/step1" || dir == "/tales/cinderella/unit2/step2" || dir == "/tales/cinderella/unit2/step3" || dir == "/tales/cinderella/unit2/step4" || dir == "/tales/cinderella/unit2/check"){x = "../../../../"};

else if (dir == "/tales/cinderella/unit3/intro" || dir == "/tales/cinderella/unit3/step1" || dir == "/tales/cinderella/unit3/step2" || dir == "/tales/cinderella/unit3/step3" || dir == "/tales/cinderella/unit3/step4" || dir == "/tales/cinderella/unit3/check"){x = "../../../../"};

else {x = ""};
//-->
//alert("'"+x+"'");














