$(function(){
    if(navigator.userAgent.indexOf("MSIE") != -1) {
        $('img').each(function() {
            if($(this).attr('src').indexOf('.png') != -1) {
                $(this).css({
                    'filter': 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' +
                    $(this).attr('src') +
                    '", sizingMethod="scale");'
                });
            }
        });
    }
	$(".mainimg_back").eq(0).css("display" , "block");
	var presenceNum = 0;
	$(".btn_main").hover(
		function () {
			var nextNum = $(".btn_main").index(this);
			if(navigator.userAgent.indexOf("MSIE 6") != -1) {
				$(".mainimg_back").eq(nextNum + 1).stop(true,true).fadeIn(0);
				$(".mainimg_back").eq(0).stop(true,true).fadeOut(0);
				presenceNum = nextNum;
			}else{
				$(".mainimg_back").eq(nextNum + 1).stop(true,true).fadeIn(300);
				$(".mainimg_back").eq(0).stop(true,true).fadeOut(300);
				presenceNum = nextNum;
				$(".btn_main").each(function (index) {
					if(index !== nextNum){
						$(this).stop(true, false).animate({ opacity: 0.4}, 300 );
					}
				});
			}
		},
		function () {
			if(navigator.userAgent.indexOf("MSIE 6") != -1) {
				$(".mainimg_back").eq(0).stop(true,true).fadeIn(0);
				$(".mainimg_back").eq(presenceNum + 1).stop(true,true).fadeOut(0);
				presenceNum = 0;
			}else{
				$(".mainimg_back").eq(0).stop(true,true).fadeIn(300);
				$(".mainimg_back").eq(presenceNum + 1).stop(true,true).fadeOut(300);
				presenceNum = 0;
				$(".btn_main").each(function (index) {
					$(this).stop(true, false).animate({ opacity: 1}, 300 );
				});
			}
		}
	);
});
