var GetDataController=function(a){var d={},c=0,b=new Model("script","js_top_load_box"),h="http://hq.sinajs.cn/rn="+b.stringMark+"&list="+a.params.toString();b.stringUrl=h;b.intInterval=a.refash?-1:5E3;b.processData=function(){d={};for(var e=0,i=a.keys.length;e<i;e++){var f=a.keys[e];if(window[f]!=undefined)d[f]=window[f]}c<5&&c++};b.updateView=function(){a.callback&&a.callback(d);if(c>=5)b.intInterval=1E4};b.start();this.ChangeData=function(e,i){a.params=e;a.keys=i;e="http://hq.sinajs.cn/rn="+b.stringMark+
"&list="+a.params.toString();b.stringUrl=e;b.start()};this.Stop=function(){b.stop()}},imgTime=(new Date).getTime(),imgRefashTime=1,imgPathObj={activeKey:"hq_str_s_sh000001",hq_str_s_sh000001:"http://image.sinajs.cn/newchart/small/nsh000001.gif",hq_str_s_sz399001:"http://image.sinajs.cn/newchart/small/nsz399001.gif",hq_str_s_sh000300:"http://image.sinajs.cn/newchart/small/nsh000300.gif",hq_str_b_NKY:"http://image.sinajs.cn/newchart/v5/forex/min5_m/NIXI.gif",hq_str_hf_GC:"http://image.sinajs.cn/newchart/v5/futures/global/mins/GC.gif",
hq_str_hf_CL:"http://image.sinajs.cn/newchart/v5/futures/global/mins/CL.gif"},ChangeImg=function(){function a(d,c,b){var h=typeof d=="string"?document.getElementById(d):d,e=h.cloneNode(true);e._A=h;e._y=typeof b!="undefined"?b:new Function;e[document.all?"onreadystatechange":"onload"]=function(){if(!(document.all&&this.readyState!="loaded"&&this.readyState!="complete")){this._A.parentNode.replaceChild(this,this._A);e._y(this);this._A=e._y=null;this[document.all?"onreadystatechange":"onload"]=null}};
e.src=c}a("js_newchart_img",imgPathObj[imgPathObj.activeKey]+"?"+imgTime)},ChangeImgKey=function(a){imgPathObj.activeKey=a;ChangeImg()},pageInit=function(){GetDataController({params:["s_sh000001","s_sz399001","s_sh000300","b_NKY","hf_GC","hf_CL","sh000001"],keys:["hq_str_s_sh000001","hq_str_s_sz399001","hq_str_s_sh000300","hq_str_hf_GC","hq_str_hf_CL","hq_str_sh000001"],callback:function(a){var d=document.getElementById("js_top_datatable"),c="",b=(new Date).getTime();if(imgTime+6E4*imgRefashTime<
b){imgTime=b;ChangeImg()}for(var h in a){b=a[h].split(",");var e=Number(b[2]).toFixed(2),i=b[3];if(e>0){e=(Number(b[2])>0?"+":"")+e;i=(Number(b[3])>0?"+":"")+i}else if(e==0)i=e="-";if(h!="hq_str_hf_GC"&&h!="hq_str_hf_CL"&&h!="hq_str_sh000001"){c+="<dl>";c+='<dt><a href="javascript://" onclick="ChangeImgKey(\''+h+"');\">"+b[0]+"</a></dt>";c+='<dd class="'+(Number(b[2])>0?"red":"green")+'">'+Number(b[1]).toFixed(2)+"</dd>";c+='<dd class="'+(Number(b[2])>0?"red":"green")+'">'+e+"</dd>";c+='<dd class="'+
(Number(b[3])>0?"red":"green")+'">'+i+"%</dd>";c+="</dl>"}else if(h=="hq_str_hf_GC"){e=(b[1]/b[0]*100).toFixed(2);var f="";if(b[7]>b[0])f="-";else if(b[7]<b[0])f="+";i=f=="+"?"red":"green";c+='<dl id="listdl3">';c+='<dt><a href="javascript://" onclick="ChangeImgKey(\''+h+"');\">\u9ec4\u91d1</a></dt>";c+='<dd class="'+i+'">'+Number(b[0]).toFixed(2)+"</dd>";c+='<dd class="'+i+'">'+f+Number(b[1]).toFixed(2)+"</dd>";c+='<dd class="'+i+'">'+f+e+"%</dd>";c+="</dl>"}else if(h=="hq_str_hf_CL"){e=(b[1]/b[0]*
100).toFixed(2);f="";if(b[7]>b[0])f="-";else if(b[7]<b[0])f="+";i=f=="+"?"red":"green";c+='<dl id="listdl4">';c+='<dt><a href="javascript://" onclick="ChangeImgKey(\''+h+"');\">\u539f\u6cb9</a></dt>";c+='<dd class="'+i+'">'+Number(b[0]).toFixed(2)+"</dd>";c+='<dd class="'+i+'">'+f+Number(b[1]).toFixed(2)+"</dd>";c+='<dd class="'+i+'">'+f+e+"%</dd>";c+="</dl>"}else if(h=="hq_str_sh000001")document.getElementById("update_time").innerHTML=b[b.length-2]+" \u6570\u636e"}d.innerHTML="";d.innerHTML=c}})};
pageInit();
var Cookie={set:function(a,d,c,b,h){if(typeof c=="undefined")c=new Date((new Date).getTime()+2592E6);document.cookie=a+"="+escape(d)+(c?"; expires="+c.toGMTString():"")+(b?"; path="+b:"; path=/")+(h?";domain="+h:"")},get:function(a){a=document.cookie.match(new RegExp("(^| )"+a+"=([^;]*)(;|$)"));if(a!=null)return unescape(a[2]);return""},clear:function(a,d,c){if(this.get(a))document.cookie=a+"="+(d?"; path="+d:"; path=/")+(c?"; domain="+c:"")+";expires=Fri, 02-Jan-1970 00:00:00 GMT"}},searchController,getCustomData=
function(a,d){for(var c=[],b=0,h=a.length;b<h;++b)c.push("hq_str_"+a[b]);if(d){searchController&&searchController.Stop();searchController=undefined}if(searchController==undefined)if(c.length>0)searchController=new GetDataController({params:a,keys:c,callback:function(e){var i=document.getElementById("my_stock_list");var f=i.innerHTML="";f+='<table id="my_stock" cellspacing="1" cellpadding="0" border="0" width="100%">';f+='<tr class="tl"><th scope="col">\u6211\u7684\u81ea\u9009\u80a1</th><th scope="col">\u5f53\u524d\u4ef7</th><th scope="col">\u6da8\u8dcc\u5e45</th><th scope="col">\u6da8\u8dcc\u989d</th><th scope="col">\u6628\u6536</th><th scope="col">\u4eca\u5f00</th><th scope="col">\u6700\u9ad8/\u6700\u4f4e\u4ef7</th><th scope="col">\u4e70\u5165/\u5356\u51fa\u4ef7</th><th scope="col">\u5220\u9664</th></tr>';
for(var j in e)if(e[j]!=""){var g=e[j].split(","),k=g[3]-g[2],q=(k/Number(g[2])*100).toFixed(2),l=k>0?"red":"green";if(k==0)l="";var m="",n="",o="",p="";if(g[1]>g[2]){m="green";n="red"}else if(g[1]<g[2]){n="green";m="red"}if(g[7]>g[6]){o="green";p="red"}else if(g[7]<g[6]){p="green";o="red"}f+='<tr><td class="name"><a title="\u70b9\u51fb\u67e5\u770b\u8be6\u60c5" href="http://finance.sina.com.cn/realstock/company/'+j.substr(7,8)+'/nc.shtml" target="_blank">'+g[0]+"</a></td>";f+='<td class="'+l+'">'+
(g[3]==0?"-":g[3])+"</td>";f+='<td class="'+l+'">'+(g[3]==0?"-":q+"%")+"</td>";f+='<td class="'+l+'">'+(g[3]==0?"-":k.toFixed(2))+"</td>";f+='<td class="'+m+'">'+g[2]+"</td>";f+='<td class="'+n+'">'+(g[3]==0?"-":g[1])+"</td>";f+='<td><span class="'+o+'">'+(g[6]==0?"-":g[6])+'</span>/<span class="'+p+'">'+(g[7]==0?"-":g[7])+"</span></td>";f+='<td><a href="javascript://" onclick="deleteMystock(this,\''+j.replace("hq_str_","")+'\');"><img alt="\u5220\u9664" src="images/delete_s.gif"/></a></td></tr>'}else{g=
j.replace("hq_str_","");alert(g+"\u5df2\u6458\u724c\uff01");deleteStockCookie(g)}f+="</table>";i.innerHTML=f}});else{a=document.getElementById("my_stock_list");d=a.innerHTML="";d+='<table id="my_stock" cellspacing="1" cellpadding="0" border="0" width="100%">';d+='<tr class="tl"><th scope="col">\u6211\u7684\u81ea\u9009\u80a1</th><th scope="col">\u5f53\u524d\u4ef7</th><th scope="col">\u6da8\u8dcc\u5e45</th><th scope="col">\u6da8\u8dcc\u989d</th><th scope="col">\u6628\u6536</th><th scope="col">\u4eca\u5f00</th><th scope="col">\u6700\u9ad8/\u6700\u4f4e\u4ef7</th><th scope="col">\u4e70\u5165/\u5356\u51fa\u4ef7</th><th scope="col">\u5220\u9664</th></tr>';
d+="</table>";a.innerHTML=d}else searchController.ChangeData(a,c)},defaulf_Stock=["sz000002","sh600036","sh601318","sh601899"],clearStock=Cookie.get("nostock"),loadMystock=function(){var a=Cookie.get("stockdata");if(a!=="")getCustomData(a.split(","));else if(clearStock==""){Cookie.set("stockdata",defaulf_Stock);getCustomData(defaulf_Stock)}},onPress=function(a){a.keyCode==13&&addMystock()},addMystock=function(){var a=Cookie.get("stockdata"),d=document.getElementById("stock_inp").value;if((d.indexOf("sh")||
d.indexOf("sz"))==-1&&d.length!==8)alert("\u60a8\u6dfb\u52a0\u7684\u80a1\u7968\u4ee3\u7801\u4e0d\u6b63\u786e\uff01");else{data=a!=""?a.split(","):[];if(d=="")alert("\u8bf7\u8f93\u5165\u60a8\u8981\u6dfb\u52a0\u7684\u80a1\u7968\u4ee3\u7801\uff01");else{for(a=0;a<data.length;a++)if(data[a]==d){alert("\u60a8\u5df2\u7ecf\u6dfb\u52a0\u8fc7\u6b64\u80a1\u7968\u3002");return}if(data.length>4){document.getElementById("stock_inp").blur();alert("\u5bf9\u4e0d\u8d77\uff0c\u6700\u591a\u53ea\u80fd\u6dfb\u52a05\u4e2a\u81ea\u9009\u80a1\uff0c\u8bf7\u60a8\u5220\u9664\u73b0\u6709\u7684\u80a1\u7968\u518d\u6dfb\u52a0\uff01")}else{a=
0;for(var c=data.length;a<c;a++)if(data[a]==d){getCustomData(data);return}data.push(d);Cookie.set("stockdata",data);getCustomData(data)}}}},deleteStockCookie=function(a){var d=Cookie.get("stockdata");data=d!=""?d.split(","):[];d=-1;for(var c=0,b=data.length;c<b;c++)if(data[c]==a){d=c;break}if(d>-1){data.splice(d,1);Cookie.set("stockdata",data);getCustomData(data,true)}},deleteMystock=function(a,d){a=Cookie.get("stockdata");data=a!=""?a.split(","):[];if(data.length==1){Cookie.clear("stockdata");getCustomData([],
true)}else{a=-1;for(var c=0,b=data.length;c<b;c++)if(data[c]==d){a=c;break}if(a>-1){data.splice(a,1);Cookie.set("stockdata",data);Cookie.set("nostock",1);getCustomData(data,true)}}},default_Fund=["f_000001"],loadMyfund=function(){},addMyfund=function(){};loadMystock();
