var myAdmin = {
	fieldset: "#tabbed",
    ini: function() {
        myAdmin.uklid();
        myAdmin.help();
    },
    items: function() {
        $(document).ready(function() {
            $(".item").hover(
                function () {
                    //$(this).children(".item_body_accessible").fadeTo(100, 0.5);
                    //$(this).parent(".item_body").fadeTo(1, 1);
                    $(this).children(".item_admin_btn").fadeIn(100);
                    $(this).children(".item_admin_btn").hover( 
                        function() { 
                            $(this).click( function() { 
                                $(this).children(".item_admin").fadeIn(200); 
                            } );
                        },
                        function() { 
                            $(this).children(".item_admin").fadeOut(200); 
                        }
                    );
                }, 
                function () {
                    //$(this).children(".item_body_accessible").fadeTo(100, 1);
                    //$(this).parent(".item_body").fadeTo(1, 0.5);
                    $(this).children(".item_admin_btn").fadeOut(200);
                    $(".item_admin").fadeOut(200);
                }
            ),
            $("#selectAll").click(function() {
                $(".checkbox").attr("checked", "checked");
            }),
            $("#deselectAll").click(function() {
                $(".checkbox").removeAttr("checked");
            }),
            $(".helpBtn").show();
        });
    },
    help: function() {
        $(document).ready(function() {
            $(".helpBtn").show();
            $(".helpText").hide();
            $(".helpBtn").click(function() {
                var position = $(this).offset();
                var obsah = $(this).next(".helpText").text();
                $("body").append('<div class="helpPanel">'+obsah+"</div>");
                $(".helpPanel").css({ "position":"absolute", "left": position.left, "top": position.top,"z-index":"1000" }).fadeIn("slow");
                
                $(".helpPanel").mouseout(function(){
                    $(this).fadeOut().remove();
                })
                $(".helpPanel").click(function(){
                    $(this).fadeOut().remove();
                })
            } );
        } );
    },
    treeMenus: function() {
    	$(".treeMenu li").each(function(i){
    		if($(this).children("ul").size()>0) $(this).prepend('<span class="treeMenuArrow"></span>')
    	});
        $(".treeMenu li").hover( 
            function() { 
                $(this).addClass("revealed").children("ul").show().children(".treeMenuSeparator").css("height", $(this).height()+"px");
            },
            function() { 
                $(this).removeClass("revealed").children("ul").hide();
            }
        );
    },
    site: function() {
        $(document).ready(function() {
        	myAdmin.treeMenus();
        	$(".ST_trigger").mouseenter(function(){
        		$(".ST_menu").show();
        	});
            $(".ST_trigger").hover( 
                    function() { 
                    	var scrOfY = 0;
						if( typeof( window.pageYOffset ) == 'number' ) {
						    scrOfY = window.pageYOffset; //Netscape compliant
						} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
						    scrOfY = document.body.scrollTop; //DOM compliant
						} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
						    scrOfY = document.documentElement.scrollTop; //IE6 standards compliant mode
						}
                    	$(".ST_menu").css("top", (scrOfY+10)+"px");
                        $(".ST_menu").css("left", "-70px").show().animate( {left:"0"}, 100);
                    },
                    function() { 
                        $(".ST_menu").hide();
                    }
                );
            $(".site_admin").hover( 
                function() { 
                    $(".site_admin .menu").slideDown(10).animate( {opacity:"1"}, 100);
                },
                function() { 
                    $(".site_admin .menu").slideUp(10).animate( {opacity:"1"}, 1);
                }
            );
        } );
    },
	uklid: function(){
			/* fieldsety */
			$(myAdmin.fieldset+" legend").hide();
			$(myAdmin.fieldset+" fieldset").css("border","0px");
			$(myAdmin.fieldset+" fieldset").css("padding","0px 10px 10px 10px");
			//$(hideFieldsets.fieldset+" fieldset").css("margin","0px");
	}	
    
}

