var itemStatus = false;
var tabService = false;

 $(document).ready(function() {


     $('.submenu a:not(.selected)')
		.css( {backgroundPosition: "-20px 35px"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(-20px 94px)"}, {duration:500})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(40px 35px)"}, {duration:200, complete:function(){
				$(this).css({backgroundPosition: "-20px 35px"})
			}})
		})

      var options = {
                minWidth: 200,
				arrowSrc: '/img/arrow_gray_light.png',
				offsetLeft : -1,
				offsetTop: 1,
				copyClassAttr: true,
                onClick: function(e,menuItem){
                    var link = $(this).find('a').attr('href');
                    if(link)
                        window.location.href=link;
                },
                onClose: function(){
					/*
                    $("#navigation_top li.profile_menu>img").each(function(){
                        rollsrc = $(this).attr("src");
                        rollON = rollsrc.replace("_on.png",".png");
                        $(this).attr("src",rollON);
                        $(this).removeClass("selected");
                    });
				*/
                }
    };


	// nawigacja rozwijana na warstwie
	$('#navigation_top').menu(options);
	$('#navigation_sub').menu(options);



     // glosowanie gwiazdkami
     $('ul.stars li').mouseover(function(){
           setVoteStar(this, 'hover');
     })
     $('ul.stars li').mouseout(function(){
           clearVoteStar(this);
     })
     $('ul.stars li').click(function(){
           setVoteStar(this, 'selected');
           sendVote(this);
     })

     

});


jQuery.create = function() {

    if (arguments.length == 0) return [];
    var args = arguments[0] || {},
    elem = null, elements = null;
    var siblings = null;
    // In case someone passes in a null object,
    // assume that they want an empty string.

    if (args == null) args = "";

    if (args.constructor == String) {

            if (arguments.length > 1) {

                    var attributes = arguments[1];

                    if (attributes.constructor == String) {
                        elem = document.createTextNode(args);
                        elements = [];
                        elements.push(elem);
                        siblings = jQuery.create.apply(null, Array.prototype.slice.call(arguments, 1));
                        elements = elements.concat(siblings);
                        return elements;
                    }
                    else {
                        elem = document.createElement(args);
                        // Set element attributes.
                        
                        for (var attr in attributes)
                                
                                jQuery(elem).attr(attr, attributes[attr]); // Add children of this element.
                                var children = arguments[2];

                                //alert(arguments[2]);
                                
                                children = jQuery.create.apply(null, children);
                                jQuery(elem).append(children); // If there are more siblings, render those too.

                                
                                if (arguments.length > 3) {
                                    siblings = jQuery.create.apply(null, Array.prototype.slice.call(arguments, 3));
                                    return [elem].concat(siblings);
                                }
                                
                                return elem;
                        }
            }
            else return document.createTextNode(args);
   }
   else {
            elements = [];
            elements.push(args);
            siblings = jQuery.create.apply(null, (Array.prototype.slice.call(arguments, 1)));
            elements = elements.concat(siblings);
            return elements;
   }
}