var stockCurIndex=0;var stockPrevIndex=0;var stockPage=0;var stockChartStatus=false;var onChartPanel=false;var stockSymbol="";function launchStockPanel(){resetStockContent();resetStockIndex();highLightStockKey()}function resetStockIndex(){stockCurIndex=0;stockPrevIndex=0;stockPage=0}function highLightStockKey(){if(document.getElementById("stockFindBtn")!=null){document.getElementById("stockFindBtn").src="/view/tv/images/wrarrow.png"}var A="stockKey"+stockPrevIndex;if(document.getElementById(A)!=null){document.getElementById(A).style.backgroundImage="none"}var B="stockKey"+stockCurIndex;if(document.getElementById(B)!=null){if(stockCurIndex==40){document.getElementById(B).style.backgroundImage='url("/view/tv/images/delKeySel.png")'}else{document.getElementById(B).style.backgroundImage='url("/view/tv/images/keyboardSelector.png")'}document.getElementById(B).style.backgroundPosition="center center";document.getElementById(B).style.backgroundRepeat="no-repeat"}}function escapestockPanel(){stockKeyHandler(rcMENU)}function stockHome(B){var A="";A=(B==1?"#fcf3b8":"none");document.getElementById("stockHomePanel").style.background=A}function disableStockInfo(){}function getKeyValue(C){var A=String.fromCharCode(C);if(C==32){document.getElementById("stockContent").innerHTML+=" ";return }if(C>=48&&C<=57){document.getElementById("stockContent").innerHTML+=A.toLowerCase();return }if(C==46){var B=document.getElementById("stockContent").innerHTML;if(B.length>0){B=B.substring(0,(B.length-1));document.getElementById("stockContent").innerHTML=B}return }if(C>=97&&C<=122){var B=document.getElementById("stockContent").innerHTML;if(B.length>25){return }document.getElementById("stockContent").innerHTML+=A.toLowerCase();return }if(C>=65&&C<=90){var B=document.getElementById("stockContent").innerHTML;if(B.length>25){return }document.getElementById("stockContent").innerHTML+=A.toLowerCase();return }}function stockKeyHandler(D){switch(D){case rcDOWN:if(stockPage==0){if(stockCurIndex<36){stockPrevIndex=stockCurIndex;if(stockCurIndex==35){stockCurIndex+=5}else{stockCurIndex+=6}}else{stockPrevIndex=stockCurIndex;stockCurIndex=stockCurIndex-36}highLightStockKey()}break;case rcUP:if(stockPage==0){if(stockCurIndex<6){stockPrevIndex=stockCurIndex;if(stockCurIndex==5){stockCurIndex+=35}else{stockCurIndex+=36}}else{stockPrevIndex=stockCurIndex;stockCurIndex=stockCurIndex-6}highLightStockKey()}break;case rcLEFT:if(stockPage==0){var B=stockCurIndex%6;stockPrevIndex=stockCurIndex;if(B==0){if(stockCurIndex==36){stockCurIndex+=4}else{stockCurIndex+=5}}else{--stockCurIndex}highLightStockKey()}else{if(onChartPanel){document.getElementById("stockChart").style.background="";onChartPanel=false;document.getElementById("stockFindBtn").src="/view/tv/images/wrarrowSel.png";stockPage=1}else{stockPage=0;highLightStockKey()}}break;case rcRIGHT:if(stockPage==0){var B=(stockCurIndex+1)%6;if(B==0||stockCurIndex==40){var C="stockKey"+stockCurIndex;if(document.getElementById(C)!=null){document.getElementById(C).style.backgroundImage="none"}resetStockIndex();document.getElementById("stockFindBtn").src="/view/tv/images/wrarrowSel.png";stockPage=1}else{stockPrevIndex=stockCurIndex;++stockCurIndex;highLightStockKey()}}else{if(onChartPanel){onChartPanel=false;document.getElementById("stockChart").style.background="";stockPage=0;resetStockIndex();highLightStockKey()}else{onChartPanel=true;document.getElementById("stockChart").style.background="darkoliveGreen"}}break;case rcOK:var F=document.getElementById("stockContent").innerHTML;if(stockPage==0){var E="stockKey"+stockCurIndex;if(stockCurIndex==40){if(F.length>0){F=F.substring(0,(F.length-1));document.getElementById("stockContent").innerHTML=F}}else{if(F.length>20){return }document.getElementById("stockContent").innerHTML=F+document.getElementById(E).innerHTML}}else{if(onChartPanel){openStockChart(F)}else{if(F.length>0){getStockData(F)}}}break;case rcMENU:if(onChartPanel){onChartPanel=false;if(document.getElementById("homePanelImage")!=null){document.getElementById("homePanelImage").style.visibility="hidden"}document.getElementById("stockChart").style.background="";document.getElementById("openChartId").innerHTML="";stockPage=0;resetStockIndex();highLightStockKey()}else{onChartPanel=false;exitStockPanel();stockActive=false;showGoPanel();showGuidePanel()}break;case rcRED:stockActive=false;keyActionHandler(rcRED);break;case rcREFRESH:stockActive=false;keyActionHandler(rcRED);break;default:var A=document.getElementById("stockContent").innerHTML;A=activeKeyBoard(D,A);if(A.length>20){return }document.getElementById("stockContent").innerHTML=A;break}}function getStockData(B){stockSymbol=B;var C="method=getStockData&rssFeed=http://www.quoterss.com/quote.php?&source="+B+"&serial="+serial;var A={success:function(F){try{var E=YAHOO.lang.JSON.parse(F.responseText);disPlayStockInfo(E);document.getElementById("stockChart").innerHTML="view chart"}catch(D){}},failure:function(D){failureInfo()}};YAHOO.util.Connect.asyncRequest("POST",serverUrl,A,C);return false}function disPlayStockInfo(A){document.getElementById("stockHeaderDetail").innerHTML=A.header;document.getElementById("stockDetail").innerHTML=A.title;document.getElementById("stockPrevHeader").innerHTML=A.last+":";document.getElementById("stockPrevData").innerHTML=A.lastValue;document.getElementById("stockCurHeader").innerHTML=A.change+":";document.getElementById("stockCurData").innerHTML=A.changeValue;document.getElementById("stockContent").innerHTML=""}function resetStockContent(){document.getElementById("stockHeaderDetail").innerHTML="";document.getElementById("stockDetail").innerHTML="";document.getElementById("stockPrevHeader").innerHTML="";document.getElementById("stockPrevData").innerHTML="";document.getElementById("stockCurHeader").innerHTML="";document.getElementById("stockCurData").innerHTML="";document.getElementById("stockContent").innerHTML=""}function selStockKey(A){stockCurIndex=A;highLightStockKey();stockPrevIndex=stockCurIndex;stockPage=0}function printSelKey(A){stockPage=0;stockCurIndex=A;stockKeyHandler(rcOK)}function selStockGo(){var A="stockKey"+stockCurIndex;if(document.getElementById(A)!=null){document.getElementById(A).style.backgroundImage="none"}resetStockIndex();document.getElementById("stockFindBtn").src="/view/tv/images/wrarrowSel.png";stockPage=1}function getStockDetails(){stockPage=1;stockKeyHandler(rcOK)}function unSelStockGo(){highLightStockKey();stockPage=0}function exitStockPanel(){var A="stockKey"+stockCurIndex;if(document.getElementById(A)!=null){document.getElementById(A).style.backgroundImage="none"}document.getElementById("stockFindBtn").src="/view/tv/images/wrarrow.png"}function openStockChart(){var A=DetectFlashVer(10,0,0);if(!A){document.getElementById("statusMessagePanel").innerHTML="get the flash player now on http://www.adobe.com/go/getflashplayer/";return }document.getElementById("openChartId").innerHTML="";var B=stockSymbol;B="GOOG";document.getElementById("openChartId").innerHTML='<embed height="422" width="624" src="http://us.js2.yimg.com/us.js.yimg.com/lib/fi/200909301414/us/swf/yfcv3/flashchart.swf" type="application/x-shockwave-flash" name="test" allowscriptaccess="always" menu="false" bgcolor="#ffffff" loop="false" wmode="opaque" flashvars="lcId=1255000446705&amp;localeUri=http%3A//us.js2.yimg.com/us.js.yimg.com/lib/fi/200909301414/us/locale/yfcv3/dictionary.xml&amp;chartHost=chartapi.finance.yahoo.com&amp;keyeventsHost=finance.yahoo.com&amp;sigdevsHost=ads.finance.yahoo.com&amp;buildType=prod&amp;state=symbol%3D'+B+'%3Brange%3D1d%3Bcharttype%3Dline%3Bcrosshair%3Don%3Bohlcvalues%3D0%3Blogscale%3Doff&amp;source=undefined" pluginspage="http://www.macromedia.com/go/getflashplayer"/>';if(stbTypeId==7||statusInfo==1){document.getElementById("homePanelImage").style.visibility="visible"}}function onChartSelPanel(A){if(A==1){stockPage=1;onChartPanel=true;document.getElementById("stockChart").style.background="darkoliveGreen"}else{onChartPanel=false;document.getElementById("stockChart").style.background=""}}