PP.namespace("home");
PP.home={
initHome:function(){
	$$("#chargeDefaultNote0").click(
		function(){
			$E("chargeType").value="QQ卡";
			chooseChargeType('QQ卡',$('chargeType').selectedIndex)
		}
	);
	$$("#chargeDefaultNote1").click(
		function(){
			$E("chargeType").value="梦幻西游";
			chooseChargeType('梦幻西游',$('chargeType').selectedIndex)
		}
	);
	$$("#chargeDefaultNote2").click(
		function(){
			$E("chargeType").value="久游一卡通";
			chooseChargeType('久游一卡通',$('chargeType').selectedIndex)
		}
	);
	$$("#chargeDefaultNote3").click(
		function(){
			$E("chargeType").value="征途";
			chooseChargeType('征途',$('chargeType').selectedIndex)
		}
	);
	$$("#showSell0").hover(
		function(){
			$E("showSell1").className="";
			this.className="buyNow";
			$$("#showSellItem0").show();
			$$("#showSellItem1").hide()
		},
		function(){}
	);
	$$("#showSell1").hover(
		function(){
			$E("showSell0").className="";
			this.className="sellNow";
			$$("#showSellItem0").hide();
			$$("#showSellItem1").show()
		},
		function(){}
	);
	$$("#keywordSearch > dt").hover(
		function(){PP.home.showKeyOver(this)},
		function(){}
	);
	$$("#keywordSearch > dd").hover(
		function(){},
		function(){PP.home.showKeyOut(this)}
	);
	PP.home.hideBanner.runAfter(15000);
	$$("#ppMenuItem > li").hover(
		function(){PP.home.showPPMenu(this)},
		function(){}
	);
	PP.home.rollSale();
	$$("#saleHot").hover(
		function(){clearTimeout(PP.home.saleRoll)},
		function(){
			PP.home.saleRoll=setTimeout(PP.home.moveSale,
			PP.home.saleSpeed)
		}
	);
	$$("#rollUp").click(function(){PP.home.moveSaleUp()});
	$$("#rollDown").click(function(){PP.home.moveSaleDown()})
},
showPPMenu:function(a){
	var b=a.id.replace("ppMenuItem","");
	$$("#ppMenuItem > li").removeClass("hover");
	$$("#ppMenuItem"+b).addClass("hover");
	$$("#ppMainDesc > ul").addClass("h");
	$$("#ppMenuItemShow"+b).removeClass("h")
},
nowPushId:0,
homeIsRoll:true,
initHomeAd:function(){
	var a="";
	PP.home.nowPushId=randomInt(5);
	PP.home.showHomeAd(PP.home.nowPushId);
	$$("#homePushName > li").hover(
		function(){
			PP.home.homeIsRoll=false;
			PP.home.showHomeAd(this.id.replace("homeAd",""))
		},
		function(){PP.home.homeIsRoll=true}
	);
	$$("#homePushShow > a").hover(
		function(){PP.home.homeIsRoll=false},
		function(){PP.home.homeIsRoll=true}
	);
	PP.home.rollHomeAd.runAfter(5000)
},
showHomeAd:function(a){
	$$("#homePushShow"+PP.home.nowPushId).hide();
	$$("#homeAd"+PP.home.nowPushId).removeClass("now");
	$$("#homePushShow"+a).show();
	$$("#homeAd"+a).addClass("now");
	PP.home.nowPushId=a
},

rollHomeAd:function(){
	if(PP.home.homeIsRoll){
		var a;
		a=parseInt(PP.home.nowPushId)+1;
		if(a>5){a=0}PP.home.showHomeAd(a)
	};
	PP.home.rollHomeAd.runAfter(5000)
},

nowKeyId:-1,
showKeyOver:function(a){
	if(PP.home.nowKeyId!=-1){
		var b=$$("#showKey"+PP.home.nowKeyId);
		b.removeClass("now");
		$E("showKeyItem"+PP.home.nowKeyId).className=""
	};
	PP.home.nowKeyId=a.id.replace("showKey","");
	$$("#"+a.id).addClass("now");
	$$("#showKeyItem"+PP.home.nowKeyId).addClass("now")
},

showKeyOut:function(a){
	var b=$$("#showKey"+a.id.replace("showKeyItem",""));
	b.removeClass("now");
	a.className="";
	PP.home.nowKeyId=-1
},

hideBanner:function(){$$("#bannerAd").hide()},
saleNum:0,

rollSale:function(){
	var a="";
	
	a+=a;
	$$("#saleHot").html(a);
	if(PP.home.saleNum>3){
		setTimeout(PP.home.moveSale,PP.home.saleStopTime)
	}
},

saleRoll:0,
saleStopTime:3000,
saleSpeed:10,
saleHeight:38,

moveSale:function(){
	var t=$E("saleHot").scrollTop;
	if(t>=PP.home.saleHeight*Math.ceil(PP.home.saleNum/3)){t=0};
	t+=1;
	$E("saleHot").scrollTop=t;
	if(t%PP.home.saleHeight==0){
		PP.home.saleRoll=setTimeout(PP.home.moveSale,PP.home.saleStopTime)
	}else{
		PP.home.saleRoll=setTimeout(PP.home.moveSale,PP.home.saleSpeed)
	}
},

moveSaleUp:function(){
	clearTimeout(PP.home.saleRoll);
	var t=$E("saleHot").scrollTop;
	if(t==0){t=PP.home.saleHeight*Math.ceil(PP.home.saleNum/3)};
	$E("saleHot").scrollTop=t;
	t-=PP.home.saleHeight;
	$E("saleHot").scrollTop=t
},

moveSaleDown:function(){
	clearTimeout(PP.home.saleRoll);
	var t=$E("saleHot").scrollTop;
	if(t>=PP.home.saleHeight*Math.ceil(PP.home.saleNum/3)){t=0};
	t+=PP.home.saleHeight;
	$E("saleHot").scrollTop=t
}

};
