var docsIdCache=new Array();var memIdCache=new Array();var docsTypeCache=new Array();var imageUrl="";var curDocsIndex=new Array();var docsRowIndex=0;var docsColumnIndex=0;var docsCursorIndex=0;var docsTotalTitle=0;var startDocsIndex=0;var docsOpenStatus=false;function resetDocsParams(){docsIdCache=new Array();memIdCache=new Array();docsTypeCache=new Array();imageUrl="";curDocsIndex=new Array();docsRowIndex=0;docsColumnIndex=0;docsCursorIndex=0;docsTotalTitle=0;startDocsIndex=0;docsOpenStatus=false}function launchDocsPanel(A){resetDocsParams();docsActive=true;getDocsInfo(A)}function updateDocStocPanel(){var A="";var F;var B=0;var A='<tr><td colspan="7" width="400px" height="10px">&nbsp;</td></tr><tr><td width="15px" height="80px">&nbsp;</td>';for(var D=0;D<3;D++){curDocsIndex[D]=new Array(3);for(var C=0;C<3;C++){curDocsIndex[D][C]=0}}for(F=0;(docsIdCache.length>=9&&F<9)||(docsIdCache.length<9&&F<docsIdCache.length);++F){var I=parseInt(F/3);var G=parseInt(F%3);if(F%3==0&&F!=0){A+='</tr><tr><td colspan="7" width="400px" height="10px">&nbsp;</td></tr><tr><td width="5px" height="80px">&nbsp;</td>'}var H=3*I+G;H=docsIdCache[H];curDocsIndex[I][G]=1;A+='<td align="center" valign="middle" nowrap style="width:100px;height:75px;'+(statusInfo==1?"cursor:pointer;":"")+'" '+(statusInfo==1?" onmouseover='' onclick='openDocContent("+F+");' ":"")+' ><img id="docsTitleId'+I+""+G+'" style="width:100px;height:75px;border:1px solid gray;background:black;" src="'+imageUrl+""+docsIdCache[F]+'.png" /></td><td width="5px" height="80px" >&nbsp;</td>';B++}if(B>0){for(var E=0;E<(9-B);++E){if((B+E)%3==0){A+='</tr><tr><td colspan="7" width="400px" height="10px">&nbsp;</td></tr><tr><td width="5px" height="80px">&nbsp;</td>'}A+='<td align="center" valign="middle" nowrap style="width:100px;height:80px;">&nbsp;</td><td width="5px" height="80px" >&nbsp;</td>'}}A+='</tr><tr><td colspan="7" width="400px" height="10px">&nbsp;</td></tr>';document.getElementById("docsPanel").innerHTML='<table width="100%" align="left" valign="top" cellspacing="0" cellpadding="0" >'+(A?A:'<tr><td height="28" width="100%" align="center" valign="middle"><span style="width:100%;text-align:center;vertical-align:middle;background-repeat:no-repeat;">No options avaliable</span></td></tr>')+"</table>";selDocsTitle(docsRowIndex,docsColumnIndex)}function scrollDocsPanel(B,F){var A="";var H;var C=0;var A='<tr><td colspan="7" width="400px" height="10px">&nbsp;</td></tr><tr><td width="15px" height="80px">&nbsp;</td>';for(var E=0;E<3;E++){curDocsIndex[E]=new Array(3);for(var D=0;D<3;D++){curDocsIndex[E][D]=0}}for(H=B;H<=F;++H){var K=parseInt(H/3);var J=parseInt(H%3);if(H%3==0&&H!=0&&C!=0){A+='</tr><tr><td colspan="7" width="400px" height="10px">&nbsp;</td></tr><tr><td width="5px" height="80px">&nbsp;</td>'}var I=3*K+J;I=docsIdCache[I];curDocsIndex[parseInt(C/3)][parseInt(C%3)]=1;A+='<td align="center" valign="middle" nowrap style="width:100px;height:75px;'+(statusInfo==1?"cursor:pointer;":"")+'" '+(statusInfo==1?" onmouseover='' onclick='openDocContent("+H+");' ":"")+' ><img id="docsTitleId'+K+""+J+'" style="width:100px;height:75px;border:1px solid gray;background:black;" src="'+imageUrl+""+docsIdCache[H]+'.png" /></td><td width="5px" height="80px" >&nbsp;</td>';C++}if(C>0){for(var G=0;G<(9-C);++G){if((C+G)%3==0){A+='</tr><tr><td colspan="7" width="400px" height="10px">&nbsp;</td></tr><tr><td width="5px" height="80px">&nbsp;</td>'}A+='<td align="center" valign="middle" nowrap style="width:100px;height:80px;">&nbsp;</td><td width="5px" height="80px" >&nbsp;</td>'}}A+='</tr><tr><td colspan="7" width="400px" height="10px">&nbsp;</td></tr>';document.getElementById("docsPanel").innerHTML='<table width="100%" align="left" valign="top" cellspacing="0" cellpadding="0" >'+(A?A:'<tr><td height="28" width="100%" align="center" valign="middle"><span style="width:100%;text-align:center;vertical-align:middle;background-repeat:no-repeat;">No options avaliable</span></td></tr>')+"</table>";selDocsTitle(docsRowIndex,docsColumnIndex)}function openDocContent(A){document.getElementById("waitPanel").style.backgroundImage="none";document.getElementById("layer62").style.display="none";docsOpenStatus=true;var B="doc_id="+docsIdCache[A]+"&amp;mem_id="+memIdCache[A]+"&amp;doc_type="+docsTypeCache[A];document.getElementById("openChartId").innerHTML='<embed height="422" width="624" type="application/x-shockwave-flash" flashvars="'+B+'&amp;embed=0&amp;revision=73827213&amp;showrelated=0&amp;showotherdocs=0&amp;loaderURL=http://stg.docstoc.com&amp;fullscreenBroswer=0&amp;fullScreenBrowser=0&amp;didURL=http://docs.docstoc.com/did/" salign="" allowscriptaccess="always" allowfullscreen="true" bgcolor="#ffffff" name="flashContainer" wmode="opaque" pluginspage="http://www.macromedia.com/go/getflashplayer" src="http://swf.docstoc.com/swf/DSViewer.1.0.30.swf" name="flashContainer" id="flashContainer" style="height: 422px; width: 624px;"/>';document.getElementById("flashContainer").focus();document.getElementById("homePanelImage").style.visibility="visible"}function getDocsInfo(A){var B="method=getDocsInfo&serial="+serial+"&widgetId="+A;createAjaxRequest();if(ajaxRequest==null){return }ajaxRequest.onreadystatechange=function(){if(ajaxRequest.readyState==4){if(ajaxRequest.status==200){if(ajaxRequest.responseText=="recall"){getDocsInfo(A)}else{var C=ajaxRequest.responseText;if(C.length>0){data=C.split("-?#-");docsIdCache=data[0].split("-@#-");memIdCache=data[1].split("-@#-");docsTypeCache=data[2].split("-@#-");imageUrl=data[3];docsTotalTitle=docsIdCache.length-1;updateDocStocPanel();showDocsPanel()}}}else{if(ajaxRequest.status==500){failureInfo()}}}};ajaxRequest.open("POST","/TvHandler",true);ajaxRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");ajaxRequest.send(B);return false}function docsKeyHandler(F){switch(F){case rcLEFT:if(docsColumnIndex==0){return }if(docsColumnIndex>=0){unSelDocsTitle(docsRowIndex,docsColumnIndex);--docsColumnIndex;selDocsTitle(docsRowIndex,docsColumnIndex);return }break;case rcRIGHT:var D=docsRowIndex*3+docsColumnIndex;if(D==docsTotalTitle||docsColumnIndex==2){return }if(docsColumnIndex>=0){unSelDocsTitle(docsRowIndex,docsColumnIndex);++docsColumnIndex;selDocsTitle(docsRowIndex,docsColumnIndex);return }break;case rcMENU:if(docsOpenStatus){docsOpenStatus=false;hideStatusPanel();showDocsPanel();document.getElementById("statusMessagePanel").innerHTML="";document.getElementById("layer62").style.display="block";if(document.getElementById("keyDigitPanel")!=null){document.getElementById("keyDigitPanel").style.visibility="hidden"}document.getElementById("waitPanel").style.backgroundImage="url('./view/tv/images/banner.png')";if(stbTypeId==7){document.getElementById("homePanelImage").style.visibility="hidden"}}else{resetDocsParams();feedType="igmp";document.getElementById("openChartId").innerHTML="";startStream();docsOpenStatus=false;docsActive=false;showGoPanel();showGuidePanel()}break;case rcUP:if(docsRowIndex==0){return }unSelDocsTitle(docsRowIndex,docsColumnIndex);docsRowIndex--;if(docsCursorIndex!=0){docsCursorIndex--;selDocsTitle(docsRowIndex,docsColumnIndex)}else{docsCursorIndex=0;var H=0;H=(startDocsIndex<3?0:startDocsIndex-3);startDocsIndex=H;var B=((docsTotalTitle-H)>8?(H+8):docsTotalTitle);scrollDocsPanel(H,B)}break;case rcDOWN:var G=docsCursorIndex+1;var E=docsColumnIndex;if(G<3){if(curDocsIndex[G][E]==0){return }}var C=(docsTotalTitle/3);if(docsRowIndex==parseInt(C)){return }unSelDocsTitle(docsRowIndex,docsColumnIndex);docsRowIndex++;if(docsCursorIndex<2){docsCursorIndex++;selDocsTitle(docsRowIndex,docsColumnIndex)}else{var H=0;if(docsRowIndex<3){H=docsRowIndex;startDocsIndex=H}else{H=startDocsIndex+3;startDocsIndex=H}docsCursorIndex=2;var B=((docsTotalTitle-H)>8?(H+8):docsTotalTitle);scrollDocsPanel(H,B)}break;case rcOK:var A=docsRowIndex*3+docsColumnIndex;openDocContent(A);break}}function selDocsTitle(F,B){var C="docsTitleId"+F+""+B;var D=3*F+B;updateDescPanel(D);try{document.getElementById(C).style.border="1px solid orange"}catch(A){try{docsRowIndex-=1;docsCursorIndex-=1;selDocsTitle(docsRowIndex,docsColumnIndex)}catch(E){}}}function unSelDocsTitle(C,A){var B="docsTitleId"+C+""+A;if(document.getElementById(B)!=null){document.getElementById(B).style.border="1px solid gray"}}function updateDescPanel(B){return ;try{var C=B+" item is doc_id="+docsIdCache[B]+"&amp;mem_id="+memIdCache[B]+"&amp;doc_type="+docsTypeCache[B];document.getElementById("descPanel").innerHTML=C}catch(A){}}function showDocsArraow(A){document.getElementById("moveDocs"+A).style.background="#fcf3b8"}function hideDocsArrow(A){document.getElementById("moveDocs"+A).style.background="none"}function moveDocsPage(A){if(A==1){docsKeyHandler(rcUP)}else{docsKeyHandler(rcDOWN)}}function showHomeDocsPanel(B){var A="";A=(B==1?"#fcf3b8":"none");document.getElementById("docsHome").style.background=A}function escapeDocsPanel(){docsKeyHandler(rcMENU)}