function getObject(element)
{if(arguments.length>1){for(var i=0,elements=[],length=arguments.length;i<length;i++){elements.push($(arguments[i]));}return elements;}if(typeof element=='string'){return document.getElementById(element);}return element;};
/*Tab 切换*/
//顶部焦点新闻
function SwitchNewsWin17oks(id,num,count)
{
    ClearWin17okClasss(id,count);
    document.getElementById("Win17okname_" + id + num).className = "Win17okf";
    document.getElementById(id + num).className = "Win17ok_Show";
    if(document.getElementById("imgQuote" + num)) document.getElementById("imgQuote" + num).src = imgQuotes[num - 1];
    if(num==2)
    {
        changecjsp();
    }
}
function ClearWin17okClasss(id,count)
{
    for(i=1;i<=count;i++)
    {
        document.getElementById("Win17okname_" + id + i).className = "Win17okn";
        document.getElementById(id + i).className = "Win17ok_Hidden";
    }
}
//行情中心
function hqzxtab(id,num,count)
{
    Clearhqzxtab(id,count);
    document.getElementById("Win17okname_" + id + num).className = "Win17ohq";
    document.getElementById(id + num).className = "Win17ok_Show";
	/*当鼠标在5上时处理样式*/
	 if(num==5)  
	 {
        document.getElementById("hqxzleft").className = "hqzxgg Win17ok_Hidden";
	 }
	 if(num!=5)  
	 {
        document.getElementById("hqxzleft").className = "hqzxgg";
	 } 
    /*当鼠标在6上时处理样式*/
    if(num==6 || num!=7)
    {
        document.getElementById("Win17okname_" + id + 6).className = "hqzxlefta";
        document.getElementById("Win17okname_" + id + 7).className = "hqzxlefta2";
    }
	if(num!=6 || num!=7)
    {
        document.getElementById("Win17okname_" + id + 6).className = "hqzxleftb";
        document.getElementById("Win17okname_" + id + 7).className = "hqzxlefta2";
    }
	if(num==6)
    {
        document.getElementById("Win17okname_" + id + 6).className = "hqzxlefta";
    }
    if(num==7)
    {
        document.getElementById("Win17okname_" + id + 7).className = "hqzxleftb2";
        document.getElementById("Win17okname_" + id + 6).className = "hqzxleftb";
    }
    if(document.getElementById("imgQuote" + num)) document.getElementById("imgQuote" + num).src = imgQuotes[num - 1];
}
function Clearhqzxtab(id,count)
{
    for(i=1;i<=count;i++)
    {
        document.getElementById("Win17okname_" + id + i).className = "Win17okhx";
        document.getElementById(id + i).className = "Win17ok_Hidden";
    }
}
//
function hqzxtab2(id,num,count)
{
    Clearhqzxtab2(id,count);
    document.getElementById("Win17okname_" + id + num).className = "hqzxw";
    document.getElementById(id + num).className = "Win17ok_Show";
    if(document.getElementById("imgQuote" + num)) document.getElementById("imgQuote" + num).src = imgQuotes[num - 1];
}
function Clearhqzxtab2(id,count)
{
    for(i=1;i<=count;i++)
    {
        document.getElementById("Win17okname_" + id + i).className = "hqzxlefta";
        document.getElementById(id + i).className = "Win17ok_Hidden";
    }
}
function SwitchNewsLeft(id,num,count)
{ 
    ClearNewsLeft(id,count);
    document.getElementById("Win17okname_" + id + num).className = "Win17okf";
    document.getElementById(id + num).className = "Win17ok_Show";
}
function ClearNewsLeft(id,count)
{ 
    for(i=1;i<=count;i++)
    {
        document.getElementById("Win17okname_" + id + i).className = "Win17okn";
        document.getElementById(id + i).className = "Win17ok_Hidden"; 
    }
}
function g(o){return document.getElementById(o);} 
function HoverLi(perfix,n,q){ 
for(var i=1;i<=q;i++)
{g(perfix+'tb_'+i).className='normaltab';g(perfix+'tbc_0'+i).className='undis';} 
g(perfix+'tbc_0'+n).className='dis';g(perfix+'tb_'+n).className='hovertab'; 
}
function bHoverLi(perfix,n,q){
	  /*当鼠标在2上时处理样式*/
for(var i=1;i<=q;i++){

    g(perfix+'btb_'+i).className='normaltab'+i;
    g('dh_zg0'+i).className='undis';  

}
 
g(perfix+'btb_'+n).className='bhovertab'+n; 
g('dh_zg0'+n).className='dh_zg'; 
//g(perfix+'btbc_0'+n).className='dis';
//g(perfix+'btbc_0'+n).className='dis';
var sf = document.getElementById('searchform');//getObject("searchform");
var query = getObject("query");    
sf.action ='';
    switch(n){ 
        case 1: 
            sf.action = "http://www.17ok.com/sougu/index.php?n=1"
            query.value = '输入资讯关键字';
            break;
        case 2: 
            sf.action = "http://www.17ok.com/sougu/index.php?n=2" 
            query.value = '输入股票代码/简称/拼音';
            break; 
        case 3:
            sf.action = "http://www.17ok.com/sougu/index.php?n=3"
            query.value = '输入基金代码/简称/拼音'; 
            break;
        case 4:
            sf.action = "http://www.17ok.com/sougu/index.php?n=4"
            query.value = '输入股票代码/简称/拼音';
            break; 
        case 5: 
            sf.action = "http://www.17ok.com/sougu/index.php?n=5"
            query.value = '输入股票代码/简称/拼音';
            break;
        case 6:
            sf.action = "http://www.17ok.com/dailydp/index.php"
            query.value = '输入股票代码/简称/拼音';
             break;   
        case 7:
            sf.action = "http://www.17ok.com/sougu/index.php?n=7"
            query.value = '输入股票代码/简称/拼音';
            break;
    }
}
/*最新财经 上市公司切换*/
function left_chg(perfix,n,q)
{
if(n==1)
{
     g(perfix+'btb_'+n).className='zxcjtab'; 
     g(perfix+'btbc_0'+n).className='left_Show'; 
     g(perfix+'btb_'+2).className='ssgstab_no';
     g(perfix+'btbc_0'+2).className='left_Hidden';
     g(perfix+'btb_'+3).className='ssxwtab_no';
     g(perfix+'btbc_0'+3).className='left_Hidden';      
} else if(n==2)
{
     g(perfix+'btb_'+n).className='ssgstab'; 
     g(perfix+'btbc_0'+n).className='left_Show';
     g(perfix+'btb_'+1).className='zxcjtab_no';    
     g(perfix+'btbc_0'+1).className='left_Hidden';
     g(perfix+'btb_'+3).className='ssxwtab_no';
     g(perfix+'btbc_0'+3).className='left_Hidden';
} else
if(n==3)
{
     g(perfix+'btb_'+2).className='ssgstab_no'; 
     g(perfix+'btbc_0'+2).className='left_Hidden';
     g(perfix+'btb_'+1).className='zxcjtab_no';    
     g(perfix+'btbc_0'+1).className='left_Hidden';
     g(perfix+'btb_'+n).className='ssxwtab';
     g(perfix+'btbc_0'+n).className='left_Show';
}
}
/*大首页免费诊股*/
function isphone1()   
 {
  var num = document.getElementById('mobile').value;
  var stockcode = document.getElementById('stockcode').value;
   if(stockcode=="")
   {
        document.getElementById('stockcode').value ='请输入股票代码'; 
        document.sjdc.stockcode.focus();   
        document.sjdc.stockcode.style.bgColor="#cc0000";
        return false;
  }
  var partten_code = /^[0-9]{6}$/ ;
  if(partten_code.test(stockcode) ==false)
  {
       document.getElementById('stockcode').value ='输入正确股票代码'; 
       document.sjdc.stockcode.focus();   
       document.sjdc.stockcode.style.bgColor="#cc0000";
       return false;  
  }
   if(num=="" || num=="13×××××××××")
   {
        document.getElementById('mobile').value ='请输入手机或电话'; 
        document.sjdc.mobile.focus();   
        document.sjdc.mobile.style.bgColor="#cc0000";
        return false;
  }
 //匹配固定电话或小灵通，例如：031185907468或02185907468格式    
 var partten =/^((0(?!(13)))[0-9]{3}\-)?[2-9][0-9]{6,7}$|^((0(?!(13)))[0-9]{2}\-)?[2-9][0-9]{7}$/ ;
 var partten1 = /^1[3,5,8]\d{9}$/;
  if(partten.test(num) || partten1.test(num))
  {
        document.getElementById('sjdc').submit();
        //document.getElementById('stockcode').value = "股票代码";   
        //document.getElementById('mobile').value = "手机或电话";
  }else
  {
        document.getElementById('mobile').value ='请输入正确手机或电话号码';
        document.sjdc.mobile.focus();
        document.sjdc.mobile.bgColor="#FF0000";
        return false;
  }
  document.mfzg.submit();
}
/*判断是否为个股专评*/
function sgsubmit()
{
   var sf = getObject("searchform");
   var query = getObject("query");  
   if(query.value=="" || query.value=="输入资讯关键字")
   {
        query.value ='输入资讯关键字'; 
        query.focus();   
        query.style.bgColor="#cc0000";
        return false;
  }
   if(query.value=="" || query.value=="输入股票代码/简称/拼音")
   {
        query.value ='输入股票代码/简称/拼音'; 
        query.focus();   
        query.style.bgColor="#cc0000";
        return false;
  }
   if(query.value=="" || query.value=="输入基金代码/简称/拼音" )
   {
        query.value ='输入基金代码/简称/拼音'; 
        query.focus();   
        query.style.bgColor="#cc0000";
        return false;
  }

   if(sf.action == "http://www.17ok.com/dailydp/index.php") 
    {
        /*执行查询*/
        var urlgo = 'http://www.17ok.com/dailydp/newindex.php?code=' + encodeURI(query.value);
        x_open('个股专评 - 财界网', urlgo,416,220);
        setTimeout("closeit()",28000); 
        return false;
     }else
      {     var URL;                
            URL = sf.action + "&code=" + encodeURI(query.value);
            window.open(URL);
            return false;
       }
      return true; 
}
/*
私募基金组合
id为组合类型的编号
1为稳健型 2为成长型 3为激进型
*/
function smjj_chg(id)
{
    var i;
    var id_name; 
    for(i=1; i<4; i++)
    {
        id_name = 'smjj_' + i;
        if (id == i)
        {
            getObject(id_name).className = "sm_Show";
        }
        else 
        {
            getObject(id_name).className = "sm_Hidden"; 
        }
    }
}
/*行情中心的进入股吧*/
function hqzx_gb()
{
    var stockcode = getObject('stock_code');
    if(stockcode.value=="股票代码/简称/拼音" || stockcode.value=="")
    { 
        return;

    }else
    {
           window.open('http://www.17ok.com/sougu/index.php?n=2&code='+stockcode.value);
            return; 
    }

}

/*个股专评*/
function sgsingle(code){
            
    /*执行查询*/
    var urlgo = 'http://www.17ok.com/dailydp/newindex.php?code='+code;
    x_open('个股专评 - 财界网', urlgo,416,220);
    setTimeout("closeit()",8000); 
    return false;
}
/*头部搜索股吧 基金*/
function guba_search() 
{
    var obj = getObject('code_search');
    var url = "";
    if (obj.value == "输入代码或简称" || obj.value == '')
    {
        url = "http://guminba.17ok.com/17stock/";
    }
    else
    {
        url = 'http://guminba.17ok.com/17stock/index/search.php?search_type=1&search_content=' + obj.value;
    }

    window.open(url);
}
/*搜索博客*/
function check_spaceitem()
{
        var searchkey = getObject('searchkey');
        if(searchkey.value=="" || searchkey.value=="请输入标题")
        {
            searchkey.value ='请输入标题'; 
            searchkey.focus();   
            searchkey.style.bgColor="#cc0000";
            return false;
        }    
}
/*个股咨询*/
function savephone(){
    var phone = getObject('phone');
    if(phone.value == "请输入电话"){
        alert("请输入您的电话!");
        return false;
    }
    else{
        window.open("http://www.waytoway.com/phone.php?phone="+phone.value, "phone");
    }
}
/*大首页登录检测*/
function routing()
{
    var hydlzx = getObject("hydlzx");
    var username = getObject("username");
    var password = getObject("password");
    var gotopath = getObject("goto"); 
    if(username.value=='') 
    {
        alert("请输入用户名");
        username.focus();
        return false;
    }
    if(password.value=='')
    {
        alert("请输入密码");
        password.focus();
        return false;
    }
    if(gotopath.value=='')
    {
        alert("请选择去向");
        gotopath.focus();   
        return false;
    }
    hydlzx.submit();
}  