//获取数据请求
JZPGTopRequest = new function(){
	this.scriptid ="JZPGTopRequest";
	this.url = "http://stockdata.stock.hexun.com/2008/DefaultDataOutput.aspx?ColumnId=5589";
	this.typeCode = "0";
	this.sortType = "1";

	this.CreateLink = function()
	{
		var request = this.url + "&";
		//request += "sortType=" + this.sortType + "&typeCode=" + this.typeCode + "&time=" + Common.Time();
		request += "sortType=" + this.sortType + "&typeCode=" + this.typeCode + "&updown=asc";
		return request;
	}	
	this.Request = function()
	{
		Common.AppendDataArray(this.scriptid,this.CreateLink());
	}
	this.SetSorttype = function(st)
	{
		this.sortType = st;
		this.Request();
	}
}


//显示数据
JZPGListPage = new function(){
	this.dataArray;
	this.divName = "JZPGListDiv";
	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(JZPGTopRequest.sortType);
		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 "1":cName="市盈率";break;
			case "2":cName="市净率";break;
			default:cName="市盈率";break;
		}
		return cName;
	}
}


