
if(!window.notshowSlider) {
jQuery.easing={easein:function(x,t,b,c,d){return c*(t/=d)*t+b},easeinout:function(x,t,b,c,d){if(t<d/2)return 2*c*t*t/(d*d)+b;var a=t-d/2;return-2*c*a*a/(d*d)+2*c*a/d+c/2+b},easeout:function(x,t,b,c,d){return-c*t*t/(d*d)+2*c*t/d+b},expoin:function(x,t,b,c,d){var a=1;if(c<0){a*=-1;c*=-1}return a*(Math.exp(Math.log(c)/d*t))+b},expoout:function(x,t,b,c,d){var a=1;if(c<0){a*=-1;c*=-1}return a*(-Math.exp(-Math.log(c)/d*(t-d))+c+1)+b},expoinout:function(x,t,b,c,d){var a=1;if(c<0){a*=-1;c*=-1}if(t<d/2)return a*(Math.exp(Math.log(c/2)/(d/2)*t))+b;return a*(-Math.exp(-2*Math.log(c/2)/d*(t-d))+c+1)+b},bouncein:function(x,t,b,c,d){return c-jQuery.easing['bounceout'](x,d-t,0,c,d)+b},bounceout:function(x,t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b}},bounceinout:function(x,t,b,c,d){if(t<d/2)return jQuery.easing['bouncein'](x,t*2,0,c,d)*.5+b;return jQuery.easing['bounceout'](x,t*2-d,0,c,d)*.5+c*.5+b},elasin:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b},elasout:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b},elasinout:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b},backin:function(x,t,b,c,d){var s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b},backout:function(x,t,b,c,d){var s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},backinout:function(x,t,b,c,d){var s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b},linear:function(x,t,b,c,d){return c*t/d+b}};
(function($){$.fn.lavaLamp=function(o){o=$.extend({fx:"linear",speed:500,click:function(){}},o||{});return this.each(function(){var b=$(this),noop=function(){},$back=$('<li class="back"><div class="left"></div></li>').appendTo(b),$li=$("li",this),curr=$("li.current",this)[0]||$($li[0]).addClass("current")[0];$li.not(".back").hover(function(){move(this)},noop);$(this).hover(noop,function(){move(curr)});$li.click(function(e){setCurr(this);return o.click.apply(this,[e,this])});setCurr(curr);function setCurr(a){$back.css({"left":a.offsetLeft+"px","width":a.offsetWidth+"px"});curr=a};function move(a){$back.each(function(){$.dequeue(this,"fx")}).animate({width:a.offsetWidth,left:a.offsetLeft},o.speed,o.fx)}})}})(jQuery);
if($("#1").get(0)){
	$(function() {
		$("#1").lavaLamp({
			fx: "backout", 
        	speed: 700,
        	click: function(event, menuItem) {
    			//window.location.href=event.target.href;
    			return true;
        	}
		});
	});
}
}
var mzCommon = null;
function MZCommon(){
}
MZCommon.prototype={
	curIndex : 0,
	isHomeHold : false,
	isShowMyinfo : false,    //我的信息，   鼠标离开后，若2S内未进入选中区，自动关闭
	isMyinfoHover : false,    //鼠标停在A标签上，true使自动关闭任务失效
	toSearch : function(){
	if($.trim($('#searchKeyWord').val())=='')
	{
		ZZtips.attachTip("searchKeyWord", "请输入关键字！");
		return ;
	}
	window.location = MZEnv.contextPath+"services/"+"search.html?keyword="+encodeURIComponent($.trim($('#searchKeyWord').val()));
},
	toAsk    : function()
	{
			if($.trim($('#searchKeyWord').val())=='')
			{
				ZZtips.attachTip("searchKeyWord", "请输入关键字！");
				return ;
			}
			window.location = MZEnv.contextPath+"services/"+"ask.html?keyword="+encodeURIComponent($.trim($('#searchKeyWord').val()));
	},
	bindFillInputEvent : function()//绑定搜索提示控件
	{
		$("#searchKeyWord").jsonSuggest('',{
			uri: $.getUrl("csc_KeyWordAct/"),
			ajaxResults: true,
			idInput : 'hideKeyWordId',
			matchField : 'key',
			minSearchLength : 4,
			onSelect:function()//选定后触发的事件
			{
				window.location = MZEnv.contextPath+"services/"+"ask.html?keyword="+encodeURIComponent($.trim($('#searchKeyWord').val()));
			}
		});
	},
	floatShow : function(){
		if($('.myinfo_navdiv').get(0)){
			$(".a_myinfo").hover(function(){
				mzCommon.isMyinfoHover=true;
				mzCommon.isShowMyinfo=true;
				$('.myinfo_navdiv').show();
			});
			$(".a_myinfo").mouseleave(function(){
				mzCommon.isMyinfoHover=false;
				setTimeout( function(){
//					alert(mzCommon.isShowMyinfo);
					if(mzCommon.isShowMyinfo && !mzCommon.isMyinfoHover)
						$('.myinfo_navdiv').hide();
				}, 1000 );
			});
			$('.myinfo_navdiv').mouseout(function(event){
				mzCommon.isShowMyinfo=false;
				if ($(event.relatedTarget).parents("div:first").get(0) == $(this).get(0)) {
					return;
				}
				$('.myinfo_navdiv').hide();
			});
		}
	},
	selectSmallPic : function(picId,imgUrl,pidPath) {
    	$("#bigImg")[0].src=imgUrl+pidPath;
    	var tempSrc = $(".pj_s_pic_bg").find('img')[0].src;
    	var tempOpList = tempSrc.split("/");
    	var pic_fileName = tempOpList[tempOpList.length-1];
    	$(".pj_s_pic_bg").find('img')[0].src = imgUrl + "s_"+pic_fileName.split("_")[1];
    	var divList=$("#pj_spic_content div");
    	for(var i=0;i<divList.length;i++){
    		divList[i].className="pj_s_pic";
    	}
    	$("#"+picId)[0].className="pj_s_pic pj_s_pic_bg";
    	var ImageTemp = new Image();
    	ImageTemp.src = imgUrl+"s2_"+$("#"+picId).attr('id').split("_")[1]+".png";
    	$("#"+picId).find('img').replaceWith(ImageTemp);
	},
	hideNearSep : function(){
		if($('.pic_bg_m8').get(0)){
			if($('.pic_bg_m8 ~ .pj_sep').get(0)){
				$($('.pic_bg_m8 ~ .pj_sep')[0]).css({background:'none'});
			}
			if($('.pic_bg_m8').prev().attr('class')=='pj_sep'){
				$('.pic_bg_m8').prev().css({background:'none'});
			}
		}
		if($('.pic_bg').get(0)){
			if($('.pic_bg ~ .pj_sep').get(0)){
				$($('.pic_bg ~ .pj_sep')[0]).css({background:'none'});
			}
			if($('.pic_bg').prev().attr('class')=='pj_sep'){
				$('.pic_bg').prev().css({background:'none'});
			}
		}
	},
	changeHomePic : function(id){
		id = id.data.data;
		if(mzCommon.isHomeHold){
			return ;
		}
		if($("#"+id).hasClass('selected') || isIndexMoving) 
			return;
		if(id=='indexHome1') {
//			move_p1=130;
			move_p2=-708;
//			selectedIndex=1;
			$("#homepic1").show();
			$("#homepic1").addClass("showHome1");
			$("#indexHome1")[0].className="selected";
			$("#indexHome2")[0].className="";
			$("#indexHome3")[0].className="";
			$("#spanHome1")[0].className="h_nav_sel1";
			$("#spanHome2")[0].className="h_nav_2";
			$("#spanHome3")[0].className="h_nav_3";
		}
		else if(id=='indexHome2'){
				move_p2=0;
				setTimeout(function(){
					$("#homepic1").hide();
				},280);
//			if(selectedIndex==1) {
//				move_p1=-505;
//				move_p2=-635;
//			}
//			else {
//				move_p1=-765;
//				move_p2=-635;
//			}
//			selectedIndex=2;
			
			$("#homepic2").addClass("showHome2");
			
			$("#indexHome1")[0].className="";
			$("#indexHome2")[0].className="selected";
			$("#indexHome3")[0].className="";
			$("#spanHome1")[0].className="h_nav_1";
			$("#spanHome2")[0].className="h_nav_sel2";
			$("#spanHome3")[0].className="h_nav_3";
//			$("#homepic2").addClass("showHome2");
			
		}
		else {
//			move_p1=-1140;
			move_p2=-1878;
//			selectedIndex=3;
			$("#homepic3").addClass("showHome3");
			$("#indexHome1")[0].className="";
			$("#indexHome2")[0].className="";
			$("#indexHome3")[0].className="selected";
			$("#spanHome1")[0].className="h_nav_1";
			$("#spanHome2")[0].className="h_nav_2";
			$("#spanHome3")[0].className="h_nav_sel3";
			
		}
		if(id !=1){
			$("#homepic1").show();
		}
		isIndexMoving=true;
		$("#homepicId").animate({ marginLeft: move_p2 }, 300,'linear',mzCommon.moveCallFuc );  //一级移动
	},
	moveCallFuc : function() {
//		$("#homepicId").animate({ marginLeft: move_p2 }, 150,'linear',function() {   //二级移动
			isIndexMoving=false;
//		}); 
	},
	gotoM9pro : function() {
		window.location.href ="http://en.meizu.com/products/mx-product.html";
	}
	,
	ie6HomechangePic :function(i){
		i = i.data;
		var home_tempindex = i;
		i=home_tempindex+1;
		if(('indexHome'+i)=='indexHome1') {
				$("#indexHome2")[0].className="selected";
				$("#indexHome2")[0].className="";
				$("#indexHome3")[0].className="";
				$("#spanHome2")[0].className="h_nav_sel2";
				$("#spanHome1")[0].className="h_nav_1";
				$("#spanHome3")[0].className="h_nav_3";
		}
		else if(('indexHome'+i)=='indexHome2'){
				$("#homepic1").hide();
				$("#homepic1").addClass("showHome1");
				$("#indexHome2")[0].className="";
				$("#indexHome1")[0].className="selected";
				$("#indexHome3")[0].className="";
				$("#spanHome2")[0].className="h_nav_2";
				$("#spanHome1")[0].className="h_nav_sel1";
				$("#spanHome3")[0].className="h_nav_3";
			
		}
		else {
			$("#homepic3").addClass("showHome3");
			$("#indexHome1")[0].className="";
			$("#indexHome2")[0].className="";
			$("#indexHome3")[0].className="selected";
			$("#spanHome1")[0].className="h_nav_1";
			$("#spanHome2")[0].className="h_nav_2";
			$("#spanHome3")[0].className="h_nav_sel3";
			
		}
		if(mzCommon.curIndex == home_tempindex || mzCommon.isHomeHold){
			return ;
		}
		mzCommon.isHomeHold = true;
		var currentTempIndex1 = mzCommon.curIndex+1;
			if(mzCommon.load){
				currentTempIndex1 =2;
				mzCommon.load = false;
			}else{
				if(currentTempIndex1 ==2){
					currentTempIndex1 =1;
				}else if(currentTempIndex1 ==1){
					currentTempIndex1 =2;
				}
			}
		$("#homepic"+(currentTempIndex1)).fadeOut(800,function(){
			var currentTempIndex = home_tempindex+1;
				if(currentTempIndex ==2){
					currentTempIndex =1;
				}else if(currentTempIndex ==1){
					currentTempIndex =2;
				}
			$('#homepic'+parseInt(currentTempIndex)).fadeIn(400);
			mzCommon.curIndex = home_tempindex;
			mzCommon.isHomeHold = false;
		});
	}
};



jQuery(function(){
	mzCommon = new MZCommon();
	if($('#searchKeyWord').get(0)){
		mzCommon.bindFillInputEvent();
		$('#topSearchButton').bind('click',mzCommon.toSearch.bind(mzCommon));
		$('#toAskButton').bind('click',mzCommon.toAsk.bind(mzCommon));
		mzCommon.floatShow();
	}
	if($('#bbsLoginLink').get(0)){
		$('#bbsLoginLink').bind('click',function(){
		window.location.href = "http://bbs.meizu.com/logging.php?action=login&continue="+encodeURIComponent(window.location.href);
		return false;
		}); 
	}
	if($('#cscshover').get(0)){
		$('#searchKeyWord').bind('focus',function(){
			$('#cscshover').addClass('focus');
		});
		$('#searchKeyWord').blur(function(){
			$('#cscshover').removeClass('focus');
		});
	}
	if($('.nav4').get(0) && $('.proc_navdiv_mx').get(0)){
			$('#moreProduct').mouseleave(	function(){
				$('.proc_navdiv_mx').css('display','none');
			});
			$('#moreProduct').mouseover(	function(){
				$('.proc_navdiv_mx').css({'display':'block'});
			});
			$('.proc_navdiv_mx').mouseleave(	function(){
				$('.proc_navdiv_mx').css('display','none');
			});
			$('.proc_navdiv_mx').mouseover(	function(){
				$('.proc_navdiv_mx').css({'display':'block'});
			});
	}
	mzCommon.hideNearSep();

	$('a').each(function(){
		$(this).attr('hidefocus',true);
	});
	if ( $.browser.msie ){
		if($.browser.version=='8.0'){
			$('a').each(function(){
				$(this).focus(function(){
					$(this).blur();
				});
			});
		}
		
		if($.browser.version=='6.0'){
				$("span[id^='spanHome']").each(function(i){
					$(this).bind('click',i,mzCommon.ie6HomechangePic);
				document.execCommand("BackgroundImageCache", false, true);
			});
		}
	}
	if(!$.browser.msie ||($.browser.msie && $.browser.version != '6.0')){
			$('#spanHome1').bind('click',{data:'indexHome1'},mzCommon.changeHomePic);
			$('#spanHome2').bind('click',{data:'indexHome2'},mzCommon.changeHomePic);
			$('#spanHome3').bind('click',{data:'indexHome3'},mzCommon.changeHomePic);
	}
	
	$('.c_menu a').each(function(){
		$(this).mouseover(function(){
			var prev = "";
			var next = "";
			if($(this).parent().prev().children()[0])
			{
				prev = $(this).parent().prev().children()[0].className;
			}
			if($(this).parent().next().children()[0]){
				next = $(this).parent().next().children()[0].className;
			}
			
			 if(prev.indexOf('selected') != -1){
				 	
				 	$(this).find(".hideLeft").css('background-color','#00A9F6');
				}
			 if(next.indexOf('selected') != -1){
				 	
				 $(this).parent().next().find(".hideLeft").css('background-color','#00A9F6');
				}
			 
			
		});
		$(this).mouseout(function(){
				$(this).find(".hideLeft").find('.hideLeft').css('background-color','#edf2f6');
				 $(this).parent().next().find('.hideLeft').css('background-color','#edf2f6');
			
		});
	});
	
	if($('#global')[0]){
		$('#global').hover(function(){
			var pos = $(this).offset();
			$('.site_navdiv').css({'left':(pos.left-18+'px'),'top':(pos.top+20+'px'),'zIndex':20000}).show();
		},function(){
			$('.site_navdiv').hide();
		});
		$('.site_navdiv').hover(function(){
			$('.site_navdiv').show();
		},function(){
			$('.site_navdiv').hide();
		});
	}
});




