var POSL="1,4,9,5,7,3,6,2,8";
var POSC = "1,2,3";
var ArrPos = new Array(1,2,3,4,5,6,7,8,9);
var waitInterval;
var MouseDelayTime=200;

function SetMouseOut()
{
  window.clearTimeout(waitInterval);
}

function ShowContent(l)
{
  var pos=new HttpCookie("pos");  
  var pos_line=pos.values.get("line");
  if(pos_line==null||pos_line==""||pos_line.length!=POSL.length)
  {
    pos_line = POSL;
  }
  var arrPosL = pos_line.split(","); 
  var pos_col=pos.values.get("l_" + arrPosL[l-1]);  
  if(pos_col==null||pos_col==""||pos_col.length!=POSC.length)
  {
    pos_col = POSC;
  }
  //alert(pos_col);
  var arrPosC = pos_col.split(",");
  var objfd = document.getElementById("l_"+l);
  var objfh = document.getElementById("lh_"+arrPosL[l-1]);
  var objhd = document.getElementById("hd"+l);
  //alert(arrPosL[l-1]);
  var nodeHDChild= objfh.childNodes;
  var c = new Array();
  
  //alert(nodeHDChild.length);
  for(var i=0;i<nodeHDChild.length;i++)
  {    
    //alert(arrPosC[i]-1);
    if(objfd!=null&&objhd!=null)
    {      
      
      if(i<arrPosC.length && arrPosC[i]-1<nodeHDChild.length)
      {      
      c[i] = nodeHDChild[arrPosC[i]-1].cloneNode(true);         
      }
      else
      {
      c[i] = nodeHDChild[i].cloneNode(true);    
      }
      objfd.insertBefore(c[i],objhd);
    }
  }
  while(true)
  {
    if(nodeHDChild.length == 0)
    {
      break;
    }
    var d = objfh.removeChild(nodeHDChild[0]);     
  } 
} 

function ChangeDiv1(num)
{  
   for(var i=1;i<7;i++)
   {     
     var divID = document.getElementById("SearchTitle"+i); 
     if (divID != null)
     {
       divID.className="searchtitlecss1";
     }
     
     var ContentDiv = document.getElementById("SearchBody"+i);
     if(ContentDiv!=null)
     {
       ContentDiv.className="hiddenblock";
     }
         
   }
   
   var CContentDiv = document.getElementById("SearchBody"+num);
   if(CContentDiv!=null)
   {
     CContentDiv.className="showblock";
   } 
   
   if(num!=6)
   {
     var LdivID = document.getElementById("SearchTitle6");
     if(LdivID!=null)
     {
       LdivID.className="";
     }
   }
   
   var CdivID = document.getElementById("SearchTitle"+num);
   num = num-1;
   var NdivID1 = document.getElementById("SearchTitle"+num); 
   
   if (CdivID != null)
   {
     CdivID.className="searchtitlecss2";
   }
   
   if (NdivID1 != null)
   {
     NdivID1.className="";
   }   
    
}

function SetMouseOver2(row,cols,num)
{
  window.clearTimeout(waitInterval);
	waitInterval=window.setTimeout("ChangeDiv2("+row+","+cols+","+num+")",MouseDelayTime)
}


function ChangeDiv2(row,cols,num)
{
   for(var i=1;i<cols+1;i++)
   {     
     var divID = document.getElementById("l"+row+"_2_t_"+i); 
     if (divID != null)
     {
       divID.className="mtitle_1";
     }
     
     var ContentDiv = document.getElementById("l"+row+"_2_l_"+i);
     if(ContentDiv!=null)
     {
       ContentDiv.className="hiddenblock";
     }
         
   }
   
   var CdivID = document.getElementById("l"+row+"_2_t_"+num); 
   if (CdivID != null)
   {
     CdivID.className="mtitle_2";
   }
   
   var CContentDiv = document.getElementById("l"+row+"_2_l_"+num); 
   if (CContentDiv != null)
   {
     CContentDiv.className="showblock";
   }
}

function SetMouseOver3(row,num)
{
  window.clearTimeout(waitInterval);
	waitInterval=window.setTimeout("ChangeDiv3("+row+","+num+")",MouseDelayTime)
}
function ChangeDiv3(row,num)
{
   for(var i=0;i<7;i++)
   {
     var divID = document.getElementById("l"+row+"_1_t_"+i);
     if (divID != null)
     {
       divID.className="";
     }
     
     var ContentDiv = document.getElementById("l"+row+"_1_l_"+i);
     if(ContentDiv!=null)
     {
       ContentDiv.className="hiddenblock";
     }
     
     var BDiv = document.getElementById("l"+row+"_1_b_"+i);
     if(BDiv!=null)
     {
       BDiv.className="";
     }
   }
   
   var CdivID = document.getElementById("l"+row+"_1_t_"+num); 
   if (CdivID != null)
   {
     CdivID.className="rtitle";
   }
   
   var CBdivID = document.getElementById("l"+row+"_1_b_"+num); 
   if (CBdivID != null)
   {
     CBdivID.className="rline3";
   }
   
   var CContentDiv = document.getElementById("l"+row+"_1_l_"+num); 
   if (CContentDiv != null)
   {
     CContentDiv.className="showblock";
   }
   
   var LdivID1 = document.getElementById("l"+row+"_1_b1"); 
   var LdivID2 = document.getElementById("l"+row+"_1_b2"); 
   if(LdivID1!=null && LdivID2!=null)
   {
     if(num<4)
     {
       LdivID1.className="rline2";
       LdivID2.className="rline4";
     }
     else
     {
       LdivID1.className="rline4";
       LdivID2.className="rline2";
     }
   }
}

function SetMouseOver4(num)
{
  window.clearTimeout(waitInterval);
	waitInterval=window.setTimeout("ChangeDiv4("+num+")",MouseDelayTime)
}
function ChangeDiv4(num)
{
  for(var i=1;i<5;i++)
   {     
     var divID = document.getElementById("hszdt"+i); 
     if (divID != null)
     {
       divID.className="title2";
     }
     
     //var ContentDiv = document.getElementById("hszdl"+i);
     //if(ContentDiv!=null)
     //{
       //ContentDiv.className="hiddenblock";
     //}
         
   }

   var CdivID = document.getElementById("hszdt"+num); 
   if (CdivID != null)
   {
     CdivID.className="title1";
   }
   
   //var CContentDiv = document.getElementById("hszdl"+num); 
   var CContentDiv = document.getElementById("frmHSRiser"); 
   if (CContentDiv != null)
   {
     CContentDiv.src = "http://web7.jrj.com.cn/HomeV1/hsrisefall" + num + ".htm";
   }  
}

function IsCorrectStock(code,type)
{
  var response;
  if(type=='stock')
  {
    response=HomeV1.Stock.IsCorrectStockCode(code);
  }
  if (type == 'fund')
  {
    response=HomeV1.Stock.IsCorrectFundCode(code);
  }
  if (type == 'openfund')
  {
    response=HomeV1.Stock.IsCorrectOpenFundCode(code);
  }
  if(response.error!=null)
  {
    //alert(response.error);
    return "";
  }  
  var stock=response.value;        
  return stock;
}

function GotoURL()
{
  hideDiv();
  var obj=document.getElementById("symbol"); 
  var objs = document.getElementById("menu1"); 
  if (obj!=null&&objs!=null)
  {
    var val = obj.value;
    var x = objs.value;
    if(val != null && x != null)
    { 
      //var StockCode = IsCorrectStock(val,'stock');   
      var StockCode = val;   
     if(StockCode!="")
      {
        switch(x)
        {
          case "1":
            window.open('http://share.jrj.com.cn/cominfo/go.asp?symbol='+StockCode+'&CPage=default')
            //window.open('http://share.jrj.com.cn/cominfo/default_'+StockCode+'.htm');            
            return;
            break;
          case "2":
            window.open('http://share.jrj.com.cn/cominfo/go.asp?symbol='+StockCode+'&CPage=ggxw')
            //window.open('http://share.jrj.com.cn/cominfo/ggxw_'+StockCode+'.htm');            
            return;
            break;
          case "3":
            window.open('http://share.jrj.com.cn/cominfo/ggpl_'+StockCode+'.htm');            
            return;
            break;
          case "4":
            window.open('http://share.jrj.com.cn/cominfo/go.asp?symbol='+StockCode+'&CPage=gsgg')
            //window.open('http://share.jrj.com.cn/cominfo/gsgg_'+StockCode+'.htm');            
            return;
            break;
          case "5":
            window.open('http://comment.jrj.com.cn/messageboard/show_review_1.aspx?StockCode='+StockCode);            
            return;
            break;
          case "6":
            window.open('http://share.jrj.com.cn/cominfo/go.asp?symbol='+StockCode+'&CPage=gsgk')
            //window.open('http://share.jrj.com.cn/cominfo/gsgk_'+StockCode+'.htm');            
            return;
            break;
          case "7":
            window.open('http://share.jrj.com.cn/cominfo/go.asp?symbol='+StockCode+'&CPage=mgsy')
            //window.open('http://share.jrj.com.cn/cominfo/mgsy_'+StockCode+'.htm');            
            return;
            break;
          case "8":
            window.open('http://share.jrj.com.cn/cominfo/go.asp?symbol='+StockCode+'&CPage=fhsp')
            //window.open('http://share.jrj.com.cn/cominfo/fhsp_'+StockCode+'.htm');            
            return;
            break;
          case "9":
            window.open('http://share.jrj.com.cn/cominfo/go.asp?symbol='+StockCode+'&CPage=ggry')
            //window.open('http://share.jrj.com.cn/cominfo/ggry_'+StockCode+'.htm');            
            return;
            break;
          case "10":
            window.open('http://share.jrj.com.cn/cominfo/go.asp?symbol='+StockCode+'&CPage=gmxx')
            //window.open('http://share.jrj.com.cn/cominfo/gmxx_'+StockCode+'.htm');            
            return;
            break;
          case "11":
            window.open('http://share.jrj.com.cn/cominfo/go.asp?symbol='+StockCode+'&CPage=gbjg')
            //window.open('http://share.jrj.com.cn/cominfo/gbjg_'+StockCode+'.htm');            
            return;
            break;
          case "12":
            window.open('http://share.jrj.com.cn/cominfo/go.asp?symbol='+StockCode+'&CPage=sdgd')
            //window.open('http://share.jrj.com.cn/cominfo/sdgd_'+StockCode+'.htm');            
            return;
            break;
          case "13":
            window.open('http://share.jrj.com.cn/cominfo/go.asp?symbol='+StockCode+'&CPage=jjcc')
            //window.open('http://share.jrj.com.cn/cominfo/jjcc_'+StockCode+'.htm');            
            return;
            break;
          case "14":
            window.open('http://share.jrj.com.cn/cominfo/go.asp?symbol='+StockCode+'&CPage=gbjg')
            window.open('http://share.jrj.com.cn/cominfo/jbcwsj_'+StockCode+'.htm');            
            return;
            break;
          case "15":
            window.open('http://share.jrj.com.cn/cominfo/go.asp?symbol='+StockCode+'&CPage=cwbl')
            //window.open('http://share.jrj.com.cn/cominfo/cwbl_'+StockCode+'.htm');            
            return;
            break;
          case "16":
            window.open('http://share.jrj.com.cn/cominfo/go.asp?symbol='+StockCode+'&CPage=zcfzb')
            //window.open('http://share.jrj.com.cn/cominfo/zcfzb_'+StockCode+'.htm');            
            return;
            break;
          case "17":
            window.open('http://share.jrj.com.cn/cominfo/go.asp?symbol='+StockCode+'&CPage=lrfpb')
            //window.open('http://share.jrj.com.cn/cominfo/lrfpb_'+StockCode+'.htm');            
            return;
            break;
          case "18":
            window.open('http://share.jrj.com.cn/cominfo/go.asp?symbol='+StockCode+'&CPage=xjllb')
            //window.open('http://share.jrj.com.cn/cominfo/xjllb_'+StockCode+'.htm');            
            return;
            break;
          case "19":
            window.open('http://share.jrj.com.cn/cominfo/go.asp?symbol='+StockCode+'&CPage=jdbg')
            //window.open('http://share.jrj.com.cn/cominfo/jdbg_'+StockCode+'.htm');            
            return;
            break;
          case "20":
            window.open('http://share.jrj.com.cn/cominfo/go.asp?symbol='+StockCode+'&CPage=zqbg')
            //window.open('http://share.jrj.com.cn/cominfo/zqbg_'+StockCode+'.htm');            
            return;
            break;
          case "21":
            window.open('http://share.jrj.com.cn/cominfo/go.asp?symbol='+StockCode+'&CPage=ndbg')
            //window.open('http://share.jrj.com.cn/cominfo/ndbg_'+StockCode+'.htm');            
            return;
            break;
          case "22":
            window.open('http://share.jrj.com.cn/cominfo/go.asp?symbol='+StockCode+'&CPage=glgs')
            //window.open('http://share.jrj.com.cn/cominfo/glgs_'+StockCode+'.htm');            
            return;
            break; 
          case "23":
            window.open('http://share.jrj.com.cn/cominfo/go.asp?symbol='+StockCode+'&CPage=ssggs')
           // window.open('http://share.jrj.com.cn/cominfo/ssggs_'+StockCode+'.htm');            
            return;
            break;
          case "24":
            window.open('http://share.jrj.com.cn/cominfo/go.asp?symbol='+StockCode+'&CPage=zgsms')
            //window.open('http://share.jrj.com.cn/cominfo/zgsms_'+StockCode+'.htm');            
            return;
            break;        
        }
      }      
    }
  }
  alert('请输入正确的股票代码！');  
  obj.select();
}

function ChangeSelect2(location)
{  
  var objChildMenu=document.getElementById("menu2"); 
  objChildMenu.length=0;  
  for (i=0;i<FundMenu.length;i++)
  {        
    if(FundMenu[i][0]==location)
    {    
      objChildMenu.options[objChildMenu.length]=new Option(FundMenu[i][1],FundMenu[i][2]);
    }
  }  
}

function ChangeFundSelect(location)
{
  var objfundcode=document.getElementById("symbolfund");
  objfundcode.value = "";
  ChangeSelect2(location)
}

function ShowDivStock(val)
{
  if(window.event.keyCode==13)
  {
    GotoURL();
  }
  ShowDiv(val,940,240);
}

function ShowDivFund()
{
  if(window.event.keyCode==13)
  {
    GotoURL2();
  }
   var objKind = document.getElementById("fundtype"); 
   var kind = "";
   if(objKind.value=="0") {kind = "open";}
   if (objKind.value=="1") {kind = "fund";}
   var objValue = document.getElementById("symbolfund"); 
   var key = objValue.value;
   ShowDiv2(key,kind,840,240);
}

function GotoURL2()
{
  hideDiv2();
  var obj=document.getElementById("symbolfund"); 
  var objs = document.getElementById("menu2");
  var objt=document.getElementById("fundtype");  
  if (obj!=null&&objs!=null&&objt!=null)
  {
    var val = obj.value;
    var x = objs.value;
    var t = objt.value;
    if(val != null && x != null && t != null)
    {  

      var StockCode = val;
      if (t==0)
      {
        //StockCode = IsCorrectStock(val,'openfund')
      }
      if(t == 1)
      {
        //StockCode = IsCorrectStock(val,'fund')
      }
      if(StockCode!="")
      {
        window.open(x+StockCode+'.htm');
        return;       
      }      
    }
  }
  alert('请输入正确的基金代码！');  
  obj.select();
}

function ShowDivBond()
{
  if(window.event.keyCode==13)
  {
    GotoURL3();
  }
}

function GotoURL3()
{
  window.open('http://bond.jrj.com.cn/bonddetail.asp?zqdm='+document.getElementById('symbolbond').value);
}

function ChangeSelect(location)
{
  var objChildMenu=document.getElementById("findtype"); 
  objChildMenu.length=0;  
  for (i=0;i<FindTypeList.length;i++)
  {        
    if(FindTypeList[i][0]==location)
    {    
      objChildMenu.options[objChildMenu.length]=new Option(FindTypeList[i][1],FindTypeList[i][2]);
    }
  }  
  var objbtn=document.getElementById("button3"); 
  
  switch(location)
  {     
     case "0":       
       objbtn.value="本币理财一览";
       objbtn.onclick=function(){window.open('http://bank.jrj.com.cn/bank/domestic.asp')};       
       break;
     case "1":
       objbtn.value="外币理财一览";  
       objbtn.onclick=function(){window.open('http://bank.jrj.com.cn/bank/foreign.asp')};      
       break;
   } 
   ChangeSelect1(0); 
}


function ChangeSelect1(location)
{
  var objChildMenu=document.getElementById("findvalue"); 
  objChildMenu.length=0;  
  for (i=0;i<FindValueList.length;i++)
  {        
    if(FindValueList[i][0]==location)
    {    
      objChildMenu.options[objChildMenu.length]=new Option(FindValueList[i][1],FindValueList[i][2]);
    }
  }
}

function KeyDown()
{
	if (window.event.keyCode==13)
	{
		todoX(2)
	}
}  
	
function toMain()
{
	land.action='http://user.jrj.com.cn/user/check.asp'
	land.submit()
	land.action=''
}		
  
function todoX(x)
{
	lcusername=document.land.Username.value
	lcpassword=document.land.Password.value
	if (lcusername=="" || lcpassword==""){window.alert("用户名和密码不能为空！");land.menu1.options[0].selected=true;return false}
	TmpValue=land.menu1.options[land.menu1.selectedIndex].value
	switch (TmpValue)
	{
	  case "1":
	    window.open ('http://person.jrj.com.cn/mystock/newZxg.asp?Show=0&UserName='+lcusername+'&PassWord='+lcpassword)
	    land.menu1.options[0].selected=true
	    return false
	  case "2":
	    land.action='http://user.jrj.com.cn/Custom/Login.asp'
	    break
	  case "3":
	    land.action='http://web1.jrj.com.cn/Myhome/Login.asp'
	    break
	  case "4":
	    land.action='http://web.jrj.com.cn/everyday/Login.asp'
	    break
	  case "5":
	    land.action='http://web1.jrj.com.cn/kqs2/login.asp'
	    break
	  case "6":
	    land.action='http://web1.jrj.com.cn/dxzw2/login.asp'
	    break
	  case "7":
	    land.action='http://web1.jrj.com.cn/Myweb/Login.aspx?type=3'
	    break
	  case "8":
	    land.action='http://web1.jrj.com.cn/Myweb/Login.aspx?type=4'
	    break  
	  case "9":
	    land.action='http://web1.jrj.com.cn/Myhome/login.asp?type=5'
	    break
	  case "10":
	    land.action='http://web1.jrj.com.cn/dxzw2/login.asp'
	    break    
	  case "11":
	    land.action='http://web1.jrj.com.cn/mastiff/login.asp'
	    break  
	  case "12":
	    land.action='http://user.jrj.com.cn/Jrjref/login/login.asp'
	    break   
	  case "13":
	    land.action='http://user.jrj.com.cn/yahoomail/landemail.asp'
	    break 
	  case "15":
	    land.action='http://blog.jrj.com.cn/login.aspx'
	    break       
	}
	if (land.action!='')
	{
	  land.submit()
	  land.action=''
	  land.menu1.options[0].selected=true
	}
	else
	{
	  if (x==2)
	  {
	    //window.alert("请选择栏目登陆")
	    //return false
	    toMain()
	  }
	}
}

function ShowDataSTK()
{
  var STKValueID = document.getElementById("STKValue");    
  if(STKValueID!=null)
  {
    ShowDetailSTK(STKValueID.value);
		GetNewValue();
  }
  var STKID = document.getElementById("STKData");
  if(STKID!=null)
  {
    STKID.DataURL="/HomeV1/text/StockIndex.htm?a=aaa";
    STKID.Reset();
		GetNewValue();
  }
}

function GetNewValue()
{
		var STK1 = document.getElementById("STK1");
		var STK2 = document.getElementById("STK2");
		var STK3 = document.getElementById("STK3");
		var STK4 = document.getElementById("STK4");
		var STK5 = document.getElementById("STK5");
		var STK6 = document.getElementById("STK6");
		var objImg = parent.document.getElementById("SwapImg1");
		var nhz = parent.document.getElementById("nhz");
		var nhzzd = parent.document.getElementById("nhzzd");
		var nzsname = parent.document.getElementById("nzsname");		
		var tempsrc = objImg.src;
		tempsrc=tempsrc.substr(tempsrc.lastIndexOf("/")+1);
		tempsrc=tempsrc.toLowerCase();

		if(document.all)
		{
		switch (tempsrc)
		{
			 case "shnotitle_000001.png":
			   //alert(STK2.innerText);
			   nhz.innerText=STK1.innerText;
		     nhz.className = STK2.className;
				 if(STK2.className=="c3")
				 {
				   nhzzd.innerText=" +" + STK2.innerText;
				 }				 
				 else if(STK2.className=="c1")
				 {
					 nhzzd.innerText=" -" + STK2.innerText;
				 }
				 else
				 {
					  nhzzd.innerText=" "+STK2.innerText;
				 }			
				 //nhzzd.innerText=STK2.innerText;
		     nhzzd.className = STK2.className;
				 nzsname.innerText="上证指数 ";
				 objImg.src="http://chart.jrj.com.cn/htmdata/gifindex/Shnotitle_000001.png";
			   break;
			 case "sznotitle_399001.png":
			   nhz.innerText=STK3.innerText;
		     nhz.className = STK4.className;				 
				 if(STK4.className=="c3")
				 {
				   nhzzd.innerText=" +" + STK4.innerText;
				 }				 
				 else if(STK4.className=="c1")
				 {
					 nhzzd.innerText=" -" + STK4.innerText;
				 }
				 else
				 {
					  nhzzd.innerText=" "+STK4.innerText;
				 }				 
		     nhzzd.className = STK4.className;
				 nzsname.innerText="深圳成指 ";
				 objImg.src="http://chart.jrj.com.cn/htmdata/gifindex/sznotitle_399001.png";
			   break;
			 case "sznotitle_399300.png":
			   nhz.innerText=STK5.innerText;
		     nhz.className = STK6.className;
				 if(STK6.className=="c3")
				 {
				   nhzzd.innerText=" +" + STK6.innerText;
				 }				 
				 else if(STK6.className=="c1")
				 {
					 nhzzd.innerText=" -" + STK6.innerText;
				 }
				 else
				 {
					  nhzzd.innerText=" "+STK6.innerText;
				 }				 
		     nhzzd.className = STK6.className;
				 nzsname.innerText="沪深300 ";
				 objImg.src="http://chart.jrj.com.cn/htmdata/gifindex/sznotitle_399300.png";
			   break;
		}
		}
		else
		{
			switch (tempsrc)
		{
			 case "shnotitle_000001.png":
			   //alert(STK2.textContent);
			   nhz.textContent=STK1.textContent;
		     nhz.className = STK2.className;
				 if(STK2.className=="c3")
				 {
				   nhzzd.textContent=" +" + STK2.textContent;
				 }				 
				 else if(STK2.className=="c1")
				 {
					 nhzzd.textContent=" -" + STK2.textContent;
				 }
				 else
				 {
					  nhzzd.textContent=" "+STK2.textContent;
				 }			
				 //nhzzd.textContent=STK2.textContent;
		     nhzzd.className = STK2.className;
				 nzsname.textContent="上证指数 ";
				 objImg.src="http://chart.jrj.com.cn/htmdata/gifindex/Shnotitle_000001.png";
			   break;
			 case "sznotitle_399001.png":
			   nhz.textContent=STK3.textContent;
		     nhz.className = STK4.className;				 
				 if(STK4.className=="c3")
				 {
				   nhzzd.textContent=" +" + STK4.textContent;
				 }				 
				 else if(STK4.className=="c1")
				 {
					 nhzzd.textContent=" -" + STK4.textContent;
				 }
				 else
				 {
					  nhzzd.textContent=" "+STK4.textContent;
				 }				 
		     nhzzd.className = STK4.className;
				 nzsname.textContent="深圳成指 ";
				 objImg.src="http://chart.jrj.com.cn/htmdata/gifindex/sznotitle_399001.png";
			   break;
			 case "sznotitle_399300.png":
			   nhz.textContent=STK5.textContent;
		     nhz.className = STK6.className;
				 if(STK6.className=="c3")
				 {
				   nhzzd.textContent=" +" + STK6.textContent;
				 }				 
				 else if(STK6.className=="c1")
				 {
					 nhzzd.textContent=" -" + STK6.textContent;
				 }
				 else
				 {
					  nhzzd.textContent=" "+STK6.textContent;
				 }				 
		     nhzzd.className = STK6.className;
				 nzsname.textContent="沪深300 ";
				 objImg.src="http://chart.jrj.com.cn/htmdata/gifindex/sznotitle_399300.png";
			   break;
		}
		}
}

function ShowDetailSTK(values)
{
  if (values.length==0){return false;}
  var stock = values.split(",");
  if(stock.length==12)
  {
    for(var j=0;j<stock.length;j++)
    {
      var divSTK = document.getElementById("STK"+(j+1));
      if(divSTK!=null)
      {
         divSTK.innerHTML=stock[j];
        if(j%2==1)
        {
          ShowNum(divSTK,stock[j],0)
        }
      }
    }
  }   
}


function ShowData2()
{
  ShowDataSTK();  
  window.setTimeout('ShowData2()',60000);
}

function ShowNum(who,ChrCom,NBase)
{
 lnnum = parseFloat(ChrCom).toFixed(2);
 if (isNaN(lnnum))
 {who.className='t2';}
 if (lnnum < NBase)  {who.className='c1';who.innerHTML='<img src=/HomeV1/images/down.gif width=8 height=8>'+Math.abs(lnnum);}
 if (lnnum == NBase) {who.className='c2';}
 if (lnnum > NBase)  {who.className='c3';who.innerHTML='<img src=/HomeV1/images/up.gif width=8 height=8>'+lnnum;}
 return;
}

function WriteValue(id,value)
{                                
	var obj = document.getElementById(id);	                              
	obj.value = value;
	if(id=="symbol"){hideDiv();}
	if(id=="symbolfund"){hideDiv2();}
}


//记录拖动后的cookie
function SetPos(para,key)
{
  var pos=new HttpCookie("pos");
  var keys = key + "[[]]=";
  var pattern = new RegExp(keys,"g");
  var paras = para.replace(pattern,"");
  pattern = new RegExp("\&","g");
  paras = paras.replace(pattern,",");
  var cl = key.substr(key.lastIndexOf('_')+1);
  var pos_line2=pos.values.get("line");
  if(pos_line2==null||pos_line2==""||pos_line2.length!=POSL.length)
  {
    pos_line2 = POSL;
  }
  var posArr = pos_line2.split(","); 
  var keyp = "l_"+posArr[cl-1];
  pos.values.set(keyp,paras);
  pos.setExpires(356*24*60*60);
  pos.save();
  //alert(document.cookie);
}

//交换节点
function ChangeNode(n1,n2)
{
	var id1=n1.id;
	var id2=n2.id;	
	var f = n1.parentNode;
	var n2copy = n2.cloneNode(true);
	var ni1 = f.insertBefore(n2copy,n2);
	var ni2 = f.insertBefore(n2,n1);
	var nr = f.replaceChild(n1,n2copy);
	//var t = n1.innerHTML;
	//n1.innerHTML = n2.innerHTML;
	//n2.innerHTML = t;
	//alert(id1);
	//alert(id2);
	var pos1 = id1.substr(id1.lastIndexOf('_')+1);
	var pos2 = id2.substr(id2.lastIndexOf('_')+1);	
	SetLinePos(pos1,pos2);		
}

//记录交换后行的位置
function SetLinePos(pos1,pos2)
{
  var pos=new HttpCookie("pos");
  var pos_line2=pos.values.get("line");
  if(pos_line2==null||pos_line2==""||pos_line2.length!=POSL.length)
  {
    pos_line2 = POSL;
  }
  //alert(pos_line2);ArrPos
  var posArr = pos_line2.split(","); 
  var posc1 = ArrPos[pos1-1];
  var posc2 = ArrPos[pos2-1];

  var t =  posArr[posc1-1];
  posArr[posc1-1] = posArr[posc2-1];
  posArr[posc2-1] = t;
  
  ArrPos[pos1-1] = posc2;
  ArrPos[pos2-1] = posc1;
  
  var newpos = "";
  for(var j=0;j<posArr.length;j++)
  {
    newpos = newpos+posArr[j]+",";
  }
  //alert(newpos);
  newpos = newpos.substr(0,newpos.length-1);  
  //重新存入cookie
  var pos=new HttpCookie("pos");
  pos.values.set("line",newpos);
  pos.setExpires(356*24*60*60);
  pos.save();
}

function openwin(url,w,h)
{
  window.open(url,'','toolbar=no,status=no,scrollbars=yes,resizable=no,width='+w+',height='+h);
}

function openwin2(url,w,h)
{
  window.open(url);
}

function ClearSet()
{
  var coskin=new HttpCookie("skin");          
  coskin.setValue("");          
  coskin.setExpires(-1);
  coskin.save(); 
  var pos=new HttpCookie("pos");
  pos.setValue(""); 
  pos.setExpires(-1);
  pos.save();
  
  window.location.reload();
  
}

function SwitchSalon(salonID)
{
  window.open("http://salon.jrj.com.cn/salon/text/" + salonID + ".aspx","");
}

function ChangeSelect3(location)
{
  
  var objRMB=document.getElementById("rmbchange"); 
  var objForeign1=document.getElementById("foreignexchage1");  
  var objForeign2=document.getElementById("foreignexchage2"); 
  var objbtn=document.getElementById("button5"); 
  var objresult = document.getElementById("result");
  var objSlash=document.getElementById("slash");
  objresult.value = "";  
  switch(location)
  {     
     case "0": 
       objRMB.style.display = "inline";
       objForeign1.style.display = "none";
       objForeign2.style.display = "none";  
       objSlash.style.display  = "none";         
       objRMB.length=0;  
       for (i=0;i<RMB.length;i++)
       {        
         objRMB.options[objRMB.length]=new Option(RMB[i][0]+"/人民币",RMB[i][1]);         
       }
       objbtn.value="本币汇率一览";
       objbtn.onclick=function(){window.open('http://www.jrj.com.cn/tradenotice/RMBExchangRate.aspx')};       
       break;
     case "1":
       objRMB.style.display = "none";
       objForeign1.style.display = "inline";
       objForeign2.style.display = "inline";
       objSlash.style.display  = "inline";
       objForeign1.length = 0;
       for(i=1;i<ForeignEx[0].length-1;i++)
       {
         objForeign1.options[objForeign1.length]=new Option(ForeignEx[0][i],i);      
       }
       objForeign2.length = 0;
       for(i=1;i<ForeignEx.length;i++)
       {
         objForeign2.options[objForeign2.length]=new Option(ForeignEx[i][0],i);      
       }
       objbtn.value="外币汇率一览";  
       objbtn.onclick=function(){window.open('http://fe.jrj.com.cn/ForeignExchange/BankQuote.asp')};      
       break;
   } 
   
}

function ChangeSelect4(location)
{  
  ClearLLResult();
  var objRateKind=document.getElementById("ratekind"); 
  var objRateOpt=document.getElementById("rateoption"); 
  switch(location)
  {     
     case "0":
       objRateOpt.style.display = "none";
       objRateKind.length=0;
       for (i=0;i<RMBRate.length;i++)
       {        
         if(RMBRate[i][1].substr(0,2)=="02")
         {
           objRateKind.options[objRateKind.length]=new Option(RMBRate[i][0],RMBRate[i][1]);         
         }
       }        
       break;
     case "1":   
       objRateOpt.style.display = "none";    
       objRateKind.length=0;
       for (i=0;i<RMBRate.length;i++)
       {        
         if(RMBRate[i][1].substr(0,2)=="01")
         {
           objRateKind.options[objRateKind.length]=new Option(RMBRate[i][0],RMBRate[i][1]);         
         }
       }
       break;
     case "2":       
       objRateOpt.style.display = "inline";
       objRateOpt.style.width="60px";
       objRateKind.length=0;
       for(i=1;i<ForeignRate.length;i++)
       {
         objRateKind.options[objRateKind.length]=new Option(ForeignRate[i][0],i);      
       }
       objRateOpt.length = 0;
       for(i=1;i<ForeignRate[0].length-1;i++)
       {
         objRateOpt.options[objRateOpt.length]=new Option(ForeignRate[0][i],i);      
       }       
       break;
   }   
}

function ChangeSelect5(location)
{
  ClearLLResult();
  var type = ratetype.options[ratetype.selectedIndex].value;
  var objRateOpt=document.getElementById("rateoption"); 
  if(location.substr(0,4)=="0202"||location.substr(0,4)=="0204")
  {
    objRateOpt.style.display = "inline";
    objRateOpt.length=0;
    for (i=0;i<RMBRateDQ.length;i++)
    {        
       if(RMBRateDQ[i][0]==location)
      {    
        objRateOpt.options[objRateOpt.length]=new Option(RMBRateDQ[i][1],RMBRateDQ[i][2]);
      }
    }
  }
  else
  {
    if(type == "2")
    {
      objRateOpt.style.display = "inline";
    }
    else
    {
      objRateOpt.style.display = "none";
    }    
  }
}

function ShowHLResult()
{
  var objHLType = document.getElementById("exchangetype");
  var hltype = objHLType.options[objHLType.selectedIndex].value;
  var objresult = document.getElementById("result");
  switch(hltype)
  {
    case "0":
      var objRMB = document.getElementById("rmbchange");
      var rmbresult = objRMB.options[objRMB.selectedIndex].value;
      for (i=0;i<RMB.length;i++)
      {
        if(RMB[i][1]==rmbresult)
        {
          objresult.value = RMB[i][2];
        }        
      }
      break;
    case "1":
      var objForeign1 = document.getElementById("foreignexchage1");
      var objForeign2=document.getElementById("foreignexchage2"); 
      var foreign1 = objForeign1.options[objForeign1.selectedIndex].value;
      var foreign2 = objForeign2.options[objForeign2.selectedIndex].value;
      objresult.value = ForeignEx[foreign1][foreign2];
      break;
  }
}

function ShowLLResult()
{  
  var objresult = document.getElementById("llresult");
  var Kind=ratekind.options[ratekind.selectedIndex].value;  
  var type = ratetype.options[ratetype.selectedIndex].value;
  switch(type)
  {
    case "0":     
      if(Kind.length == 4 && Kind != "0204")
      {
        for (i=0;i<RMBRate.length;i++)
        {
          if(RMBRate[i][1]==Kind)
          {
            objresult.value = RMBRate[i][2];
          }        
        }
      }
      else
      {        
        var OptDQ=rateoption.options[rateoption.selectedIndex].value;
        for (i=0;i<RMBRateDQ.length;i++)
        {
          if(RMBRateDQ[i][2]==OptDQ)
          {
            objresult.value = RMBRateDQ[i][3];
          }        
        }
      }
      break;
    case "1":
      for (i=0;i<RMBRate.length;i++)
      {
        if(RMBRate[i][1]==Kind)
        {
          objresult.value = RMBRate[i][2];
        }        
      }
      break;
    case "2":
      var Opt=rateoption.options[rateoption.selectedIndex].value; 
      objresult.value = ForeignRate[Kind][Opt];
      break;
  }
}

function ClearResult()
{
  var objresult = document.getElementById("result");
  objresult.value = "";
}

function ClearLLResult()
{
  var objresult = document.getElementById("llresult");
  objresult.value = "";
}

function ShowImg(code,market)
{
  window.open("http://quote.jrj.com.cn/htmdata/gifindex.asp?code="+code+"&market="+market,'',"height=270,width=434,status=no,toolbar=no,menubar=no,location=no,resizable=no","replace");
}


function SwapDPT_V1(x)
{
		
	if(document.all)
		{
		//alert('aa');
		var objImg = document.getElementById("SwapImg1");	
var frmgz = document.getElementById("frmgz");
	var STK1 = frmgz.contentWindow.document.getElementById("STK1");

	var STK2 = frmgz.contentWindow.document.getElementById("STK2");

	var STK3 = frmgz.contentWindow.document.getElementById("STK3");

	var STK4 = frmgz.contentWindow.document.getElementById("STK4");

	var STK5 = frmgz.contentWindow.document.getElementById("STK5");

	var STK6 = frmgz.contentWindow.document.getElementById("STK6");

	var nhz = document.getElementById("nhz");
	var nhzzd = document.getElementById("nhzzd");
	var nzsname = document.getElementById("nzsname");

	switch (x)
  {
	  case 1:
	      nhz.innerText=STK1.innerText;
		  nhz.className = STK2.className;
		  if(STK2.className=="c3")
		  {
		    nhzzd.innerText=" +" + STK2.innerText;
		  }				 
		  else if(STK2.className=="c1")
		  {
			nhzzd.innerText=" -" + STK2.innerText;
		  }
		  else
		  {
			nhzzd.innerText=" " + STK2.innerText;
		  }			
			//nhzzd.innerText=STK2.innerText;
		  nhzzd.className = STK2.className;
		  nzsname.innerText="上证指数 ";
	      
	      objImg.src = "http://chart.jrj.com.cn/htmdata/gifindex/Shnotitle_000001.png";
	      objImg.onclick = function(){ShowImg("000001",2)};
	      break;
	  case 2:
	      objImg.src = "http://chart.jrj.com.cn/htmdata/gifindex/Shnotitle_000003.png";	
		  objImg.onclick = function(){ShowImg("000003",2)};	
		  break;
	  case 3:
	     
	      nhz.innerText=STK3.innerText;
		  nhz.className = STK4.className;
		  if(STK4.className=="c3")
		  {
		    nhzzd.innerText=" +" + STK4.innerText;
		  }				 
		  else if(STK4.className=="c1")
		  {
			  nhzzd.innerText=" -" + STK4.innerText;
		  }
		  else
		  {
			  nhzzd.innerText=" " + STK4.innerText;
		  }				 
		  nhzzd.className = STK4.className;
		  nzsname.innerText="深圳成指 "; 
	      
	      
		  objImg.src = "http://chart.jrj.com.cn/htmdata/gifindex/Sznotitle_399001.png";		  
		  objImg.onclick = function(){ShowImg("399001",1)};
		  break;
	  case 4:
	    objImg.src = "http://chart.jrj.com.cn/htmdata/gifindex/Sznotitle_399003.png";		
	    objImg.onclick = function(){ShowImg("399003",1)};
      break;
    case 5:
	    nhz.innerText=STK5.innerText;
		  nhz.className = STK6.className;
		  if(STK6.className=="c3")
		  {
		    nhzzd.innerText=" +" + STK6.innerText;
		  }				 
		  else if(STK6.className=="c1")
		  {
			 nhzzd.innerText=" -" + STK6.innerText;
		  }
		  else
		  {
			nhzzd.innerText=" " + STK6.innerText;
		  }				 
		  nhzzd.className = STK6.className;
		  nzsname.innerText="沪深300 ";
	    
	    
	    objImg.src = "http://chart.jrj.com.cn/htmdata/gifindex/Sznotitle_399300.png";		    	
	    objImg.onclick = function(){ShowImg("399300",1)};
      break;
  }
  }
  else
  {
  var objImg = document.getElementById("SwapImg1");
  var frmgz = document.getElementById("frmgz");
	var STK1 = frmgz.contentWindow.document.getElementById("STK1");
	var STK2 = frmgz.contentWindow.document.getElementById("STK2");
	var STK3 = frmgz.contentWindow.document.getElementById("STK3");
	var STK4 = frmgz.contentWindow.document.getElementById("STK4");
	var STK5 = frmgz.contentWindow.document.getElementById("STK5");
	var STK6 = frmgz.contentWindow.document.getElementById("STK6");
	
	var nhz = document.getElementById("nhz");
	var nhzzd = document.getElementById("nhzzd");
	var nzsname = document.getElementById("nzsname");
  switch (x)
  {
	  case 1:
	      nhz.textContent=STK1.textContent;
		  nhz.className = STK2.className;
		  if(STK2.className=="c3")
		  {
		    nhzzd.textContent=" +" + STK2.textContent;
		  }				 
		  else if(STK2.className=="c1")
		  { 
			nhzzd.textContent=" -" + STK2.textContent;
		  }
		  else
		  {
			nhzzd.textContent=" " + STK2.textContent;
		  }			
			//nhzzd.textContent=STK2.textContent;
		  nhzzd.className = STK2.className;
		  nzsname.textContent="上证指数 ";
	      
	      objImg.src = "http://chart.jrj.com.cn/htmdata/gifindex/Shnotitle_000001.png";
	      objImg.onclick = function(){ShowImg("000001",2)};
	      break;
	  case 2:
	      objImg.src = "http://chart.jrj.com.cn/htmdata/gifindex/Shnotitle_000003.png";	
		  objImg.onclick = function(){ShowImg("000003",2)};	
		  break;
	  case 3:
	      nhz.textContent=STK3.textContent;
		  nhz.className = STK4.className;
		  if(STK4.className=="c3")
		  {
		    nhzzd.textContent=" +" + STK4.textContent;
		  }				 
		  else if(STK4.className=="c1")
		  {
			  nhzzd.textContent=" -" + STK4.textContent;
		  }
		  else
		  {
			  nhzzd.textContent=" " + STK4.textContent;
		  }				 
		  nhzzd.className = STK4.className;
		  nzsname.textContent="深圳成指 "; 
	      
	      
		  objImg.src = "http://chart.jrj.com.cn/htmdata/gifindex/Sznotitle_399001.png";		  
		  objImg.onclick = function(){ShowImg("399001",1)};
		  break;
	  case 4:
	    objImg.src = "http://chart.jrj.com.cn/htmdata/gifindex/Sznotitle_399003.png";		
	    objImg.onclick = function(){ShowImg("399003",1)};
      break;
    case 5:
	    nhz.textContent=STK5.textContent;
		  nhz.className = STK6.className;
		  if(STK6.className=="c3")
		  {
		    nhzzd.textContent=" +" + STK6.textContent;
		  }				 
		  else if(STK6.className=="c1")
		  {
			 nhzzd.textContent=" -" + STK6.textContent;
		  }
		  else
		  {
			nhzzd.textContent=" " + STK6.textContent;
		  }				 
		  nhzzd.className = STK6.className;
		  nzsname.textContent="沪深300 ";
	    
	    
	    objImg.src = "http://chart.jrj.com.cn/htmdata/gifindex/Sznotitle_399300.png";		    	
	    objImg.onclick = function(){ShowImg("399300",1)};
      break;
  }
  }
}

function review(filename)
{
  loca="http://chat.jrj.com.cn/makedp/reviewFile/"+filename+".htm"
  window.open(loca,"review","height=175,width=380,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no");  
}