var ee;
var bbstr;
function nw(word)
{
	
	if(ee)
	{
		ee.close();
	}
	if (!NavYes)
		ee=showModelessDialog("http://kodesh.snunit.k12.il/cgi-bin/kodesh/click_milon_kodesh.pl?word="+word+"&visual=0", window ,"dialogHeight:200px; dialogWidth:300px;help:no;status:no;resizable: no;scroll:yes;dialogLeft:0;dialogTop:100; ");
	 else
	{  	
		a="toolbar=no,member=no,location=no,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=200px,width=300px,left=0,top=0";
		swin=window.open("http://kodesh.snunit.k12.il/cgi-bin/kodesh/click_milon_kodesh.pl?word="+word+"&visual=0","an",a );
   		swin.focus();
		//document.getElementById("milon_window").style.display = "block";
		//document.getElementById("milon_window_content").src = "http://kodesh.snunit.k12.il/cgi-bin/kodesh/click_milon_kodesh.pl?word="+word+"&visual=0";
		
	}
}

function nw1(word)
{
	
	if(ee)
	{
		ee.close();
	}
	if (!NavYes)
		ee=showModelessDialog("http://www.galim.org.il/cgi-bin/kodesh/click_milon_kodesh_heb_step1.pl?word="+word+"&visual=0", window ,"dialogHeight:200px; dialogWidth:310px;help:no;status:no;resizable: no;scroll:yes;dialogLeft:0;dialogTop:100; ");
	 else
	{  	
		 a="toolbar=no,member=no,location=no,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=200px,width=300px,left=0,top=0";
		swin=window.open("http://kodesh.snunit.k12.il/cgi-bin/kodesh/click_milon_kodesh_heb_step1.pl?word="+word+"&visual=0","an",a );
   		swin.focus();
	}
}


function bbJump()
{
	if (dict_he) // the button to translate is on, 
	{
		if (!NavYes)// IE
		{
			if (document.selection.type=="Text" &&document.selection.createRange)
			 { 
				// document.body.style.cursor="wait";
				 bbstr = document.selection.createRange(); 
				 bbstr=bbstr.text ;			
				if(bbstr.indexOf(' ')!=-1)
				bbstr=bbstr.substring(bbstr.charAt(0),bbstr.indexOf(' '));
				nw(bbstr);		
			}
			else
			{
				document.selection.empty();
			}
		}
		else  //NS
		{
			bbstr=document.getSelection()
			if(bbstr.indexOf(' ')!=-1)
				bbstr=bbstr.substring(bbstr.charAt(0),bbstr.indexOf(' '));
				
			nw(bbstr);
		}
	}
	else if (dict_hh)
	{
		if (!NavYes)// IE
		{
			if (document.selection.type=="Text" &&document.selection.createRange)
			 { 
				 //document.body.style.cursor="wait";
				 bbstr = document.selection.createRange(); 
				 bbstr=bbstr.text ;			
				if(bbstr.indexOf(' ')!=-1)
				bbstr=bbstr.substring(bbstr.charAt(0),bbstr.indexOf(' '));
				nw1(bbstr);		
			}
			else
			{
				document.selection.empty();
			}
		}
		else  //NS
		{
			bbstr=document.getSelection()
			if(bbstr.indexOf(' ')!=-1)
				bbstr=bbstr.substring(bbstr.charAt(0),bbstr.indexOf(' '));
			nw1(bbstr);
		}
	}
}

 document.ondblclick = bbJump;
