(function($){

$(document).ready(function() {
/*
  $("#navbar li.cat-item").hover(
	function() {
		$(this).addClass("active");
	},
    function () {
        $(this).removeClass("active");
    }
);

$("#navbar ul.children").parent("li.cat-item").hover(
	function() {
		$(this).addClass("active");
	},	
	function () {
		$(this).removeClass("active");
    }
	);



$("#navbar .page_item ul").parent("li.page_item").hover(
	function() {
		$(this).addClass("active");
	},	
	function () {
		$(this).removeClass("active");
    }
	);

$("#navbar ul li ul li").parents("li").addClass("parent-li");
*/
/* VENTURIS*/
//$("li.current_page_item").parent("ul").addClass("parent-ul");
//$("li.current-cat").parent("ul").addClass("parent-ul");

$("ul#menu li.page_item").hover(
	function() {
		$(this).addClass("hover");
	},
    function () {
        $(this).removeClass("hover");
    }
);
$("ul#menu li.cat-item").hover(
	function() {
		$(this).addClass("hover");
	},
    function () {
        $(this).removeClass("hover");
    }
);

$("div#lang-switcher").hover(
	function() {
		$(this).addClass("visible");
	},	
	function () {
		$(this).removeClass("visible");
    }
	);
$('<div id="dottip"></div>').hide().appendTo('body');
var tipTitle = '';
/* DOT >>>>  FLAG 	
$("#legendary-pink-dots div").hover(
	function() {
		
	},	
	function () {
		
    }
	);
	
*/	
	
	
$('#legendary-pink-dots').bind('mouseover', function(event) {
  var $link = $(event.target).closest('a');
  if ($link.length) {
 var link = $link[0];
 tipTitle = link.title;
 link.title = '';
 $('#dottip')
 .css({
	position: 'absolute',
   top: event.pageY,
   left: event.pageX
 })
 .html('<div>' + tipTitle + '</div>')
 .show();
  }
  $("#flags div a").each(function () {
		var $flag = $(this).closest('a');
		var flag = $flag[0];
		flagTitle = flag.title;
		if (flagTitle==tipTitle) {
		$(this).closest('div').addClass("hover");
		}
	});
  
}).bind('mouseout', function(event) {
  var $link = $(event.target).closest('a');
  if ($link.length) {
 $link.attr('title', tipTitle);
 $('#dottip').hide();
  }
  $("#flags div").removeClass("hover");
}).bind('mousemove', function(event) {
  if ($(event.target).closest('a').length) {
 $('#dottip').css({
   top: event.pageY + 12,
   left: event.pageX + 12
 });
  }
});	


$('#flags').bind('mouseover', function(event) {
 $(event.target).closest('div').addClass("hover");
 var $link = $(event.target).closest('a');
	 if ($link.length) {
	 var link = $link[0];
	 tipTitle = link.title;
	 link.title = '';
  }
  $('#legendary-pink-dots div a').each(function (kropa) {
		var $dot = $(this).closest('a');
		var dot = $dot[0];
		dotTitle = dot.title;
		var dotXY = $(this).offset(); 
		if (dotTitle==tipTitle) {
			$(this).closest('div').addClass("hover");
				$('#dottip')
				.css({
				position: 'absolute',
				top: dotXY.top + 52,
				left: dotXY.left - 12}
				) 
				.html('<div>' + tipTitle + '</div>')
				.show();
 
		}
		});
	
}).bind('mouseout', function(event) {
  var $link = $(event.target).closest('a');
  if ($link.length) {
 $link.attr('title', tipTitle);
 $('#dottip').hide();
  }
  $('#flags div').removeClass("hover");
  $('#legendary-pink-dots div').removeClass("hover");
});


/* FLAG >>>>  DOT  + TOOLTIP 
$("#flags div").hover(
	function() {
		$(this).addClass("hover");
			
		var flag = $(this).attr("class").split(' ').slice(-2);
		$("#legendary-pink-dots div").each(function () {
		if ($(this).hasClass(flag)) {
		//var title = $(this).children("a").attr("title");
		$(this).addClass("hover");
		//$(this).append("<p>" + title +"</p>");
		}
	});
	},	
	function () {
		$(this).removeClass("hover");
		$("#legendary-pink-dots div").removeClass("hover");
		$("#legendary-pink-dots div p").remove();
    }
	);	
	*/	

	
	
	
	
/*  DEALS TOOLTIP  */	
$("li.deal").mousemove(
		
		function(e){
		var divHeight = $(this).find(".desc").height();
		var divWidth =$(this).find(".desc").width();
		var height = divHeight+40
		var cssObj = {
      'display':'block',
	  'left': (e.clientX),
	  'top':(e.pageY-height),
	  'height':divHeight
	  
    }
		$(this).find("p").addClass("hover");
		$(this).find(".desc").css(cssObj);
}
);
$("li.deal").hover(
function(){
$(this).find(".desc").css("display","block");
},
function(){
$(this).find(".desc").css("display","none");});
		//$("html, body").animate({scrollTop: $("#content").height()}, 300);
		
		
	
				
	});	
  })(jQuery);
