    function ShowMenu(id){
        var e = document.getElementById(id);
        if(e != undefined){
            var child = e.childNodes;
            if(child.length){
                for (var i = 0 ; i < child.length ; i++){
                    if(child[i].nodeName == 'UL'){
                        child[i].className = (child[i].className == 'opened') ? 'closed' : 'opened';
                    }
                }
            }
        }
    }

    NewWindow1 = null;
    function ShowWin(href, w, h){
    	if(NewWindow1){ NewWindow1.close(); }
    	if(NewWindow1==null || NewWindow1.closed){
    		var top = screen.height/2 - h/2;
    		var left = screen.width/2 - w/2;
    		var settings =
    	 		"left=" + left + "px,"
    			+"top=" + top + "px,"
    			+"width=" + w + "px,"
    			+"height=" + h + "px,"
    			+"toolbar=yes,"
    			+"location=no,"
    			+"directories=no,"
    			+"status=yes,"
    			+"menubar=yes,"
    			+"scrollbars=yes,"
    			+"resizable=yes";
    		NewWindow1 = window.open(href,'okno',settings);
    	}
    	NewWindow1.focus();
    }
    
    function getElementPosition(element) {
        var pos = {x:0, y:0};
    	if (element.offsetParent) {
    		pos.x = element.offsetLeft
    		pos.y = element.offsetTop
    		while (element = element.offsetParent) {
    			pos.x += element.offsetLeft
    			pos.y += element.offsetTop
    		}
    	}
    	return pos;
    }
    
    function getXY(e) {
        var pos = {x:0, y:0};
        pos.x = (window.Event) ? e.pageX : event.clientX;
        pos.y = (window.Event) ? e.pageY : event.clientY;
        return pos;
    }
    
    function addLoadEvent(func){	
        var oldonload = window.onload;
        if (typeof window.onload != 'function'){
            window.onload = func;
        } else {
            window.onload = function(){
                oldonload();
                func();
            }
        }
    }

