
function menuOn(i){
	$(".M"+i).addClass("M"+i+"On").parent().css("background-position","0 -78px").attr("x",true);
}
(function($) {
	if(!document.defaultView || !document.defaultView.getComputedStyle){ // IE6-IE8
		var oldCurCSS = jQuery.curCSS;
		jQuery.curCSS = function(elem, name, force){
			if(name === 'background-position'){
				name = 'backgroundPosition';
			}
			if(name !== 'backgroundPosition' || !elem.currentStyle || elem.currentStyle[ name ]){
				return oldCurCSS.apply(this, arguments);
			}
			var style = elem.style;
			if ( !force && style && style[ name ] ){
				return style[ name ];
			}
			return oldCurCSS(elem, 'backgroundPositionX', force) +' '+ oldCurCSS(elem, 'backgroundPositionY', force);
		};
	}
	
	var oldAnim = $.fn.animate;
	$.fn.animate = function(prop){
		if('background-position' in prop){
			prop.backgroundPosition = prop['background-position'];
			delete prop['background-position'];
		}
		if('backgroundPosition' in prop){
			prop.backgroundPosition = '('+ prop.backgroundPosition;
		}
		return oldAnim.apply(this, arguments);
	};
	
	function toArray(strg){
		strg = strg.replace(/left|top/g,'0px');
		strg = strg.replace(/right|bottom/g,'100%');
		strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
		var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
		return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
	}
	
	$.fx.step. backgroundPosition = function(fx) {
		if (!fx.bgPosReady) {
			var start = $.curCSS(fx.elem,'backgroundPosition');
			
			if(!start){//FF2 no inline-style fallback
				start = '0px 0px';
			}
			
			start = toArray(start);
			
			fx.start = [start[0],start[2]];
			
			var end = toArray(fx.options.curAnim.backgroundPosition);
			fx.end = [end[0],end[2]];
			
			fx.unit = [end[1],end[3]];
			fx.bgPosReady = true;
		}
		//return;
		var nowPosX = [];
		nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
		nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];           
		fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];

	};
})(jQuery);




var menuLi = false;
$(function(){
	//if($.browser.version=="6.0"){DD_belatedPNG.fix("img");}
	//导航效果
//	var menuInTime=menuOutTime=false;
	$(".menuTitle li[class!=FG]")
	//$(".menuTitle li:eq(5),.menuTitle li:eq(7),.menuTitle li:eq(9),.menuTitle li:eq(11)")
	.hover(function(){
		$(this).css({backgroundPosition:"-220px -78px"});
		if($(this).find("a").attr("n")){
			l = $(this).offset().left;
			t = $(this).offset().top;
			$("#menuDown").css({left:l-5,top:t+$(this).height() -1}).show();
			n= $(this).find("a").attr("n");
			$("#menuDown ul").html($("#"+n).html())
			if(menuOutTime){clearTimeout(menuOutTime)}
		}
	},function(){
		if(!$(this).attr("x")){
			$(this).stop().animate({backgroundPosition:"(-220px -122px)"}, {duration:300})
		}else{
			$(this).css({backgroundPosition:"0px -78px"}) 
		}
		menuOutTime = setTimeout(function(){ $("#menuDown").hide();},100)
	})
	$("#menuDown").hover(function(){
		if(menuOutTime){clearTimeout(menuOutTime)}
	},function(){
		menuOutTime = setTimeout(function(){ $("#menuDown").hide();},100)
	})

//-------------------------------------------------------------------------------------------------

	$(".homePrLogo_A li")
	.each(function(i){$(this).attr("i",i+1)})
	.hover(function(){
		$(this).addClass($(this).attr("i")+"On");
	},function(){
		$(this).removeClass($(this).attr("i")+"On");
	})
 
	$(".homePrLogo_A li").each(function(i){$(this).attr("num",i)}).click(function(){
		$(".homePrLogo_A li").each(function(){
			$(this).removeClass("logo_0"+$(this).attr("i")+"On")
		})
		$(this).addClass("logo_0"+$(this).attr("i")+"On")
		$(".homePrLogo_B .tab").hide();
		$(".homePrLogo_B .tab:eq("+$(this).attr("num")+")").show();
		
	})
	
	
	
	//搜索效果
	$(".searchKey").mouseover(function(){
		$(this).css("backgroundPosition","0px bottom")
	}).mouseout(function(){
		$(this).css("backgroundPosition","0px 0px")
	})
	$(".searchBtn").mouseover(function(){
		$(this).css("backgroundPosition","right bottom")
	}).mouseout(function(){
		$(this).css("backgroundPosition","right 0px")
	})
 
/*	var _ff = $(".logo").parent().parent();
	_ff.html("11").click(function(){
	//	$("body *").hover(function(){$(this).css({'border':'solid 1px #F00'})},function(){$(this).css({'border':'none'})})
//		.click(function(){
//			var _x = $(this).parent().html()
//			_ff.html(_x)
//			})
		$(this).text($("html").html())
	})*/
})
