var selSpiritualTitle=new Array();var spiritualGenreCache=new Array();var spiritualTitleCache=new Array();var spiritualDescCache=new Array();var curSpIndexArr=new Array();var spiritGenreCache=new Array();var spiritGenreTitleCache=new Array();var spiritVideoCache=new Array();var spiritUseGraphicCache=new Array();var spiritualCursorIndex=0;var spiritualPanel=0;var spiritualTitleTotal=0;var spiritTitleMax=2;var startSpiritualIndex=0;var spiritColumnIndex=0;var spiritRowIndex=0;var spiritGenreClick=0;var spiritGenreIndex=0;var spiritGenreCursor=0;var spiritGenreTotal=0;var spiritualPlayStatus=false;var selSpiritIndexArr=new Array();function launchSpiritualPanel(A){resetSpiritGenre();getSpiritualInfo(A)}function getSpiritGenre(){updateSpiritualGenre()}function getSpiritualInfo(A){var B="method=getSpiritualInfo&serial="+serial+"&widgetId="+A;createAjaxRequest();if(ajaxRequest==null){return }ajaxRequest.onreadystatechange=function(){if(ajaxRequest.readyState==4){if(ajaxRequest.status==200){if(ajaxRequest.responseText=="recall"){getSpiritualInfo()}else{var C=ajaxRequest.responseText;document.getElementById("spiritualDescription").innerHTML="";document.getElementById("spiritualGenreList").innerHTML="";document.getElementById("spiritualTitleList").innerHTML="";if(C.length>0){data=C.split("-?#-");spiritGenreCache=data[0].split("-@#-");spiritGenreTitleCache=data[1].split("-@#-");spiritualTitleCache=data[2].split("-@#-");spiritualDescCache=data[3].split("-@#-");spiritUseGraphicCache=data[4].split("-@#-");spiritVideoCache=data[5].split("-@#-");spiritTitleId=data[6].split("-@#-");for(var G=0;G<spiritGenreCache.length;G++){var F=0;var E=new Array();for(var D=0;D<spiritGenreTitleCache.length;D++){if(spiritGenreTitleCache[D]==spiritGenreCache[G]){E[F]=D;++F}}selSpiritIndexArr[G]=E}spiritGenreTotal=(spiritGenreCache.length==0?0:spiritGenreCache.length-1);updateSpiritualGenre()}else{document.getElementById("spiritualGenreList").innerHTML='<table width="190px" align="left" border="0px" style="margin-top:10px;margin-left:5px;" cellspacing="0" cellpadding="0"><tr><td width="190px" height="30px" valign="middle" align="center" nowrap style="background:url(/view/tv/images/rowGenre.png) no-repeat;"  ><span style="margin-left:-25px;" >'+records.key372+"</span></td></tr></table>";document.getElementById("spiritualTitleList").innerHTML="no title available"}showSpiritualPanel()}}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 updateSpiritualGenre(){var A="";for(var B=0;(spiritGenreCache.length>9&&B<9)||(spiritGenreCache.length<=9&&B<spiritGenreCache.length);++B){A+='<tr><td id="spiritGenreId'+B+'" '+(statusInfo==1?'style="cursor:pointer;font-weight:bolder;font-size:12px;" onmouseover="onSpiritualPanel('+B+');"':' style="font-weight:bolder;font-size:12px;" ')+' width="155px" height="30px" valign=center nowrap>&nbsp;&nbsp;&nbsp;'+spiritGenreCache[B]+"</td></tr>"}document.getElementById("spiritualGenreList").innerHTML="<table width="+(A?"165px":"190px")+' align="left" border="0px" style="margin-top:10px;margin-left:5px;" cellspacing="0" cellpadding="0">'+(A?A:"<tr><td width="+(A?"155px":"190px")+' height="30px" valign="middle" align="center" nowrap>'+records.key372+"</td></tr>")+"</table>";selSpiritGenre(spiritGenreIndex);updateSpiritualTitle()}function updateSpiritualTitle(){resetSpiritVars();var A="";var J=returnCurSpiritIndex();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++){curSpIndexArr[D]=new Array(3);for(var C=0;C<3;C++){curSpIndexArr[D][C]=0}}for(F=0;(J.length>=9&&F<9)||(J.length<9&&F<J.length);++F){B++;var I=parseInt(F/3);var H=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="15px" height="80px">&nbsp;</td>'}var G=3*I+H;G=J[G];curSpIndexArr[I][H]=1;A+='<td align="center" valign="middle" nowrap style="width:75px;height:75px;'+(statusInfo==1?"cursor:pointer;":"")+'" '+(statusInfo==1?" onmouseover='selSpTitlePanel("+I+", "+H+");' onclick='spiritualKeyHandler("+rcOK+");' ":"")+' ><img id="spiritualTitleId'+I+""+H+'" style="width:75px;height:75px;border:2px solid transparent;" src='+(spiritUseGraphicCache[G]==1?'"/ImageHandler?value='+spiritTitleId[G]+'&icon=-1&imageType=5"':"./view/tv/images/vod/logo_none.png")+' /></td><td width="15px" height="80px" >&nbsp;</td>'}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="15px" height="80px">&nbsp;</td>'}A+='<td align="center" valign="middle" nowrap style="width:75px;height:80px;">&nbsp;</td><td width="15px" height="80px" >&nbsp;</td>'}}A+='</tr><tr><td colspan="7" width="400px" height="10px">&nbsp;</td></tr>';document.getElementById("spiritualTitleList").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>";selSpiritTitle(0,0)}function assignSpTitleDesc(E,C){try{var D=returnCurSpiritIndex();var B=3*E+C;B=D[B];document.getElementById("spiritualDescription").innerHTML=spiritualDescCache[B]}catch(A){}}function selSpiritGenre(B){try{document.getElementById("spiritGenreId"+B).style.background='url("/view/tv/images/rowGenre.png") no-repeat'}catch(A){}}function unSelSpiritGenre(B){try{document.getElementById("spiritGenreId"+B).style.background="none"}catch(A){}}function resetSpiritGenre(){selSpiritualTitle=new Array();spiritualGenreCache=new Array();spiritualTitleCache=new Array();spiritualDescCache=new Array();curSpIndexArr=new Array();spiritGenreCache=new Array();spiritGenreTitleCache=new Array();spiritVideoCache=new Array();spiritUseGraphicCache=new Array();spiritGenreIndex=0;spiritGenreCursor=0;spiritGenreTotal=0;spiritualPanel=0}function scrollSpiritGenre(D,A){var B="";for(var C=D;C<=A;++C){B+='<tr><td style="cursor:pointer;font-weight:bolder;" id="spiritGenreId'+C+'" onmouseover="onSpiritualPanel('+C+');" width="155px" height="30px" valign="middle" nowrap>&nbsp;&nbsp;&nbsp;'+spiritGenreCache[C]+"</td></tr>"}document.getElementById("spiritualGenreList").innerHTML="<table width="+(B?"165px":"190px")+' align="left" border="0px" style="margin-top:10px;margin-left:5px;" cellspacing="0" cellpadding="0">'+(B?B:"<tr><td width="+(B?"155px":"190px")+' height="28px" valign="middle" align="center" nowrap>'+records.key372+"</td></tr>")+"</table>"}function spiritualKeyHandler(H){switch(H){case rcOK:var G=returnCurSpiritIndex();var E=3*spiritRowIndex+spiritColumnIndex;E=G[E];if(!spiritVideoCache[E]){return }startSpiritStream(spiritRowIndex,spiritColumnIndex,spiritVideoCache[E]);document.getElementById("layer58").style.display="none";break;case rcRIGHT:if(spiritualPanel==0){selSpiritTitle(spiritRowIndex,spiritColumnIndex);spiritualPanel=1;return }var A=spiritRowIndex*3+spiritColumnIndex;if(A==spiritualTitleTotal||spiritColumnIndex==2){return }if(spiritColumnIndex>=0){unSelSpiritTitle(spiritRowIndex,spiritColumnIndex);spiritColumnIndex++;selSpiritTitle(spiritRowIndex,spiritColumnIndex);return }case rcLEFT:if(spiritColumnIndex==0){spiritualPanel=0;unSelSpiritTitle(spiritRowIndex,spiritColumnIndex);return }if(spiritualPanel==0){return }if(spiritColumnIndex>=0){unSelSpiritTitle(spiritRowIndex,spiritColumnIndex);--spiritColumnIndex;selSpiritTitle(spiritRowIndex,spiritColumnIndex);return }break;case rcUP:if(spiritualPanel==0){if(spiritGenreIndex==0){return }spiritGenreIndex--;if(spiritGenreCursor!=0){unSelSpiritGenre(spiritGenreCursor);spiritGenreCursor--;selSpiritGenre(spiritGenreCursor)}else{var B=spiritGenreIndex;var C=spiritGenreIndex+9;scrollSpiritGenre(B,C)}spiritGenreClick=spiritGenreIndex-spiritGenreCursor;updateSpiritualTitle();return }if(spiritRowIndex==0){return }unSelSpiritTitle(spiritRowIndex,spiritColumnIndex);spiritRowIndex--;if(spiritualCursorIndex!=0){spiritualCursorIndex--;selSpiritTitle(spiritRowIndex,spiritColumnIndex)}else{spiritualCursorIndex=0;var B=0;B=(startSpiritualIndex<3?0:startSpiritualIndex-3);startSpiritualIndex=B;var C=((spiritualTitleTotal-B)>8?(B+8):spiritualTitleTotal);scrollSpiritTitles(B,C)}break;case rcDOWN:if(spiritualPanel==0){if(spiritGenreIndex==spiritGenreTotal){break}spiritGenreIndex++;if(spiritGenreCursor<9){unSelSpiritGenre(spiritGenreCursor);spiritGenreCursor++;selSpiritGenre(spiritGenreCursor)}else{var B=spiritGenreIndex-9;var C=spiritGenreIndex;scrollSpiritGenre(B,C)}spiritGenreClick=spiritGenreIndex-spiritGenreCursor;updateSpiritualTitle();return }var F=spiritualCursorIndex+1;var D=spiritColumnIndex;if(F<3){if(curSpIndexArr[F][D]==0){return }}var I=(spiritualTitleTotal/3);if(spiritRowIndex==parseInt(I)){return }unSelSpiritTitle(spiritRowIndex,spiritColumnIndex);spiritRowIndex++;if(spiritualCursorIndex<spiritTitleMax){spiritualCursorIndex++;selSpiritTitle(spiritRowIndex,spiritColumnIndex)}else{var B=0;if(spiritRowIndex<3){B=spiritRowIndex;startSpiritualIndex=B}else{B=startSpiritualIndex+3;startSpiritualIndex=B}spiritualCursorIndex=2;var C=((spiritualTitleTotal-B)>8?(B+8):spiritualTitleTotal);scrollSpiritTitles(B,C)}break;case rcMENU:if(spiritualPlayStatus){spiritualPlayStatus=false;spiritualPanel=1;hideStatusPanel();document.getElementById("statusMessagePanel").innerHTML="";document.getElementById("layer58").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){if(document.getElementById("epgPlayer")!=null){document.getElementById("epgPlayer").className="epgPlayerOld"}}if(stbTypeId==7){document.getElementById("homePanelImage").style.visibility="hidden"}}else{feedType="igmp";document.getElementById("epgPlayer").innerHTML="";startStream();spiritualPlayStatus=false;spiritualActive=false;showGoPanel();showGuidePanel()}break;case rcREFRESH:refreshStb();break}}function onSpiritualPanel(A){unSelSpiritGenre(spiritGenreCursor);spiritGenreIndex=A;spiritGenreCursor=spiritGenreIndex-spiritGenreClick;selSpiritGenre(spiritGenreCursor);spiritualPanel=0;updateSpiritualGenre()}function onSpiritualTitle(A){unSelSpiritTitle(spiritRowIndex,spiritColumnIndex);var C=parseInt(A/3);var B=A%3;spiritualPanel=1;spiritRowIndex=C;spiritColumnIndex=B;selSpiritTitle(spiritRowIndex,spiritColumnIndex)}function selSpiritTitle(E,B){var C="spiritualTitleId"+E+""+B;try{assignSpTitleDesc(E,B);document.getElementById(C).style.border="2px solid paleGoldenRod"}catch(A){try{spiritRowIndex-=1;spiritualCursorIndex-=1;selSpiritTitle(spiritRowIndex,spiritColumnIndex)}catch(D){}}}function unSelSpiritTitle(C,A){var B="spiritualTitleId"+C+""+A;if(document.getElementById(B)!=null){document.getElementById(B).style.border="2px solid Transparent"}}function scrollSpiritTitles(B,F){spiritualPanel=1;var H;var C=0;var L=returnCurSpiritIndex();for(var E=0;E<3;E++){curSpIndexArr[E]=new Array(3);for(var D=0;D<3;D++){curSpIndexArr[E][D]=0}}document.getElementById("spiritualTitleList").innerHTML="";var A='<tr><td colspan="7" width="400px" height="10px">&nbsp;</td></tr><tr><td width="15px" height="80px">&nbsp;</td>';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="15px" height="80px">&nbsp;</td>'}curSpIndexArr[parseInt(C/3)][parseInt(C%3)]=1;var I=3*K+J;I=L[I];C++;A+='<td align="center" valign="middle" nowrap style="width:75px;height:75px;'+(statusInfo==1?"cursor:pointer;":"")+'" '+(statusInfo==1?" onmouseover='selSpTitlePanel("+K+", "+J+");' onclick='spiritualKeyHandler("+rcOK+");' ":"")+' ><img id="spiritualTitleId'+K+""+J+'" style="width:75px;height:75px;"  src='+(spiritUseGraphicCache[I]==1?'"/ImageHandler?value='+spiritTitleId[I]+'&icon=-1&imageType=5"':"./view/tv/images/vod/logo_none.png")+' /></td><td width="15px" height="80px" >&nbsp;</td>'}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="15px" height="80px">&nbsp;</td>'}A+='<td align="center" valign="middle" nowrap style="width:75px;height:80px;" onclick="spiritualKeyHandler('+rcOK+');" onmouseover="onSpiritualTitle('+H+');">&nbsp;</td><td width="15px" height="80px" >&nbsp;</td>'}}A+='</tr><tr><td colspan="7" width="400px" height="10px">&nbsp;</td></tr>';document.getElementById("spiritualTitleList").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>";selSpiritTitle(spiritRowIndex,spiritColumnIndex)}function resetSpiritVars(){curSpIndexArr=new Array();spiritualCursorIndex=0;spiritualPanel=0;spiritualTitleTotal=0;spiritTitleMax=2;startSpiritualIndex=0;spiritColumnIndex=0;spiritRowIndex=0}function returnCurSpiritIndex(){var A=new Array();if(selSpiritIndexArr[spiritGenreIndex].length>0){A=(selSpiritIndexArr[spiritGenreIndex])}spiritualTitleTotal=A.length-1;return A}function startSpiritStream(I,G,F){feedType="rtsp";spiritualPlayStatus=false;if(!F){return }var D="src=rtsp://"+vodServer+"/"+F+";servertype=ncube";if(stbTypeId==7){var C=DetectFlashVer(10,0,0);if(!C){document.getElementById("statusMessagePanel").innerHTML="get the flash player now on http://www.adobe.com/go/getflashplayer/";return }var E=F;var B=E.substring(0,E.indexOf("."));var A=E.substring(E.indexOf(".")+1,E.length).toUpperCase();if(A=="JPEG"||A=="JPG"||A=="GIF"||A=="PNG"||A=="BMP"||A=="EXE"||A=="TIF"||A=="ICO"||A=="ZIP"||A=="TXT"||A=="DOC"||A=="DOCX"){spiritualPlayStatus=true;showStatusPanel();document.getElementById("statusMessagePanel").innerHTML=records.key1623;return }else{if(A=="MP4"||A=="MOV"||A=="F4V"){E="rtmp://72.17.154.130:1935/vod/mp4:"+E}else{E="rtmp://72.17.154.130:1935/vod/"+B+".flv"}E=B;var H=fmsServerIp+":"+fmsServerPort;document.getElementById("epgPlayer").innerHTML='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="624" height="422" id="mediacasterstreammanagerLive" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="true" /><param name="movie" value="/view/tv/flash/vodTvPlayer.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><param name="wmode" value="opaque"><param name="FlashVars" value="streamName='+E+"&ip="+H+'" /><embed src="/view/tv/flash/vodTvPlayer.swf" FlashVars="streamName='+E+"&ip="+H+'" wmode="opaque" quality="high" bgcolor="#000000" width="624" height="422" name="mediacasterstreammanagerLive" align="middle" allowScriptAccess="sameDomain" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';spiritualPlayStatus=true;if(document.getElementById("epgPlayer")!=null){document.getElementById("epgPlayer").className="epgPlayer"}if(stbTypeId==7){document.getElementById("homePanelImage").style.visibility="visible"}document.getElementById("waitPanel").style.backgroundImage="none"}}else{document.getElementById("waitPanel").style.backgroundImage="none";spiritualPlayStatus=true;playStream(D)}}function highLightSpiritualPanel(B){var A="#fcf3b8";document.getElementById("spiritualPanel"+B).style.background=A}function hideSpiritualPanel(B){var A="none";document.getElementById("spiritualPanel"+B).style.background=A}function spiritualPanelHome(B){var A="";A=(B==1?"#fcf3b8":"none");document.getElementById("spiritualPanelHomeBtn").style.background=A}function escapeSpiritualPanel(){spiritualKeyHandler(rcMENU)}function moveSpiritualPanel(A){switch(A){case 1:spiritualKeyHandler(rcUP);break;case 2:spiritualKeyHandler(rcDOWN);break;case 3:spiritualKeyHandler(rcLEFT);break;case 4:spiritualKeyHandler(rcRIGHT);break}}function selSpTitlePanel(B,A){unSelSpiritTitle(spiritRowIndex,spiritColumnIndex);spiritualPanel=1;spiritRowIndex=B;spiritColumnIndex=A;selSpiritTitle(B,A)}