	


		function searchName(startInd){
				 startInd++;
				 if (document.cookie.indexOf(";",startInd) > startInd)	
						stopInd=document.cookie.indexOf(";",startInd);        	
					 else 					
						stopInd=document.cookie.length;		  
				  
					var name_arr = new Array;		 
					name_arr=document.cookie.substring(startInd,stopInd).split("%");	
					h_name="";	 
					if (name_arr.length>1) 
					{		    
													
						for (k=1; k<name_arr.length; k++)    
						{
							if (name_arr[k].length>2)
							{
								
								var heb_lett=name_arr[k].substring(0,2);
								//alert(heb_lett)
								h_name+=hex_arr[heb_lett];
								h_name+=name_arr[k].substring(2,name_arr[k].length);
							} else 
									 h_name+=hex_arr[name_arr[k]];                   
						}
					}		 
						
				return h_name;
		}

		var hex_arr=new Array;
		var hex_arr2=new Array;
		 hex_arr2=hex_arr['E0']="א";
		 hex_arr2=hex_arr['E1']="ב";
		 hex_arr2=hex_arr['E2']="ג";
		 hex_arr2=hex_arr['E3']="ד";
		 hex_arr2=hex_arr['E4']="ה";
		 hex_arr2=hex_arr['E5']="ו";
		 hex_arr2=hex_arr['E6']="ז";
		 hex_arr2=hex_arr['E7']="ח";
		 hex_arr2=hex_arr['E8']="ט";
		 hex_arr2=hex_arr['E9']="י";
		 hex_arr2=hex_arr['EA']="ך";
		 hex_arr2=hex_arr['EB']="כ";
		 hex_arr2=hex_arr['EC']="ל";
		 hex_arr2=hex_arr['ED']="ם";
		 hex_arr2=hex_arr['EE']="מ";
		 hex_arr2=hex_arr['EF']="ן";
		 hex_arr2=hex_arr['F0']="נ";
		 hex_arr2=hex_arr['F1']="ס";
		 hex_arr2=hex_arr['F2']="ע";
		 hex_arr2=hex_arr['F3']="ף";
		 hex_arr2=hex_arr['F4']="פ";
		 hex_arr2=hex_arr['F5']="ץ";
		 hex_arr2=hex_arr['F6']="צ";
		 hex_arr2=hex_arr['F7']="ק";
		 hex_arr2=hex_arr['F8']="ר";
		 hex_arr2=hex_arr['F9']="ש";
		 hex_arr2=hex_arr['FA']="ת";
		 hex_arr2=hex_arr['27']="&#39;";
		 hex_arr2=hex_arr['22']="&quot;";
		 hex_arr2=hex_arr['20']=" ";


		rememberFlag=false;
		
		
	function ReadCookie(cookieName) {
	 var theCookie=" "+document.cookie;
	 var ind=theCookie.indexOf(" "+cookieName+"=");
	 if (ind==-1) ind=theCookie.indexOf(";"+cookieName+"=");
	 if (ind==-1 || cookieName=="") return "";
	 var ind1=theCookie.indexOf(";",ind+1);
	 if (ind1==-1) ind1=theCookie.length; 
	 return unescape(theCookie.substring(ind+cookieName.length+2,ind1));
	}	

	$(document).ready(function(){
  	//$("#send_page").hide();
	 var status = ReadCookie("Ticket"); 
	
	 if(status.indexOf("user_status&2")==-1) $("#send_page").hide();
 
	$('body').append('<div id="dictonary_tools" class="window"></div> <div id="mask_tools"></div>')
	$('#tools_dictionary a:eq(0)').click(function(e) { Dictionary(e,1,"form_dictionary_word")});	
	$('#tools_dictionary a:eq(1)').click(function(e) { Dictionary(e,0,"form_dictionary_word")});
	
	if(location.href.indexOf("voc")==-1 || location.href.indexOf("mahadura")==-1){
		var txt;
		if(location.href.indexOf("community")!=-1 || location.href.indexOf("mahadura")!=-1)  txt = ReadCookie("Ticket");
	    else if($.cookie!=undefined) txt = $.cookie('Ticket'); 
		if(txt!=null){
			
			txt2=searchName(document.cookie.indexOf('galim_h_name')+10);	
			$("#login_username").show();
			$("#login_username_seperator").show()
			$("#login_username").html("שלום "+txt2);
			
			$("#login_status").html("יציאה");
			$("#login_status").attr("title","יציאה");
			$("#login_status").attr("href","http://www.galim.org.il/cgi-bin/galim/register/logoff.pl");		
			}
		else{
			$("#login_username").hide();
			$("#login_username_seperator").hide()
			}
		}


	});
			
			function OpenTools(arrow, tab_type, tools_box){
			
				var tmp = $("#"+arrow).attr("src");
				
				if($("#tools_slider").css("display") == "block" || $("#areas").css("display") == "block")
				CloseTools();
				
				if(tmp.indexOf("on") == -1){
						$("#"+tab_type).css("background","url(http://www.galim.org.il/images/top/"+tab_type+".png) no-repeat");
						tmp = tmp.replace(".gif","_on1.gif");
						$("#"+tools_box).slideDown(200);
						$("#"+tab_type+" a:eq(0)").css("color","#fff");
					}
				else{
						$("#"+tab_type).css("background","none");
						tmp = tmp.replace("_on1.gif",".gif");
						$("#"+tools_box).slideUp(200);
						$("#"+tab_type+" a:eq(0)").css("color","#3d3f3f");
					}
					$("#"+arrow).attr("src",tmp);
					
					$("#close_tools").click(function(){
						  CloseTools();						 
					  });

				}
				
			function CloseTools(){
				var tmp2 = $(".tools_arrows").attr("src");
				$("#tools_slider , #areas").hide();
				tmp2 = tmp2.replace("_on1.gif",".gif");
				$(".tools_arrows").attr("src",tmp2);
				$("#tools_tab,#areas_tab").css("background","none");
				$("#tools_tab a:eq(0),#areas_tab a:eq(0)").css("color","#3d3f3f");
				}

			
			/////////////////Dictionary /////////////////
		function Dictionary(e,x, formName)
		{
			  word=document.getElementById(formName).value;
				
			  e.preventDefault();
			  var id = $("#dictonary_tools");
			  var maskHeight = $(document).height();
			  var maskWidth = $(window).width();
			
			  $('#mask_tools').css({'width':maskWidth,'height':maskHeight});
			  $('#mask_tools').show();
			  $('#mask_tools').css("opacity",0);
			  $('#mask_tools').animate({    opacity: 0.6  }, 1000, function() {});
			  var winH = 100;
			  var winW = $(window).width();
			  $(id).css('top',  100);
			  $(id).css('left', winW/2-$(id).width()/2);
			
			    $(id).fadeIn(2000); 
				if(x==0)
			  		$(id).html("<iframe src='http://popup.galim.org.il/cgi-bin/galim/dictionary/click_milon_step1.pl?word="+word+ "&visual=0&act=hh' frameborder=0 ></iframe><img src='http://www.galim.org.il/images/dictonary/close.png'  id='close' alt='סגירה' title='סגירה' />");
				else $(id).html("<iframe src='http://popup.galim.org.il/cgi-bin/galim/dictionary/click_milon_step1.pl?word="+word+ "&visual=0&act=ehe' frameborder=0 ></iframe><img src='http://www.galim.org.il/images/dictonary/close.png'  id='close' alt='סגירה' title='סגירה' />");
				
				
			//  $("#dictonary_tools iframe").height($("#dictonary").innerHeight());
				   
			  $('#mask_tools , #close').click(function () {
			  $('#mask_tools').hide();
			  $('.window').hide();
			  }); 
		}
	
	var font_size_counter = 0;
	
	function ChangeFontSizeInc(){
				font_size_counter++;
				
				if(font_size_counter<4 && font_size_counter>-4){
				var current_fontsize;	
				$("html * :not(#tools * , #tools)").each(function(i){
					current_fontsize  = parseFloat($(this).css("font-size"));
					
					current_fontsize = current_fontsize+1;  
					
					$(this).css("font-size",current_fontsize)
				});
				if(location.href.indexOf("fields")!=-1) SetFloatHeight();
				}
		}
		
	function ChangeFontSizeDec(){
				
		 		font_size_counter--;
				
				if(font_size_counter<4 && font_size_counter>-4){
				var current_fontsize;	
				$("html * :not(#tools * , #tools)").each(function(i){
					current_fontsize  = parseFloat($(this).css("font-size"));
					
					current_fontsize = current_fontsize-1;  
					
					$(this).css("font-size",current_fontsize)
				});
				if(location.href.indexOf("fields")!=-1) SetFloatHeight();
				}
		}

	function SendPage(){
		
			 //alert("בשל הבעיה בקהילות גלים זמנית לא ניתן לבצע הקצאת משימות. עמכם הסליחה");
			 
			  var id = $("#dictonary_tools");
			  var maskHeight = $(document).height();
			  var maskWidth = $(window).width();
			
			  $('#mask_tools').css({'width':maskWidth,'height':maskHeight});
			  $('#mask_tools').show();
			  $('#mask_tools').css("opacity",0);
			  $('#mask_tools').animate({    opacity: 0.6  }, 1000, function() {});
			  var winH = 100;
			  var winW = $(window).width();
			  $(id).css('top',  100);
			  $(id).css('left', winW/2-$(id).width()/2);
			
			  $(id).fadeIn(2000); 
			
			  $(id).html("<form action='http://community.galim.org.il/privatemsg/new/task' method='GET' id='toolbar_tasks'><img src='http://www.galim.org.il/images/close.jpg' class='close' id='close_missions' alt='סגירה' title='סגירה' /><input type='text' id='page_name' name='page_name'  /><br /><br /><input type='hidden' value='' id='page_url' name='page_url' /> <input type='image' src='http://www.galim.org.il/images/send_button.png' id='send_missions' alt='כניסה' title='כניסה' /><br /></form>");
								   
			  $('#mask_tools , #close , .close').click(function () {
			  $('#mask_tools').hide();
			  $('.window').hide();
			  }); 	
			
			$("#page_url").attr("value",location.href);		
		}

		
		
		
		
		
		
