function getFlashFocus()
{ 
 thisMovie().focus();
}

String.prototype.Trim = function() 
{ 
    return this.replace(/(^\s*)|(\s*$)/g, ""); 
} 
String.prototype.LTrim = function() 
{ 
    return this.replace(/(^\s*)/g, ""); 
} 
String.prototype.Rtrim = function() 
{ 
    return this.replace(/(\s*$)/g, ""); 
}

var movieObject = null;

function thisMovie() 
{
  if (movieObject == null)
  {
   if (navigator.appName.indexOf("Microsoft") != -1) 
   {
        movieObject = window["myFlash"];
   }
   else 
   {
      if(document["myFlash"].length != undefined)
      {
          movieObject = document["myFlash"][1];
      }
      else
          movieObject = document["myFlash"];
   }
  }
  
  return movieObject;
}


var beResize = true;
window.onresize = resizeAcition;

function resizeAcition()
{ 
  thisMovie().reFlashSize(document.body.clientWidth,document.body.clientHeight - 27);
	
}

function flashaa(args)
{
  document.getElementById("testDiv").value += args;
  //alert(args);
}

function flashaaa(args)
{
  window.status += "  m:"+args;
}

function changeColor(currentColor)
{
  if(currentColor=="black"){
    thisMovie().bgcolor="#000000";
    //document.body.bgColor="#000000";
    document.getElementById("flashTD").style.backgroundColor="#000000";
  }
  if(currentColor=="white"){
    thisMovie().bgcolor="#FFFFFF";
    //document.body.bgColor="#FFFFFF";
    document.getElementById("flashTD").style.backgroundColor="#FFFFFF";
  }
}

function reFlashSize(current_width,current_height)
{
    thisMovie().width=current_width;
    thisMovie().height=current_height;
 
}

function addMySelfChooseGP(stockID)
{
		//Ajax.sendGetRequest("zxg.jsp?action=add&ZQDM="+ZQDM+"&userID="+userid, true, null);
    setCookie("zxg_cookie",stockID);
}
function deleteMySelfChooseGP(stockID)
{
	 //Ajax.sendGetRequest("zxg.jsp?action=del&ZQDM="+ZQDM+"&userID="+userid, true, null);   
   setCookie("zxg_cookie",stockID);
   displayMySelftChooseGP();
}

function getZXG()
{
  thisMovie().setZXGValue(getCookie("zxg_cookie"));
}

function displayMySelftChooseGP()
{
   thisMovie().displayMySelftChoose();
}

function displayMySelftChooseGpBack(responseText)
{ 
   thisMovie().displayMySelftChoose();
   thisMovie().allStockID(responseText.Trim());
}

function getUserIDZXG(userid)
{ 
 	Ajax.sendGetRequest("zxg.jsp?action=get&userID="+userid,true,"callBackZXG(ME.http_request.responseText)");
}

function callBackZXG(responseText)
{  
   if(responseText!=null&&responseText.Trim()!=""&&responseText!="null")
   {  
      thisMovie().setZXGValue(responseText.Trim());
   }
}

function addMark(mark_value)
{
   setCookie("mark_zq",mark_value);
}

function getMark()
{ 
  if(getCookie("mark_zq")!="")
  { 
     thisMovie().setMarkValue(getCookie("mark_zq"));
  }
}

function writeZQLog(log_value)
{
  setCookie("zq_log",log_value);
  cls(document.getElementById("div_cls"));
}

function getLogValue()
{ 
  if(getCookie("zq_log")!="")
  { 
    thisMovie().setLogValue(getCookie("zq_log"));
  }
}

function displayLogList(log_value)
{ 
  document.logSubmitForm.log_value.value=log_value;
  document.logSubmitForm.submit();
}

function displayLogForm()
{   
	 var	msg="<br><form METHOD=POST  name='formSS' onSubmit='return save_log()'>"
		  +"<table width='100%'><tr>"
			+"<td ><textarea name='log_area' rows='11' cols='50'></textarea></td></tr>"
		  +"<tr><td   align='center'>"
			+"<input type='submit' name='submit' value='提交'>&nbsp;"
			+"<input type='reset' name='reset' value='重置'></td></tr></table>"
			+"</form>";
			
			var c = new xWin(400,260,270,100,"撰写股票日志",msg);	
}

function save_log()
{

	if(document.formSS.log_area.value=="")
	{
		  alert("请填写内容");
		  return false;
	}

	thisMovie().logSubmit(document.formSS.log_area.value);
	
	return false;
}

function close_logForm()
{
	cls(document.getElementById("div_cls"));
}


var parseAllStockFlag=false;

function setParseAllStockSuccess()
{
  parseAllStockFlag=true;
}

function getAllStock()
{ 
  if(parseAllStockFlag)
     return;
  try
  {
   
    if(beResize)
		{
			beResize = false;
		}
		
		thisMovie().reFlashSize1(document.body.clientWidth,document.body.clientHeight - 27);
		thisMovie().wmode="Window";
    parseAllStockFlag = true;
    thisMovie().setMarkValue(getCookie("mark_zq"));
  	thisMovie().setZXGValue(getCookie("zxg_cookie"));
   	thisMovie().setLogValue(getCookie("zq_log"));
   	thisMovie().setIsOpenMarketRadar(getCookie("marketRadarStatus"));
   
  }catch(e)
  {
   		setTimeout ("getAllStock()" ,10);
  }
}


function displayRadarInfo(radarStatus)
{
  if(radarStatus==false)
  {
    if(!confirm("市场雷达还没打开,您是否想打开?"))
      return false;
    
    thisMovie().openRadar();
    setCookie("marketRadarStatus","true");
  }
  
  marketRadar.displayDiv("市场雷达[运行中]");
  
}


function qiuckBuy(ZQDM, SCDM, price)
{ 
  hqlogin.displayDiv("闪电买入");
}

function quickSell(ZQDM, SCDM, price)
{ 
  hqlogin.displayDiv("闪电卖出");
}

function commonBuy(ZQDM)
{ 
  hqlogin.displayDiv("普通买入");
}

function commonSell(ZQDM)
{ 
  hqlogin.displayDiv("普通卖出");
}


function cdTW()
{ 
  hqlogin.displayDiv("撤单查询");
}

function getCookie(cookie_name)
{
  var strCookie=document.cookie;
	var arrCookie=strCookie.split(";");
	
	for(var i=0;i<arrCookie.length;i++)
	{
		var index = arrCookie[i].indexOf( cookie_name );
		if( index >= 0 ) {
		    return unescape(arrCookie[i].substring( index + cookie_name.length + 1 ));
		}
	}
	
	return "";
}


function setCookie(name,value)
{
   var days=365;
   var exp=new Date();
   exp.setTime(exp.getTime()+days*24*60*60*1000);
   document.cookie=name+"="+escape(value)+";expires="+exp.toGMTString()+";path=/";
}


var childLink = null;

function display(indexNo,textID,linkObj)
{
	var link = document.getElementById("link");
	
	if(link && indexNo > -1)
	{
		var links = link.getElementsByTagName("a");
		
		for (var i = 0; i < links.length; i++)
		{
			if(i == indexNo)
				links[i].className = "xiz";
			else
				links[i].className = "";
		}
	}
	
	if(linkObj)
	{
		if(childLink == null)
		{
			childLink = document.createElement("div");
		
			childLink.id = "childLink";
			childLink.className = "childLink";
			childLink.onmouseleave = function()
			{
				this.parentElement.removeChild (this);
			}
		}
		
		childLink.style.top = 24;
		childLink.style.left = 14;
		childLink.style.display = "";
		
		if(childLink && childLink.parentElement)
			childLink.parentElement.removeChild (childLink);
		
		childLink.innerHTML = document.getElementById (textID).value;
		
		if(linkObj.previousSibling)
			linkObj.previousSibling.appendChild(childLink);
		else
			linkObj.parentElement.appendChild(childLink);
	}
}

var childLink1;

function displayChild(textID,linkObj)
{
	
	if(linkObj)
	{
		if(childLink1 == null)
		{
			childLink1 = document.createElement("div");
		
			childLink1.id = "childLink1";
			childLink1.className = "childLink";
			childLink1.onmouseleave = function()
			{
				this.parentElement.removeChild (this);
			}
		}
		
		
		//childLink1.style.top = 24;
		//childLink1.style.left = 14;
		childLink1.style.display = "";
		
		if(childLink1 && childLink1.parentElement)
			childLink1.parentElement.removeChild (childLink1);
		
		childLink1.innerHTML = document.getElementById (textID).value;
		
		
		if(linkObj.nextSibling != null)
		{
			linkObj.nextSibling.appendChild(childLink1);
		}
		else
		{
			linkObj.parentElement.appendChild(childLink1);
		}
	}
}

function changeTitleStyle(obj,_style)
{
	
	if(_style == 1)
	{
		obj.className = "child_up";
	}
	else
	{
		obj.className = "child";
	}
}

function childTran(ahref)
{
	location.href = ahref.getAttribute ("href");
}


