Browser = {
	IE:     !!(window.attachEvent && !window.opera),
	Opera:  !!window.opera,
	WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
	Gecko:  navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
	MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
}
function $(element) {
  if (typeof(element) == "string")
    element = document.getElementById(element);
  return element;
}
function ShowAd()
{
	    var focus_width=302;
	    var focus_height=225;
	    var text_height=0;
		if(Browser.Gecko)
		{
			focus_height=199;
			text_height=0;
		}
	    var swf_height = focus_height+text_height;
	    var p = new Array(); 
	    var l = new Array(); 
	    var t = new Array(); 
	    p[0]='images/focus_1.jpg';
	    p[1]='images/focus_2.jpg';
	    p[2]='images/focus_3.jpg';
		p[3]='images/focus_4.jpg';
	    p[4]='images/focus_5.jpg';
	    l[0]='';
	    l[1]='';
	    l[2]='';
		l[3]='';
	    l[4]='';
		t[0]='';
	    t[1]='';
		t[2]='';
		t[3]='';
	    t[4]='';
	    var pics=p[0]+'|'+p[1]+'|'+p[2]+'|'+p[3]+'|'+p[4];
	    var links=l[0]+'|'+l[1]+'|'+l[2]+'|'+l[3]+'|'+l[4];
	    var texts=t[0]+'|'+t[1]+'|'+t[2]+'|'+t[3]+'|'+t[4];
	    var str="<object ID=\"focus_flash\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\""+ focus_width +"\" height=\""+ swf_height +"\">";
	    str+="<param name=\"allowScriptAccess\" value=\"sameDomain\"><param name=\"movie\" value=\"images/pixviewer.swf\"><param name=\"quality\" value=\"high\"><param name=\"bgcolor\" value=\"F1F1F1\">";
	    str+="<param name=\"menu\" value=\"false\"><param name=wmode value=\"opaque\">";
	    str+="<param name=\"FlashVars\" value=\"pics="+pics+"&links="+links+"&texts="+texts+"&borderwidth="+focus_width+"&borderheight="+focus_height+"&textheight="+text_height+"\">";
	    str+="<embed ID=\"focus_flash\" src=\"images/pixviewer.swf\" wmode=\"opaque\" FlashVars=\"pics="+pics+"&links="+links+"&texts="+texts+"&borderwidth="+focus_width+"&borderheight="+focus_height+"&textheight="+text_height+"\" menu=\"false\" bgcolor=\"#F1F1F1\" quality=\"high\" width=\""+ focus_width +"\" height=\""+ focus_height +"\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"/>";
	    str+="</object>";
	    document.getElementById("mid_l_1_l").innerHTML=str;
}

// 加入收藏
function AddFavor() {  
    try {
        window.external.addFavorite(window.location.href, window.document.title);  
    }catch (e){  
        try{  
            window.sidebar.addPanel(window.document.title, window.location, "");  
        }catch (e) {
			alert("加入收藏失败，请使用Ctrl+D进行添加");  
        }  
    }  
} 


function quotesearch(code) 
{

  stockcode_current=code;
  if (stockcode_current=="请输入代码或简称" || stockcode_current=="")stockcode_current="600900";
var re=/[0-9]{6}/; 
var re2=/[0-9]{1,}/; 
var re3=/[^0-9]{1,}/; 
  bool1=code.match(re);
  bool2=code.match(re2);
  bool3=code.match(re3);
  
  if(bool1!=null && stockcode_current.length==6){
    window.open("http://quote.eastmoney.com/"+stockcode_current+".html");	}
  else {
    if (bool2!=null && bool3==null && stockcode_current.length<3 || stockcode_current.length==3 && stockcode_current=="600" || stockcode_current.length==3 && stockcode_current=="000"){alert("符合条件的股票代码过多，请重新输入关键字！");return false;}
    if (bool2==null && bool3!=null && stockcode_current.length<2){alert("模糊查询时关键字至少2位！");return false;}
  	window.open("http://quote.eastmoney.com/quote.asp?stockcode="+stockcode_current);}
  return(false);
}

function q_search(bb){
var s1=bb;
var s = escape(s1);
if (s1=="输代码、名称或拼音缩写" || s1=="" ){
window.open("http://q.eastmoney.com/");
return false;
}else{
window.open("http://q.eastmoney.com/q.aspx?StockCode="+s);
return false;}
  }

function gb_search(code)
{       
  var re=/[0-9]{6}/; 
  bool1=code.match(re);

	if(bool1!=null)
	{window.open('http://guba.eastmoney.com/'+code+',guba.html');}
	else
        {window.open('http://guba.eastmoney.com/guba_hz_1.htm');}
}

function so_search(code)
{       
	if(code!=null)
	{window.open('http://so.eastmoney.com/Search.aspx?Page=1&q='+code+'&t=body');}
	else
	{window.open('http://so.eastmoney.com/News.aspx');}
}


