	function addOnLoad(func) {
		var oldonload = window.onload;
	
		if (typeof window.onload != 'function') {
			window.onload = func;
		} else {
			window.onload = function() {
				oldonload();
				func();
			}
		}
	}
	
	function activateMenu() 
	{
		if ($('left_meniu'))
		{
			var nav = "left_meniu";
			/* currentStyle restricts the Javascript to IE only */
			if (document.all &&
				document.getElementById(nav).currentStyle) {  
				var navroot = document.getElementById(nav);
				/* Get all the list items within the menu */
				var lis=navroot.getElementsByTagName("LI");  
				for (i=0; i<lis.length; i++) {
				   /* If the LI has another menu level */
					if(lis[i].lastChild.tagName=="UL"){
						/* assign the function to the LI */
						lis[i].onmouseover=function() {
						   /* display the inner menu */
						   this.lastChild.style.display="block";
						}
						lis[i].onmouseout=function() {   
						   this.lastChild.style.display="none";
						}
					}
				}
			}
		}
	}
	
	//addOnLoad(activateMenu);
	
	function reloadPage()
	{
		window.location.reload( true );
	}
	
	var expand_cookie = 'meniu_cookie';
							function setTreeCookie(name, value)
							{
								document.cookie = name + '=' + value + ';path=/';
							}
							
							function getTreeCookie(name)
							{
								cook = document.cookie.split(name + '=');	
								if (cook.length < 2) {
									return null;
								}
								temp = cook[1];
								if (temp.indexOf(';') == -1) {
									return temp;
								}
								data = temp.split(';');
								return data[0];
							}
							
							function parseExpandString()
							{	
								expandString = getTreeCookie(expand_cookie);
								tree_expand = new Array();
								if (expandString) {
									expanded = expandString.split('|');		
									for (i=0; i<expanded.length-1; i++) 
									{
										tree_expand[i] = new Array(expanded[i], 1);
									}
								}
								
								for(var j=0; j<tree_expand.length; j++)
								{
									Effect.toggle('categorysub'+tree_expand[j][0], 'blind', { duration: 0.2});
								}
							}
							
							function saveExpandString()
							{	
								expandString = '';	
								for (i=0; i<tree_expand.length; i++) 
								{		
									if (tree_expand[i][1] == 1) 
									{			
										expandString += tree_expand[i][0] + '|';
									}
								}		
								setTreeCookie(expand_cookie, expandString);	
							}
							
							function add_item(id, type)
							{
								var found = false;
								if (type == "expand")
								{		
									if (tree_expand.length > 0)
									{			
										for(i=0; i<tree_expand.length; i++)
										{
											if (tree_expand[i][0] == id)
											{
												found = true;
												tree_expand[i][1] = 0;
											}
										}
										
										if (!found)
										{
											tree_expand[tree_expand.length] = new Array(id, 1);
										}
									}
									else
									{			
										tree_expand[0] = new Array(id, 1);										
									}
								}								
								saveExpandString();
							}
							addOnLoad(parseExpandString);