//获取数据请求
GDTopRequest = new function(){
	this.scriptid ="GDTopRequest";
	this.url = "http://stockdata.stock.hexun.com/2008/DefaultDataOutput.aspx?ColumnId=5585";
	this.typeCode = "0";
	this.updown = "desc";

	this.CreateLink = function()
	{
		var request = this.url + "&";
		//request += "updown=" + this.updown + "&typeCode=" + this.typeCode + "&time=" + Common.Time();
		request += "updown=" + this.updown + "&typeCode=" + this.typeCode;
		return request;
	}	
	this.Request = function()
	{
		Common.AppendDataArray(this.scriptid,this.CreateLink());
	}
	this.SetUpdown = function(st)
	{
		this.updown = st;
		this.Request();
	}
}


//显示数据
GDListPage = new function(){
	this.dataArray;
	this.divName = "GDListDiv";
	this.columnArray = new Array();
	this.reloadTime = 30000;
	this.reload = true;
	this.setTimeObj;
	this.GetData = function(array,time)
	{
		this.dataArray = array;
		this.NewLoadDataFinish();
	}
	this.NewLoadDataFinish = function()
	{
		var columnName = this.GetColumnName(GDTopRequest.updown);
		var hc = new Array();
		
		hc.push("<table width=\"125\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"box14\">");
		hc.push("<tr><td>排名</td><td>简称</td><td>"+ columnName +"</td></tr>");
		for(var i=0;i < this.dataArray.length;i++){
			hc.push("<tr>");
			hc.push("<td>" + (i+1) + "</td>");
			hc.push("<td><a href=\"http://stockdata.stock.hexun.com/" + this.dataArray[i][0] + ".shtml\" target=\"_blank\">" + this.dataArray[i][1] + "</a></td>");//名称
			if(this.dataArray[i][2] == null){
				hc.push("<td>--</td>");
			}else{
				hc.push("<td>" + this.dataArray[i][2] + "</td>");
			}
			hc.push("</tr>");
		}
		hc.push("</table>");
		Common.$(this.divName).innerHTML = hc.join('');
	}
	this.GetColumnName = function(st)
	{
		var cName = "";
		switch(st)
		{
			case "desc":cName="增幅排名";break;
			case "asc":cName="减幅排名";break;
			default:cName="增幅排名";break;
		}
		return cName;
	}
}

