/*查询实时价格*/
function queryPA(stockId){
	//try{
		document.getElementById("row"+stockId).innerHTML = "<img src=\"/images/loading.gif\" />";
		var url = '/api/price.php?stockId='+stockId;			
		var newCallback = new Object();
		newCallback.success = successPriceRowFunction;
		newCallback.failure = failurePriceRowFunction;
		newCallback.timeout = 25000;
		newCallback.argument = stockId;	
		var transaction = YAHOO.util.Connect.asyncRequest('GET', url, newCallback);
	/*}catch{
		document.getElementById("row"+stockId).innerHTML = "通讯故障<a href='javascript:queryPA("+stockId+");'>重试</a>";
	}*/
}

/*统计首页促销的几个链接*/
function countCommend(id){
	//try{
		var url = '/api/countCommend.php?id='+id;			
		var newCallback = new Object();
		//newCallback.success = successPriceRowFunction;
		//newCallback.failure = failurePriceRowFunction;
		newCallback.timeout = 25000;
		newCallback.argument = id;	
		var transaction = YAHOO.util.Connect.asyncRequest('GET', url, newCallback);
	/*}catch{
		document.getElementById("row"+stockId).innerHTML = "通讯故障<a href='javascript:queryPA("+stockId+");'>重试</a>";
	}*/
}

function stringToArray(splitChar,sourceString){
	tarGetString = sourceString.split(splitChar);
	return tarGetString;
}


function successPriceRowFunction(o)
{	
	    var stockId = o.argument;
		var xmlDoc = o.responseText;
		if(xmlDoc == null ||xmlDoc==''){
		   failurePriceRowFunction(o);
		}		
		else{
			var matRow = document.getElementById('row'+stockId);
  			matRow.innerHTML = xmlDoc;
		}
}
	
function failurePriceRowFunction(o)
{
		var stockId = o.argument;		
		var matRow = document.getElementById('row'+stockId);
		matRow.innerHTML = "请求超时<br /><a href='javascript:queryPA("+stockId+");'>重试</a>";
}