this.tooltip = function(){	
	/* CONFIG */		
		xOffset = 10;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("a.tooltip").hover(function(e){											  
	/*$("div.content-box-item").hover(function(e){*/	
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};



(function($)
{
   $.fn.tooltip = function(nastavenia)
   {
      var predvolene =
      {
         delay: 100,
         xOffset: 15,
         yOffset: 15
      };
      var nastavenia = $.extend(predvolene, nastavenia);
      var tooltext = '';
      return this.each(function()
      {
         object = $(this);
         var tooltip_timer;
         object
            .bind('mouseover', function(e)
            {
               tooltext = $(this).attr('title');
               $(this).removeAttr('title');
               this.title = "";
               
               tooltip_timer = setTimeout(function()
               {
                  $('<div id="tooltip"></div>')
                     .hide()
                     .appendTo('body');
                  $("#tooltip")
                     .html(tooltext)
                     .css('position', 'absolute')
                     .css({
                        top: e.pageY + nastavenia.yOffset,
                        left: e.pageX + nastavenia.xOffset
                     })
                     .show();
               }, nastavenia.delay);
            })
            .bind('mousemove', function(e)
            {
               $('#tooltip')
                  .css({
                     top: e.pageY + nastavenia.yOffset,
                     left: e.pageX + nastavenia.xOffset
                  });
            })
            .bind('mouseout', function()
            {
               $('#tooltip').remove();
               clearTimeout(tooltip_timer);
               $(this).attr('title', tooltext);
            });
      });
   }
})(jQuery);


// starting the script on page load
$(document).ready(function(){
	/*tooltip();*/
	$('a.tooltip').tooltip();
	
	$(function() {
		$('a[rel=lightbox]').lightBox(); 
	});	
	
});


function AjaxUpdate(cssid, link, conf, cssclass){
	
	$('.'+cssclass).attr("disabled","true");	
		$.ajax({
			type: "GET",			
			url: encodeURI(link),
			cache: "false",
			dataType: "text",
			contentType: "application/x-www-form-urlencoded",

    			error: function(){
        			alert('Error loading XML document.');
    			},
															
			success: function(response){
				$("#"+cssid).html(response);
				//$('.shop-ajax-loading').css("display","none");		
			}
		});
}


