var ShowStorage=[];var Startup=[];var WPNPlayerComm=new Class.create();WPNPlayerComm.prototype={stationName:"",initialShowID:"",isPlayerLoaded:false,autoStartPlaying:false,activePlayer:"",tvStationObj:null,initialize:function(A){this.tvStationObj=A;this.stationName=A.getName();this.autoStartPlaying=A.getAutoPlay()},setParametres:function(){},playerLoaded:function(){this.isPlayerLoaded=true;if(this.autoStartPlaying==true){this.playShowById(this.initialShowID)}},playingStarted:function(A){},playingFinished:function(A){playlist.playingFinished(this.initialShowID)},playShowById:function(A){this.initialShowID=A;showPlayerType=ShowStorage[A]["showPlayerType"];if(showPlayerType=="WPNPLAYER"){if(this.activePlayer=="WPNPLAYER"){obj=swfobject.getObjectById("WPNPlayer");if(obj&&typeof obj.playShowByID!="undefined"){obj.playShowByID(A)}else{}}else{this.autoStartPlaying=true;this.renderToDiv()}return }if(showPlayerType=="WPNPLAYER_LIVE"||showPlayerType=="youtube"||showPlayerType=="googlevideo"||showPlayerType=="brightcove"||showPlayerType=="billabong"){this.autoStartPlaying=true;this.renderToDiv();return }},youtubePlayerStateChange:function(A){this.isPlayerLoaded=true;if(A=="0"){this.playingFinished(this.initialShowID)}},renderToDiv:function(){playerType=ShowStorage[this.initialShowID]["showPlayerType"];if(playerType=="WPNPLAYER"){$("stream_player").update('<div id="player_embed"></div>');this.activePlayer=playerType;swfobject.embedSWF("http://www.wpntv.com/common/BKDPlayer/WPNMediaPlayer.swf","player_embed","576","324","9.0.0",false,{mode:"WPNTV",channel:this.stationName,showid:this.initialShowID,reportstatus:"true",maintainaspect:this.tvStationObj.getMaintainAspect(),acceptcommands:"true",hasintro:this.tvStationObj.isIntroEnabled()},{allowScriptAccess:"always",quality:"high",allowFullScreen:"true",swLiveConnect:"true",seamlesstabbing:"true"},{name:"WPNPlayer",id:"WPNPlayer"});return }if(playerType=="WPNPLAYER_LIVE"){$("stream_player").update('<div id="player_embed"></div>');this.activePlayer=playerType;swfobject.embedSWF("http://www.wpntv.com/common/BKDPlayer/WPNMediaPlayer.swf","player_embed","576","324","9.0.0",false,{liveid:this.initialShowID,maintainaspect:this.tvStationObj.getMaintainAspect()},{allowScriptAccess:"always",quality:"high",allowFullScreen:"true",swLiveConnect:"true",seamlesstabbing:"true"},{base:"http://www.wpntv.com",name:"WPNPlayer",id:"WPNPlayer"});return }if(playerType=="youtube"){$("stream_player").update('<div id="player_embed"></div>');this.activePlayer=playerType;swfobject.embedSWF("http://www.youtube.com/v/"+ShowStorage[this.initialShowID]["showParams"]+"&enablejsapi=1&playerapiid=video&rel=0&autoplay="+(this.autoStartPlaying==true?"1":"0"),"player_embed","576","324","8",null,null,{allowScriptAccess:"always"},{id:"youtubePlayer",bgcolor:"#000000"})}if(playerType=="googlevideo"){this.isPlayerLoaded=true;$("stream_player").update('<div id="player_embed"></div>');this.activePlayer=playerType;swfobject.embedSWF("http://video.google.com/googleplayer.swf?docId="+ShowStorage[this.initialShowID]["showParams"]+"&hl=en","player_embed","576","324","8",null,null,{subtitle:"on"},{id:"VideoPlayback",style:"width:576px; height:324px;"});return }if(playerType=="brightcove"){this.isPlayerLoaded=true;$("stream_player").update('<div id="player_embed"></div>');this.activePlayer=playerType;$("stream_player").update("<embed id='bcove' src='http://www.brightcove.tv/playerswf' bgcolor='#FFFFFF' flashVars='initVideoId="+ShowStorage[this.initialShowID]["showParams"]+"&servicesURL=http://www.brightcove.tv&viewerSecureGatewayURL=https://www.brightcove.tv&cdnURL=http://admin.brightcove.com&autoStart="+(this.autoStartPlaying==true?"true":"false")+"' base='http://admin.brightcove.com' name='bcPlayer' width='576' height='324' allowFullScreen='true' allowScriptAccess='always' seamlesstabbing='false' type='application/x-shockwave-flash' swLiveConnect='true' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'></embed>");return }if(playerType=="billabong"){this.isPlayerLoaded=true;$("stream_player").update('<div id="player_embed"></div>');this.activePlayer=playerType;$("stream_player").update('<object width="576" height="324"><param name="movie" value="http://www.billabong.com.au/video_player.swf?v='+ShowStorage[this.initialShowID]["showParams"]+'"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.billabong.com.au/video_player.swf?v='+ShowStorage[this.initialShowID]["showParams"]+'" type="application/x-shockwave-flash" width="576" height="324" allowFullScreen="true"></embed></object>');return }},renderToDivForShowID:function(A){this.initialShowID=A;this.renderToDiv()}};function onYouTubePlayerReady(A){obj=swfobject.getObjectById("youtubePlayer");if(obj){obj.addEventListener("onStateChange","youtubePlayerStateChange")}else{}}var WPNTVStation=new Class.create();WPNTVStation.prototype={initialize:function(A){this.stationName="webkast";if(!Object.isUndefined(A.stationName)){this.stationName=A.stationName}this.autoPlay=false;if(!Object.isUndefined(A.autoplay)){this.autoPlay=A.autoplay}this.maintainAspect=false;if(!Object.isUndefined(A.maintainAspect)){this.maintainAspect=A.maintainAspect}this.uacct="";if(!Object.isUndefined(A.uacct)){this.uacct=A.uacct}this.homeLink="";if(!Object.isUndefined(A.homeLink)){this.homeLink=A.homeLink;$("home").update(this.homeLink)}if(!Object.isUndefined(A.uploadVisible)){if(A.uploadVisible==true){Try.these(function(){$("uploadBoxSignedIn").setStyle({display:"inline"});$("uploadBoxNotSignedIn").setStyle({display:"inline"})})}}this.liveStreamEnabled=false;if(!Object.isUndefined(A.liveStreamEnabled)){this.liveStreamEnabled=A.liveStreamEnabled}this.liveStreams=[];if(!Object.isUndefined(A.liveStreams)){this.liveStreams=A.liveStreams}this.randomShowOnStartup=false;if(!Object.isUndefined(A.randomShowOnStartup)){this.randomShowOnStartup=A.randomShowOnStartup}this.switchbarIcons="";if(!Object.isUndefined(A.switchbarIcons)){this.switchbarIcons=A.switchbarIcons}this.switchbarCustomColor="";this.switchbarHasCustomColor=false;if(!Object.isUndefined(A.switchbarCustomColor)){this.switchbarHasCustomColor=true;this.switchbarCustomColor=A.switchbarCustomColor}this.hasIntro=false;if(!Object.isUndefined(A.hasIntro)){this.hasIntro=A.hasIntro}this.showCommentsPane=true;if(!Object.isUndefined(A.showCommentsPane)){this.showCommentsPane=A.showCommentsPane}this.adCode="reklama";this.defaultCover="wpntvcover.png";this.customUrl="http://"+this.stationName+".tv"},report:function(){},getName:function(){return this.stationName},getAddress:function(){return this.customUrl},getLocation:function(){return window.location},getDefaultShowCover:function(){return this.defaultCover},getAutoPlay:function(){return this.autoPlay},getMaintainAspect:function(){return this.maintainAspect},getUACCT:function(){return this.uacct},getLiveStreamEnabled:function(){return this.liveStreamEnabled},getLiveStreams:function(){return this.liveStreams},getRandomShowOnStartup:function(){return this.randomShowOnStartup},doLocalization:function(A){},getSwitchbarIcons:function(){return this.switchbarIcons},getSwitchbarCustomColor:function(){return this.switchbarCustomColor},getSwitchbarHasCustomColor:function(){return this.switchbarHasCustomColor},isIntroEnabled:function(){return this.hasIntro},getShowCommentsPane:function(){return this.showCommentsPane}};var ShowStorageControl=new Class.create();ShowStorageControl.prototype={initialize:function(){},newShow:function(I,A,K,H,J,D,E,B,C,G,F){if(Object.isUndefined(ShowStorage[I])){this.updateShow(I,A,K,H,J,D,E,B,C,G,F)}else{}},updateShow:function(I,A,K,H,J,D,E,B,C,G,F){ShowStorage[I]=[];ShowStorage[I]["showID"]=I;ShowStorage[I]["showHasSnapshot"]=A;ShowStorage[I]["showSection"]=K;ShowStorage[I]["showDateCreated"]=H;if(H.indexOf("1970")!=-1){ShowStorage[I]["showDateCreated"]=""}ShowStorage[I]["showDescription"]=J;ShowStorage[I]["showTitle"]=D;ShowStorage[I]["showCommentsNum"]=B;ShowStorage[I]["showRating"]=C;ShowStorage[I]["showParams"]="none";ShowStorage[I]["showDuration"]=G;ShowStorage[I]["showPlayerType"]="WPNPLAYER";ShowStorage[I]["showShowViews"]=F;if(E.indexOf("WPNPLAYER_LIVE:")!=-1||E.indexOf("youtube:")!=-1||E.indexOf("brightcove:")!=-1||E.indexOf("googlevideo:")!=-1||E.indexOf("billabong:")!=-1){Try.these(function(){params=E.split(":");ShowStorage[I]["showParams"]=params[1];ShowStorage[I]["showPlayerType"]=params[0]}.bind(E).bind(I))}},setShowInPlaylistState:function(B,A){if(Object.isUndefined(ShowStorage[B])){ShowStorage[B]["playlist"]=A}},isShowInPlaylist:function(A){if(Object.isUndefined(ShowStorage[A])){if(Object.isUndefined(ShowStorage[A]["playlist"])){return ShowStorage[A]["playlist"]}}return false},updateShowByXMLNode:function(A,B){showID=A.getAttribute("ID");showHasSnapshot=A.getAttribute("hasSnapshot");showSection="";Try.these(function(){showSection=A.getAttribute("section").escapeHTML()}.bind(A).bind(showSection));showDateCreated=A.getAttribute("created").escapeHTML();showTitle=A.getElementsByTagName("showname")[0].childNodes[0].nodeValue.escapeHTML();showDescription=(A.getElementsByTagName("description")[0].childNodes.length>0?A.getElementsByTagName("description")[0].childNodes[0].nodeValue.escapeHTML():"");showDuration="";showViews=A.getAttribute("showViews");showFilename="";showCommentsNum="0";showRating="0";Try.these(function(){showCommentsNum=A.getAttribute("comments")}.bind(A).bind(showCommentsNum));Try.these(function(){showRating=A.getAttribute("rating")}.bind(A).bind(showRating));Try.these(function(){showFilename=A.getElementsByTagName("files")[0].getElementsByTagName("file")[0].getElementsByTagName("filename")[0].childNodes[0].nodeValue}.bind(A).bind(showFilename));Try.these(function(){showDurationSeconds=A.getElementsByTagName("files")[0].getElementsByTagName("file")[0].getElementsByTagName("length")[0].childNodes[0].nodeValue;if(A.getElementsByTagName("files")[0].getElementsByTagName("file").length>1){showDurationSeconds=parseInt(showDurationSeconds)+parseInt(A.getElementsByTagName("files")[0].getElementsByTagName("file")[1].getElementsByTagName("length")[0].childNodes[0].nodeValue)}minutes=parseInt(showDurationSeconds/60);seconds=parseInt(showDurationSeconds%60);if(showDurationSeconds=="-1"){showDuration=""}else{showDuration=minutes+":"+(seconds<10?"0":"")+seconds}}.bind(A).bind(showDuration));if(B==true){this.updateShow(showID,showHasSnapshot,showSection,showDateCreated,showDescription,showTitle,showFilename,showCommentsNum,showRating,showDuration,showViews)}else{this.newShow(showID,showHasSnapshot,showSection,showDateCreated,showDescription,showTitle,showFilename,showCommentsNum,showRating,showDuration,showViews)}return showID}};var showStorageControl=new ShowStorageControl();var VideoInfoPane=new Class.create();VideoInfoPane.prototype={tvStationObj:null,activeShowID:"",requestShow:"/common/videobrowser/scripts/archive.php",periodicalUpdater:null,initialize:function(A){this.tvStationObj=A;this.periodicalUpdater=new PeriodicalExecuter(this.updateDescription.bind(this),100)},displayShowInfo:function(A){this.periodicalUpdater.stop();this.activeShowID=A.showID;$("playerInfo_Title").update(A.showTitle.truncate(67));if(A.showDescription.length<=260){$("playerInfo_Description").update(A.showDescription)}$("playerInfo_LinkValue").setValue(this.tvStationObj.getAddress()+"/browser/?showid="+A.showID);$("playerInfo_Duration").update(" "+A.showDuration);$("playerInfo_Date").update(A.showDateCreated);$("numViews").update("...");$("commentsText").update("");ratingSystem.setDefaultRating(A.showRating);ratingSystem.renderDefaultRating();if(A.showPlayerType=="WPNPLAYER"){$("embedHolder").show();$("playerInfo_NumViews").show();$("videoLinkHolder").show();$("ratingSystem").show();$("commentsHolder").show();$("playerInfo_EmbedValue").setValue('<object width="640" height="480"><param name="movie" value="http://wpntv.com/common/bkdplayer/?station='+this.tvStationObj.getName()+"&showid="+A.showID+'"></param><param name="allowFullScreen" value="true"></param>				<param name="allowscriptaccess" value="always"></param>	<embed src="http://wpntv.com/common/bkdplayer/?station='+this.tvStationObj.getName()+"&showid="+A.showID+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="480"></embed></object>')}else{if(A.showPlayerType=="WPNPLAYER_LIVE"){$("videoLinkHolder").hide();$("embedHolder").hide();$("playerInfo_NumViews").hide();$("ratingSystem").hide();$("commentsHolder").hide()}else{$("commentsHolder").show();$("ratingSystem").show();$("videoLinkHolder").show();$("embedHolder").hide();$("playerInfo_NumViews").hide()}}if(A.showDescription.length>260){this.descriptionPosition=-1;this.updateDescription();this.periodicalUpdater=new PeriodicalExecuter(this.updateDescription.bind(this),10)}this.retrieveShowStats()},retrieveShowStats:function(){new Ajax.Request(this.requestShow+"?TVStation="+this.tvStationObj.getName()+"&action=retrieveShowStats&showID="+this.activeShowID,{method:"get",contentType:"application/xml",onSuccess:function(A){xmlResponse=A.responseXML;showNode=xmlResponse.getElementsByTagName("SearchResult")[0];currentShowID=showNode.getAttribute("showID");if(this.activeShowID==currentShowID){currentShowViews=showNode.getAttribute("showViews");currentShowComments=showNode.getAttribute("showComments");currentShowRating=showNode.getAttribute("showRating");$("numViews").update(currentShowViews);$("commentsText").update(Locale.comment+"!("+currentShowComments+")");ratingSystem.setDefaultRating(currentShowRating);ratingSystem.renderDefaultRating()}}.bind(this)})},descriptionPosition:0,updateDescription:function(){$("playerInfo_Description").hide();this.descriptionPosition=this.descriptionPosition+1;truncIdx=parseInt(ShowStorage[this.activeShowID]["showDescription"].length/260);outputText="";if(this.descriptionPosition>truncIdx){this.descriptionPosition=0}outputText=ShowStorage[this.activeShowID]["showDescription"].substr(this.descriptionPosition*260,260);$("playerInfo_Description").update((this.descriptionPosition!=0?"...":"")+outputText+(this.descriptionPosition!=truncIdx?"...":"")+" ("+(this.descriptionPosition+1)+"/"+(truncIdx+1)+")");new Effect.Appear("playerInfo_Description",{duration:0.5})},getActiveShowID:function(){return this.activeShowID},reloadActiveShow:function(){new Ajax.Request(this.requestShow+"?TVStation="+this.tvStationObj.getName()+"&action=getResultSet&search="+this.activeShowID+RND.getURLRND(),{method:"get",contentType:"application/xml",onSuccess:function(A){xmlResponse=A.responseXML;showNode=xmlResponse.getElementsByTagName("SearchResult")[0].getElementsByTagName("show")[0];showID=showStorageControl.updateShowByXMLNode(showNode,true);this.displayShowInfo(ShowStorage[this.activeShowID])}.bind(this)})}};var Playlist=new Class.create();Playlist.prototype={currentPlaylist:"channelPlaylist",currentPlayingIndex:"",lastPlayedVideoID:"",lastPlayedVideoPlaylist:"",lastPlayedVideoIndex:"",request:"/common/videobrowser/scripts/archive.php",tvStationObj:null,initialize:function(A){this.channelPlaylist=[];this.userPlaylist=[];this.liveStreamPlaylist=[];this.tvStationObj=A;this.request=this.request+"?TVStation="+A.getName()+"&action=getLastAddedShows&numRecords=20"+RND.getURLRND();this.requestShow="/common/videobrowser/scripts/archive.php";this.getCurrentPlaylistEntries()},getCurrentPlaylistEntries:function(){showsNode=Startup.shows;ignoreShows=[];for(i=showsNode.length-1;i>=0;i--){showNode=showsNode[i];showID=showStorageControl.updateShowByXMLNode(showNode,false);if(ignoreShows[showID]!="true"){ignoreShows[showID]="true";this.addToChannelPlaylist(showID,false);lastShowID=showID}}this.lastPlayedVideoIndex=this.channelPlaylist.size()-1;if(this.tvStationObj.getRandomShowOnStartup()==true){rand_index=Math.ceil((showsNode.length-1)*Math.random());rand_index=rand_index-1;if(rand_index<0){rand_index=0}lastShowID=showsNode[rand_index].getAttribute("ID");this.lastPlayedVideoIndex=showsNode.length-rand_index-1}this.playlistInitializationComplete(lastShowID)},playlistInitializationComplete:function(A){startShowID=A;this.selectPlaylist("channelPlaylist");this.lastPlayedVideoID=startShowID;this.lastPlayedVideoPlaylist="channelPlaylist";if(window.location.href.indexOf("?showid=")!=-1){startShowID=window.location.href.substring(window.location.href.indexOf("?showid=")+8);this.getRequestedShow(startShowID,A);this.lastPlayedVideoIndex=-1}else{player.renderToDivForShowID(startShowID);videoInfoPane.displayShowInfo(ShowStorage[startShowID]);this.updatePlaylist(false)}},getRequestedShow:function(B,A){new Ajax.Request(this.requestShow+"?TVStation="+this.tvStationObj.getName()+"&action=getResultSet&search="+B+RND.getURLRND(),{method:"get",contentType:"application/xml",onSuccess:function(C){xmlResponse=C.responseXML;if(xmlResponse.getElementsByTagName("SearchResult")[0].getElementsByTagName("show").length>0){showNode=xmlResponse.getElementsByTagName("SearchResult")[0].getElementsByTagName("show")[0];B=showStorageControl.updateShowByXMLNode(showNode,false);videoInfoPane.displayShowInfo(ShowStorage[B]);player.renderToDivForShowID(B)}else{videoInfoPane.displayShowInfo(ShowStorage[A]);player.renderToDivForShowID(A);alertSystem.displayTextLong("Video posnetek, ki ste ga zahtevali<br/>ni bil najden!")}}.bind(this)})},createLiveStreamPlaylist:function(){liveStreams=this.tvStationObj.getLiveStreams();liveStreams.each(function(A){showStorageControl.newShow(A.value,false,"showSection","Live","",A.key,"WPNPLAYER_LIVE:"+A.value,"","","","")}.bind(this));liveStreams.each(function(A){this.liveStreamPlaylist.push(A.value)}.bind(this))},addToChannelPlaylist:function(B,A){this.channelPlaylist.push(B);if(this.currentPlaylist=="channelPlaylist"&&A==true){this.updatePlaylistAfterAdd(B)}},addToUserPlaylist:function(A){this.userPlaylist.push(A);showStorageControl.setShowInPlaylistState(A,true);if(this.currentPlaylist=="userPlaylist"){this.updatePlaylistAfterAdd(A)}else{playlistSections.selectTab(1);this.selectPlaylist("userPlaylist")}playlistSections.updateTabText(1,Locale.mySelection+" ("+this.userPlaylist.length+")")},isInUserPlaylist:function(A){return false},removeFromPlaylist:function(B,A){renderArray=[];backupArray=[];if(B=="userPlaylist"){renderArray=this.userPlaylist}else{if(B=="channelPlaylist"){renderArray=this.channelPlaylist}else{if(B=="liveStreamPlaylist"){renderArray=this.liveStreamPlaylist}}}for(i=0;i<renderArray.length;i++){if(i!=A){backupArray.push(renderArray[i])}else{showStorageControl.setShowInPlaylistState(renderArray[i],false)}}renderArray=backupArray;if(B=="userPlaylist"){this.userPlaylist=renderArray;playlistSections.updateTabText(1,"Moj izbor ("+this.userPlaylist.length+")")}else{if(B=="channelPlaylist"){this.channelPlaylist=renderArray}else{if(B=="liveStreamPlaylist"){this.liveStreamPlaylist=renderArray}}}if(B==this.currentPlaylist){if(A<this.lastPlayedVideoIndex){this.lastPlayedVideoIndex=this.lastPlayedVideoIndex-1}else{if(A==this.lastPlayedVideoIndex){this.lastPlayedVideoIndex=-1}}this.updatePlaylist(true)}},selectPlaylist:function(A){playlistName=A;if(A=="0"){playlistName="channelPlaylist"}if(A=="1"){playlistName="userPlaylist"}if(A=="2"){playlistName="liveStreamPlaylist"}if(playlistName=="userPlaylist"||playlistName=="channelPlaylist"||playlistName=="liveStreamPlaylist"){this.currentPlaylist=playlistName;this.updatePlaylist(true)}},playVideo:function(C,B,A){this.lastPlayedVideoID=C;this.lastPlayedVideoPlaylist=B;this.lastPlayedVideoIndex=A;player.playShowById(C);videoInfoPane.displayShowInfo(ShowStorage[C]);this.updatePlaylist(false)},playingFinished:function(A){if(A==this.lastPlayedVideoID){renderArray=[];index=this.lastPlayedVideoIndex;if(this.lastPlayedVideoPlaylist=="userPlaylist"){renderArray=this.userPlaylist;index++}else{if(this.lastPlayedVideoPlaylist=="channelPlaylist"){renderArray=this.channelPlaylist;index--}else{if(this.lastPlayedVideoPlaylist=="liveStreamPlaylist"){renderArray=this.liveStreamPlaylist;index++}}}if(index<0){index=renderArray.size()-1}if(index>=renderArray.size()){index=0}this.playVideo(renderArray[index],this.lastPlayedVideoPlaylist,index)}},generateTempEntry:function(C,E,B,A,D){return'<div id="playing_box" '+(D==true?'class="active"':"")+'><div id="playlist_user_'+A+'"><table class="playing_tabela"><tr><td class="playing_tabela_slika">'+(ShowStorage[E]["showHasSnapshot"]=="true"?"<a href=\"javascript: playlist.playVideo('"+E+"','"+this.currentPlaylist+"','"+A+'\');"><img height="30px" src="/media/'+E+'.jpeg" class="playing_slika"></a>':"")+"<!--a href=\"javascript: playlist.playVideo('"+E+"','"+this.currentPlaylist+"','"+A+'\');"><img height="30px" src="/media/'+E+'.jpeg" class="playing_slika"></a--></td><td class="playing_tabela_naslov"><a href="javascript: playlist.playVideo(\''+E+"','"+this.currentPlaylist+"','"+A+"');\">"+B.truncate(65)+'</a><span class="playing_trajanje">'+ShowStorage[E]["showDuration"]+'</span></td><td class="playing_tabela_close"><a href="javascript: playlist.removeFromPlaylist(\''+this.currentPlaylist+"',"+A+');"><img class="prozorno" src="images/close.png"></a></td></tr></table></div></div>'},updatePlaylist:function(A){if(A==true){$("playing_content").scrollTop=0;$("playing_content").hide()}renderArray=[];if(this.currentPlaylist=="userPlaylist"){renderArray=this.userPlaylist}else{if(this.currentPlaylist=="channelPlaylist"){renderArray=this.channelPlaylist}else{if(this.currentPlaylist=="liveStreamPlaylist"){renderArray=this.liveStreamPlaylist}}}playlistCode="";if(this.currentPlaylist=="channelPlaylist"){for(i=renderArray.size();i>0;i--){isActive=((this.lastPlayedVideoIndex==i-1&&this.lastPlayedVideoPlaylist==this.currentPlaylist)?true:false);tempEntry=this.generateTempEntry(renderArray.size()-1,ShowStorage[renderArray[i-1]]["showID"],ShowStorage[renderArray[i-1]]["showTitle"],i-1,isActive);playlistCode=playlistCode+tempEntry}}else{for(i=0;i<renderArray.size();i++){isActive=((this.lastPlayedVideoIndex==i&&this.lastPlayedVideoPlaylist==this.currentPlaylist)?true:false);tempEntry=this.generateTempEntry(i,ShowStorage[renderArray[i]]["showID"],ShowStorage[renderArray[i]]["showTitle"],i,isActive);playlistCode=playlistCode+tempEntry}}$("playing_content").update(playlistCode);if(A==true){new Effect.Appear("playing_content",{duration:0.3})}},updatePlaylistAfterAdd:function(A){renderArray=[];if(this.currentPlaylist=="userPlaylist"){renderArray=this.userPlaylist}else{if(this.currentPlaylist=="channelPlaylist"){renderArray=this.channelPlaylist}else{if(this.currentPlaylist=="liveStreamPlaylist"){renderArray=this.liveStreamPlaylist}}}newEntry=this.generateTempEntry(renderArray.size()-1,ShowStorage[A]["showID"],ShowStorage[A]["showTitle"],renderArray.size()-1,false);new Insertion.Bottom("playing_content",newEntry);new Effect.SlideDown("playlist_user_"+(renderArray.size()-1),{duration:0,afterFinish:function(){$("playing_content").scrollTop=renderArray.size()*100}})}};var SectionsBar=new Class.create();SectionsBar.prototype={lastSelectedSection:"",selectedTab:"",defaultTab:"",selectedTabOriginalWidth:100,size:0,thisObjectName:"",masterDivName:"",selectedTabWidth:"150",addFixedWidth:false,fixedWidth:"50",additionalContent:"",renderDIV:"",initialize:function(A,B,C,D){this.thisObjectName=A;this.masterDivName=B;this.renderDIV=C;this.sectionNames=[];this.sectionDivs=[];this.sectionSpans=[];this.sectionID=[];if(!Object.isUndefined(D.selectedTabWidth)){this.selectedTabWidth=D.selectedTabWidth}if(!Object.isUndefined(D.fixedWidth)){this.fixedWidth=D.fixedWidth}if(!Object.isUndefined(D.addFixedWidth)){this.addFixedWidth=D.addFixedWidth}if(!Object.isUndefined(D.onTabClick)){this.onTabClick=D.onTabClick}if(!Object.isUndefined(D.additionalContent)){this.additionalContent=D.additionalContent}},selectTab:function(A){if(this.selectedTab==A){return }this.clearSelected();for(i=0;i<this.size;i++){if(this.sectionID[i]==A){this.selectedTabOriginalWidth=$(this.sectionSpans[i]).getWidth();$(this.sectionDivs[i]).addClassName("current");param="x: "+(this.selectedTabWidth-$(this.sectionSpans[i]).getWidth());if(this.addFixedWidth){param="x: "+this.fixedWidth}new Effect.MoveAndReSize(this.sectionSpans[i],{resize:[param],duration:0.2});this.selectedTab=A;this.onTabClick(A);return }}return },clearSelected:function(){resizeDownIndex=-1;for(i=0;i<this.size;i++){$(this.sectionSpans[i]).setStyle({width:"auto"});$(this.sectionDivs[i]).removeClassName("current")}},addTab:function(B,A){this.sectionNames[this.size]=B;this.sectionDivs[this.size]="div_"+this.thisObjectName+"_"+B;this.sectionSpans[this.size]="span_"+this.thisObjectName+"_"+B;this.sectionID[this.size]=A;this.size++},getSelectedTab:function(){return this.selectedTab},renderToDiv:function(){code='<div id="'+this.masterDivName+'" style="display: none"><ul>';for(i=0;i<this.size;i++){code=code+'<li id="'+this.sectionDivs[i]+'"><a href="javascript: '+this.thisObjectName+".selectTab('"+this.sectionID[i]+'\');"><span id="'+this.sectionSpans[i]+'">'+this.sectionNames[i]+"</span></a></li>"+this.additionalContent}code=code+"</ul></div>";$(this.renderDIV).update(code);new Effect.Appear(this.masterDivName,{duration:0.3,afterFinish:this.selectDefaultTab.bind(this)})},updateTabText:function(A,B){for(i=0;i<this.size;i++){if(this.sectionID[i]==A){$(this.sectionSpans[i]).update(B);return }}},getTabName:function(A){for(i=0;i<this.size;i++){if(this.sectionID[i]==A){return this.sectionNames[i]}}},setDefaultTab:function(A){this.defaultTab=A},selectDefaultTab:function(){this.selectTab(this.defaultTab)},onTabClick:function(A){}};var ArchivePane=Class.create();ArchivePane.prototype={paneDiv:"",initialize:function(){this.panes=[];this.paneInitialized=[]},openPane:function(A){this.renderLoadingAnimation();if(A=="sections"){pane_Sections.renderToDiv();return }if(A=="comments"){pane_Comments.renderToDiv();return }if(A=="search"){pane_Search.renderToDiv();return }pane_Custom.displayForTag(A)},renderLoadingAnimation:function(){$("program").update('<div style="position:absolute; top:120px; left:430px;"><img src="loader.gif"/></div>')}};var CommunicationRequest=Class.create();CommunicationRequest.prototype={stationName:"",request:"/common/videobrowser/scripts/archive.php",errorString:"NO_TV_STATION",tvStationObj:null,initialize:function(A){this.tvStationObj=A;this.stationName=A.getName();this.request=this.request+"?TVStation="+A.getName()},getEditorSections:function(){this.updateEditorSections("")},updateEditorSections:function(A){if(this.tvStationObj.getShowCommentsPane()==true){sections.addTab(Locale.comments,"comments")}data=Startup.editors_sections;for(i=0;i<data.length;i++){sections.addTab(data[i].getElementsByTagName("editorssectionName")[0].childNodes[0].nodeValue.escapeHTML(),"tab"+i)}sections.addTab(Locale.byCategory,"sections");sections.addTab(Locale.searchEngine,"search");sections.setDefaultTab("sections");sections.renderToDiv()},getVideoSections:function(){this.updateVideoSections("")},updateVideoSections:function(A){pane_Sections.clear();data=Startup.video_sections;for(i=0;i<data.length;i++){pane_Sections.add(data[i].getElementsByTagName("videoSectionName")[0].childNodes[0].nodeValue.escapeHTML())}pane_Sections.updateVideoSections()}};var Pane_Sections=Class.create();Pane_Sections.prototype={request:"/common/videobrowser/scripts/archive.php",numResults:0,selectedSection:-1,linksMenu:null,tvStationObj:null,initialize:function(A){this.request=this.request+"?TVStation="+A.getName();this.sections=[];this.visibleShows=[];this.tvStationObj=A;this.linksMenu=new LinksMenu(0,18,"pane_Sections")},goToPage:function(A){},clear:function(){this.sections=[]},add:function(A){this.sections[this.sections.length]=A},count:function(){return this.sections.length},get:function(A){return this.sections[A]},goToPage:function(A){this.linksMenu.goToPage(A);this.displayResults(this.selectedSection)},displayInitialResultSet:function(){$("program_content_class").hide();this.visibleShows=[];this.selectedSection=-1;generatedResults="";showsNode=Startup.shows;ignoredShows=[];for(i=0;i<showsNode.length;i++){showNode=showsNode[i];showID=showStorageControl.updateShowByXMLNode(showNode,false);showDateCreated=showNode.getAttribute("created").escapeHTML();if(showDateCreated.indexOf("1970")!=-1){showDateCreated=""}showTitle=showNode.getElementsByTagName("showname")[0].childNodes[0].nodeValue.escapeHTML();showHasSnapshot=showNode.getAttribute("hasSnapshot");showSection="";if(ignoredShows[showID]!="true"){ignoredShows[showID]="true";tempEntry='<li id="video1"><table class="program_tabela"><tr><td class="program_tabela_slika">'+(showHasSnapshot=="true"?"<a href=\"javascript: pane_Sections.playShow('"+showID+'\');"><img class="program_slika_rob" src="/media/'+showID+'.jpeg" width="70" height="52"></a>':"<a href=\"javascript: pane_Sections.playShow('"+showID+'\');"><img class="program_slika_rob" src="'+tvStation.getDefaultShowCover()+'" width="70" height="52"></a>')+'</td><td rowspan="2" class="program_tabela_tekst"><p><span class="program_naslov"><a href="javascript: pane_Sections.playShow(\''+showID+"');\">"+showTitle.truncate(50)+'</a></span></p><p><span class="program_datum">'+showDateCreated+'</span></p><p><span class="program_rubrika">'+showSection.truncate(17)+'</span></p></td></tr><tr><td height="15" class="gumbi"><a href="javascript: pane_Sections.addToPlaylist(\''+showID+'\');"><img class="prozorno" src="images/playlist.png" width="65" height="14"></a></td></tr></table></li>';generatedResults=generatedResults+tempEntry}}$("program_content_class").update(generatedResults);new Effect.Appear("program_content_class",{duration:0.3})},displayResults:function(A){if(this.selectedSection!=A){this.linksMenu.resetMenu()}this.selectedSection=A;new Ajax.Request(this.request+"&action=getLastAddedShows&startRecord="+this.linksMenu.getStartRecord()+"&numRecords="+this.linksMenu.getNumRecords()+"&section="+this.get(A)+RND.getURLRND(),{method:"get",contentType:"application/xml",onSuccess:function(B){$("program_content_class").hide();xmlResponse=B.responseXML;generatedResults="";numHits=xmlResponse.getElementsByTagName("SearchResult")[0].getAttribute("NumResult");this.linksMenu.setNumHits(numHits);this.linksMenu.setStyle('style="width:'+($("program_content_class").getWidth()-30)+'px"');generatedResults=this.linksMenu.getLinksCode();for(i=0;i<xmlResponse.getElementsByTagName("SearchResult")[0].getElementsByTagName("show").length;i++){showNode=xmlResponse.getElementsByTagName("SearchResult")[0].getElementsByTagName("show")[i];showID=showStorageControl.updateShowByXMLNode(showNode,false);showHasSnapshot=showNode.getAttribute("hasSnapshot");showSection=showNode.getAttribute("section").escapeHTML();showDateCreated=showNode.getAttribute("created").escapeHTML();if(showDateCreated.indexOf("1970")!=-1){showDateCreated=""}showTitle=showNode.getElementsByTagName("showname")[0].childNodes[0].nodeValue.escapeHTML();tempEntry='<li id="video1"><table class="program_tabela"><tr><td class="program_tabela_slika">'+(showHasSnapshot=="true"?"<a href=\"javascript: pane_Sections.playShow('"+showID+'\');"><img class="program_slika_rob" src="/media/'+showID+'.jpeg" width="70" height="52"></a>':"<a href=\"javascript: pane_Sections.playShow('"+showID+'\');"><img class="program_slika_rob" src="'+tvStation.getDefaultShowCover()+'" width="70" height="52"></a>')+'</td><td rowspan="2" class="program_tabela_tekst"><p><span class="program_naslov"><a href="javascript: pane_Sections.playShow(\''+showID+"');\">"+showTitle.truncate(50)+'</a></span></p><p><span class="program_datum">'+showDateCreated+'</span></p><p><span class="program_rubrika">'+showSection.truncate(17)+'</span></p></td></tr><tr><td height="15" class="gumbi"><a href="javascript: pane_Sections.addToPlaylist(\''+showID+'\');"><img class="prozorno" src="images/playlist.png" width="65" height="14"></a></td></tr></table></li>';generatedResults=generatedResults+tempEntry}$("program_content_class").update(generatedResults);new Effect.Appear("program_content_class",{duration:0.3})}.bind(this)})},updateResults:function(A){},updateVideoSections:function(){xoutput='<ul class="main">';for(i=0;i<this.sections.length;i++){xoutput=xoutput+'<li><a href="javascript:pane_Sections.displayResults('+i+');">'+this.sections[i]+"</a></li>"}xoutput=xoutput+"</ul>";$("program_sidemenu").update(xoutput);this.displayInitialResultSet()},addToPlaylist:function(A){playlist.addToUserPlaylist(A)},playShow:function(A){playlist.playVideo(A,"","")},renderToDiv:function(){output='<div style="display: none" id="program_sidemenu"><ul class="main">';output=output+"</ul></div>";output=output+'<div style="display: none" id="program_content_class" class="program_content" ><ul>';output=output+"</ul></div>";$("program").update(output);communication.getVideoSections();new Effect.Appear("program_sidemenu",{duration:0.2})}};var Pane_Comments=Class.create();Pane_Comments.prototype={videoInfoPaneRef:null,tvStationObj:null,userControlObj:null,request:"/common/videobrowser/scripts/archive.php",isShowSelected:false,commentedShowID:"",initialize:function(B,C,A){this.comments=[];this.tvStationObj=B;this.videoInfoPaneRef=C;this.userControlObj=A},showComments:function(){this.commentedShowID=this.videoInfoPaneRef.getActiveShowID();this.updateComments()},updateComments:function(){new Ajax.Request(this.request+"?TVStation="+this.tvStationObj.getName()+"&action=getShowComments&showId="+this.commentedShowID+RND.getURLRND(),{method:"get",contentType:"application/xml",onSuccess:function(A){xmlResponse=A.responseXML;generatedResults="";this.comments=[];for(i=0;i<xmlResponse.getElementsByTagName("SearchResult")[0].getElementsByTagName("comment").length;i++){commentNode=xmlResponse.getElementsByTagName("SearchResult")[0].getElementsByTagName("comment")[i];commentEntry=[];commentEntry.commentUser=commentNode.getElementsByTagName("userUsername")[0].childNodes[0].nodeValue.escapeHTML();commentEntry.commentDate=commentNode.getElementsByTagName("added")[0].childNodes[0].nodeValue.escapeHTML();commentEntry.commentText=(commentNode.getElementsByTagName("commentText")[0].childNodes.length>0?commentNode.getElementsByTagName("commentText")[0].childNodes[0].nodeValue.escapeHTML():"");this.comments[i]=commentEntry}this.renderToDiv()}.bind(this)})},renderToDiv:function(){if(!this.isShowSelected){this.showComments();this.isShowSelected=true;return }output='<div id="program_sidemenu"><table class="program_tabela_video"><tr><td class="program_tabela_slika"><a href="javascript: void(0);"><img src="/media/'+this.commentedShowID+'.jpeg" alt="" width="70" height="52" class="program_slika_rob"></a></td><td ><p><span class="program_naslov">'+ShowStorage[this.commentedShowID]["showTitle"]+"</span></p><p>"+ShowStorage[this.commentedShowID]["showDateCreated"]+'</p><p><span class="program_rubrika">'+ShowStorage[this.commentedShowID]["showSection"]+'</span></p></td></tr><tr><td colspan="2"><span class="program_tabela_opis">'+ShowStorage[this.commentedShowID]["showDescription"]+"</span></td></tr></table></div>";this.tempContent="";for(i=0;i<this.comments.size();i++){this.tempContent=this.tempContent+'<table class="kometarji_tabela" border="0"><tr><td>Od: <a href="#">'+this.comments[i]["commentUser"]+"</a></td><td>"+this.comments[i]["commentDate"]+'</td></tr><tr><td colspan="2">'+this.comments[i]["commentText"]+"</td></tr></table>"}if(this.comments.size()==0){this.tempContent='<p align="center"><br/>Trenutno se ni komentarjev! Bodite prvi in povejte svoje mnenje o posnteku "'+ShowStorage[this.commentedShowID]["showTitle"]+'".<br/></p>'}output=output+'<div style="display: none" id="program_content_class" class="program_content" >';if(this.userControlObj.isUserLoggedIn()==false){output=output+'<table class="kometarji_tabela" border="0"><tbody><tr><td align="center" valign="middle"><p><br>        Za komentiranje morate biti prijavljeni!<br><br></p></td></tr></tbody></table>'}else{dateObj=new Date();output=output+'<table class="kometarji_tabela" border="0"> <tbody><tr><td>Od: <a href="javascript: void(0);">'+this.userControlObj.getUsername()+"</a></td><td>Datum: "+dateObj.getFullYear()+"-"+(dateObj.getMonth()+1)+"-"+dateObj.getDate()+'</td></tr><tr><td colspan="2" align="left" valign="top"><p><br><div id="comments_textarea"></div><!--textarea name="textarea" id="textarea" cols="70" rows="5"></textarea--></p><p><br><!--input type="reset" name="Reset" id="button" value="Reset"--><input type="submit" name="Submit" id="buttonSubmitComment" value="Poslji" onclick="javascript: userControl.addComment(\''+this.commentedShowID+"');\"><br><br></p></td></tr></tbody></table>"}output=output+this.tempContent;output=output+"</div>";$("program").update(output);if(this.userControlObj.isUserLoggedIn()==true){$("comments_textarea").update(new Element("textarea",{id:"commentText",name:"commentText",cols:"70",rows:"5"}))}new Effect.Appear("program_sidemenu",{duration:0.2});new Effect.Appear("program_content_class",{duration:0.3})}};var Pane_Search=Class.create();Pane_Search.prototype={output:'<div id="program_content_class" class="program_content_full" style="display: none">Za iskanje uporabite iskalnik na desni strani.</div>',tvStationName:"",request:"/common/videobrowser/scripts/archive.php",linksMenu:null,searchString:"",initialize:function(A){this.tvStationName=A.getName();this.linksMenu=new LinksMenu(0,20,"pane_Search")},startup:function(A){this.output='<div id="program_content_class" class="program_content_full" style="display: none">'+A+"</div>"},goToPage:function(A){this.linksMenu.goToPage(A);this.doUpdatePane()},doUpdatePane:function(){new Ajax.Request(this.request+"?TVStation="+this.tvStationName+"&action=getResultSet&numRecords="+this.linksMenu.getNumRecords()+"&startRecord="+this.linksMenu.getStartRecord()+"&search="+this.searchString+RND.getURLRND(),{method:"get",contentType:"application/xml",onSuccess:function(A){xmlResponse=A.responseXML;generatedResults="";numHits=xmlResponse.getElementsByTagName("SearchResult")[0].getAttribute("NumResult");this.linksMenu.setNumHits(numHits);for(i=0;i<xmlResponse.getElementsByTagName("SearchResult")[0].getElementsByTagName("show").length;i++){showNode=xmlResponse.getElementsByTagName("SearchResult")[0].getElementsByTagName("show")[i];showID=showStorageControl.updateShowByXMLNode(showNode,false);showHasSnapshot=showNode.getAttribute("hasSnapshot");showSection=showNode.getAttribute("section").escapeHTML();showDateCreated=showNode.getAttribute("created").escapeHTML();if(showDateCreated.indexOf("1970")!=-1){showDateCreated=""}showTitle=showNode.getElementsByTagName("showname")[0].childNodes[0].nodeValue.escapeHTML();tempEntry='<li id="video1"><table class="program_tabela"><tr><td class="program_tabela_slika">'+(showHasSnapshot=="true"?"<a href=\"javascript: pane_Sections.playShow('"+showID+'\');"><img class="program_slika_rob" src="/media/'+showID+'.jpeg" width="70" height="52"></a>':"<a href=\"javascript: pane_Sections.playShow('"+showID+'\');"><img class="program_slika_rob" src="'+tvStation.getDefaultShowCover()+'" width="70" height="52"></a>')+'</td><td rowspan="2" class="program_tabela_tekst"><p><span class="program_naslov"><a href="javascript: pane_Sections.playShow(\''+showID+"');\">"+showTitle+'</a></span></p><p><span class="program_datum">'+showDateCreated+'</span></p><p><span class="program_rubrika">'+showSection.truncate(17)+'</span></p></td></tr><tr><td height="15" class="gumbi"><a href="javascript: pane_Sections.addToPlaylist(\''+showID+'\');"><img class="prozorno" src="images/playlist.png" width="65" height="14"></a></td></tr></table></li>';generatedResults=generatedResults+tempEntry}if(numHits=="0"){generatedResults=Locale.searchEmpty+" ( 0 )"}this.output='<div id="program_content_class" class="program_content_full" style="display: none">'+this.linksMenu.getLinksCode()+"<ul>"+generatedResults+"</ul></div>";sections.selectTab("search");sections.updateTabText("search",Locale.searchEngine+"("+numHits+")");this.renderToDiv()}.bind(this)})},doSearch:function(){this.searchString=$("searchInput").getValue();this.linksMenu.resetMenu();this.doUpdatePane()},renderToDiv:function(){$("program").update(this.output);new Effect.Appear("program_content_class",{duration:0.3})}};var LinksMenu=Class.create();LinksMenu.prototype={startRecord:0,numRecords:20,numHits:0,currentPage:1,callbackObj:"",style:"",initialize:function(B,A,C){this.startRecord=B;this.numRecords=A;this.callbackObj=C},resetMenu:function(){this.startRecord=0;this.currentPage=1},getStartRecord:function(){return this.startRecord},getNumRecords:function(){return this.numRecords},setNumHits:function(A){this.numHits=A},goToPage:function(A){this.startRecord=this.numRecords*(A-1);this.currentPage=A},setStyle:function(A){this.style=A},getLinksCode:function(){if(this.numHits<=this.numRecords){return""}numPages=Math.round(this.numHits/this.numRecords);if(numPages-(this.numHits/this.numRecords)<0){numPages=numPages+1}currentPage=this.currentPage;pagesCode='<div  id="program_search_links" '+this.style+"><p>";doDots=false;for(i=1;i<=numPages;i++){if((i<5)||(i>numPages-5)||(i>currentPage-3&&i<currentPage+3)){if(doDots==true){doDots=false;pagesCode=pagesCode+" ... "}if(i!=currentPage){pagesCode=pagesCode+'<a href="javascript: '+this.callbackObj+".goToPage("+i+');">'+i+"</a>"}else{pagesCode=pagesCode+'<a href="javascript: '+this.callbackObj+".goToPage("+i+');">['+i+"]</a>"}}else{doDots=true}}pagesCode=pagesCode+"</p></div>";return pagesCode}};var Pane_Custom=Class.create();Pane_Custom.prototype={tvName:"",request:"/common/videobrowser/scripts/archive.php",output:"",initialize:function(A){this.tvName=A.getName();this.request=this.request+"?TVStation="+A.getName()+"&action=getLastEditorsAddedShows&startRecord=0&numRecords=12&section="},displayForTag:function(A){editorSectionName=sections.getTabName(A);new Ajax.Request(this.request+editorSectionName+RND.getURLRND(),{method:"get",contentType:"application/xml",onSuccess:function(B){xmlResponse=B.responseXML;generatedResults="";numHits=xmlResponse.getElementsByTagName("SearchResult")[0].getAttribute("NumResult");for(i=0;i<xmlResponse.getElementsByTagName("SearchResult")[0].getElementsByTagName("show").length;i++){showNode=xmlResponse.getElementsByTagName("SearchResult")[0].getElementsByTagName("show")[i];showID=showStorageControl.updateShowByXMLNode(showNode,false);showHasSnapshot=showNode.getAttribute("hasSnapshot");showSection=showNode.getAttribute("section").escapeHTML();showDateCreated=showNode.getAttribute("created").escapeHTML();if(showDateCreated.indexOf("1970")!=-1){showDateCreated=""}showTitle=showNode.getElementsByTagName("showname")[0].childNodes[0].nodeValue.escapeHTML();tempEntry='<li id="video1"><table class="program_tabela"><tr><td class="program_tabela_slika">'+(showHasSnapshot=="true"?"<a href=\"javascript: pane_Sections.playShow('"+showID+'\');"><img class="program_slika_rob" src="/media/'+showID+'.jpeg" width="70" height="52"></a>':"<a href=\"javascript: pane_Sections.playShow('"+showID+'\');"><img class="program_slika_rob" src="'+tvStation.getDefaultShowCover()+'" width="70" height="52"></a>')+'</td><td rowspan="2" class="program_tabela_tekst"><p><span class="program_naslov"><a href="javascript: pane_Sections.playShow(\''+showID+"');\">"+showTitle.truncate(50)+'</a></span></p><p><span class="program_datum">'+showDateCreated+'</span></p><p><span class="program_rubrika">'+showSection.truncate(17)+'</span></p></td></tr><tr><td height="15" class="gumbi"><a href="javascript: pane_Sections.addToPlaylist(\''+showID+'\');"><img class="prozorno" src="images/playlist.png" width="65" height="14"></a></td></tr></table></li>';generatedResults=generatedResults+tempEntry}if(numHits=="0"){generatedResults="Trenutno v tem seznamu ni video posnetkov."}this.output='<div id="program_content_class" class="program_content_full" style="display: none"><ul>'+generatedResults+"</ul></div>";this.renderToDiv()}.bind(this)})},renderToDiv:function(){$("program").update(this.output);new Effect.Appear("program_content_class",{duration:0.3})}};var AdsControl=Class.create();AdsControl.prototype={tvStationObj:null,request:"/common/videobrowser/scripts/getAd.php",initialize:function(A){this.tvStationObj=A;this.getAd()},getAd:function(){new Ajax.Request(this.request+"?TVStation="+this.tvStationObj.getName()+RND.getURLRND(),{method:"get",contentType:"application/xml",onSuccess:function(A){xmlResponse=A.responseXML;adType=xmlResponse.getElementsByTagName("Ad")[0].getAttribute("type");adID=xmlResponse.getElementsByTagName("Ad")[0].getAttribute("ID");if(adType=="flash"){adLink="";adFilename=xmlResponse.getElementsByTagName("Ad")[0].getAttribute("filename");adLink=xmlResponse.getElementsByTagName("Ad")[0].getAttribute("link");this.renderFlashAd(adFilename,adLink)}if(adType=="image"){adLink=xmlResponse.getElementsByTagName("Ad")[0].getAttribute("link");adFilename=xmlResponse.getElementsByTagName("Ad")[0].getAttribute("filename");this.renderImageAd(adFilename,adLink,adID)}if(adType=="embed"){embedCode=xmlResponse.getElementsByTagName("Ad")[0].getAttribute("embedCode");this.renderEmbedAd(embedCode)}if(adType=="ext"){adLink=xmlResponse.getElementsByTagName("Ad")[0].getAttribute("link");adFilename=xmlResponse.getElementsByTagName("Ad")[0].getAttribute("filename");sourceType=xmlResponse.getElementsByTagName("Ad")[0].getAttribute("sourceType");if(sourceType=="IMG"){this.renderImageAd(adFilename,adLink,adID)}else{if(sourceType=="SWF"){this.renderFlashAd(adFilename,adLink)}}}}.bind(this)})},renderFlashAd:function(B,A){$("banner").update('<div id="flashBanner"></div>');swfobject.embedSWF("/common/util/swf/ad/WPNFlashAd.swf?swfSource="+B+"&swfTarget="+A,"flashBanner","340","269","9.0.0",false,false,false,false)},renderImageAd:function(C,B,A){$("banner").update('<a target="_blank" href="'+B+'" onclick="javascript: adsControl.adHit(\''+A+'\');"><img border="0" src="'+C+'" /></a>')},renderEmbedAd:function(A){$("banner").update(A)},adHit:function(A){new Ajax.Request(this.request+"?TVStation="+this.tvStationObj.getName()+"&action=vote&adID="+A,{method:"get"})}};var RatingSystem=Class.create();RatingSystem.prototype={defaultRating:0,lastRatingRender:0,imageOn:"zvezda_polna1.png",imageOff:"zvezda_prazna1.png",initialize:function(){},defaultRating:function(){},selectRating:function(){},setDefaultRating:function(A){this.defaultRating=A},renderDefaultRating:function(){$("showRating_1").update('<img  border="0" class="prozorno" src="'+(this.defaultRating>0.5?this.imageOn:this.imageOff)+'" width="11" height="12">');$("showRating_2").update('<img  border="0" class="prozorno" src="'+(this.defaultRating>1.5?this.imageOn:this.imageOff)+'" width="11" height="12">');$("showRating_3").update('<img  border="0" class="prozorno" src="'+(this.defaultRating>2.5?this.imageOn:this.imageOff)+'" width="11" height="12">');$("showRating_4").update('<img  border="0" class="prozorno" src="'+(this.defaultRating>3.5?this.imageOn:this.imageOff)+'" width="11" height="12">');$("showRating_5").update('<img  border="0" class="prozorno" src="'+(this.defaultRating>4.5?this.imageOn:this.imageOff)+'" width="11" height="12">');this.lastRatingRender=this.defaultRating},renderRating:function(A){if(A==this.lastRatingRender){return }$("showRating_1").update('<img  border="0" class="prozorno" src="'+(A>0.5?this.imageOn:this.imageOff)+'" width="11" height="12">');$("showRating_2").update('<img  border="0" class="prozorno" src="'+(A>1.5?this.imageOn:this.imageOff)+'" width="11" height="12">');$("showRating_3").update('<img  border="0" class="prozorno" src="'+(A>2.5?this.imageOn:this.imageOff)+'" width="11" height="12">');$("showRating_4").update('<img  border="0" class="prozorno" src="'+(A>3.5?this.imageOn:this.imageOff)+'" width="11" height="12">');$("showRating_5").update('<img  border="0" class="prozorno" src="'+(A>4.5?this.imageOn:this.imageOff)+'" width="11" height="12">');this.lastRatingRender=A}};var ratingSystem=new RatingSystem();var Cookie=Class.create();Cookie.prototype={cookieEnabled:false,initialize:function(){this.createCookie("videobrowser","wpn.tv","1");if(this.readCookie("videobrowser")!=null){this.cookieEnabled=true}},createCookie:function(C,D,E){if(E){var B=new Date();B.setTime(B.getTime()+(E*24*60*60*1000));var A="; expires="+B.toGMTString()}else{var A=""}document.cookie=C+"="+D+A+"; path=/"},readCookie:function(B){var D=B+"=";var A=document.cookie.split(";");for(var C=0;C<A.length;C++){var E=A[C];while(E.charAt(0)==" "){E=E.substring(1,E.length)}if(E.indexOf(D)==0){return E.substring(D.length,E.length)}}return null},deleteCookie:function(A){this.createCookie(A,"",-1)},isEnabled:function(){return this.cookieEnabled}};var cookie=new Cookie();var UserControl=Class.create();UserControl.prototype={state:"logged out",requestLogin:"/common/videobrowser/scripts/checkWebUser.php",requestLogout:"/common/videobrowser/scripts/logout.php",requestAddComment:"/common/videobrowser/scripts/addShowComment.php",requestRateShow:"/common/videobrowser/scripts/addShowRating.php",username:"",rndID:"",rememberMe:false,tvStationObj:null,initialize:function(A){this.tvStationObj=A;this.initGUIelements();this.rndID=cookie.readCookie("rndID");if(this.rndID==null){this.rndID=":no_cookie:"}this.username=cookie.readCookie("name");if(this.username==null){this.username=""}else{this.rememberMe=true}this.userLogin(false)},updateGUIState:function(){if(this.state=="logged in"){$("loggedIn").setStyle({display:"inline"});$("notLoggedIn").setStyle({display:"none"});$("usernameHolder").update(this.username)}if(this.state=="logged out"){$("loggedIn").setStyle({display:"none"});$("notLoggedIn").setStyle({display:"inline"})}if(!Object.isUndefined(sections)){if(sections.getSelectedTab()=="comments"){pane_Comments.renderToDiv()}}},isUserLoggedIn:function(){if(this.state=="logged in"){return true}return false},getUsername:function(){return this.username},userLogin:function(A){if(cookie.isEnabled()==false){alertSystem.displayText("Za prijavo v stran<br/>omogocite piskotke!");return }tbusername=$("username").getValue().escapeHTML();if(tbusername.length>0){this.username=tbusername}password=$("password").getValue().escapeHTML();$("password").setValue("");params="username="+this.username+"&password="+(password.length>0?password:"np")+"&TVStation="+this.tvStationObj.getName()+"&rndID="+this.rndID;new Ajax.Request(this.requestLogin,{method:"post",parameters:params,onSuccess:function(B){if(B.responseText.indexOf("WELCOME")!=-1){this.state="logged in";if(this.rememberMe==true){Try.these(function(){cookie.createCookie("name",B.responseText.split(":")[1],"7");cookie.createCookie("rndID",B.responseText.split(":")[2],"7")})}else{cookie.deleteCookie("name");cookie.deleteCookie("rndID")}this.updateGUIState();alertSystem.displayText("Prijava uspesna!")}else{if(B.responseText.indexOf("ALLREADY")!=-1){this.state="logged in";this.username=cookie.readCookie("name");Try.these(function(){if(this.username!=B.responseText.split(":")[1]&&this.username!=null){this.userLogout()}});this.updateGUIState();if(this.username==""||this.username==null){this.userLogout()}}else{if(B.responseText.indexOf("INVALID")!=-1){this.state="logged out";this.updateGUIState();if(A==true){alertSystem.displayText("Napacno uporabnisko ime ali geslo.")}}else{this.state="logged out";this.updateGUIState()}}}}.bind(this)})},userLogout:function(){new Ajax.Request(this.requestLogout,{method:"post",onSuccess:function(A){this.state="logged out";this.updateGUIState()}.bind(this)});cookie.deleteCookie("rndID");cookie.deleteCookie("name")},addComment:function(A){new Ajax.Request(this.requestAddComment+"?showID="+A+"&comment="+$("commentText").getValue(),{method:"get",onSuccess:function(B){if(B.responseText=="COMMENTED_OK"){alertSystem.displayText("Komentar je bil dodan.");if(!Object.isUndefined(sections)){if(sections.getSelectedTab()=="comments"){pane_Comments.updateComments();videoInfoPane.reloadActiveShow()}}}else{alertSystem.displayText("Prislo je do napake pri dodajanju komentarja.")}}})},rateShow:function(A){new Ajax.Request(this.requestRateShow+"?showID="+videoInfoPane.getActiveShowID()+"&rating="+A,{method:"get",onSuccess:function(B){if(B.responseText=="RATED_OK"){alertSystem.displayText("Hvala, da ste ocenili video! ");videoInfoPane.reloadActiveShow()}else{if(B.responseText=="NOT_LOGGED"){alertSystem.displayText("Za ocenjevanje morate biti prijavljeni!")}else{alertSystem.displayText("Ta video ste ze ocenili.")}}}})},initGUIelements:function(){inputPass=$("password").getValue();inputUser=$("username").getValue();if(inputPass.length>0){this.GUI_OnFocus_PasswordOverlay()}if(inputUser.length>0){this.GUI_OnFocus_UsernameInput()}},GUI_OnFocus_PasswordOverlay:function(){$("passwordTxt").setStyle({display:"none"});$("password").setStyle({display:"inline"});$("password").focus()},GUI_OnBlur_PasswordInput:function(){input=$("password").getValue();if(input.length==0){$("password").setStyle({display:"none"});$("passwordTxt").setStyle({display:"inline"})}},GUI_OnBlur_UsernameInput:function(){input=$("username").getValue();if(input.length==0){$("username").setStyle({display:"none"});$("usernameTxt").setStyle({display:"inline"})}},GUI_OnFocus_UsernameInput:function(){$("usernameTxt").setStyle({display:"none"});$("username").setStyle({display:"inline"});$("username").focus()},GUI_ShowUpload:function(){window.open("/common/upload/wpntv/?tvStation="+this.tvStationObj.getName(),"uploadFromWindow","status = 1, height = 620, width = 460, resizable = 0")},GUI_ShowFeedbackForm:function(){window.open("/common/supportForm/supportForm.php?tvStation="+this.tvStationObj.getName(),"submitErrorWindow","status = 1, height = 340, width = 460, resizable = 0")}};var RandomGenerator=Class.create();RandomGenerator.prototype={initialize:function(){},getURLRND:function(){return"&RND="+Math.random()}};RND=new RandomGenerator;var AlertSystem=Class.create();AlertSystem.prototype={isAlertUp:false,initialize:function(){},displayText:function(A){if(this.isAlertUp==true){return }this.isAlertUp=true;$("systemResponse").update(A);new Effect.Appear("systemResponse",{duration:0.2,afterFinish:this.hideText.bind(this)})},displayTextLong:function(A){if(this.isAlertUp==true){return }this.isAlertUp=true;$("systemResponse").update(A);new Effect.Appear("systemResponse",{duration:0.2,afterFinish:this.hideTextLong.bind(this)})},hideText:function(){new Effect.Fade("systemResponse",{duration:1,afterFinish:this.alertDone.bind(this)})},hideTextLong:function(){new Effect.Fade("systemResponse",{duration:5,afterFinish:this.alertDone.bind(this)})},alertDone:function(){this.isAlertUp=false}};alertSystem=new AlertSystem();Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++;$("ajaxStatus").update("Nalagam ...")},onComplete:function(){Ajax.activeRequestCount--;if(Ajax.activeRequestCount==0){$("ajaxStatus").update("")}}});var tvStation;var userControl;var videoInfoPane;var adsControl;var player;var playlist;var archivePane;var pane_Sections;var pane_Comments;var pane_Search;var pane_Custom;var sections;var playlistSections;var communication;document.observe("wpntv:load_startup_xml",function(){new Ajax.Request("/xml/startup.xml?s=1"+RND.getURLRND(),{method:"get",contentType:"application/xml",onSuccess:function(A){xmlResponse=A.responseXML;showsNode=xmlResponse.getElementsByTagName("browser")[0].getElementsByTagName("shows")[0].getElementsByTagName("show");videoSectionsNode=xmlResponse.getElementsByTagName("browser")[0].getElementsByTagName("videosections")[0].getElementsByTagName("videoscetion");editorsSectionsNode=xmlResponse.getElementsByTagName("browser")[0].getElementsByTagName("editorssections")[0].getElementsByTagName("editorssection");Startup.shows=showsNode;Startup.editors_sections=editorsSectionsNode;Startup.video_sections=videoSectionsNode;document.fire("wpntv:browserStartup")}.bind(this)})}.bind(this));document.observe("wpntv:browserStartup",function(){tvStation=new WPNTVStation(TVStationSettings);userControl=new UserControl(tvStation);videoInfoPane=new VideoInfoPane(tvStation);adsControl=new AdsControl(tvStation);player=new WPNPlayerComm(tvStation);playlist=new Playlist(tvStation);this.playingFinished=player.playingFinished.bind(player);this.playerLoaded=player.playerLoaded.bind(player);this.onShowStartPlaying=player.playingStarted.bind(player);this.youtubePlayerStateChange=player.youtubePlayerStateChange.bind(player);archivePane=new ArchivePane();archivePane.renderLoadingAnimation();pane_Sections=new Pane_Sections(tvStation);pane_Comments=new Pane_Comments(tvStation,videoInfoPane,userControl);pane_Search=new Pane_Search(tvStation);pane_Custom=new Pane_Custom(tvStation);sections=new SectionsBar("sections","filter_tabs","filtertabholder",{addFixedWidth:true,fixedWidth:"30",onTabClick:function(B){archivePane.openPane(B)}});playlistSections=new SectionsBar("playlistSections","playlist_tabs","playing_head",{selectedTabWidth:"130",onTabClick:function(B){playlist.selectPlaylist(B)}});playlistSections.addTab(Locale.actual,0);playlistSections.addTab(Locale.mySelection,1);if(tvStation.getLiveStreamEnabled()==true){playlistSections.addTab("V Zivo",2);playlist.createLiveStreamPlaylist()}playlistSections.setDefaultTab("0");playlistSections.renderToDiv();communication=new CommunicationRequest(tvStation);communication.getEditorSections();pane_Search.startup(Locale.searchEmpty);Try.these(function(){if(tvStation.getUACCT()!=""){var B=_gat._getTracker(tvStation.getUACCT());B._trackPageview()}}.bind(tvStation),function(){});Try.these(function(){var B=_gat._getTracker("UA-2486047-43");B._setDomainName("none");B._setAllowLinker(true);B._trackPageview()},function(){});var A=new SwitchBar(tvStation.getSwitchbarIcons());if(tvStation.getSwitchbarHasCustomColor()){A.setColor(tvStation.getSwitchbarCustomColor())}A.renderFlashBrowser()}.bind(this));Event.observe(window,"load",function(){if(!Object.isUndefined(TVStationSettings.locale)){localization=new Localization(TVStationSettings.locale,function(){document.fire("wpntv:load_startup_xml",{})})}else{localization=new Localization("default",function(){document.fire("wpntv:load_startup_xml",{})})}}.bind(this));