





/*
-- ------ Auction ------ --
*/
function Auction(){}
//-- ------ #Parameters ------ --

Auction.prototype.sAjax_0=new netsSingleAjax();


//-- ------ #Methods ------ --
//-- #Navigation --

//-- #Tab --
Auction.prototype.OnTab_A=function(pFlag,pIndex){
	var Coun0=0;
	var tmpElement=document.getElementById("mainTab_"+pFlag+"_Button_"+Coun0);
	while(tmpElement!=undefined){
		document.getElementById("mainTab_"+pFlag+"_Button_"+Coun0).className="Auction_Title_6";
		document.getElementById("mainTab_"+pFlag+"_Box_"+Coun0).className=tmpCommon.sysHidden;
		Coun0++;
		tmpElement=document.getElementById("mainTab_"+pFlag+"_Button_"+Coun0);
	}
	
	document.getElementById("mainTab_"+pFlag+"_Button_"+pIndex).className="Auction_Title_5";
	document.getElementById("mainTab_"+pFlag+"_Box_"+pIndex).className="Auction_Box_3";
	return 0;
}
Auction.prototype.OnTab_B=function(pFlag,pIndex){
	var Coun0=0;
	var tmpElement=document.getElementById("mainTab_"+pFlag+"_Button_"+Coun0);
	while(tmpElement!=undefined){
		document.getElementById("mainTab_"+pFlag+"_Button_"+Coun0).className="Auction_Title_9";
		document.getElementById("mainTab_"+pFlag+"_Box_"+Coun0).className=tmpCommon.sysHidden;
		Coun0++;
		tmpElement=document.getElementById("mainTab_"+pFlag+"_Button_"+Coun0);
	}
	
	document.getElementById("mainTab_"+pFlag+"_Button_"+pIndex).className="Auction_Title_8";
	document.getElementById("mainTab_"+pFlag+"_Box_"+pIndex).className="Auction_Box_3";
	return 0;
}
//-- #Search --
Auction.prototype.sDefaultSTR="请在这里输入您要查询的内容...";
Auction.prototype.OnSearch_Text=function(){
	var tmpSTR=document.getElementById("AuctionSearchTxt").value;
	if(tmpSTR==this.sDefaultSTR){
		tmpSTR="";
	}
	var tmpURL="../../../Plus/m_default/shop/auctionList.php?ID="+document.getElementById("AuctionGroupTxt").value+
		"&DKeyword="+tmpCommon.encodeURL(tmpSTR,0)+
		"&DSearch=0,0,"+document.getElementById("AuctionTypeTxt").value+tmpCommon.sysSPLIT1+document.getElementById("AuctionStateTxt").value;
	
	window.location=tmpURL;
	return 0;
}
Auction.prototype.OnSearch_Focus=function(pType){
	var tmpElement=document.getElementById("AuctionSearchTxt");
	if(pType==0){
		//#Focus
		if(tmpElement.value==this.sDefaultSTR){
			tmpElement.value="";
		}
		tmpElement.style.color="#333333";
	}else{
		//#Blur
		if(tmpElement.value==""){
			tmpElement.value=this.sDefaultSTR;
		}
		tmpElement.style.color="#CCCCCC";
	}
	
	return 0;
}
//-- #Refresh --
Auction.prototype.sRefresh_URL="";
Auction.prototype.sRefreshData_URL="";
Auction.prototype.sRefresh_Timespan=0;
Auction.prototype.sAjax_Refresh=new netsSingleAjax();
Auction.prototype.sAjax_RefreshData=new netsSingleAjax();
Auction.prototype.OnRefresh=function(){
	var tmpURL=this.sRefresh_URL+"?Code="+Math.random();

	this.sAjax_Refresh.sFlag="Data";
	this.sAjax_Refresh.sPanel="Data";
	this.sAjax_Refresh.sURL=tmpURL;
	this.sAjax_Refresh.sendRequestSp(tmpURL,"auction_Refresh_Callback();");
	//window.open(tmpURL,"_blank");
	return 0;
}
function auction_Refresh_Callback(){
	var tmpFlag=tmpAuction.sAjax_Refresh.sFlag;
	var tmpPanel=document.getElementById(tmpAuction.sAjax_Refresh.sPanel);
	var tmpURL=tmpAuction.sAjax_Refresh.sURL;
	var tmpHttpRequests=tmpAuction.sAjax_Refresh.sHttpRequests;
	//alert(tmpHttpRequests.responseText);
	if(tmpHttpRequests.readyState==4){
		//alert(tmpHttpRequests.responseText);
		var tmpData=getDataByFlag(tmpHttpRequests.responseText,tmpFlag);
		//alert(tmpData);
		if(tmpData.indexOf("sendRequest")>=0 && tmpData!="<!--sendRequest-->"){
			tmpINT=parseInt(tmpData);
			if(tmpAuction.sRefresh_Timespan<tmpINT){
				var tmpURL=tmpAuction.sRefreshData_URL+"&Code="+Math.random();
				tmpAuction.sAjax_RefreshData.sFlag="Data";
				tmpAuction.sAjax_RefreshData.sPanel="auctionData";
				tmpAuction.sAjax_RefreshData.sURL=tmpURL;
				tmpAuction.sAjax_RefreshData.sendRequestSp(tmpURL,"auction_RefreshData_Callback();");
				//window.open(tmpURL,"_blank");
			}
	    }
	}else{
	}
	
}
function auction_RefreshData_Callback(){
	var tmpFlag=tmpAuction.sAjax_RefreshData.sFlag;
	var tmpPanel=document.getElementById(tmpAuction.sAjax_RefreshData.sPanel);
	var tmpURL=tmpAuction.sAjax_RefreshData.sURL;
	var tmpHttpRequests=tmpAuction.sAjax_RefreshData.sHttpRequests;
	//alert(tmpHttpRequests.responseText);
	if(tmpHttpRequests.readyState==4){
		//alert(tmpHttpRequests.responseText);
		var tmpData=getDataByFlag(tmpHttpRequests.responseText,tmpFlag);
		//alert(tmpData);
		if(tmpData.indexOf("sendRequest")>=0 && tmpData!="<!--sendRequest-->"){
			var tmpAR0=tmpData.split(tmpCommon.sysSPLIT6);
			tmpAuction.sRefresh_Timespan=tmpAR0[0];
			document.getElementById("auctionPrice").innerHTML=tmpAR0[1];
			document.getElementById("shadtPriceTxt").value=tmpAR0[2];
			document.getElementById("Order_Price_Txt").value=tmpAR0[2];
			
			tmpPanel.innerHTML=tmpAR0[3];
			
	    }
	}else{
	}
	
}
//#Time
Auction.prototype.sTimeboxs="";
Auction.prototype.OnTimerun=function(){
	var tmpDate_Today=new Date();
	var tmpDate_Endday=new Date();
	
	var tmpAR0=this.sTimeboxs.split(tmpCommon.sysSPLIT1);
	var Coun0=0;
	while(tmpAR0.length>Coun0){
		if(document.getElementById("AuctionTime_"+tmpAR0[Coun0]+"_Endtime")!=undefined){
			tmpSTR=document.getElementById("AuctionTime_"+tmpAR0[Coun0]+"_Endtime").value;
			tmpDate_Endday=tmpCommon.formatDate(tmpSTR);
			var tmpDatetime=this.DateSub(tmpDate_Endday,tmpDate_Today);

			document.getElementById("AuctionTime_"+tmpAR0[Coun0]+"_Day").innerHTML=tmpDatetime[0];
			document.getElementById("AuctionTime_"+tmpAR0[Coun0]+"_Hour").innerHTML=tmpDatetime[1];
			document.getElementById("AuctionTime_"+tmpAR0[Coun0]+"_Min").innerHTML=tmpDatetime[2];
			document.getElementById("AuctionTime_"+tmpAR0[Coun0]+"_Seconds").innerHTML=tmpDatetime[3];
		}
		Coun0++;
	}

	return 0;
}
Auction.prototype.DateSub=function(pDate,pDate_DIS){
	var tmpAR0=new Array(0,0,0,0);
	
	tmpYear=pDate.getYear()-pDate_DIS.getYear();
	tmpMonth=pDate.getMonth()-(pDate_DIS.getMonth()+1);
	tmpDay=pDate.getDay()-pDate_DIS.getDay();
	tmpHour=pDate.getHours()-pDate_DIS.getHours();
	tmpMinute=pDate.getMinutes()-pDate_DIS.getMinutes();
	tmpSecond=pDate.getSeconds()-pDate_DIS.getSeconds();

	if(tmpSecond<0){
		tmpMinute--;
		tmpSecond+=60;
	}
	if(tmpMinute<0){
		tmpHour--;
		tmpMinute+=60;
	}
	if(tmpHour<0){
		tmpDay--;
		tmpHour+=24;
	}
	if(tmpDay<0){
		tmpMonth--;
		tmpDay+=30;
	}
	if(tmpMonth<0){
		tmpYear--;
		tmpMonth+=12;
	}

	tmpAR0[0]=tmpYear*365+tmpMonth*30+tmpDay;
	tmpAR0[1]=tmpHour;
	tmpAR0[2]=tmpMinute;
	tmpAR0[3]=tmpSecond;
	return tmpAR0;
}




