var layer1;
var layer2;
function center_show_div(divid,id){
	
	var win = $("#"+divid);
	//var img = getElementPos(id);
	var img = getXY(id);
	var left = img.x-6;
	var top = img.y+15;
	win.css("filter","alpha(opacity=0)");
	 		//FF
	win.css("opacity","0");
	win.css("left",left).css("top",top).slideDown(400,function(){
	win.fadeTo(100,0.77);
	});
	window.setTimeout("close()",5000);
}
function close(){
$("#jfddzt_1").hide(100);
$("#jfddzt_2").hide(100);
$("#jfddzt_3").hide(100);
}
function getXY(id){

var Y = $('#'+id).offset().top;
var X = $('#'+id).offset().left; 
return {x:X,y:Y}
}


function show_div(div1,div2,div3,stat){
var tag =false;
 if(stat!="jfdt_1_show")
    tag =true;
 
	 if($('#'+div1).css("display")=="block"){
	 	$('#'+div1).hide(100,function(){
	 	//IE
	 		$('#'+stat).css("filter","alpha(opacity=0)");
	 		//FF
	 		$('#'+stat).css("opacity","0")
	 		$('#'+stat).show(100,function(){
	 			$('#'+stat).fadeTo(300,0.77,function(){
	 			//执行操作
	 			if(tag){
	
	 			}
	 		});
	 			
	 		});
	 		
	 	});
	 }
	 if($('#'+div2).css("display")=="block"){
	 	$('#'+div2).hide(100,function(){
	 	//IE
	 		$('#'+stat).css("filter","alpha(opacity=0)");
	 		//FF
	 		$('#'+stat).css("opacity","0")
	 			 		$('#'+stat).show(100,function(){
	 			$('#'+stat).fadeTo(300,0.77);
	 		});
	 	});
	 }
	 if($('#'+div3).css("display")=="block"){
	 	$('#'+div3).hide(100,function(){
	 	//IE
	 		$('#'+stat).css("filter","alpha(opacity=0)");
	 		//FF
	 		$('#'+stat).css("opacity","0")
	 			 		$('#'+stat).show(100,function(){
	 			$('#'+stat).fadeTo(300,0.77);
	 		});
	 	});
	 }
	 close();
}
function show_goods_div2(div1,div2,div3,stat){
	   $('#'+div1).hide(500);
	   $('#'+div2).hide(500);
	   $('#'+div3).hide(500);
	   $('#'+stat).slideDown(500);
	 }
function show_goods_div(div1,div2,div3,stat){
	 if($('#'+div1).css("display")=="block"){
	 	$('#'+div1).hide(100,function(){
	 	//IE
	 		$('#'+stat).css("filter","alpha(opacity=0)");
	 		//FF
	 		$('#'+stat).css("opacity","0")
	 		$('#'+stat).show(100,function(){
	 			$('#'+stat).fadeTo(300,0.77);
	 		});
	 		
	 	});
	 }
	 if($('#'+div2).css("display")=="block"){
	 	$('#'+div2).hide(100,function(){
	 	//IE
	 		$('#'+stat).css("filter","alpha(opacity=0)");
	 		//FF
	 		$('#'+stat).css("opacity","0")
	 			 		$('#'+stat).show(10,function(){
	 			$('#'+stat).fadeTo(300,0.77);
	 		});
	 	});
	 }
	 if($('#'+div3).css("display")=="block"){
	 	$('#'+div3).hide(100,function(){
	 	//IE
	 		$('#'+stat).css("filter","alpha(opacity=0)");
	 		//FF
	 		$('#'+stat).css("opacity","0")
	 			 		$('#'+stat).show(100,function(){
	 			$('#'+stat).fadeTo(300,0.77);
	 		});
	 	});
	 }
}
/****打折价格***/
function show_hide(stat,id,tag){
if(tag==1){
show_goods_new2('zhekou_1','zhekou_2','zhekou_3',stat,id);
}else{
show_goods_new('zhekou_1','zhekou_2','zhekou_3',stat,id);
}
}
function autoplay(time){
//图片自动播放
  var rand =  Math.floor(Math.random()*3);
  var acction =  Math.floor(Math.random()*2);
  if(acction == 0){
	  if(rand == 0){
	  	show_goods_new('zhekou_1','zhekou_2','zhekou_3','zhekou_1','a50');
	 	//show_goods_div2('new_1','new_2','new_3','new_1');
	 	//show_goods_div2('hot_1','hot_2','hot_3','hot_1');
	  }else if(rand == 1){
	  	show_goods_new('zhekou_1','zhekou_2','zhekou_3','zhekou_2','a60');
	  	//show_goods_div2('new_1','new_2','new_3','new_2')
	  	//show_goods_div2('hot_1','hot_2','hot_3','hot_2');
	  }else if(rand == 2){
	  	show_goods_new('zhekou_1','zhekou_2','zhekou_3','zhekou_3','a70');
	  	//show_goods_div2('new_1','new_2','new_3','new_3')
	  	//show_goods_div2('hot_1','hot_2','hot_3','hot_3');
	  }
  }else{
	  if(rand == 0){
	  	show_goods_new('zhekou_1','zhekou_2','zhekou_3','zhekou_1','a50');
	 	//show_goods_div('new_1','new_2','new_3','new_1');
	 	//show_goods_div('hot_1','hot_2','hot_3','hot_1');
	  }else if(rand == 1){
	  	show_goods_new('zhekou_1','zhekou_2','zhekou_3','zhekou_2','a60');
	  	//show_goods_div('new_1','new_2','new_3','new_2')
	  	//show_goods_div('hot_1','hot_2','hot_3','hot_2');
	  }else if(rand == 2){
	  	show_goods_new('zhekou_1','zhekou_2','zhekou_3','zhekou_3','a70');
	  	//show_goods_div('new_1','new_2','new_3','new_3')
	  	//show_goods_div('hot_1','hot_2','hot_3','hot_3');
	  }
  }
   window.setTimeout("autoplay(" + time +")",time);
}
function show_goods_new2(div1,div2,div3,stat,id){
	   $('#'+div1).hide(500);
	   $('#'+div2).hide(500);
	   $('#'+div3).hide(500);
	   $('#'+stat).slideDown(500);
	   $('#a50').removeClass("current");
	   $('#a60').removeClass("current");
	   $('#a70').removeClass("current");
	   $('#'+id).toggleClass("current");
	 }
function show_goods_new(div1,div2,div3,stat,id){
	   $('#a50').removeClass("current");
	   $('#a60').removeClass("current");
	   $('#a70').removeClass("current");
	 if($('#'+div1).css("display")=="block"){
	 	$('#'+div1).hide(100,function(){
	 	//IE
	 		$('#'+stat).css("filter","alpha(opacity=0)");
	 		//FF
	 		$('#'+stat).css("opacity","0");
	 		$('#'+id).addClass("current");
	 		$('#'+stat).show(100,function(){
	 			$('#'+stat).fadeTo(300,0.77);
	 		});
	 		
	 	});
	 }
	 if($('#'+div2).css("display")=="block"){
	 	$('#'+div2).hide(100,function(){
	 	//IE
	 		$('#'+stat).css("filter","alpha(opacity=0)");
	 		//FF
	 		$('#'+stat).css("opacity","0");
	 		$('#'+id).addClass("current");
	 		$('#'+stat).show(10,function(){
	 			$('#'+stat).fadeTo(300,0.77);
	 		});
	 	});
	 }
	 if($('#'+div3).css("display")=="block"){
	 	$('#'+div3).hide(100,function(){
	 	//IE
	 		$('#'+stat).css("filter","alpha(opacity=0)");
	 		//FF
	 		$('#'+stat).css("opacity","0");
	 		$('#'+id).addClass("current");
	 			$('#'+stat).show(100,function(){
	 			$('#'+stat).fadeTo(300,0.77);
	 		});
	 	});
	 }
}
/****季风订单onclick事件*****/
function show_jfdd(stat){

 show_div('jfdt_1','jfdt_2',"jfdt_3",'jfdt_'+stat);
}
/************滚动插件************/
(function($){
$.fn.extend({
        Scroll:function(opt,callback){
                //参数初始化
                if(!opt) var opt={};
                var _this=this.eq(0).find("ul:first");
                var        lineH=_this.find("li:first").height(), //获取行高
                        line=opt.line?parseInt(opt.line,10):parseInt(this.height()/lineH,10), //每次滚动的行数，默认为一屏，即父容器高度
                        speed=opt.speed?parseInt(opt.speed,10):500, //卷动速度，数值越大，速度越慢（毫秒）
                        timer=opt.timer?parseInt(opt.timer,10):3000; //滚动的时间间隔（毫秒）
                if(line==0) line=1;
                var upHeight=0-line*lineH;
                //滚动函数
                scrollUp=function(){
                        _this.animate({
                                marginTop:upHeight
                        },speed,function(){
                                for(i=1;i<=line;i++){
                                        _this.find("li:first").appendTo(_this);
                                }
                                _this.css({marginTop:0});
                        });
                }
                //鼠标事件绑定
                _this.hover(function(){
                        clearInterval(timerID);
                },function(){
                        timerID=setInterval("scrollUp()",timer);
                }).mouseout();
        }        
})
})(jQuery);
