function send_qry_checkinput()
{
	if (window.event.keyCode == 13)
	{
		document.getElementById('img_send_qry').focus();
		document.getElementById('img_send_qry').click();
	}
}

var v_path = "/sstock/";
var v_other_param="";
function send_qry_box()
{
	var sUrl;
	var sStockCode;

	if (document.getElementById('input_zqdm').value == "代码/名称/拼音")
	{
		sStockCode = "";
	}
	else
	{
		sStockCode = document.getElementById('input_zqdm').value;
	}

        // v_cgi_name 在调用send_qry_box的页面里面定义	
	sUrl = "http://stock.finance.qq.com/cgi-bin"+v_path+v_cgi_name+"?ZHENGQUANDM="+sStockCode+v_other_param;
	window.open(sUrl,'_self');
	return false;
}

function show_desc()
{
	window.open('http://stock.finance.qq.com/sstock/stock_desc.htm', '_blank', 'width=550 height=380 left=250 top=250');
}

function show_vs_desc()
{
	window.open('http://stock.finance.qq.com/sstock/stock_vs_desc.htm', '_blank', 'width=550 height=380 left=250 top=250');
}

function send_fst_k(v_type)
{
	var v_url;
	var v_cgi_name;
	var v_value = document.getElementById('sel_fst_k').value;
	var v_index = "";
	var v_zhengquandm = "";

        v_zhengquandm = document.getElementById('h_zhengquandm').value;
        if (v_type == "GP")
        {
                // 个股
                v_stockindex = "1";
                v_url = "/cgi-bin/"                

        	if (v_value == "fst")
        	{
        	        v_url += "sstock/ggcx";
                }
                else if (v_value == "nian_k")
                {
        	        v_url += "hqing/kline";
        	        v_index = "15";
                }
                else if (v_value == "5_k")
                {
        	        v_url += "hqing/kline";
        	        v_index = "16";
                }
                else if (v_value == "30_k")
                {
        	        v_url += "hqing/kline";
        	        v_index = "17";
                }
                else if (v_value == "60_k")
                {
        	        v_url += "hqing/kline";
        	        v_index = "18";
                }
        }	
        else
        {
                // 指数
                v_url = "/cgi-bin/hqing/"
                
        	if (v_value == "fst")
        	{
        	        v_url += "zhishulist";
                }
                else if (v_value == "nian_k")
                {
        	        v_url += "indexkl";
        	        v_index = "15";
                }
                else if (v_value == "5_k")
                {
        	        v_url += "indexkl";
        	        v_index = "16";
                }
                else if (v_value == "30_k")
                {
        	        v_url += "indexkl";
        	        v_index = "17";
                }
                else if (v_value == "60_k")
                {
        	        v_url += "indexkl";
        	        v_index = "18";
                }
        }
        
        v_url = "http://stock.finance.qq.com" + v_url + "?version=31&ZHENGQUANDM="+v_zhengquandm + "&type="+v_index;	
	window.open(v_url, '_blank');	
}

function set_fst_k(v_index)
{
	var v_opt = "";
        if (v_index == "16")
        {
                v_opt = "5_k"
        }
        else if (v_index == "17")
        {
                v_opt = "30_k"
        }
        else if (v_index == "18")
        {
                v_opt = "60_k"
        }
        
        if (v_opt == "")
        {
                return;
        }
        
        document.getElementById(v_opt).selected = true;
}

function add_pstock(v_type)
{
        var v_url;
        var v_zhengquandm = "";
        var v_stockindex;
        
        v_zhengquandm = document.getElementById('h_zhengquandm').value;
        if (v_type == "GP")
        {
                v_stockindex = "1";
        }
        else
        {
                v_stockindex = "2";
        }
        
        v_url = "http://stock.finance.qq.com/cgi-bin/pstock/pstock_manage?ltype=QPANEL&ftype=MS&STOCKINDEX="+v_stockindex+"&ZHENGQUANDM="+v_zhengquandm+"&ACTION=ADD&derr=0&random=" + Math.random();        
	window.open(v_url, '_blank');	
        
}

String.prototype.trim = function()
{
    return this.replace(/(^[\s]*)|([\s]*$)/g, "");
}

function pic_compare(v_type, v_target)
{
        var v_url;
        var v_zhengquandm = "";
        var v_vs_code = "";
        var v_ttype = "";
        var v_vs_zs ="";

        v_zhengquandm = document.getElementById('h_zhengquandm').value;
        v_vs_code = document.getElementById('vs_code').value;
        v_ttype = document.getElementById('sel_time').value;
        v_vs_zs = document.getElementById('sel_vs_zs').value;
        
        if (v_vs_code.trim() == "")
        {
                v_vs_code = v_vs_zs;
        }
        else
        {
                if (v_vs_zs != "NULL")
                {
                        v_vs_code = v_vs_code + "," + v_vs_zs;
                }
        }
        
        v_url = "http://stock.finance.qq.com/cgi-bin/hqing/vs?zhengquandm="+v_zhengquandm+"&vs_code="+v_vs_code+"&ptype="+v_type+"&ttype="+v_ttype+"&zs="+v_vs_zs+"&r="+Math.random();
	window.open(v_url, v_target);	
}


function write_vs_zs()
{
  document.write("<option id='NULL'     value='NULL'>空</option>"); 
  document.write("<option id='sh000001' value='sh000001' selected style='color: #000000'>上证指数</option>"); 
  document.write("<option id='sz399001' value='sz399001'>深证成指</option>"); 
  document.write("<option id='sh000002' value='sh000002'>Ａ股指数 </option>"); 
  document.write("<option id='sh000003' value='sh000003'>Ｂ股指数 </option>"); 
  document.write("<option id='sh000004' value='sh000004'>工业指数</option>"); 
  document.write("<option id='sh000005' value='sh000005'>商业指数</option>"); 
  document.write("<option id='sh000006' value='sh000006'>地产指数</option>"); 
  document.write("<option id='sh000007' value='sh000007'>公用指数</option>"); 
  document.write("<option id='sh000008' value='sh000008'>综合指数</option>"); 
  document.write("<option id='sh000010' value='sh000010'>上证180 </option>"); 
  document.write("<option id='sh000011' value='sh000011'>上证基金</option>"); 
  document.write("<option id='sh000012' value='sh000012'>国债指数</option>"); 
  document.write("<option id='sh000013' value='sh000013'>企债指数</option>"); 
  document.write("<option id='sh000015' value='sh000015'>红利指数</option>"); 
  document.write("<option id='sh000016' value='sh000016'>上证５０  </option>");  
  document.write("<option id='sz399002' value='sz399002'>成份Ａ指 </option>"); 
  document.write("<option id='sz399003' value='sz399003'>成份Ｂ指 </option>"); 
  document.write("<option id='sz399004' value='sz399004'>深证100R </option>"); 
  document.write("<option id='sz399106' value='sz399106'>深证综指</option>"); 
  document.write("<option id='sz399107' value='sz399107'>深证Ａ指 </option>"); 
  document.write("<option id='sz399108' value='sz399108'>深证Ｂ指 </option>"); 
  document.write("<option id='sz399110' value='sz399110'>农林指数</option>"); 
  document.write("<option id='sz399120' value='sz399120'>采掘指数</option>"); 
  document.write("<option id='sz399130' value='sz399130'>制造指数</option>"); 
  document.write("<option id='sz399131' value='sz399131'>食品指数</option>"); 
  document.write("<option id='sz399132' value='sz399132'>纺织指数</option>"); 
  document.write("<option id='sz399133' value='sz399133'>木材指数</option>"); 
  document.write("<option id='sz399134' value='sz399134'>造纸指数</option>"); 
  document.write("<option id='sz399135' value='sz399135'>石化指数</option>"); 
  document.write("<option id='sz399136' value='sz399136'>电子指数</option>"); 
  document.write("<option id='sz399137' value='sz399137'>金属指数</option>"); 
  document.write("<option id='sz399138' value='sz399138'>机械指数</option>"); 
  document.write("<option id='sz399139' value='sz399139'>医药指数</option>"); 
  document.write("<option id='sz399140' value='sz399140'>水电指数</option>"); 
  document.write("<option id='sz399150' value='sz399150'>建筑指数</option>"); 
  document.write("<option id='sz399160' value='sz399160'>运输指数</option>"); 
  document.write("<option id='sz399170' value='sz399170'>IT指数  </option>"); 
  document.write("<option id='sz399180' value='sz399180'>批零指数</option>"); 
  document.write("<option id='sz399190' value='sz399190'>金融指数</option>"); 
  document.write("<option id='sz399200' value='sz399200'>地产指数</option>"); 
  document.write("<option id='sz399210' value='sz399210'>服务指数</option>"); 
  document.write("<option id='sz399220' value='sz399220'>传播指数</option>"); 
  document.write("<option id='sz399230' value='sz399230'>综企指数</option>"); 
  document.write("<option id='sz399305' value='sz399305'>深证基金</option>"); 
  document.write("<option id='sz399481' value='sz399481'>企债指数</option>"); 
}

function set_vs_zs(v_opt)
{
        document.getElementById(v_opt).selected = true;
}
function send_qry_vs()
{
	if (window.event.keyCode == 13)
	{
                send_qry_box();                
	}
}

function add_QQstock(vType,code,type)
{
	uin1 = Cookie.getCookie("stk_uin");
	uin = Cookie.getCookie("uin");
	skey = Cookie.getCookie("skey");
	if(uin1!=null){codelist=Cookie.getCookie(uin1+"_CODE");} else {codelist="";}
	if (codelist.indexOf(code+"_"+type)!=-1){window.open("http://stock.finance.qq.com/cgi-bin/pstock/show_pstock?ltype=QQ&ftype=MS&randm="+Math.random(),"_blank");}
	else if(uin!=null&&skey!=null)
	{if(uin&&(skey!="")) window.location.href = "http://stock.finance.qq.com/cgi-bin/pstock/pstock_manage?ltype=QQ&ftype=MS&STOCKINDEX="+vType+"&zhengquandm="+code+"&ACTION=ADD";}
	else
	{openmsg("dLoginBig");}
}
function openmsg(obj)
{
	var mark = $("mark");
	var message = $(obj);
	var cw = document.documentElement.scrollWidth;
	var ch = document.documentElement.clientHeight;
	var ch2 = document.documentElement.scrollHeight;
	mark.style.display = "block";
	mark.style.height = ch2;
	mark.style.left=0;
	message.style.display = "block";
	message.style.top = document.documentElement.scrollTop + (ch - message.clientHeight)/2 + "px";
	message.style.left = (cw - message.clientWidth)/2 + "px";
	
	document.onmousedown=click;
	changeWindow();
}
function click() 
{
	if (window.event.button==1||window.event.button==2) 
	{
		return false;
	}
}
function changeWindow()
{
	var message = $("dLoginBig");
	var cw = document.documentElement.scrollWidth;
	var ch = document.documentElement.clientHeight;
	var ch2 = document.documentElement.scrollHeight;
	message.style.top = document.documentElement.scrollTop + (ch - message.clientHeight)/2 + "px";
	message.style.left = (cw - message.clientWidth)/2 + "px";
	
	window.setTimeout(changeWindow, 50);
}