var requestFailTime = 0;
var serverName = "";
var dir = "ajaxhq";
var curStockidlist = "";
var ListHQTimeoutHandler = null;
var DapanHQTimeoutHandler = null;
var MinuteHQTimeoutHandler = null;
var fbcjTimeoutHandler = null;
var phbTimeoutHandler = null;
var sshqTimeoutHandler = null;
var ctrlmproTimeoutHandler = null;
//Ö÷Á¦´óµ¥
var zlddTimeoutHandler = null;
var max_minute_index = 0;
var max_fbcj_index = -1;
var max_large_index = 0;
var curstockid = "";
var tradeStatus = "";
var serverprotocol = "http://";

function setServerName(_serverName,_port)
{
	serverName = "hq.cindasc.com";//_serverName;//+":"+_port;
}

function initAllStock(_serverName,_port)
{
	setServerName(_serverName,_port)
	var url = serverprotocol+serverName+"/"+dir+"/jsp/getAllStock.jsp";
	Ajax.sendGetRequest(url, true, "initAllStockCallback(ME.http_request.responseText)");	
}

function initAllStockCallback(responseText)
{
	
	var responseObj = eval ("("+responseText+")");
  //thisMovie().parseAllStock(responseObj.allStock,responseObj.dq,responseObj.hy,responseObj.gn);
  var msg ="<m><c>allstockidlist</c><sz>"+responseObj.allStock+"</sz><sh></sh></m>"
  thisMovie().receiveMessage(msg);
  
  loadDaPan();
  getFqsj();
  getCategroyStock();
}

function getFqsj()
{
	var url = serverprotocol+serverName+"/"+dir+"/jsp/getFqsj.jsp";
	Ajax.sendGetRequest(url, true, "getFqsjCallback(ME.http_request.responseText)");		
}

function getFqsjCallback(responseText)
{
	var msg ="<m><c>fqsjinfo</c><content>"+responseText+"</content></m>";
  thisMovie().receiveMessage(msg);
}

function getCategroyStock()
{
	var url = serverprotocol+serverName+"/"+dir+"/jsp/getCategroyStock.jsp";
	Ajax.sendGetRequest(url, true, "getCategroyStockCallback(ME.http_request.responseText)");	
}

function getCategroyStockCallback(responseText)
{
	var msg ="<m><c>allstockiditypeinfo</c><content>"+responseText+"</content></m>"
  thisMovie().receiveMessage(msg);
}

function sendMessage(msg)
{
	 var doc = XMLJS.parseXML(msg);
	 var root = XMLJS.getXMLRootNode(doc);
	 var command = XMLJS.getXMLSingleNodeValue(root,"c");
	 
	 if(command == "listhq")
	 {
	 		clearTimeout(ListHQTimeoutHandler);
	 		clearTimeout(sshqTimeoutHandler);
	 		clearTimeout(MinuteHQTimeoutHandler);
	 		clearTimeout(fbcjTimeoutHandler);
	 		clearTimeout(ctrlmproTimeoutHandler);
	 		var curStockidlist = XMLJS.getXMLSingleNodeValue(root,"stockidlist");
	 		
	 		var url = serverprotocol+serverName+"/"+dir+"/jsp/flashHQList_inner.jsp?stockIDs="+curStockidlist;
	 		Ajax.sendGetRequest(url,true,"callBackShowHQList(ME.http_request.responseText,'"+curStockidlist+"')");
	 }
	 else if (command == "sshq")
	 {
	 		curstockid = XMLJS.getXMLSingleNodeValue(root,"stockid");
	 		loadStockLastSSHQ(curstockid);
	 }
	 else if (command == "dayhq")
	 {
	 		var stockid = XMLJS.getXMLSingleNodeValue(root,"stockid");
	 		drawDayHQGraphics(100,stockid);
	 }
	 else if (command == "weekhq")
	 {
	 		var stockid = XMLJS.getXMLSingleNodeValue(root,"stockid");
	 		drawWeekHQGraphics(stockid)	
	 }
	 else if (command == "monthhq")
	 {
	 		var stockid = XMLJS.getXMLSingleNodeValue(root,"stockid");
	 		drawMonthHQGraphics(stockid);
	 }
	 else if (command == "fbcj")
	 {
	 		var stockid = XMLJS.getXMLSingleNodeValue(root,"stockid");
	 		readFbcjs(stockid);
	 }
	 else if (command == "f10") 
	 {
	 	 var stockid = XMLJS.getXMLSingleNodeValue(root,"stockid");
	 	 var index = XMLJS.getXMLSingleNodeValue(root,"index"); 
	 	 readF10(index,stockid);     
	 }                                         
	 else if (command == "phb")
	 {
	 		var key = XMLJS.getXMLSingleNodeValue(root,"key");
	 		var order = XMLJS.getXMLSingleNodeValue(root,"order");
	 		
	 		if(order == "Y")
	 		{
	 			 readPHB(key);
	 		}
	 		else
	 		{
	 			 clearTimeout(phbTimeoutHandler);
	 		}
	 		
	 }
	 else if (command == "zldd")
	 {
	 		
	 		var order = XMLJS.getXMLSingleNodeValue(root,"order");
	 		
	 		if(order == "Y")
	 		{
	 			displayLargeTrade()
	 		}
	 		else
	 		{
	 			clearTimeout(zlddTimeoutHandler);	
	 		}	
	 }
	 else if (command == "ctrlmpro")
	 {
	 	  var stockidlist = XMLJS.getXMLSingleNodeValue(root,"stockidlist");
	 	  displayProMoreMinuteHQ(stockidlist);
	 }
	 else if (command == "searchstockbyprice")
	 {
	 		var stockid = XMLJS.getXMLSingleNodeValue(root,"stockid");
	 		searchStockByPrice(stockid);	
	 }
	 else if (command == "sort")
	 {
	 		var scdm = XMLJS.getXMLSingleNodeValue(root,"scdm");
	 		var sortby = XMLJS.getXMLSingleNodeValue(root,"sortby");
	 		flashOrder(scdm,sortby);	
	 }
	 else if (command == "sortbycategory")
	 {
	 		var stockidlist = XMLJS.getXMLSingleNodeValue(root,"stockidlist");
	 		var sortby = XMLJS.getXMLSingleNodeValue(root,"sortby");
	 		flashCategoryOrder(stockidlist,sortby);		
	 }
	 else if (command == "leida")
	 {
	 	
	 }
	 else if(command == "cnt")
	 {
	 		var _day = XMLJS.getXMLSingleNodeValue(root,"day");
	 		var _index = XMLJS.getXMLSingleNodeValue(root,"index");
	 		var _offset = XMLJS.getXMLSingleNodeValue(root,"offset");
	 		var _length = XMLJS.getXMLSingleNodeValue(root,"length");	
	 		var _type = XMLJS.getXMLSingleNodeValue(root,"type");
	 		getXXDLContent(_day,_index,_offset,_length,_type);
	 }
}

function callBackShowHQList(responseText,stockIDList)
{
	try
	{
   	var msg ="<m><c>listhq</c><st>init</st><ct>"+responseText.Trim()+"</ct></m>";
   	thisMovie().receiveMessage(msg);
  }catch(e){}
   ListHQTimeoutHandler = setTimeout("refreshListHQ('"+stockIDList+"')",1000);
}

function refreshListHQ(stockIDList)
{
	 var url = serverprotocol+serverName+"/"+dir+"/jsp/flashHQList_inner.jsp?stockIDs="+stockIDList;
	 Ajax.sendGetRequest(url,true,"callBackRefreshHQList(ME.http_request.responseText,'"+stockIDList+"')");	
}

function callBackRefreshHQList(responseText,stockIDList)
{
	try
	{
   	var msg ="<m><c>listhq</c><st>push</st><ct>"+responseText.Trim()+"</ct></m>"
  	thisMovie().receiveMessage(msg);
  }catch(e){}
   
   ListHQTimeoutHandler = setTimeout("refreshListHQ('"+stockIDList+"')",1000);
}

function loadDaPan()
{
	var url = serverprotocol+serverName+"/"+dir+"/jsp/dapan.jsp";
  Ajax.sendGetRequest(url,true,"updateDaPan(ME.http_request.responseText)");	
}

function updateDaPan(responseText)
{
	 var responseObj = {};
	 
	 try 
	 {
	   responseObj = eval ("("+responseText+")");
	 }
	 catch (e)
	 {
	  
	   TimeoutHandler1 = setTimeout ("loadDaPan()" ,1000);
	   return ;
	 }
	 
	 var trade_status = "";
	 
	 try
	 {
		 	var msg ="<m><c>dapanhq</c><st>push</st><dp>"+responseObj.sz399001+"|"+responseObj.sh000001+"|"+responseObj.sh000300+"</dp></m>"
	   	thisMovie().receiveMessage(msg);
	   
	   	trade_status=responseObj.tradeStatus;
	 }catch(e){}
   
   if(trade_status=="tradeon")
	 {
   		DapanHQTimeoutHandler = setTimeout("loadDaPan()",1000);	
   }
   else
   {
   	  DapanHQTimeoutHandler = setTimeout("loadDaPan()",1000 * 60);	
   }
}

function loadStockLastSSHQ(stockID)
{
	 clearTimeout(ListHQTimeoutHandler);
	 clearTimeout(MinuteHQTimeoutHandler);
	 clearTimeout(sshqTimeoutHandler);
	 clearTimeout(fbcjTimeoutHandler);
	 clearTimeout(phbTimeoutHandler);
	 clearTimeout(ctrlmproTimeoutHandler);
	 max_minute_index = 0;
	 max_fbcj_index = -1;
	 
	 var url = serverprotocol+serverName+"/"+dir+"/jsp/lastHQ.jsp?stockID="+stockID+"&index=" + max_minute_index +"&fbcj_index="+max_fbcj_index;
	 Ajax.sendGetRequest(url,true,"updateStockWDTable(ME.http_request.responseText,'"+stockID+"')");
}

function updateStockWDTable(responseText,_stockID)
{  
	 	var responseObj = {}
   	try 
   	{
  	  responseObj = eval ("("+responseText+")");
  	}
  	catch (e)
  	{
  	
  	  TimeoutHandler = setTimeout ("loadStockLastSSHQ('"+_stockID+"')" ,1000);
  	  return ;
  	}
  	
  	var stockInfo=responseObj.stockInfo;
   
  	if (responseObj.stockID!= _stockID)
    { 	
      	return;
    }
    
    var zsSum = "";
    if(responseObj.zsSum)
  	{
  	  zsSum = responseObj.zsSum;
  	}
  	
  	var fbcjs= responseObj.fbcjs;
  	var minuteHQs = responseObj.minuteHQs;
  	
  	if(minuteHQs != "")
  	{
	  		var minuteHQArr = minuteHQs.split("|");
	  		
	  		if(minuteHQArr.length > 3)
	  		{
	  			 max_minute_index = minuteHQArr[minuteHQArr.length - 3].split(",")[0];	
	  		}
	  		else
	  		{
	  			 max_minute_index = 0;		
	  		}
  	}
  	
  	
  	if(fbcjs != "")
  	{
  			var fbcjArr = fbcjs.split("|");
  			
  			var lastFBCJ = fbcjArr[fbcjArr.length - 1];
  			if(lastFBCJ == "")
  			   lastFBCJ = fbcjArr[fbcjArr.length - 2];
  			   
  			if(lastFBCJ.indexOf(",") != -1)
  			{
  				 max_fbcj_index = 	lastFBCJ.split(",")[6];
  			}
  	}
  	
  	tradeStatus = responseObj.tradeStatus;
  	
  	var msg ="<m><c>sshq</c><st>init</st><sid>"+responseObj.stockID+"</sid><sshqdata>"+stockInfo+"</sshqdata><minutehqdata>"+minuteHQs+"</minutehqdata><fbcjdata>"+fbcjs+"</fbcjdata><day>"+responseObj.sshqDay+"</day><mt>"+responseObj.sshqMinute+"</mt><zssum>"+zsSum+"</zssum></m>"
    thisMovie().receiveMessage(msg);
    
    getSSHQXXDL(responseObj.stockID);
    
    
    MinuteHQTimeoutHandler = setTimeout("refreshMinuteHQ('"+responseObj.stockID+"')",1000 * 30);
    sshqTimeoutHandler = setTimeout("refreshSSHQ('"+responseObj.stockID+"')",1000);
    //fbcjTimeoutHandler = setTimeout("refreshFbcj('"+responseObj.stockID+"')",1000);
}

function refreshSSHQ(stockID)
{
		var url = serverprotocol+serverName+"/"+dir+"/jsp/refreshSSHQ.jsp?stockID="+stockID+"&fbcj_index="+max_fbcj_index;
    
    Ajax.sendGetRequest(url,true,"freshSSHQCallBack(ME.http_request.responseText,'"+stockID+"')");	
}

function freshSSHQCallBack(responseText,_stockID)
{
	try
	{
			var responseObj = eval ("("+responseText+")");
			
			if(tradeStatus == "tradeoff" && responseObj.tradeStatus == "tradeon")
			{
					thisMovie().loadMinuteSSHQ("","",responseObj.stockID,"");
					
					tradeStatus = responseObj.tradeStatus;
					return;	
			}
			
			tradeStatus = responseObj.tradeStatus;
			
			var zsSum = "";
			
			if(responseObj.zsSum)
			{
				zsSum = responseObj.zsSum;	
			}
			
			var msg ="<m><c>sshq</c><st>push</st><sid>"+responseObj.stockID+"</sid><ct>"+responseObj.stockInfo+"</ct><day>"+responseObj.sshqDay+"</day><mt>"+responseObj.sshqMinute+"</mt><zssum>"+zsSum+"</zssum><md>single</md></m>"
		  thisMovie().receiveMessage(msg);
		  
		  
		  var fbcjs = responseObj.fbcjs;
			var msg ="<m><c>fbcj</c><subtype>push</subtype><stockid>"+responseObj.stockID+"</stockid><content>"+fbcjs+"</content></m>"
		  thisMovie().receiveMessage(msg);
		 
		  if(fbcjs != "")
		  {
		  		var fbcjArr = fbcjs.split("|");
		  			
		  		var lastFBCJ = fbcjArr[fbcjArr.length - 1];
		  		
		  		if(lastFBCJ == "")
		  		{
		  			  lastFBCJ = fbcjArr[fbcjArr.length - 2];
		  		}
		  		
		  		if(lastFBCJ.indexOf(",") != -1)
		  		{	   
		  			max_fbcj_index = 	lastFBCJ.split(",")[6];
		  		}
		  }
		  
		  sshqTimeoutHandler = setTimeout("refreshSSHQ('"+_stockID+"')",1000);
		  
	}
	catch(e)
	{
		sshqTimeoutHandler = setTimeout("refreshSSHQ('"+_stockID+"')",1000);
	}
  	
}

function refreshMinuteHQ(stockID)
{
	  var url = serverprotocol+serverName+"/"+dir+"/jsp/refreshMinuteHQ.jsp?stockID="+stockID+"&index="+max_minute_index;
    Ajax.sendGetRequest(url,true,"refreshMinuteHQCallBack(ME.http_request.responseText,'"+stockID+"')");
}

function refreshMinuteHQCallBack(responseText,_stockID)
{
	
	try
	{
			var responseObj = eval ("("+responseText+")");
			
			var minuteHQs = responseObj.minuteHQs;
			var msg ="<m><c>minutehq</c><subtype>push</subtype><stockid>"+responseObj.stockID+"</stockid><content>"+minuteHQs+"</content><mode>single</mode></m>"
		  thisMovie().receiveMessage(msg);
		  
		  if(minuteHQs != "")
			{
		  		var minuteHQArr = minuteHQs.split("|");
		  		
		  		if(minuteHQArr.length > 1)
		  		{
		  			 max_minute_index = parseInt(minuteHQArr[minuteHQArr.length - 1].split(",")[0]) - 2;	
		  		}
			}
			
			MinuteHQTimeoutHandler = setTimeout("refreshMinuteHQ('"+responseObj.stockID+"')",1000 * 30);
			
	}catch(e)
	{
		MinuteHQTimeoutHandler = setTimeout("refreshMinuteHQ('"+_stockID+"')",1000 * 30);
	}
  
  			
}

function refreshFbcj(stockID)
{
	var url = serverprotocol+serverName+"/"+dir+"/jsp/refreshFbcj.jsp?stockID="+stockID+"&fbcj_index="+max_fbcj_index;
  Ajax.sendGetRequest(url,true,"refreshFbcjCallBack(ME.http_request.responseText)");		
}

function refreshFbcjCallBack(responseText)
{
	
	try
	{
			var responseObj = eval ("("+responseText+")");
			
			var fbcjs = responseObj.fbcjs;
			var msg ="<m><c>fbcj</c><subtype>push</subtype><stockid>"+responseObj.stockID+"</stockid><content>"+fbcjs+"</content></m>"
		  thisMovie().receiveMessage(msg);
		  
		  if(fbcjs != "")
		  {
		  		var fbcjArr = fbcjs.split("|");
		  			
		  		var lastFBCJ = fbcjArr[fbcjArr.length - 1];
		  		
		  		if(lastFBCJ == "")
		  		{
		  			  lastFBCJ = fbcjArr[fbcjArr.length - 2];
		  		}
		  		
		  		if(lastFBCJ.indexOf(",") != -1)
		  		{	   
		  			max_fbcj_index = 	lastFBCJ.split(",")[6];
		  		}
		  }
		  
		  fbcjTimeoutHandler = setTimeout("refreshFbcj('"+responseObj.stockID+"')",1000);
	}catch(e)
	{
		fbcjTimeoutHandler = setTimeout("refreshFbcj('"+responseObj.stockID+"')",1000);
	}
  
  			
}

function drawDayHQGraphics(dayCount,stockId)
{  
		clearTimeout(ListHQTimeoutHandler);
	  clearTimeout(MinuteHQTimeoutHandler);
	  clearTimeout(phbTimeoutHandler);
	  clearTimeout(ctrlmproTimeoutHandler);
		var url = serverprotocol+serverName+"/"+dir+"/jsp/flashDayHQ.jsp?stockID="+stockId+"&dayCount="+dayCount;
    Ajax.sendGetRequest(url,true,"callBackDayHQ(ME.http_request.responseText)");
    var url = serverprotocol+serverName+"/"+dir+"/jsp/flashFullDayHQ.jsp?stockID="+stockId;
    Ajax.sendGetRequest(url,true,"callBackFullDayHQ(ME.http_request.responseText)");
}


function callBackDayHQ(responseText)
{
  var responseObj=eval("("+responseText+")");
  var msg ="<m><c>dayhq</c><subtype>init</subtype><stockid>"+responseObj.stockID+"</stockid><content>"+responseObj.dayHQ+"</content><count>"+responseObj.dayHQCount+"</count></m>";
  thisMovie().receiveMessage(msg);
}

function callBackFullDayHQ(responseText)
{
  var responseObj=eval("("+responseText+")");
  var msg ="<m><c>dayhq</c><subtype>push</subtype><stockid>"+responseObj.stockID+"</stockid><content>"+responseObj.dayHQs+"</content></m>";
  thisMovie().receiveMessage(msg);
  
	var msg ="<m><c>xxdllist</c><type>day</type><stockid>"+responseObj.stockID+"</stockid><content>"+responseObj.xxdls+"</content></m>";
  thisMovie().receiveMessage(msg);	
}


function drawWeekHQGraphics(stockId)
{ 
	  clearTimeout(ListHQTimeoutHandler);
	  clearTimeout(MinuteHQTimeoutHandler);
	  clearTimeout(phbTimeoutHandler);
	  clearTimeout(ctrlmproTimeoutHandler);
		var url = serverprotocol+serverName+"/"+dir+"/jsp/flashWeekHQ.jsp?stockID="+stockId;
    Ajax.sendGetRequest(url,true,"callBackWeekHQ(ME.http_request.responseText)");
}

function callBackWeekHQ(responseText)
{ 
	var responseObj=eval("("+responseText+")");
  var msg ="<m><c>weekhq</c><subtype>init</subtype><stockid>"+responseObj.stockID+"</stockid><content>"+responseObj.weekHQ+"</content><count>"+responseObj.weekHQCount+"</count></m>";
  thisMovie().receiveMessage(msg);
}

function drawMonthHQGraphics(stockId)
{ 
	clearTimeout(ListHQTimeoutHandler);
	clearTimeout(MinuteHQTimeoutHandler);
	clearTimeout(phbTimeoutHandler);
	clearTimeout(ctrlmproTimeoutHandler);
	var url = serverprotocol+serverName+"/"+dir+"/jsp/flashMonthHQ.jsp?stockID="+stockId;
  Ajax.sendGetRequest(url,true,"callBackMonthHQ(ME.http_request.responseText)");
}

function callBackMonthHQ(responseText)
{
  var responseObj=eval("("+responseText+")");
  var msg ="<m><c>monthhq</c><subtype>init</subtype><stockid>"+responseObj.stockID+"</stockid><content>"+responseObj.monthHQ+"</content><count>"+responseObj.monthHQCount+"</count></m>";
  thisMovie().receiveMessage(msg);
}

function readFbcjs(stockID)
{
	clearTimeout(ListHQTimeoutHandler);
	clearTimeout(MinuteHQTimeoutHandler);
	clearTimeout(sshqTimeoutHandler);
	clearTimeout(fbcjTimeoutHandler);
	clearTimeout(phbTimeoutHandler);
	clearTimeout(ctrlmproTimeoutHandler);
	var url = serverprotocol+serverName+"/"+dir+"/jsp/fbcjs.jsp?stockID="+stockID;
  Ajax.sendGetRequest(url, true, "readFbcjsCallback(ME.http_request.responseText)");
}

function readFbcjsCallback(responseText)
{  
	try
	{
   	var responseObj=eval("("+responseText+")");
   	var fbcjs = responseObj.fbcjs;
   	var msg ="<m><c>fbcj</c><subtype>init</subtype><stockid>"+responseObj.stockinfo.ID+"</stockid><content>"+fbcjs+"</content><zqjc>"+responseObj.stockinfo.ZQJC+"</zqjc><zqdm>"+responseObj.stockinfo.ZQDM+"</zqdm><zrsp>"+responseObj.stockinfo.ZRSP+"</zrsp></m>";
   	thisMovie().receiveMessage(msg);
  }catch(e){}
   
   sshqTimeoutHandler = setTimeout("refreshSSHQ('"+responseObj.stockinfo.ID+"')",1000);
}

function readF10(index,stockID)
{
	clearTimeout(ListHQTimeoutHandler);
	clearTimeout(MinuteHQTimeoutHandler);
	clearTimeout(sshqTimeoutHandler);
	clearTimeout(fbcjTimeoutHandler);
	clearTimeout(phbTimeoutHandler);
	clearTimeout(ctrlmproTimeoutHandler);
	var url = serverprotocol+serverName+"/"+dir+"/jsp/readF10.jsp?stockID="+stockID+"&index="+index;
  Ajax.sendGetRequest(url, true, "readF10Callback(ME.http_request.responseText)");
}

function readF10Callback(responseText)
{
	var responseObj=eval("("+responseText+")");
	var content = responseObj.content.replace(/&nbsp;/g," ");
	var content = content.replace(/<br\/>/g,"\n");
  var msg ="<m><c>f10</c><subtype>init</subtype><stockid>"+responseObj.stockID+"</stockid><content>"+content+"</content><index>"+responseObj.index+"</index></m>";
  thisMovie().receiveMessage(msg);
}

function readPHB(key)
{
	clearTimeout(ListHQTimeoutHandler);
	clearTimeout(MinuteHQTimeoutHandler);
	clearTimeout(sshqTimeoutHandler);
	clearTimeout(fbcjTimeoutHandler);
	clearTimeout(phbTimeoutHandler);
	clearTimeout(ctrlmproTimeoutHandler);
	var url = serverprotocol+serverName+"/"+dir+"/jsp/PHB.jsp?key="+key;
  Ajax.sendGetRequest(url, true, "readPHBCallback(ME.http_request.responseText)");
}

function readPHBCallback(responseText)
{
	try
	{
			var responseObj=eval("("+responseText+")");
			var msg ="<m><c>phb</c><subtype>init</subtype><key>"+responseObj.key+"</key><zhangfulist>"+responseObj.zhangFuList+"</zhangfulist><diefulist>"+responseObj.dieFuList+"</diefulist><zhengfulist>"+responseObj.zhengFuList+"</zhengfulist><zhangshulist>"+responseObj.zhangShuList+"</zhangshulist><dieshulist>"+responseObj.dieShuList+"</dieshulist><weibilist>"+responseObj.weiBiList+"</weibilist><weibidesclist>"+responseObj.weiBiDESCList+"</weibidesclist><liangbilist>"+responseObj.liangBiList+"</liangbilist><cjjelist>"+responseObj.CJJEList+"</cjjelist></m>";
  		thisMovie().receiveMessage(msg);
  }catch(e){}
  phbTimeoutHandler = setTimeout("readPHB('"+responseObj.key+"')",2000);
}

function displayLargeTrade()
{
	 var url = serverprotocol+serverName+"/"+dir+"/jsp/getLargeTrade.jsp?large_index="+max_large_index;
   Ajax.sendGetRequest(url,true,"displayLargeTradeCallBack(ME.http_request.responseText)");
}

function displayLargeTradeCallBack(responseText)
{
	try
	{
		  var msg ="<m><c>zldd</c><content>"+responseText+"</content></m>";
		  thisMovie().receiveMessage(msg);
		  
		  if(responseText != null && responseText != "")
		  {
		  	 var fArr = responseText.split("|");
		  	 max_large_index = fArr[fArr.length -1].split(",")[6];
		  }
	}catch(e){}
  
  zlddTimeoutHandler = setTimeout("displayLargeTrade()",2000);
}


function displayProMoreMinuteHQ(stockIDs)
{
	 var url = serverprotocol+serverName+"/"+dir+"/jsp/ctrlMPro.jsp?stockIDList="+stockIDs;
   Ajax.sendGetRequest(url,true,"displayProMoreMinuteHQCallBack(ME.http_request.responseText,'"+stockIDs+"')");	
}

function displayProMoreMinuteHQCallBack(responseText,stockIDs)
{
	try
	{
			var responseObj=eval("("+responseText+")");
			
			var msg ="<m><c>ctrlmpro</c><subtype>init</subtype><content>"+responseObj.content+"</content></m>";
		  thisMovie().receiveMessage(msg);
	}catch(e){}
  ctrlmproTimeoutHandler = setTimeout("refreshProMoreMinuteHQ('"+stockIDs+"','"+responseObj.maxIndexs+"')");		
}

function refreshProMoreMinuteHQ(stockIDs,maxIndexs)
{
	 var url = serverprotocol+serverName+"/"+dir+"/jsp/refreshCtrlMPro.jsp?stockIDList="+stockIDs+"&maxIndexList="+maxIndexs;
   Ajax.sendGetRequest(url,true,"refreshProMoreMinuteHQCallBack(ME.http_request.responseText,'"+stockIDs+"')");	
}

function refreshProMoreMinuteHQCallBack(responseText,stockIDs)
{
	try
	{
	 	var responseObj=eval("("+responseText+")");
	 	var msg ="<m><c>ctrlmpro</c><subtype>push</subtype><content>"+responseObj.content+"</content></m>";
   	thisMovie().receiveMessage(msg);	
  }catch(e){}
  
	ctrlmproTimeoutHandler = setTimeout("refreshProMoreMinuteHQ('"+stockIDs+"','"+responseObj.maxIndexs+"')");	
}

function searchStockByPrice(stockid)
{
	var url = serverprotocol+serverName+"/"+dir+"/jsp/searchStockByPrice.jsp?stockID="+stockid;
  Ajax.sendGetRequest(url,true,"seachStockByPriceCallback(ME.http_request.responseText)");

}

function seachStockByPriceCallback(responseText)
{
	 var msg ="<m><c>searchstockbyprice</c><subtype>init</subtype><content>"+responseText+"</content></m>";
   thisMovie().receiveMessage(msg);
}

function flashOrder(scdm,orderCol)
{
	var url = serverprotocol+serverName+"/"+dir+"/jsp/flashOrder.jsp?SCDM="+scdm+"&orderCol="+orderCol;
	Ajax.sendGetRequest(url,false,"callBackFlashOrder(ME.http_request.responseText)");
}

function callBackFlashOrder(responseText)
{
   var msg ="<m><c>sort</c><subtype>init</subtype><content>"+responseText+"</content></m>";
   thisMovie().receiveMessage(msg);
}

function flashCategoryOrder(stockIDs,orderCol)
{
  document.categoryForm.stockIDs.value=stockIDs;
  document.categoryForm.orderCol.value=orderCol;
  var url = serverprotocol+serverName+"/"+dir+"/jsp/flashCategoryOrder.jsp";
  Ajax.sendPostRequest(url, document.categoryForm, false, "callBackFlashCategoryOrder(ME.http_request.responseText)");
	 
}

function callBackFlashCategoryOrder(responseText)
{
	 var msg ="<m><c>sortbycategory</c><subtype>init</subtype><content>"+responseText+"</content></m>";
   thisMovie().receiveMessage(msg);		
}

function getSSHQXXDL(stockID)
{
	var url = serverprotocol+serverName+"/"+dir+"/jsp/getSSHQXXDL.jsp?stockID="+stockID;
  Ajax.sendGetRequest(url, false, "getSSHQXXDLCallback(ME.http_request.responseText)");
	 
}

function getSSHQXXDLCallback(responseText)
{
	 var responseObj=eval("("+responseText+")");
	 var msg ="<m><c>xxdllist</c><type>sshq</type><stockid>"+responseObj.stockID+"</stockid><content>"+responseObj.content+"</content></m>";
   thisMovie().receiveMessage(msg);			
}

function getXXDLContent(_day,_index,_offset,_length,_type)
{
	var url = serverprotocol+serverName+"/"+dir+"/jsp/getXXDLContent.jsp?type="+_type+"&cDay="+_day+"&index="+_index+"&offset="+_offset+"&length="+_length;
  Ajax.sendGetRequest(url, false, "getXXDLContentCallback(ME.http_request.responseText,'"+_index+"')");		
}

function getXXDLContentCallback(responseText,_index)
{
	
	// var responseObj=eval("("+responseText+")");
	 var msg ="<m><c>xxdlcontent</c><index>"+_index+"</index><content>"+responseText+"</content></m>";
   thisMovie().receiveMessage(msg);		
}