var radioGenreList=new Array();var curRadioIndex=new Array();var radioTitleCache=new Array();var radioTitleIdCache=new Array();var radioTitleDesc=new Array();var radioIpList=new Array();var radioIpPort=new Array();var radioGenreIndex=0;var radioGenreTotal=0;var radioTitleMax=2;var curRadioAssestIndex=0;var radioTitleTotal=0;var radioCursorIndex=0;var radioRowIndex=0;var radioColumnIndex=0;var radioPanel=0;var radioGenreCursor=0;var startRadioIndex=0;function getIrInfo(A){var B="method=getInternetRadioInfo&widgetId="+A+"&serial="+serial;createAjaxRequest();if(ajaxRequest==null){return }ajaxRequest.onreadystatechange=function(){if(ajaxRequest.readyState==4){if(ajaxRequest.status==200){if(ajaxRequest.responseText=="recall"){getTransportInfo()}else{var C=ajaxRequest.responseText;if(C.length>0){var F=C.split("-?#-");radioGenreList=(F[0]).length>0?(F[0]).split("-*$-"):new Array();var E=(F[1]).length>0?(F[1]).split("-*$-"):new Array();radioTitleIdCache=new Array(E.length);for(var D=0;D<E.length;D++){radioTitleIdCache[D]=(E[D]).length>0?(E[D]).split("-@#-"):new Array()}E=(F[2]).length>0?(F[2]).split("-*$-"):new Array();radioTitleCache=new Array(E.length);for(var D=0;D<E.length;D++){radioTitleCache[D]=(E[D]).length>0?(E[D]).split("-@#-"):new Array()}E=(F[3]).length>0?(F[3]).split("-*$-"):new Array();radioTitleDesc=new Array(E.length);for(var D=0;D<E.length;D++){radioTitleDesc[D]=(E[D]).length>0?(E[D]).split("-@#-"):new Array()}E=(F[4]).length>0?(F[4]).split("-*$-"):new Array();radioIpList=new Array(E.length);for(var D=0;D<E.length;D++){radioIpList[D]=(E[D]).length>0?(E[D]).split("-@#-"):new Array()}E=(F[5]).length>0?(F[5]).split("-*$-"):new Array();radioIpPort=new Array(E.length);for(var D=0;D<E.length;D++){radioIpPort[D]=(E[D]).length>0?(E[D]).split("-@#-"):new Array()}}createIrGenrePanel();showInRadioPanel()}}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 launchInRadioPanel(A){resetRadioGanre();getIrInfo(A)}function createIrGenrePanel(){var A="";for(var B=0;(radioGenreList.length>9&&B<9)||(radioGenreList.length<=9&&B<radioGenreList.length);++B){A+='<tr><td id="radioGenreId'+B+'" '+(statusInfo==1?'style="cursor:pointer;font-weight:bolder;font-size:12px;" onmouseover="onInternetRadioPanel('+B+');"':' style="font-weight:bolder;font-size:12px;" ')+' width="155px" height="30px" valign=center nowrap>&nbsp;&nbsp;&nbsp;'+irGenreName(radioGenreList[B])+"</td></tr>"}document.getElementById("radioList").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 style="background:url(\'/view/tv/images/rowGenre.png\') no-repeat;">'+records.key372+"</td></tr>")+"</table>";selRadioGenre(radioGenreIndex);radioGenreTotal=radioGenreList.length-1;updateRadioTitle()}var radioGenreClick=0;function onInternetRadioPanel(A){unSelRadioGenre(radioGenreCursor);radioPanel=0;radioGenreCursor=A;radioGenreIndex=radioGenreCursor+radioGenreClick;selRadioGenre(A);updateRadioTitle()}function irGenreName(B){var A="";B=parseInt(B);switch(B){case 1:A="Jazz";break;case 2:A="Rock";break;case 3:A="Classic";break;case 4:A="Other";break;case 5:A="Melody";break}return A}function selRadioGenre(B){try{document.getElementById("radioTitle").innerHTML="";document.getElementById("radioDescription").innerHTML="";document.getElementById("radioGenreId"+B).style.background='url("/view/tv/images/rowGenre.png") no-repeat'}catch(A){}}function unSelRadioGenre(B){try{document.getElementById("radioGenreId"+B).style.background=""}catch(A){}}function resetRadioTitle(){radioTitleMax=2;radioTitleTotal=0;radioCursorIndex=0;radioRowIndex=0;radioColumnIndex=0;radioPanel=0;startRadioIndex=0}function resetRadioGanre(){radioGenreIndex=0;radioGenreTotal=0;radioGenreCursor=0;curRadioAssestIndex=0;radioGenreList=new Array();curRadioIndex=new Array();radioTitleCache=new Array();radioTitleIdCache=new Array();radioTitleDesc=new Array();radioIpList=new Array();radioIpPort=new Array();filePlayStatus=false}function returnRadioIndex(){return }function updateRadioTitle(){resetRadioTitle();var F="";for(var C=0;C<3;C++){curRadioIndex[C]=new Array(3);for(var A=0;A<3;A++){curRadioIndex[C][A]=0}}var E;var B=0;var I=radioTitleCache.length>0?radioTitleCache[radioGenreIndex]:new Array();var F='<tr><td colspan="7" width="400px" height="10px">&nbsp;</td></tr><tr><td width="15px" height="80px">&nbsp;</td>';for(E=0;(I.length>=9&&E<9)||(I.length<9&&E<I.length);++E){B++;var H=parseInt(E/3);var G=parseInt(E%3);if(E%3==0&&E!=0){F+='</tr><tr><td colspan="7" width="400px" height="10px">&nbsp;</td></tr><tr><td width="15px" height="80px">&nbsp;</td>'}curRadioIndex[H][G]=1;F+='<td align="center" valign="middle" nowrap '+(statusInfo==1?' onclick="openRadioContent('+E+');" onmouseover="onRadioTitlePanel('+H+","+G+","+E+');" style="width:80px;height:75px;cursor:pointer;" ':'style="width:80px;height:75px;"')+'  ><img class="radioBack" id="radioTitleId'+H+""+G+'" style="width:75px;height:75px;" src="/ImageHandler?value='+radioTitleIdCache[radioGenreIndex][E]+'&icon=-1&imageType=12" /></td><td width="15px" height="80px" >&nbsp;</td>'}if(B>0){for(var D=0;D<(9-B);++D){if((B+D)%3==0){F+='</tr><tr><td colspan="7" width="400px" height="10px">&nbsp;</td></tr><tr><td width="15px" height="80px">&nbsp;</td>'}F+='<td align="center" valign="middle" nowrap style="width:80px;height:80px;">&nbsp;</td><td width="15px" height="80px" >&nbsp;</td>'}}F+='</tr><tr><td colspan="7" width="400px" height="10px">&nbsp;</td></tr>';document.getElementById("radioTitleList").innerHTML='<table width="100%" align="left" valign="top" cellspacing="0" cellpadding="0" >'+(I.length>0?F:'<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>";if(radioGenreList.length==0){document.getElementById("radioTitleList").innerHTML='<table width="100%" align="left" valign="top" cellspacing="0" cellpadding="0" ><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>'}radioTitleTotal=I.length-1}function onRadioTitlePanel(C,A,B){unSelRadioTitlePanel(radioRowIndex,radioColumnIndex);radioPanel=1;radioCursorIndex=B;radioRowIndex=C;radioColumnIndex=A;selRadioTitlePanel(radioRowIndex,radioColumnIndex)}function openRadioContent(A){radioKeyHandler(rcOK)}function updateRadioDesc(D,C){var B=3*D+C;try{if(radioTitleCache[radioGenreIndex].length){document.getElementById("radioTitle").innerHTML=radioTitleCache[radioGenreIndex][B];document.getElementById("radioDescription").innerHTML=radioTitleDesc[radioGenreIndex][B]}}catch(A){}}function selRadioTitlePanel(C,B){updateRadioDesc(C,B);try{document.getElementById("radioTitleId"+C+""+B).style.border="1px solid white"}catch(A){}}function unSelRadioTitlePanel(C,B){try{document.getElementById("radioTitle").innerHTML="";document.getElementById("radioDescription").innerHTML="";document.getElementById("radioTitleId"+C+""+B).style.border="1px solid Gray"}catch(A){}}function showHomeIRPanel(B){var A="";A=(B==1?"#fcf3b8":"none");document.getElementById("internetRadioHome").style.background=A}function escapeIRPanel(){keyActionHandler(rcMENU)}function startRadioStream(F,D){var E=radioTitleCache.length>0?radioTitleCache[radioGenreIndex]:new Array();var A=3*radioRowIndex+radioColumnIndex;if(!E[A]){return }filePlayStatus=true;showRadioPlayPanel();stopStream();document.getElementById("epgPlayer").innerHTML="";var C=radioIpList[radioGenreIndex][A]+":"+radioIpPort[radioGenreIndex][A];var B='<embed width="578" height="320" flashvars="radioStation=http://'+C+"&amp;stationName="+E[A]+'&amp;isPopout=true" allowscriptaccess="always" wmode="transparent" bgcolor="#000000" wmode="opaque" name="shoutcast" id="shoutcast" src="http://stat.in.com/listen/player/shoutcast_withSkin.swf" type="application/x-shockwave-flash"  />';document.getElementById("radioContentPanel").innerHTML=B}function radioKeyHandler(E){switch(E){case rcOK:if(filePlayStatus){return }if(radioPanel==0){return }startRadioStream(radioRowIndex,radioColumnIndex);break;case rcMENU:if(filePlayStatus){filePlayStatus=false;radioPanel=1;hideStatusPanel();document.getElementById("statusMessagePanel").innerHTML="";if(document.getElementById("keyDigitPanel")!=null){document.getElementById("keyDigitPanel").style.visibility="hidden"}if(stbTypeId==7||statusInfo==1){document.getElementById("homePanelImage").style.visibility="hidden"}hideRadioPlayPanel()}else{document.getElementById("radioContentPanel").innerHTML="";resetRadioGanre();resetRadioTitle();hideRadioPlayPanel();feedType="igmp";startStream();filePlayStatus=false;inActive=false;showGoPanel();showGuidePanel()}break;case rcRIGHT:if(filePlayStatus){return }if(radioPanel==0){selRadioTitlePanel(radioRowIndex,radioColumnIndex);radioPanel=1;return }var C=radioRowIndex*3+radioColumnIndex;if(C==radioTitleTotal||radioColumnIndex==2){return }if(radioColumnIndex>=0){unSelRadioTitlePanel(radioRowIndex,radioColumnIndex);++radioColumnIndex;selRadioTitlePanel(radioRowIndex,radioColumnIndex);return }break;case rcLEFT:if(filePlayStatus){return }if(radioColumnIndex==0){radioPanel=0;unSelRadioTitlePanel(radioRowIndex,radioColumnIndex);return }if(radioPanel==0){return }if(radioColumnIndex>=0){unSelRadioTitlePanel(radioRowIndex,radioColumnIndex);--radioColumnIndex;selRadioTitlePanel(radioRowIndex,radioColumnIndex);return }break;case rcUP:if(filePlayStatus){return }if(radioPanel==0){if(radioGenreIndex==0){return }radioGenreIndex--;if(radioGenreCursor!=0){unSelRadioGenre(radioGenreCursor);radioGenreCursor--;selRadioGenre(radioGenreCursor)}else{var G=radioGenreIndex;var B=radioGenreIndex+9;scrollRadioGenre(G,B)}updateRadioTitle();radioGenreClick=radioGenreIndex-radioGenreCursor;return }if(radioRowIndex==0){return }unSelRadioTitlePanel(radioRowIndex,radioColumnIndex);radioRowIndex--;if(radioCursorIndex!=0){radioCursorIndex--;selRadioTitlePanel(radioRowIndex,radioColumnIndex)}else{radioCursorIndex=0;var G=0;G=(startRadioIndex<3?0:startRadioIndex-3);startRadioIndex=G;var B=((radioTitleTotal-G)>8?(G+8):radioTitleTotal);scrollRadioTitle(G,B)}break;case rcDOWN:if(filePlayStatus){return }if(radioPanel==0){if(radioGenreIndex==radioGenreTotal){break}radioGenreIndex++;if(radioGenreCursor<9){unSelRadioGenre(radioGenreCursor);radioGenreCursor++;selRadioGenre(radioGenreCursor)}else{var G=radioGenreIndex-9;var B=radioGenreIndex;scrollRadioGenre(G,B)}updateRadioTitle();radioGenreClick=radioGenreIndex-radioGenreCursor;return }var F=radioCursorIndex+1;var D=radioColumnIndex;if(F<3){if(curRadioIndex[F][D]==0){return }}var A=(radioTitleTotal/3);if(radioRowIndex==parseInt(A)){return }unSelRadioTitlePanel(radioRowIndex,radioColumnIndex);radioRowIndex++;if(radioCursorIndex<radioTitleMax){radioCursorIndex++;selRadioTitlePanel(radioRowIndex,radioColumnIndex)}else{var G=0;if(radioRowIndex<3){G=radioRowIndex;startRadioIndex=G}else{G=startRadioIndex+3;startRadioIndex=G}radioCursorIndex=2;var B=((radioTitleTotal-G)>8?(G+8):radioTitleTotal);scrollRadioTitle(G,B)}break}}function hideRadioPlayPanel(){document.getElementById("radioPlayPanel").style.visibility="hidden"}function showRadioPlayPanel(){document.getElementById("radioPlayPanel").style.visibility="visible"}function scrollRadioGenre(E,A){var C=0;for(var B=E;B<=A;++B){var D="radioGenreId"+C;document.getElementById(D).innerHTML=(radioGenreList[B].length>16?radioGenreList[B]:radioGenreList[B]);C++}}function scrollRadioTitle(B,F){radioPanel=1;var H;var C=0;var L=radioTitleIdCache[radioGenreIndex];for(var E=0;E<3;E++){curRadioIndex[E]=new Array(3);for(var D=0;D<3;D++){curRadioIndex[E][D]=0}}document.getElementById("radioTitleList").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>'}curRadioIndex[parseInt(C/3)][parseInt(C%3)]=1;var I=3*K+J;A+='<td align="center" valign="middle" nowrap '+(statusInfo==1?' onclick="openRadioContent('+H+');" onmouseover="onRadioTitlePanel('+K+","+J+","+C+');"style="width:80px;height:75px;cursor:pointer;"':'style="width:80px;height:75px;"')+' ><img id="radioTitleId'+K+""+J+'" class="radioBack" style="width:75px;height:75px;"  src="/ImageHandler?value='+L[I]+'&icon=-1&imageType=12" /></td><td width="15px" 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="15px" height="80px">&nbsp;</td>'}A+='<td align="center" valign="middle" nowrap style="width:80px;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("radioTitleList").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>";selRadioTitlePanel(radioRowIndex,radioColumnIndex)}