/* 
	© fmv Group
	
*/

$(document).ready(function(){



	$('ul#main li').not('.active').delayedMouseEnter(function(){
	
		$(this).find('.movingarrow').stop().animate({bottom:'-16px'});
		$(this).find('img').animate({marginTop:'0px'});
	
	}, 300);	
	
	$('ul#main li').not('.active').mouseleave(function(){
	
		$(this).find('.movingarrow').stop().animate({bottom:'-60px'});
		$(this).find('img').animate({marginTop:'-36px'});
		
		
	});
	
	$('ul#main li a').click(function(){
	
		var href = $(this).attr('href');
		$(location).attr('href',href);
	
	})

	
	var $email = $(".mail");  
	var address = $email.text()
		.replace(/\s*\publishing\s*/, '@')   
			.replace(/\s*\[dot\]\s*/g, '.');  
				$email.html('<a href="mailto:' + address + '">'  
				 + address +'</a>');  
				 
				 
	
	
});


/* Delayed Mouse effect */

(function($) {
 
  $.fn.delayedMouseEnter = function(callback, options) {
 
	var options = $.extend({ delay: 200 }, options);
 
	return this.not("span").each(function() {
		var obj = $(this);
		var timer = false;
		obj.mouseenter( function(event) {
			if(timer) clearTimeout(timer);
			timer = setTimeout( function() { callback.apply(obj[0], [event]); }, options.delay );
		});		
		obj.mouseleave( function(event) {
			if(timer) clearTimeout(timer);
			timer = false;
		});		
	});
  };
 
})(jQuery);

(function($) {
 
  $.fn.delayedMouseLeave = function(callback, options) {
 
	var options = $.extend({ delay: 300 }, options);
 
	return this.not("span").each(function() {
		var obj = $(this);
		var timer = false;
		obj.mouseleave( function(event) {
			if(timer) clearTimeout(timer);
			timer = setTimeout( function() { callback.apply(obj[0], [event]); }, options.delay );
		});		
		obj.mouseenter( function(event) {
			if(timer) clearTimeout(timer);
			timer = false;
		});		
	});
  };
 
})(jQuery);

