(function($) {  
$.fn.pop_up_evenimente = function (options){
	options = jQuery.extend({
		speedIn:100, 
		speedOut:200, 
		targetDiv:'', 
		typeDelay:3000,
		targetDiv:'pop_up_evenimente',
		url:'obligatoriu'
},options);	
$.fn.findPos = function() {

       obj = jQuery(this).get(0);
	   var pozitie=$(obj).position();
       return {x:pozitie.left-705,y:pozitie.top+60};

   }

$('#'+options.targetDiv).hide();
this.lastValue = '';
var dotimeout;

$.fn.popupShow=function(){
	var curObj = $('#'+options.targetDiv);
	var pos = $(this).findPos();
	if( $(curObj).is(':hidden') ) {
		curObj.css({left:(pos.x+$(this).width())+'px'});
		curObj.css({top:(pos.y)+'px'});
		curObj.stop();
		curObj.show();
		$('#main_meniu_all_events a').addClass('selectat');
		dotimeout = setTimeout('$(this).popupHide()', options.typeDelay);
	}
};

$.fn.popupHide=function(e){
	var curObj = $('#'+options.targetDiv);
	curObj.stop();
	curObj.hide();
	$('#main_meniu_all_events a').removeClass('selectat');
};


$('#'+options.targetDiv).bind('mouseenter', function() {
	clearTimeout(dotimeout);
})

$('#'+options.targetDiv).bind('mouseleave', function() {
	dotimeout = setTimeout('$(this).popupHide()', 1000);
})

$(this).bind('mouseenter',function(){
	var curObj = $('#'+options.targetDiv);
	var pos = $(this).findPos();
	$(this).popupShow()
	clearTimeout(dotimeout);
});

$(this).bind('mouseleave',function(){
	dotimeout = setTimeout('$(this).popupHide()', 1000);
});

}})(jQuery);

