$(function() {
	
	$('.global-navi a img:not(img[src*=_on.])').rollover();
});



(function(jQuery) {
	jQuery.fn.max_height = function(){
			var max_height = 0;
			this.each(
								function(){
									var height = jQuery(this).height();
									if(height > max_height){
										max_height= height;
									}
								}
			);
			this.each(
								function(){
									var set_height = max_height + 'px';
									jQuery(this).css('height',set_height);
									}
			);
	}
	jQuery.fn.rollover = function(){
		this.each(
			function(){
			var imgsrc = this.src;
		    var dot = this.src.lastIndexOf('.');
		    var imgsrc_ro = this.src.substr(0, dot) + '_on' + this.src.substr(dot, 4);
			var img = '<img src="' + imgsrc_ro +'"/>';
			var img_el = $(img);
			jQuery(this).hover(
				function  () {
					jQuery(this).stop();
					img_el.css({position:"absolute",top:0,left:0,zIndex:-1}).insertAfter(this);
					jQuery(this).animate({opacity:0},800);
				},
				function(){	
					jQuery(this).stop().animate({opacity:1},600);
				}

			);
				
			}
		);		
	};

})(jQuery);
