function setSwfPX(A,B){$data("swfwidth",A);$data("swfheight",B)}function index(){$loadChartXml("/lib/app_setting/big.volume.asp?");$data("split","index");$data("n",1);setSwfPX(750,195);initTimeData(indexShowed,0);$data("photo",setInterval(function(){initTimeData(indexShowed)},15000))}function indexShowed(){indexShow($data("n"));pie()}function indexShow(A){$("#swfphoto li").hide();$data("n",A);switch(A){case 4:MostPhoto();break;case 3:FundVolumeOf();break;case 2:VolumePhoto();break;default:LinePhoto();break}}function tv(){var B=$sort();var A=(B=="SZ")?"\u6df1\u5733 ":(B=="SH"?"\u4e0a\u6d77 ":bkname());setSwfPX(700,150);$(".code").prepend(A);switch($.query.get("type")){case"storage":storShow();break;case"day":DDEDayLine();break;default:showSwf("fundtime");break}$(".statusbox").draggable($(".statusbox"))}var bkname=function(){switch($code().substring(0,3)){case"991":return"\u884c\u4e1a\u677f\u5757 ";break;case"993":return"\u6982\u5ff5\u677f\u5757 ";break;default:return"\u677f\u5757 ";break}};var $nodata=function(A){return($data(A)==undefined)};var $data=function(B,A){return(A==undefined)?$("div").data(B):$("div").data(B,A)};var $sort=function(){return $(".code").attr("value").substring(0,2).toUpperCase()};var $code=function(){var A=$(".code").attr("value");return(!A)?"":A.substring(2)};var $thisdate=function(){return $("#thisdate").html()};var isBig=function(){return($code()=="000001")};var isStock=function(){var code = $code();return (code.substring(0,1) == '6' || ($sort()=='SZ' && code!='399001'));};var isBlock=function(){return($code().substring(0,1)=="9")};var $loadChartXml=function(A){if($nodata("chartline_xml")){ajaxQuery("get",(A==undefined)?"/lib/app_setting/stock.prices.txt?":A,"",function(B){$data("chartline_xml",B.replace(/\n+/gi,""))})}};var $clearGetPhoto=function(){if(!$nodata("photo")){clearInterval($data("photo"))}};var $frame=function(A){return $("#photoframe").contents().find(A)};var storBind=function(){$(".tv_total_area a").click(function(){var A=$(this).attr("val");ShowFlashDiaLog(param,A)})};var showNews=function(){document.getElementById("bestgo_news").innerHTML=$data("news")};var onSelDate=function(){$("#seldate").empty();if(arrDate!=undefined){var D=$("<select />").change(changeStor);var B=-1,A=arrDate.length,E=1;for(var C=0;C<A;C++){if($data("date")==arrDate[C]){B=C-1;E=C+1}$("<option />").attr("value",arrDate[C]).text(arrDate[C]).appendTo(D)}if(B>=0&&B<=A){$("#seldate").html($("<span>&nbsp;&nbsp;>></span>").attr({value:arrDate[B],title:"\u540e\u4e00\u5929("+arrDate[B]+")"}).click(changeStor))}$("#seldate").prepend(D);if(E<A&&E>=0){$("#seldate").prepend($("<span><<&nbsp;&nbsp;</span>").attr({value:arrDate[E],title:"\u524d\u4e00\u5929("+arrDate[E]+")"}).click(changeStor))}}};var showCon=function(){($(".usage dd").css("display")=="block")?$(".usage dd").hide("slow"):$(".usage dd").show("quick")};function changeStor(){$data("date",this.value);$("#seldate select").attr("disabled",true);getStor()}function getStor(){showbox("\u6b63\u5728\u52a0\u8f7d\u4e3b\u529b\u96f7\u8fbe\u6570\u636e...\u8bf7\u7a0d\u540e");$.ajax({type:"get",url:"/xview_storagedata.asp?"+param+"&begindate="+$("div").data("date"),timeout:20000,error:function(){$("#seldate").prepend("\u8f7d\u5165\u5931\u8d25!")},success:function(A){hidebox(1000);$("#stor").show().html(A);onSelDate();$("#seldate select").attr("value",$("div").data("date"));showNews();storBind()}})}function storShow(){if($("#stor").css("display")=="block"){return}$clearGetPhoto();$(".swfarea").hide();$(".usage").hide();onSelDate();$("#stor").show();load_news();$("#photoframe").attr("src","/lib/topview_photo.asp?"+param).show().load(function(){$("#photoframe").height($frame("#content").height())});$("#pan").hide();storBind()}function load_news(){if(!$nodata("news")){showNews();return}$.ajax({type:"POST",url:"/tv_news.asp",timeout:20000,error:function(){$("#bestgo_news").html("\u4e2a\u80a1\u8d44\u8baf\u2014\u8f7d\u5165\u5931\u8d25")},data:"stockname="+escape($(".stockname").text()),success:function(A){$data("news",A);showNews()}})}function showSwf(A){$("#seldate").text("");$loadChartXml();$("#photoframe").hide();$(".swfarea").show();$clearGetPhoto();$("#pan").show();$("#stor").hide();$(".usage").show();switch(A){case"ddetime":initTimeData(ddeShowAll,0);$data("photo",setInterval(function(){initTimeData(ddeShowAll)},60000));break;default:initTimeData(fundShowAll,0);$data("photo",setInterval(function(){initTimeData(fundShowAll)},15000));break}}function FundDayLine(){return false}function DDEDayLine(){$clearGetPhoto();$(".swfarea").hide();$("#stor").hide();$("#pan").hide();$(".usage").show();$("#photoframe").attr("src","/lib/dde_dayline_photo.asp?"+param).show().load(function(){$("#photoframe").height($frame("#content").height())})}function initTimeData(B,A){if(!$nodata("lined")&&!chkOpen()){if(A==0){B()}return false}$.ajax({type:"get",url:"/lib/photo_newdata.asp?"+timeParam+"&time="+$data("lasttime1")+"&"+Math.round(Math.random()*10000),timeout:20000,error:function(){showbox("\u5b9e\u65f6DDE\u6570\u636e\u8bfb\u53d6\u5931\u8d25...\u8bf7\u7a0d\u540e<br />5\u79d2\u540e\u81ea\u52a8\u5173\u95ed\u6b64\u6d88\u606f\u6846!");setTimeout(hidebox,5000,10)},success:function(C){clearDatad();$data("timedata",C);($data("split")=="index")?indexSplit():splitData();B()}})}function indexSplit(){var I,G;var K=[],E=[],H=[],B=[];var F=1000000;if(!$nodata("timedata")){G=$data("timedata").match(/(\d+\:\d+\:\d+;)(.*?)\r/g);if(G!=null){for(var D=0,C=G.length;D<C;D++){I=G[D].split(";");for(var J=I.length-5;J>0;J--){I[J]=parseFloat(I[J])}time=I[0].replace(/(\d+\:\d+)\:\d+/g,"$1;");K.push(time+I[1]+"\n");E.push(time+I[17]+";"+I[18]+"\n");H.push(time+mostEx(I.slice(9,15),I[19]/F));B.push(time+formatNumber(getV(I[21]*I[17],I[22]*I[18])*100,"0.00")+"\n")}$data("lasttime",I[0]);$data("pied",I[5]+";"+I.slice(9).join(";"));$(".swftitle span:eq(1)").text(I[1]);$(".swftitle span:eq(2)").text(I[2]);$(".swftitle span:eq(3)").text(I[3]);$(".swftitle span:eq(4)").text(formatNumber(getV(I[5],I[20]),"0.00"));$(".swftitle span:eq(5)").text(I[19])}$nodata("lasttime")?$data("lasttime","9:30:00"):$data("lasttime");var A=$getDate()+$data("lasttime");$(".swftitle span:eq(0)").text(A);strAxes=fillTime($data("lasttime"));var J;($data("lasttime")=="9:30:00")?J="0":J=";";$data("lasttime1",A);$data("axes1",strAxes.replace(/\$1/g,J));$data("axes2",strAxes.replace(/\$1/g,J+";"));$data("axes3",strAxes.replace(/\$1/g,J+";;;;"));$appendData("lined",K.join(""));$appendData("volumed",E.join(""));$appendData("mostd",H.join(""));$appendData("fundofd",B.join(""));$("div").removeData("timedata")}}function splitData(){var K,H;var Q=[],F=[],N=[],L=[],I=[],J=[],B=[],M=[],C=[];var G=isStock()?100:1000000;if(!$nodata("timedata")){H=$data("timedata").match(/(\d+\:\d+\:\d+;)(.*?)\r/g);var O=isBig();if(H!=null){for(var E=0,D=H.length;E<D;E++){K=H[E].split(";");for(var P=K.length-5;P>0;P--){K[P]=parseFloat(K[P])}time=K[0].replace(/(\d+\:\d+)\:\d+/g,"$1;");Q.push(time+K[1]+"\n");F.push(time+K[17]+";"+K[18]+"\n");N.push(time+K[6]+"\n");L.push(time+K[7]+"\n");I.push(time+K[8]+"\n");J.push(time+mostEx(K.slice(9,15),K[19]/G));B.push(time+mostEx(K.slice(9,15),1));M.push(time+formatNumber(getV(K[16],K[15]),"0.00")+"\n");if(O){C.push(time+formatNumber(getV(K[21]*K[17],K[22]*K[18])*100,"0.00")+"\n")}}$data("lasttime",K[0]);$data("pied",K[5]+";"+K.slice(9).join(";"));$(".swftitle span:eq(1)").text(K[1]);$(".swftitle span:eq(2)").text(K[2]);$(".swftitle span:eq(3)").text(K[3]);$(".swftitle span:eq(4)").text(formatNumber(getV(K[5],K[20]),"0.00"));$(".swftitle span:eq(5)").text(K[19])}$nodata("lasttime")?$data("lasttime","9:30:00"):$data("lasttime");var A=$getDate()+$data("lasttime");$(".swftitle span:eq(0)").text(A);strAxes=fillTime($data("lasttime"));var P=($data("lasttime")=="9:30:00")?"0":";";$data("lasttime1",A);$data("axes1",strAxes.replace(/\$1/g,P));$data("axes2",strAxes.replace(/\$1/g,P+";"));$data("axes3",strAxes.replace(/\$1/g,P+";;;;"));$appendData("lined",Q.join(""));$appendData("volumed",F.join(""));$appendData("ddxd",N.join(""));$appendData("ddyd",L.join(""));$appendData("ddzd",I.join(""));$appendData("mostd",J.join(""));$appendData("most1d",B.join(""));$appendData("singularofd",M.join(""));if(isBig()){$appendData("fundofd",C.join(""))}$("div").removeData("timedata")}}var clearDatad=function(){if($noline()&&!$nodata("lined")&&!chkOpen()){$("div").removeData("lined");$("div").removeData("volumed");$("div").removeData("ddxd");$("div").removeData("ddyd");$("div").removeData("ddzd");$("div").removeData("mostd");$("div").removeData("singularofd");$("div").removeData("most1d");$("div").removeData("fundofd")}};var $noline=function(){return(!$nodata("axes1"))?$data("axes1").length==0:false};var $getDate=function(){return $data("ddetime").split(" ")[0]+" "};var $appendData=function(A,B){return $nodata(A)?$data(A,B):$data(A,$data(A)+B)};var $getAllData=function(A,B){return($("div").data(A)==undefined)?"":$("div").data(A)+$data("axes"+B)};var mostEx=function(C,A){var B=formatNumber((parseFloat(formatNumber((C[0]-C[1]),"0.00"))+parseFloat(formatNumber((C[2]-C[3]),"0.00")))*A,"0.00");B+=";"+formatNumber((C[0]-C[1])*A,"0.00");B+=";"+formatNumber((C[2]-C[3])*A,"0.00");B+=";"+formatNumber((C[1]+C[3]+C[5]-C[0]-C[2]-C[4])*A,"0.00");B+=";"+formatNumber((C[4]-C[5])*A,"0.00")+"\n";return B};function ddeShowAll(){LinePhoto();setTimeout(MostPhoto1,30);setTimeout(DDXphoto,10);setTimeout(DDEphoto,20);setTimeout(VolumePhoto,30);setTimeout(singularPhoto,20);setTimeout(pie,80)}function fundShowAll(){otherHide();LinePhoto();setTimeout("MostPhoto()",30);if(isBig()){setTimeout(function(){FundVolumeOf();VolumePhoto()},20)}setTimeout(DDXphoto,20);setTimeout(pie,50)}function otherHide(){$("#ddzphoto").hide();$("#ddxphoto").hide();$("#singularphoto").hide();if(!isBig()){$("#tedaphoto").hide();$("#volumephoto").hide()}}var LinePhoto=function(){echoPhoto("\u5206\u65f6\u8d70\u52bf","line",$getAllData("lined",1))};var DDXphoto=function(){echoPhoto("\u5927\u5355\u52a8\u5411(\u5206\u65f6DDX)","ddx",$getAllData("ddxd",1));echoPhoto("\u6da8\u8dcc\u52a8\u56e0(\u5206\u65f6DDY)","ddy",$getAllData("ddyd",1))};var DDEphoto=function(){echoPhoto("\u5927\u5355\u5dee\u5206(\u5206\u65f6DDZ)","ddz",$getAllData("ddzd",1))};var FundVolumeOf=function(){echoPhoto("\u8d44\u91d1\u80fd\u91cf\u6bd4(%)","fundof",$getAllData("fundofd",1))};var VolumePhoto=function(){if(!isBlock()){echoPhoto("\u591a\u7a7a\u529b\u9053(\u624b)","volume",$getAllData("volumed",2))}};var singularPhoto=function(){echoPhoto("\u5355\u6570\u6bd4","singular",$getAllData("singularofd",1))};var MostPhoto=function(){$("#tedaphoto").empty().hide();echoPhoto("\u8d44\u91d1\u6d41\u5411BBD\u6307\u6807("+getUnit()+")","tedas",$getAllData("mostd",3))};var getUnit=function(){return isStock()?"\u4e07\u5143":"\u4ebf\u5143"};var MostPhoto1=function(){$("#tedasphoto").empty().hide();echoPhoto("\u5927\u5c0f\u5355\u5deeBBD\u6307\u6807(\u6bd4\u4f8b)","teda",$getAllData("most1d",3))};var getSettingFile=function(C,A){if(C=="\u5927\u5c0f\u5355\u5deeBBD\u6307\u6807(\u6bd4\u4f8b)"){A="teda1"}var B=A+"_xml";if($nodata(B)){$data(B,filterXml(C,A))}return $data(B)};var filterXml=function(B,A){switch(A){case"teda","tedas":return $data("chartline_xml").replace(/(\$name)/gi,B).replace(/(\$2name)/gi,"\u7279\u5927").replace(/(\$3name)/gi,"\u5927\u5355").replace(/(\$4name)/gi,"\u4e2d\u5355").replace(/(\$1name)/gi,"\u7279\u5927+\u5927").replace(/(\$textc)/gi,"ffffff").replace(/(\$linec)/gi,"FF0000").replace(/(\$bottom)/gi,"30").replace(/(\$5name)/gi,"\u5c0f\u5355").replace(/<hidden>false<\/hidden>/gi,"<hidden>true</hidden>");break;case"teda1":return $data("chartline_xml").replace(/(\$name)/gi,B).replace(/(\$2name)/gi,"\u7279\u5927").replace(/(\$3name)/gi,"\u5927\u5355").replace(/(\$4name)/gi,"\u4e2d\u5355").replace(/(\$1name)/gi,"\u7279\u5927+\u5927").replace(/(\$textc)/gi,"ffffff").replace(/(\$linec)/gi,"FF0000").replace(/(\$bottom)/gi,"30").replace(/(\$5name)/gi,"\u5c0f\u5355").replace(/<hidden>false<\/hidden>/gi,"<hidden>true</hidden>");break;case"ddx":return $data("chartline_xml").replace(/(\$1?name)/gi,B).replace(/(\$textc)/gi,"CC0000").replace(/(\$linec)/gi,"eeff00").replace(/(\$bottom)/gi,"5");break;case"ddy":return $data("chartline_xml").replace(/(\$1?name)/gi,B).replace(/(\$textc)/gi,"CC0000").replace(/(\$linec)/gi,"ff00ff").replace(/(\$bottom)/gi,"5");break;case"ddz":return $data("chartline_xml").replace(/(\$1?name)/gi,B).replace(/(\$textc)/gi,"CC0000").replace(/(\$linec)/gi,"63ffff").replace(/(\$bottom)/gi,"5");break;case"fundof":return $data("chartline_xml").replace(/<graph\s+gid="1">/gi,'<graph gid="1"><fill_alpha>45</fill_alpha>').replace(/(\$1?name)/gi,B).replace(/(\$textc)/gi,"FFFFFF").replace(/(\$linec)/gi,"FF0000").replace(/(\$bottom)/gi,"5");break;case"volume":return $data("chartline_xml").replace(/<width>50<\/width>/gi,"<width>100</width>").replace(/(\$2name)/gi,"\u603b\u5356\u91cf").replace(/(\$1name)/gi,"\u603b\u4e70\u91cf").replace(/(\$name)/gi,B).replace(/(\$textc)/gi,"FFFFFF").replace(/(\$linec)/gi,"FF0000").replace(/(\$bottom)/gi,"30");break;case"line":return $data("chartline_xml").replace(/<width>50<\/width>/gi,"<width>100</width>").replace(/(\$1?name)/gi,B).replace(/(\$textc)/gi,"FFFFFF").replace(/(\$linec)/gi,"FF0000").replace(/(\$bottom)/gi,"35");break;default:return $data("chartline_xml").replace(/\$1?name/gi,B).replace(/\$textc/g,"FFFFFF").replace(/\$linec/g,"FF0000").replace(/\$bottom/g,"30");break}};echoPhoto=function(D,E,B){$("#"+E+"photo").show();var A=flashMovie(E+"swf");if(A){A.setData(B);return}var C=new ColoObject("/swf/swfline.swf",E+"swf",$data("swfwidth"),$data("swfheight"),"8","#000000");C.addVariable("path","/swf/");C.addVariable("chart_id",E+"swf");C.addVariable("chart_settings",encodeURIComponent(getSettingFile(D,E)));C.addVariable("chart_data",encodeURIComponent(B));C.addVariable("loading_data","\u6b63\u5728\u8f7d\u5165("+$code()+")"+D+"...");C.addVariable("preloader_color","#F7F7F7");C.addParam("wmode","transparent");C.write(E+"photo")};function piePhoto(B){var A=flashMovie("coloppie");if(A){A.setData(B);return}var C=new ColoObject("/swf/colopie.swf","coloppie","180","140","8","#000000");C.addVariable("path","/swf/");C.addVariable("chart_id","coloppie");C.addVariable("chart_settings",encodeURIComponent("<settings><data_type>csv</data_type><pie><color></color><radius>60</radius><inner_radius>0</inner_radius><height>0</height><angle></angle></pie><animation><start_time></start_time><start_effect></start_effect><pull_out_time>1.5</pull_out_time></animation><data_labels><radius>100</radius><text_color>#FFFFFF</text_color><show><![CDATA[]]></show></data_labels><legend><enabled>false</enabled></legend><labels><label><x>5</x><y>15</y><align>center</align><text_size>15</text_size><text><![CDATA[<b></b>]]></text></label></labels></settings>"));C.addVariable("chart_data",encodeURIComponent(B));C.addParam("wmode","transparent");C.write("pieswf")}function pie(){if($nodata("pied")){return}var F=$data("pied").split(";");for(var D=0;D<F.length-3;D++){F[D]=(D<7&&D>0)?formatNumber(parseFloat(F[D])/100,"0.000"):formatNumber(parseFloat(F[D]),"0.000")}var G=1-F[1]-F[3]-F[5];var A=1-F[2]-F[4]-F[6];if(!($data("split")=="index")){if(!isStock()){F[11]=F[11]/10000}$(".fund .red").hide();for(var D=0;D<5;D++){switch(D){case 0:var C=(F[1]-F[2])+(F[3]-F[4]);break;case 3:var C=G-A;break;case 4:var C=F[5]-F[6];break;default:var C=F[D*2-1]-F[D*2];break}var E=getColor(C);setFundof(D,E,C*F[11],C)}}for(var D=0;D<4;D++){var B=(D==3)?5:D*2+1;if(D==2){setPanof(D,G*F[0],G);setPanof(D+4,A*F[0],A)}else{setPanof(D,F[B]*F[0],F[B]);setPanof(D+4,F[B+1]*F[0],F[B+1])}}for(var D=0;D<2;D++){setPanNum(D*2,formatNumber(F[7+D],"0"));setPanNum(D*2+1,formatNumber(F[0]/F[7+D],"0.0"))}var H="\u7279\u5927\u4e70\u5165;"+F[1]*100+";false;FF5552\n\u5927\u5355\u4e70\u5165;"+F[3]*100+";false;bd3c39\n\u4e2d\u5355\u4e70\u5165;"+G*100+";false;7b2829;\n\u5c0f\u5355\u4e70\u5165;"+F[5]*100+";false;391410;\n\u7279\u5927\u5356\u51fa;"+F[2]*100+";false;52ffff\n\u5927\u5355\u5356\u51fa;"+F[4]*100+";false;39bebd\n\u4e2d\u5355\u5356\u51fa;"+A*100+";false;297d7b;\n\u5c0f\u5355\u5356\u51fa;"+F[6]*100+";false;103c39;\n";piePhoto(H)}var setPanNum=function(A,B){$("#rpan strong:eq("+A+")").text(B)};var setPanof=function(A,C,B){$("#rpan span:eq("+A+")").html(formatNumber(C,"0")+" "+formatNumber(B*100,"0.0")+"%")};var setFundof=function(B,A,D,C){$(".fundof .h td:eq("+B+")").css("color",A).text(formatNumber(D,"0.0")).prepend($("<div />").css({background:A,height:Math.abs(C*500)})).prepend(formatNumber(C*100,"0.0")+"%")};var fillTime=function(G){var E=new Date();E=E.format("yyyy/MM/dd");var J=new Date(E+" "+G);var D=new Date(E+" 15:00:00");var H=new Date(E+" 11:30:00");var I=new Date(E+" 13:00:00");var A=J.dateDiff("n",D);var F=[];if(A<=0){return""}for(var C=1;C<=A;C++){var B=DateAdd("n",1,J);if(B.dateDiff("n",H)>=0||I.dateDiff("n",B)>=0){F.push(B.format("h:m")+";$1\n")}}return F.join("")};function amChartInited(A){}function amReturnData(A,B){}function getV(B,A){return(A==0)?0:B/A}function getColor(A){return(A<0)?"green":"red"}var s=1;function ShowFlashDiaLog(B,A){swfphoto1("flashcontent",A);if(s==1){s=0;$("#storageflash").dialog({title:$(".code").attr("value")+" \u6301\u4ed330\u5929\u8d8b\u52bf\u56fe",width:778,height:248})}else{$("#storageflash").dialog("open")}$("#storageflash").css("display","block")}function swfphoto1(C,A){var B=new ColoObject("/swf/swfline.swf","ssscwcw","750","165","8","#000000");B.addVariable("path","/swf/");B.addVariable("settings_file",encodeURIComponent("/lib/app_setting/tv_storline_type.asp?stype="+encodeURIComponent(A)));B.addVariable("data_file",encodeURIComponent("/lib/photo_data.asp?action=storageline&stockcode="+$(".code").attr("value")+"&stype="+A));B.addVariable("loading_data","\u6b63\u5728\u8f7d\u5165("+A+")\u6301\u4ed3\u7ebf...");B.addVariable("preloader_color","#F7F7F7");B.write(C)}function showbox(B,A){if(A!=undefined){hidebox(500);return}$(".statusbox").css({top:"300px",left:"500px"}).show(function(){$(".statusbox dd").html(B)})}function hidebox(A){setTimeout(function(){$(".statusbox").hide()},A)};

