function PVS_LoadComponents(){
var _1=pvs.getConfig().getSystemURL("BasePVS");
pvs.loadComponents.apply(pvs);
if($("VideoPlayer")&&$("VideoEngine")){
Element.setStyle($("VideoPlayer"),{position:"absolute"});
Element.setStyle($("VideoEngine"),{position:"absolute",left:"-10px",top:"-10px"});
var _2=pvs.getConfig().getSystemURL("GTVDisplayXML");
var _3=pvs.getConfig().getSystemURL("GTVEngineXML");
var _4=pvs.getConfig().getSystemParam("GTVWindowMode","value");
gtv=new GTV(this);
gtv.embedDisplay("VideoPlayer",_1+"pvs/lib/swf/gdisplay.swf",_2,_4);
gtv.embedEngine("VideoEngine",_1+"pvs/lib/swf/gengine.swf",_3);
gtv.registerMethod("onClientInitialized",pvs.eventOnGTVInitialized.bind(pvs));
gtv.registerMethod("onChannels",pvs.eventOnGTVChannelsLoaded.bind(pvs));
gtv.registerMethod("onContentLoaded",pvs.eventOnGTVContentLoaded.bind(pvs));
gtv.registerMethod("onPlayStarted",pvs.eventOnGTVPlayingContent.bind(pvs));
gtv.registerMethod("onPlayingSegment",pvs.eventOnGTVPlayingSegment.bind(pvs));
gtv.registerMethod("onDefaultPlaying",pvs.eventOnGTVDefaultPlaying.bind(pvs));
gtv.registerMethod("onAncestry",pvs.eventOnGTVAncestryLoaded.bind(pvs));
gtv.registerMethod("onAdPlaying",pvs.eventOnGTVAdPlaying.bind(pvs));
gtv.registerMethod("onAdEnd",pvs.eventOnGTVAdEnd.bind(pvs));
gtv.registerMethod("setAdBanner",pvs.eventOnGTVSetAdBanner.bind(pvs));
gtv.registerMethod("resize",pvs.eventOnGTVResize.bind(pvs));
gtv.registerMethod("onStreamTimeout",pvs.eventOnGTVErrorStreamTimeout.bind(pvs));
gtv.registerMethod("onStreamNotFound",pvs.eventOnGTVErrorStreamNotFound.bind(pvs));
gtv.registerMethod("onChannelLoadError",pvs.eventOnGTVErrorChannelLoad.bind(pvs));
gtv.registerMethod("onDeepLinkError",pvs.eventOnGTVErrorDeepLink.bind(pvs));
gtv.registerMethod("onContentLoadError",pvs.eventOnGTVErrorContentLoad.bind(pvs));
}
}
function PVS_OnLoad(){
pvs.eventPageLoadComplete();
}
var PVS=Class.create();
PVS.prototype={initialize:function(){
this.oComponents={HORICHANNELS:"HoriChannels",ARROWNAV:"ArrowNav",PLAYCURRENTLEVELBUTTON:"PlayCurrentLevelButton",GOTOPLAYINGLEVELBUTTON:"GoToPlayingLevelButton",THREEHUNDREDBYTWOFIFTYAD:"ThreeHundredByTwoFiftyAd",LEVELTITLE:"LevelTitle",SHAREURLBOX:"ShareURLBox",EMBEDCODEBOX:"EmbedCodeBox",GOUPBUTTON:"GoUpButton",NOWPLAYINGPRIMARYDETAIL:"NowPlayingPrimaryDetail",NOWPLAYINGSECONDARYDETAIL:"NowPlayingSecondaryDetail",SHAREVIDEOBUTTONS:"ShareVideoButtons"};
this.cfg=null;
this.winDebug=null;
this.nActiveComponents=0;
this.aComponents=new Array();
this.aComponentIndex=new Array();
this.aGTVChannels=new Array();
this.aChannels=new Array();
this.oCurrentChannel=null;
this.aChannelStyleElements=new Array();
this.sCurrentChannelStyle=null;
this.bLoadPage=false;
this.bLoadChannels=false;
this.bLoadComponents=false;
this.bMaximized=false;
this.bPlayingDeepLink=false;
this.userProfile=null;
this.aProfMixes=new Array();
this.oCurrentLevel=null;
this.aCurrentLevelContent=null;
this.oCurrentPlaying=null;
this.aCurrentPlayingLevelContent=null;
this.oCurrentPlayingLevelParent=null;
this.aGoingUpContent=null;
this.oGoingUpParent=null;
this.CONTENTTYPE_SEARCH="#Search#";
this.CONTENTTYPE_SEARCHRESULT_PLAYLIST="#SearchPlaylist#";
this.CONTENTTYPE_SEARCHRESULT_SEGMENT="#SearchSegment#";
this.CONTENTTYPE_GPL="#GPL#";
this.CONTENTTYPE_PROFMIXREF="#ProfMixRef#";
this.CONTENTTYPE_PROFMIX="#ProfMix#";
this.CONTENTTYPE_PROFMIXSEGMENT="#ProfMixSegment#";
this.fnGTVContentLoadedHandler=null;
this.fnGTVAncestryLoadedHandler=null;
this.sLogLevel=null;
var _5=""+window.location;
var _6=_5.toQueryParams();
if(_6.loglevel){
if(_6.loglevel=="info"){
this.sLogLevel="info";
}else{
if(_6.loglevel=="debug"){
this.sLogLevel="debug";
}
}
}
},getChannels:function(){
return this.aChannels;
},getChannelByName:function(_7){
var _8=null;
this.aChannels.each(function(_9){
if(_9.getTitle()==_7){
_8=_9;
}
});
return _8;
},getChannelIndexByName:function(_a){
var _b=null;
var _c=0;
this.aChannels.each(function(_d){
if(_d.getTitle()==_a){
_b=_c;
}
_c++;
});
return _b;
},getCurrentChannel:function(){
return this.oCurrentChannel;
},setCurrentChannel:function(_e){
this.oCurrentChannel=_e;
},getCurrentVideo:function(){
return this.oCurrentPlaying;
},setCurrentVideo:function(_f){
this.oCurrentPlaying=_f;
},getCurrentPlayingLevelContent:function(){
return this.aCurrentPlayingLevelContent;
},setCurrentPlayingLevelContent:function(_10){
this.aCurrentPlayingLevelContent=_10;
},getCurrentPlayingLevelParent:function(){
return this.oCurrentPlayingLevelParent;
},setCurrentPlayingLevelParent:function(_11){
this.oCurrentPlayingLevelParent=_11;
},getGoingUpContent:function(){
return this.aGoingUpContent;
},setGoingUpContent:function(_12){
this.aGoingUpContent=_12;
},getGoingUpParent:function(){
return this.oGoingUpParent;
},setGoingUpParent:function(_13){
this.oGoingUpParent=_13;
},hasDeepLink:function(){
var _14=""+window.location;
var _15=_14.toQueryParams();
return (_15.c||_15.p);
},isCurrentLevel:function(_16){
return (this.oCurrentLevel==_16);
},loadConfiguration:function(_17){
new Ajax.Request(_17,{parameters:"ck="+Math.random(),method:"get",asynchronous:false,onSuccess:function(_18){
if(_18.responseText){
var _19=Sarissa.getDomDocument();
_19=(new DOMParser()).parseFromString(_18.responseText,"text/xml");
_19.setProperty("SelectionLanguage","XPath");
var cfg=new PVSConfig();
cfg.setDocument(_19);
pvs.setConfig(cfg);
return true;
}
},onFailure:function(){
}});
return false;
},setConfig:function(cfg){
this.cfg=cfg;
},getConfig:function(){
return this.cfg;
},loadComponents:function(){
var _1c=this.getConfig().getSystemURL("BasePVS");
var _1d=this;
var _1e=Object.keys(this.oComponents);
_1e.each(function(_1f){
if($(_1d.oComponents[_1f])){
_1d.nActiveComponents++;
_1d.includeJS(_1c+"pvs/components/"+_1d.oComponents[_1f]+"/component.js");
_1d.includeCSS(_1c+"pvs/components/"+_1d.oComponents[_1f]+"/component.css");
}
});
if(this.nActiveComponents==0){
this.bLoadComponents=true;
}
},registerComponent:function(_20){
this.aComponents.push(_20);
this.aComponentIndex[_20.getName()]=_20;
if(this.aComponents.length==this.nActiveComponents){
this.bLoadComponents=true;
this.handleAppInit();
}
},getComponent:function(_21){
return this.aComponentIndex[_21];
},eventPageLoadComplete:function(){
this.bLoadPage=true;
this.handleAppInit();
},eventOnGTVInitialized:function(){
this.setVideoPlayerStyles();
gtv.getChannels();
},eventOnGTVChannelsLoaded:function(_22){
this.aGTVChannels=_22;
this.bLoadChannels=true;
this.handleAppInit();
},handleAppInit:function(){
if(this.bLoadPage&&this.bLoadChannels&&this.bLoadComponents){
pvs.eventOnAppReady();
}
},eventOnAppReady:function(){
var _23=this;
this.aGTVChannels.each(function(_24){
_23.actionAddChannel(_24);
});
var _25=this.actionLoadDeepLink();
if(!_25){
var _26=this.getChannels();
if(_26.length>0){
_26[0].open();
}
}
this.relayEvent("eventOnAppReady",new Array());
try{
var _27=this.readCookie("email");
var _28=this.readCookie("pw");
if(this.isValidEmail(_27)&&_28.length>0){
this.log("eventOnAppReady() Auto login for: "+_27);
this.actionLogin(_27,_28);
}else{
this.log("eventOnAppReady() No auto login");
}
}
catch(e){
this.logError("eventOnAppReady() Auto login: "+e.message);
}
},eventOnGTVDefaultPlaying:function(){
this.relayEvent("eventStoppedPlaying");
},eventOnGTVContentLoaded:function(_29){
if(this.fnGTVContentLoadedHandler!=null){
this.fnGTVContentLoadedHandler(_29);
}else{
this.relayEvent("eventOnGTVContentLoaded",new Array(_29));
}
},eventOnGTVAncestryLoaded:function(_2a){
if(this.fnGTVAncestryLoadedHandler!=null){
this.fnGTVAncestryLoadedHandler(_2a);
}else{
this.relayEvent("eventOnGTVAncestryLoaded",new Array(_2a));
}
},eventOnGTVSetAdBanner:function(_2b,_2c){
this.relayEvent("eventOnGTVSetAdBanner",new Array(_2b,_2c));
},eventOnGTVAdPlaying:function(){
this.relayEvent("eventAdPlaying");
},eventOnGTVAdEnd:function(){
this.relayEvent("eventAdStopped");
},eventOnGTVResize:function(){
try{
if(!this.bMaximized){
var eVP=$("VideoPlayer");
var _2e=Position.cumulativeOffset(eVP);
var _2f=-(_2e[0]);
var _30=-(_2e[1]);
var _31=this.getScrollPos();
_30+=_31.top;
_2f+=_31.left;
var _32=this.getBrowserDimensions();
var _33=(document.all)?0:16;
if(_31.top>0){
_32.w-=_33;
}
if(_31.left>0){
_32.h-=_33;
}
Element.setStyle(eVP,{left:_2f+"px",top:_30+"px",width:_32.w+"px",height:_32.h+"px"});
this.relayEvent("eventVideoMaximized");
}else{
this.setVideoPlayerStyles();
this.relayEvent("eventVideoMinimized");
}
this.bMaximized=!this.bMaximized;
}
catch(e){
this.logError("eventOnGTVResize() "+e.message);
}
},eventOnGTVErrorStreamTimeout:function(){
this.relayEvent("eventVideoError");
},eventOnGTVErrorStreamNotFound:function(){
this.relayEvent("eventVideoError");
},eventOnGTVErrorDeepLink:function(){
this.relayEvent("eventVideoError");
},eventOnGTVErrorChannelLoad:function(){
this.relayEvent("eventContentError");
},eventOnGTVErrorContentLoad:function(){
this.relayEvent("eventContentError");
},eventOnGTVPlayingContent:function(_34){
this.eventNowPlaying(_34);
},eventOnGTVPlayingSegment:function(_35){
this.eventNowPlaying(_35);
},eventNowPlaying:function(_36){
if(_36!=null){
_36=this.getGTVContent(_36);
this.setCurrentVideo(_36);
this.log("eventNowPlaying() determining ancestry");
this.fnGTVContentLoadedHandler=this.onGTVEventNowPlayingLevelContent.bind(this);
gtv.getPlayingSegmentLevel();
}
},onGTVEventNowPlayingLevelContent:function(_37){
try{
if(_37!=null){
if(_37.length>0){
this.debug("onGTVEventNowPlayingLevelContent() got playing level: "+_37.length+" items");
var _38=this.getGTVContentList(_37);
this.setCurrentPlayingLevelContent(_38);
this.fnGTVAncestryLoadedHandler=this.onGTVEventNowPlayingLevelAncestry.bind(this);
gtv.getAncestry(_37[0]);
}else{
throw new Error("Playing level is empty");
}
}else{
throw new Error("No playing level received");
}
}
catch(e){
this.logError("onGTVEventNowPlayingLevelContent() "+e.message);
}
},onGTVEventNowPlayingLevelAncestry:function(_39){
try{
if(_39!=null){
this.debug("onGTVEventNowPlayingLevelAncestry() got ancestry: "+_39.length+" items");
if(_39.length>0){
var _3a=this.getGTVContent(_39[0]);
this.setCurrentPlayingLevelParent(_3a);
this.updateLevelRelationships(this.getCurrentPlayingLevelContent(),this.getCurrentPlayingLevelParent());
var _3b=this;
var _3c=this.getCurrentVideo();
if(_3c!=null){
this.getCurrentPlayingLevelContent().each(function(_3d){
if(_3d.getID()==_3c.getID()){
_3c=_3d;
throw $break;
}
});
}
this.relayEvent("eventNowPlaying",new Array(_3c));
if(this.bPlayingDeepLink){
this.log("onGTVEventNowPlayingLevelAncestry() deep link, opening playing level");
this.bPlayingDeepLink=false;
this.actionGoToPlayingLevel();
}
}else{
throw new Error("Ancestry is empty");
}
}else{
throw new Error("No ancestry received");
}
}
catch(e){
this.logError("onGTVEventNowPlayingLevelAncestry() "+e.message);
}
},eventOnLevelChange:function(_3e,_3f,_40,_41){
try{
this.aCurrentLevelContent=_3e;
this.oCurrentLevel=_3f;
this.log("eventOnLevelChange() "+_3f.getTitle()+" ("+_3f.getContentType()+") "+_3e.length+" children");
this.updateLevelRelationships(this.aCurrentLevelContent,_3f);
if(_3f.getContentType()==_3f.sTYPE_GTVCONTENT){
if(_3f.getObject().channel){
var _42=this.getChannelByName(_3f.getObject().channel);
if(_42!=null){
this.actionSetChannelContext(_42);
}
}
}
if(_40&&_3e.length==1){
var _43=this.getConfig().getSystemParam("AutoOpenSingleLevels","value");
if(_43=="true"){
if(!_41){
if(_3e[0].getCanOpen()){
_3e[0].open();
return;
}
}else{
this.actionGoUp(_3e[0]);
return;
}
}
}
this.relayEvent("eventOnLevelChange",new Array(this.aCurrentLevelContent,this.oCurrentLevel));
this.relayEvent("eventContentLoaded",new Array(this.aCurrentLevelContent,this.oCurrentLevel));
}
catch(e){
this.logError("eventOnLevelChange() "+e.message);
throw e;
}
},updateLevelRelationships:function(_44,_45){
try{
this.log("updateLevelRelationships()");
var _46=0;
_44.each(function(_47){
_47.setParent(_45);
_47.setSiblings(_44,_46);
_46++;
});
_45.setChildren(_44);
}
catch(e){
this.logError("updateLevelRelationships() "+e.message);
throw e;
}
},actionAddChannelStyleElement:function(_48){
this.aChannelStyleElements.push(_48);
},actionAddChannel:function(_49){
this.log("actionAddChannel() adding: "+_49);
var _4a=new Channel(this);
_4a.setTitle(_49);
this.aChannels.push(_4a);
this.relayEvent("eventOnChannelAdded",new Array(_4a));
return _4a;
},actionRemoveChannel:function(_4b){
try{
this.log("actionRemoveChannel() removing: "+_4b.getTitle());
var _4c=this.getChannelIndexByName(_4b.getTitle());
if(_4c!=null){
var _4d=(_4b==this.getCurrentChannel());
this.aChannels.splice(_4c,1);
this.relayEvent("eventOnChannelRemoved",new Array(_4b));
if(_4d){
if(this.aChannels.length>0){
this.aChannels[0].open();
}
}
}else{
throw new Error("Could not find channel: "+_4b.getTitle());
}
}
catch(e){
this.logError("actionRemoveChannel() "+e.message);
}
},actionSetChannelContext:function(_4e){
if(_4e!=this.getCurrentChannel()){
if(this.aChannelStyleElements.length>0){
var _4f=_4e.getCSSClassName();
for(var x=0;x<this.aChannelStyleElements.length;x++){
Element.addClassName(this.aChannelStyleElements[x],_4f);
}
if(this.sCurrentChannelStyle!=null){
for(var x=0;x<this.aChannelStyleElements.length;x++){
Element.removeClassName(this.aChannelStyleElements[x],this.sCurrentChannelStyle);
}
this.sCurrentChannelStyle=null;
}
this.sCurrentChannelStyle=_4f;
}
this.setCurrentChannel(_4e);
gtv.setDefaultFLVChannel(_4e.getTitle());
this.relayEvent("eventOnChannelSwitch",new Array(_4e));
}
},actionPlayCurrentLevel:function(){
if(this.oCurrentLevel!=null){
if(this.oCurrentLevel.getCanPlay()){
this.oCurrentLevel.play();
}
}
},actionHideVideoPlayer:function(){
var _51=-1000;
var _52=-1000;
var _53=40;
var _54=30;
Element.setStyle($("VideoPlayer"),{left:_51+"px",top:_52+"px",width:_53+"px",height:_54+"px"});
},actionRestoreVideoPlayer:function(){
this.setVideoPlayerStyles();
},actionLoadDeepLink:function(){
var _55=false;
try{
var _56=""+window.location;
var _57=_56.toQueryParams();
if(_57.p&&_57.s){
this.bPlayingDeepLink=true;
_55=true;
var c=(_57.c)?_57.c:null;
var p=(_57.p)?_57.p:null;
var s=(_57.s)?_57.s:null;
var r=(_57.r)?_57.r:null;
var i=(_57.i)?_57.i:null;
gtv.playDeepLink(c,r,p,s,i);
}else{
if(_57.c){
var _5d=this.getChannels();
_5d.each(function(_5e){
if(_5e.getTitle()==_57.c){
_55=true;
_5e.open();
}
});
}
}
return _55;
}
catch(e){
this.logError("actionLoadDeepLink() "+e.message);
return false;
}
},actionGoToPlayingLevel:function(){
this.log("actionGoToPlayingLevel()");
this.fnGTVContentLoadedHandler=this.onGTVPlayingLevelContent.bind(this);
gtv.getPlayingSegmentLevel();
},onGTVPlayingLevelContent:function(_5f){
try{
if(_5f!=null){
if(_5f.length>0){
this.log("onGTVPlayingLevelContent() got playing level: "+_5f.length+" items");
var _60=this.getGTVContentList(_5f);
this.setCurrentPlayingLevelContent(_60);
this.fnGTVAncestryLoadedHandler=this.onGTVPlayingLevelAncestry.bind(this);
gtv.getAncestry(_5f[0]);
}else{
throw new Error("Playing level is empty");
}
}else{
throw new Error("No playing level received");
}
}
catch(e){
this.logError("onGTVPlayingLevelContent() "+e.message);
}
},onGTVPlayingLevelAncestry:function(_61){
try{
if(_61!=null){
this.log("onGTVPlayingLevelAncestry() got ancestry: "+_61.length+" items");
if(_61.length>0){
var _62=this.getGTVContent(_61[0]);
this.setCurrentPlayingLevelParent(_62);
this.eventOnLevelChange(this.getCurrentPlayingLevelContent(),this.getCurrentPlayingLevelParent(),false);
}else{
throw new Error("Ancestry is empty");
}
}else{
throw new Error("No ancestry received");
}
}
catch(e){
this.logError("onGTVPlayingLevelAncestry() "+e.message);
}
},actionGoUp:function(_63){
try{
if(_63==null){
_63=this.oCurrentLevel;
}
if(_63!=null){
if(_63.getHasParent()){
var _64=this.oCurrentLevel.getSiblings();
var _65=this.oCurrentLevel.getParent();
this.eventOnLevelChange(_64,_65,true,true);
}else{
if(_63.getContentType()==_63.sTYPE_SEARCH){
throw new Error("Top of search result");
}else{
if(_63.getContentType()==_63.sTYPE_GTVCONTENT){
this.fnGTVAncestryLoadedHandler=this.onGTVGoingUpAncestry.bind(this);
gtv.getAncestry(_63.getObject());
}
}
}
}else{
throw new Error("No content to go up from");
}
}
catch(e){
this.logError("actionGoUp() "+e.message);
if(this.getCurrentChannel()!=null){
this.getCurrentChannel().open();
}
}
},onGTVGoingUpAncestry:function(_66){
try{
if(_66!=null){
this.log("onGTVGoingUpAncestry() got ancestry: "+_66.length+" items");
if(_66.length>0){
var _67=this.getGTVContent(_66[0]);
this.setGoingUpParent(_67);
this.fnGTVContentLoadedHandler=this.onGTVGoingUpContentLoaded.bind(this);
gtv.openContent(_66[0]);
}else{
throw new Error("Ancestry is empty");
}
}else{
throw new Error("No ancestry received");
}
}
catch(e){
this.logError("onGTVGoingUpAncestry() "+e.message);
if(this.getCurrentChannel()!=null){
this.getCurrentChannel().open();
}
}
},onGTVGoingUpContentLoaded:function(_68){
try{
if(_68!=null){
this.log("onGTVGoingUpContentLoaded() got content: "+_68.length+" items");
var _69=this.getGTVContentList(_68);
this.setGoingUpContent(_69);
this.eventOnLevelChange(this.getGoingUpContent(),this.getGoingUpParent(),true,true);
}else{
throw new Error("No ancestry received");
}
}
catch(e){
this.logError("onGTVGoingUpContentLoaded() "+e.message);
if(this.getCurrentChannel()!=null){
this.getCurrentChannel().open();
}
}
},isLoggedIn:function(){
return (this.userProfile!=null);
},getUserProfile:function(){
return (this.isLoggedIn())?this.userProfile:null;
},actionLogin:function(_6a,_6b,_6c,_6d){
try{
if(!this.isLoggedIn()){
var _6e=new UserProfile();
_6e.setEmail(_6a);
_6e.setUserPW(_6b);
var _6f=this.getConfig().getSystemParam("Operator","value");
var _70=this.getConfig().getSystemURL("GWebservice");
var _71=this.getConfig().getSystemURL("AjaxBridge");
var _72=new UserLoginRequest();
_72.setOperator(_6f);
_72.setServerURL(_70);
_72.setBridgeURL(_71);
_72.setResponseHandlers(this.eventOnLoginSuccess.bind(this),this.eventOnLoginFailed.bind(this));
_72.addResponseParams(new Array(_6c,_6d,_6b));
_72.setUserProfile(_6e);
_72.send();
}else{
throw new Error("User is already logged in");
}
}
catch(e){
this.logError("actionLogin() "+e.message);
this.eventOnLoginFailed(_6c,_6d);
}
},eventOnLoginSuccess:function(_73,_74,_75,_76){
this.setupUser(_73,_76);
this.relayEvent("eventOnUserLogin");
if(_74!=null){
_74();
}
},eventOnLoginFailed:function(_77,_78){
this.log("eventOnLoginFailed()");
if(_78!=null){
_78();
}
},actionRegister:function(_79,_7a,_7b,_7c,_7d,_7e,_7f,_80,_81,_82){
try{
if(!this.isLoggedIn()){
var _83=new UserProfile();
_83.setEmail(_79);
_83.setUserPW(_7a);
_83.setUserName(_7b);
_83.setFirstName(_7c);
_83.setLastName(_7d);
_83.setDOB(_7e);
_83.setZip(_7f);
_83.setNewsletter(_80);
var _84=this.getConfig().getSystemParam("Operator","value");
var _85=this.getConfig().getSystemURL("GWebservice");
var _86=this.getConfig().getSystemURL("AjaxBridge");
var _87=new UserRegisterRequest();
_87.setOperator(_84);
_87.setServerURL(_85);
_87.setBridgeURL(_86);
_87.setResponseHandlers(this.eventOnRegisterSuccess.bind(this),this.eventOnRegisterFailed.bind(this));
_87.addResponseParams(new Array(_81,_82,_7a));
_87.setUserProfile(_83);
_87.send();
}else{
throw new Error("User is already logged in");
}
}
catch(e){
this.logError("actionRegister() "+e.message);
this.eventOnRegisterFailed(_81,_82);
}
},eventOnRegisterSuccess:function(_88,_89,_8a,_8b){
this.setupUser(_88,_8b);
this.relayEvent("eventOnRegisterSuccess");
if(_89!=null){
_89();
}
},eventOnRegisterFailed:function(_8c,_8d){
this.log("eventOnRegisterFailed()");
if(_8d!=null){
_8d();
}
},setupUser:function(_8e,_8f){
this.log("setupUser() "+_8e.getUserName()+" ("+_8e.getProfMixRefs().length+" profmixes)");
this.userProfile=_8e;
try{
this.setCookie("email",this.userProfile.getEmail(),5,"/");
this.setCookie("pw",_8f,5,"/");
}
catch(e){
this.log("setupUser() Error storing login: "+e.message);
}
try{
var _90=new Array(),_91;
var _92=this;
_8e.getProfMixRefs().each(function(_93){
_91=new ProfMix(_92);
_91.loadFromGPLRef(_93);
_90.push(_91);
});
this.aProfMixes=_90;
}
catch(e){
this.log("setupUser() Profmixes are unavailable: "+e.message);
}
},actionLogout:function(){
if(this.isLoggedIn()){
try{
this.setCookie("email","",5,"/");
this.setCookie("pw","",5,"/");
}
catch(e){
this.log("actionLogout() Error clearing stored login: "+e.message);
}
this.userProfile=null;
this.aProfMixes=new Array();
this.relayEvent("eventOnUserLogout");
}
},actionAddProfMixChannel:function(_94){
try{
this.log("actionAddProfMixChannel() adding: "+_94);
var _95=new ProfMixChannel(this);
_95.setTitle(_94);
this.aChannels.push(_95);
this.relayEvent("eventOnChannelAdded",new Array(_95));
return _95;
}
catch(e){
this.logError("actionAddProfMixChannel() "+e.message);
throw e;
}
},actionGetProfMixes:function(){
try{
if(this.isLoggedIn()){
return this.aProfMixes;
}else{
throw new Error("User must be logged in");
}
}
catch(e){
this.logError("actionGetProfMixes() "+e.message);
throw e;
}
},actionCreateProfMix:function(_96,_97,_98,_99){
try{
if(_96!=null&&_97!=null){
if(_98==null){
_98="User Favorites";
}
if(_99==null){
_99=false;
}
this.log("actionCreateProfMix() creating profmix: "+_96);
var _9a=new ProfMixGPL();
_9a.setTitle(_96);
_9a.setDescription(_97);
_9a.setCategory(_98);
_9a.setType("profmix");
_9a.setIsExplicit(_99);
var _9b=new ProfMix(this);
_9b.loadFromGPL(_9a);
this.aProfMixes.push(_9b);
return _9b;
}else{
throw new Error("Must provide name and description");
}
}
catch(e){
this.logError("actionCreateProfMix() "+e.message);
throw e;
}
},eventProfMixContentAdded:function(_9c,_9d,_9e){
this.relayEvent("eventProfMixContentAdded",new Array(_9c,_9d,_9e));
},eventProfMixContentMoved:function(_9f,_a0,_a1,_a2){
this.relayEvent("eventProfMixContentMoved",new Array(_9f,_a0,_a1,_a2));
},eventProfMixContentRemoved:function(_a3,_a4,_a5){
this.relayEvent("eventProfMixContentRemoved",new Array(_a3,_a4,_a5));
},actionSendToAFriend:function(_a6,_a7,_a8,_a9,_aa,_ab){
try{
if(_a6!=null){
if(_a7!=null&&this.isValidEmail(_a8)&&this.isValidEmail(_a9)){
var _ac=this.getShareURL(_a6);
var _ad=this.getConfig().getSystemParam("Operator","value");
var _ae=this.getConfig().getSystemURL("GWebservice");
var _af=this.getConfig().getSystemURL("AjaxBridge");
var _b0=new SendToAFriendRequest(_a7,_a8,_a9,_ac);
_b0.setOperator(_ad);
_b0.setServerURL(_ae);
_b0.setBridgeURL(_af);
_b0.setResponseHandlers(this.eventOnSendToAFriendSuccess.bind(this),this.eventOnSendToAFriendFailed.bind(this));
_b0.addResponseParams(new Array(_aa,_ab));
_b0.send();
return;
}else{
throw new Error("Invalid or missing inputs");
}
}else{
throw new Error("No content to send");
}
}
catch(e){
this.logError("actionSendToAFriend() "+e.message);
this.eventOnSendToAFriendFailed(_aa,_ab);
}
},eventOnSendToAFriendSuccess:function(_b1,_b2){
this.log("eventOnSendToAFriendSuccess()");
if(_b1!=null){
_b1();
}
},eventOnSendToAFriendFailed:function(_b3,_b4){
this.log("eventOnSendToAFriendFailed()");
if(_b4!=null){
_b4();
}
},actionSearch:function(_b5,_b6){
var _b7=new Search(this);
_b7.setTitle("Results for: "+_b5);
_b7.setQuery(_b5);
_b7.setClass(_b6);
_b7.open();
},getGTVContentList:function(_b8){
var _b9=new Array(),_ba;
var _bb=this;
_b8.each(function(_bc){
_ba=_bb.getGTVContent(_bc);
_b9.push(_ba);
});
return _b9;
},getGTVContent:function(_bd){
var _be=new GTVContent(this);
_be.setObject(_bd);
return _be;
},getGTVPlayList:function(_bf){
var _c0=new Array();
_bf.each(function(_c1){
if(_c1.getContentType()==_c1.sTYPE_GTVCONTENT){
_c0.push(_c1.getObject());
}
});
return _c0;
},relayEvent:function(_c2,_c3){
this.log("event: "+_c2);
if(_c3==null){
_c3=new Array();
}
var _c4,fn;
for(var x=0;x<this.aComponents.length;x++){
try{
fn=eval("pvs.aComponents["+x+"]."+_c2);
if(fn){
fn.apply(this.aComponents[x],_c3);
}
}
catch(e){
}
}
this.relayClientEvent(_c2,_c3);
},relayClientEvent:function(_c7,_c8){
try{
var fn=eval("PVS_"+_c7);
if(fn){
fn.apply(this,_c8);
}
}
catch(e){
}
},setVideoPlayerStyles:function(){
var _ca=this.getConfig().getComponentParam("VideoPlayer","Left","value");
var _cb=this.getConfig().getComponentParam("VideoPlayer","Top","value");
var _cc=this.getConfig().getComponentParam("VideoPlayer","Width","value");
var _cd=this.getConfig().getComponentParam("VideoPlayer","Height","value");
Element.setStyle($("VideoPlayer"),{left:_ca+"px",top:_cb+"px",width:_cc+"px",height:_cd+"px"});
},getEmbedCode:function(_ce){
var _cf="";
var _d0=this.getConfig().getComponentParam(this.oComponents.EMBEDCODEBOX,"Code");
if(_d0){
_cf=_d0;
_cf=_cf.replace(/#Variables#/g,this.getContentParamString(_ce));
}else{
this.logError("getEmbedCode() Could not find EmbedCode parameter");
}
return _cf;
},getShareURL:function(_d1){
var _d2="";
var _d3="?";
var _d4=this.getConfig().getSystemURL("SharePlayer");
if(_d4){
_d2=_d4+"?"+this.getContentParamString(_d1);
}else{
this.logError("getShareURL() Could not find SharePlayer URL");
}
return _d2;
},getContentParamString:function(_d5){
var _d6="";
if(_d5.getContentType()==_d5.sTYPE_GTVCONTENT){
var _d7=_d5.getObject();
var _d8="",_d9="";
if(_d7.channel){
_d6+=_d9+"c="+escape(_d7.channel);
_d9="&";
}
if(_d7.playlist){
_d6+=_d9+"p="+_d7.playlist;
_d9="&";
}
if(_d7.id){
_d6+=_d9+"s="+_d7.id;
_d9="&";
}
if(_d7.instance){
_d6+=_d9+"i="+_d7.instance;
}
}
return _d6;
},isValidEmail:function(_da){
if(_da){
return (_da.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)!=-1);
}
return false;
},getScrollPos:function(){
var _db=new Object();
_db.top=document.body.scrollTop;
_db.left=document.body.scrollLeft;
if(_db.top==0){
if(window.pageYOffset){
_db.top=window.pageYOffset;
}else{
_db.top=(document.body.parentElement)?document.body.parentElement.scrollTop:0;
}
}
if(_db.left==0){
if(window.pageXOffset){
_db.left=window.pageXOffset;
}else{
_db.left=(document.body.parentElement)?document.body.parentElement.scrollLeft:0;
}
}
return _db;
},getBrowserDimensions:function(){
var ww,wh;
if(self.innerHeight){
ww=self.innerWidth;
wh=self.innerHeight;
}else{
if(document.documentElement&&document.documentElement.clientHeight){
ww=document.documentElement.clientWidth;
wh=document.documentElement.clientHeight;
}else{
if(document.body){
ww=document.body.clientWidth;
wh=document.body.clientHeight;
}
}
}
return {w:ww,h:wh};
},includeJS:function(_de){
document.write("<script type=\"text/javascript\" src=\""+_de+"\"></script>");
},includeCSS:function(_df){
document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\""+_df+"\" />");
},setCookie:function(_e0,_e1,_e2,_e3,_e4,_e5){
var _e6=new Date();
_e6.setTime(_e6.getTime());
if(_e2){
_e2=_e2*1000*60*60*24;
}
var _e7=new Date(_e6.getTime()+(_e2));
document.cookie=_e0+"="+escape(_e1)+((_e2)?";expires="+_e7.toGMTString():"")+((_e3)?";path="+_e3:"")+((_e4)?";domain="+_e4:"")+((_e5)?";secure":"");
},readCookie:function(_e8){
var _e9=_e8+"=";
var ca=document.cookie.split(";");
for(var i=0;i<ca.length;i++){
var c=ca[i];
while(c.charAt(0)==" "){
c=c.substring(1,c.length);
}
if(c.indexOf(_e9)==0){
return c.substring(_e9.length,c.length);
}
}
return null;
},log:function(_ed){
if(this.sLogLevel=="info"||this.sLogLevel=="debug"){
var _ee=false;
try{
window.console.log(_ed);
_ee=true;
}
catch(e){
}
if(!_ee){
try{
if(this.winDebug==null||this.winDebug.closed){
this.winDebug=window.open("","pvsdebug","width=600,height=300,resizable,scrollbars");
this.winDebug.moveTo(0,0);
this.winDebug.document.open("text/plain");
}
this.winDebug.document.writeln(_ed);
}
catch(e){
}
}
}
},logError:function(_ef){
if(this.sLogLevel=="info"||this.sLogLevel=="debug"){
this.log("ERROR: "+_ef);
}
},debug:function(_f0){
if(this.sLogLevel=="debug"){
this.log("---- "+_f0);
}
}};
var PVSContent=Class.create();
PVSContent.prototype={initialize:function(pvs){
this.sTYPE_GTVCONTENT="#GTVContent#";
this.sTYPE_SEARCH="#Search#";
this.sTYPE_CHANNEL="#Channel#";
this.sTYPE_PROFMIX="#ProfMix#";
this.sTYPE_PROFMIX_SEGMENT="#ProfMixSegment#";
this.sDETAILTYPE_NODE="node";
this.sDETAILTYPE_SEGMENT="segment";
this.pvs=pvs;
this.bPVSContent=true;
this.sContentType=null;
this.sDetailType=this.sDETAILTYPE_SEGMENT;
this.aDetails=new Array();
this.bLoaded=true;
this.bSaved=true;
this.bNew=true;
this.bCanOpen=true;
this.bCanPlay=true;
this.bCanMove=false;
this.bCanAdd=false;
this.bCanRemove=false;
this.oParent=null;
this.fnCustomOpenHandler=null;
this.aSiblings=new Array();
this.nSiblingIndex=0;
this.aChildren=new Array();
this.sID=null;
this.sTitle=null;
},getIsPVSContent:function(){
return this.bPVSContent;
},setIsPVSContent:function(_f2){
this.bPVSContent=_f2;
},getContentType:function(){
return this.sContentType;
},getDetailType:function(){
return this.sDetailType;
},setDetailType:function(_f3){
this.sDetailType=_f3;
},getIsLoaded:function(){
return this.bLoaded;
},setIsLoaded:function(_f4){
this.bLoaded=_f4;
},getIsSaved:function(){
return this.bSaved;
},setIsSaved:function(_f5){
this.bSaved=_f5;
},getIsNew:function(){
return this.bNew;
},setIsNew:function(_f6){
this.bNew=_f6;
},getCanOpen:function(){
return this.bCanOpen;
},setCanOpen:function(_f7){
this.bCanOpen=_f7;
},open:function(_f8){
throw new Error("open() Must be overridden");
},handleOpenContent:function(_f9){
var _fa=false;
if(this.getHasCustomOpenHandler()){
_fa=true;
var fn=this.getCustomOpenHandler();
try{
fn(_f9);
}
catch(e){
this.pvs.logError("handleOpenContent() "+e.message);
this.handleOpenContentFailed();
}
}
return _fa;
},handleOpenContentFailed:function(){
this.pvs.relayEvent("eventContentError");
},getCanPlay:function(){
return this.bCanPlay;
},setCanPlay:function(_fc){
this.bCanPlay=_fc;
},play:function(){
throw new Error("play() Must be overridden");
},getCanMove:function(){
return this.bCanMove;
},setCanMove:function(_fd){
this.bCanMove=_fd;
},move:function(){
throw new Error("move() Must be overridden");
},getCanAdd:function(){
return this.bCanAdd;
},setCanAdd:function(_fe){
this.bCanAdd=_fe;
},add:function(){
throw new Error("add() Must be overridden");
},getCanRemove:function(){
return this.bCanRemove;
},setCanRemove:function(_ff){
this.bCanRemove=_ff;
},remove:function(){
throw new Error("remove() Must be overridden");
},getHasParent:function(){
return (this.oParent!=null);
},getParent:function(){
return this.oParent;
},setParent:function(_100){
this.oParent=_100;
},getHasCustomOpenHandler:function(){
return (this.fnCustomOpenHandler!=null);
},getCustomOpenHandler:function(){
return this.fnCustomOpenHandler;
},setCustomOpenHandler:function(_101){
this.fnCustomOpenHandler=_101;
},getSiblings:function(){
return this.aSiblings;
},setSiblings:function(_102,_103){
this.aSiblings=_102;
this.nSiblingIndex=_103;
},getChildren:function(){
return this.aChildren;
},setChildren:function(_104){
this.aChildren=_104;
},getID:function(){
return this.sID;
},setID:function(sID){
this.sID=sID;
},getTitle:function(){
return this.sTitle;
},setTitle:function(_106){
this.sTitle=_106;
},getPrimaryDetail:function(){
return this.getDetail(this.pvs.getConfig().DETAIL_PRIMARY);
},getSecondaryDetail:function(){
return this.getDetail(this.pvs.getConfig().DETAIL_SECONDARY);
},getTertiaryDetail:function(){
return this.getDetail(this.pvs.getConfig().DETAIL_TERTIARY);
},getDetail:function(_107,_108){
try{
if(_108!=null){
this.debug("getDetail() level: "+_107+", names length: "+_108.length);
}else{
this.debug("getDetail() level: "+_107);
}
if(_108==null){
var _109=this.pvs.getCurrentChannel();
if(_109!=null){
_108=this.pvs.getConfig().getChannelDetailMap(_109.getTitle(),this.getDetailType(),_107);
}
}
var _10a=null;
if(_108!=null){
for(var x=0;x<_108.length;x++){
this.debug("getDetail() handling name: "+_108[x]);
if(_108[x]==this.pvs.getConfig().DETAIL_DEFAULT){
_10a=this.getTitle();
}else{
if(_108[x]==this.pvs.getConfig().DETAIL_PARENT&&this.getHasParent()){
_10a=this.getParent().getPrimaryDetail();
}else{
_10a=this.getDetailByName(_108[x]);
}
}
if(_10a!=null){
break;
}
}
}
if(_10a==null&&_107==this.pvs.getConfig().DETAIL_PRIMARY){
_10a=this.getTitle();
}
return _10a;
}
catch(e){
this.logError("getDetail() "+e.message);
return null;
}
},getDetailByName:function(_10c){
var _10d=null;
this.aDetails.each(function(_10e){
if(_10e.getName()==_10c){
_10d=_10e.getValue();
throw $break;
}
});
return _10d;
},log:function(sMsg){
this.pvs.log("["+this.getContentType()+"] "+sMsg);
},logError:function(sMsg){
this.pvs.logError("["+this.getContentType()+"] "+sMsg);
},debug:function(sMsg){
this.pvs.debug("["+this.getContentType()+"] "+sMsg);
},createNode:function(doc,_113,_114,_115){
var e=doc.createElement(_113);
if(_114!=null){
_114.each(function(_117){
e.setAttribute(_117.name,_117.value);
});
}
if(_115!=null){
var eTxt=doc.createTextNode(_115);
e.appendChild(eTxt);
}
return e;
},appendDoc:function(e,doc){
var _11b=e.nodeType==Node.DOCUMENT_NODE?e:e.ownerDocument;
var _11c=doc.documentElement;
if(typeof (_11b.importNode)!="undefined"){
e.appendChild(_11b.importNode(_11c,true));
}else{
e.appendChild(_11c.cloneNode(true));
}
},serialize:function(){
throw new Error("serialize() Must be overridden");
}};
var Channel=Class.create();
Object.extend(Channel.prototype,PVSContent.prototype);
Object.extend(Channel.prototype,{initialize:function(pvs){
PVSContent.prototype.initialize.call(this,pvs);
this.sContentType=this.sTYPE_CHANNEL;
},getCSSClassName:function(){
var _11e=this.getTitle();
_11e=_11e.replace(/ /g,"");
_11e=_11e.replace(/'/g,"");
return _11e;
},open:function(_11f){
this.setCustomOpenHandler(_11f);
try{
if(this.getCanOpen()){
this.pvs.fnGTVContentLoadedHandler=this.onChannelOpened.bind(this);
gtv.getChannelContent(this.getTitle());
}else{
throw new Error("Content cannot be opened");
}
}
catch(e){
this.logError("open() "+e.message);
this.handleOpenContentFailed();
}
},onChannelOpened:function(_120){
try{
_120=this.pvs.getGTVContentList(_120);
if(!this.handleOpenContent(_120)){
this.pvs.actionSetChannelContext(this);
this.pvs.eventOnLevelChange(_120,this,true);
}
}
catch(e){
this.logError("onChannelOpened() "+e.message);
this.handleOpenContentFailed();
}
},play:function(){
try{
this.pvs.fnGTVContentLoadedHandler=this.onChannelOpenedForPlay.bind(this);
gtv.getChannelContent(this.getTitle());
}
catch(e){
this.logError("play() "+e.message);
}
},onChannelOpenedForPlay:function(_121){
try{
if(_121.length>0){
gtv.removeCustomSegmentList();
gtv.playContent(_121[0]);
}else{
throw new Error("No content to play");
}
}
catch(e){
this.logError("onChannelOpenedForPlay() "+e.message);
}
}});
var GTVContent=Class.create();
Object.extend(GTVContent.prototype,PVSContent.prototype);
Object.extend(GTVContent.prototype,{initialize:function(pvs){
PVSContent.prototype.initialize.call(this,pvs);
this.sContentType=this.sTYPE_GTVCONTENT;
this.oRef=null;
},getObject:function(){
return this.oRef;
},setObject:function(oRef){
this.oRef=oRef;
if(oRef.id){
this.setID(oRef.id);
}
this.setTitle(oRef.title);
this.setCanOpen(oRef.canopen);
this.setDetailType(oRef.type);
},open:function(_124){
this.setCustomOpenHandler(_124);
try{
if(this.getCanOpen()){
this.pvs.fnGTVContentLoadedHandler=this.onGTVContentOpened.bind(this);
gtv.openContent(this.oRef);
}else{
throw new Error("Content cannot be opened");
}
}
catch(e){
this.logError("open() "+e.message);
this.handleOpenContentFailed();
}
},onGTVContentOpened:function(_125){
try{
_125=this.pvs.getGTVContentList(_125);
if(!this.handleOpenContent(_125)){
this.pvs.eventOnLevelChange(_125,this,true);
}
}
catch(e){
this.logError("onGTVContentOpened() "+e.message);
this.handleOpenContentFailed();
}
},play:function(){
try{
if(this.getCanPlay()){
if(this.getHasParent()){
if(this.getParent().getContentType()==this.sTYPE_SEARCH||this.getParent().getContentType()==this.sTYPE_PROFMIX){
this.getParent().play(this.nSiblingIndex);
return;
}
}
gtv.removeCustomSegmentList();
gtv.playContent(this.getObject());
}else{
throw new Error("Cannot play this content");
}
}
catch(e){
this.logError("play() "+e.message);
}
},getTitle:function(){
return this.oRef.title;
},getDetail:function(_126){
this.debug("getDetail() channel: "+this.getObject().channel+", detail type: "+this.getDetailType()+", detail level: "+_126);
var _127=this.pvs.getConfig().getChannelDetailMap(this.getObject().channel,this.getDetailType(),_126);
return PVSContent.prototype.getDetail.call(this,_126,_127);
},getDetailByName:function(_128){
var arr=this.getObject().details;
if(arr){
var id=_128.toLowerCase();
for(var i=0;i<arr.length;i++){
if(arr[i].name){
if(arr[i].name.toLowerCase()==id){
return arr[i].value;
}
}
}
}
return null;
}});
var Search=Class.create();
Object.extend(Search.prototype,PVSContent.prototype);
Object.extend(Search.prototype,{initialize:function(pvs){
PVSContent.prototype.initialize.call(this,pvs);
this.sContentType=this.sTYPE_SEARCH;
this.sQuery=null;
this.sClass="segment";
},getQuery:function(){
return this.sQuery;
},setQuery:function(_12d){
this.sQuery=_12d;
},getClass:function(){
return this.sClass;
},setClass:function(_12e){
if(_12e=="segment"||_12e=="playlist"){
this.sClass=_12e;
}
},open:function(_12f){
this.setCustomOpenHandler(_12f);
try{
var _130=this.pvs.getConfig().getSystemParam("Operator","value");
var _131=this.pvs.getConfig().getSystemURL("GSearchWebservice");
var _132=this.pvs.getConfig().getSystemParam("Search","index");
var _133=this.pvs.getConfig().getSystemURL("AjaxBridge");
var _134=this.pvs.getConfig().getSystemParam("Search","limit");
_134=(_134==null||_134=="")?25:_134;
var _135=_131+"?Op=search&operator="+_130+"&raw=1&index="+_132+"&limit="+_134+"&class="+this.getClass()+"&query="+escape(this.getQuery());
this.pvs.log("searching: "+_135);
var _136=new SearchRequest();
_136.setServerURL(_135);
_136.setBridgeURL(_133);
_136.setResponseHandlers(this.onSearchResponse.bind(this),this.onSearchFailed.bind(this));
_136.send();
}
catch(e){
this.logError("open() "+e.message);
this.handleOpenContentFailed();
}
},onSearchResponse:function(_137){
try{
_137=this.pvs.getGTVContentList(_137);
if(!this.handleOpenContent(_137)){
this.pvs.eventOnLevelChange(_137,this,false);
}
}
catch(e){
this.logError("onSearchResponse() "+e.message);
this.handleOpenContentFailed();
}
},onSearchFailed:function(){
this.logError("onSearchFailed()");
this.handleOpenContentFailed();
},play:function(_138){
try{
if(_138==null){
_138=0;
}
var _139=this.pvs.getGTVPlayList(this.getChildren());
gtv.setCustomSegmentList(_139,_138);
}
catch(e){
this.logError("play() "+e.message);
}
}});
var PVSData=Class.create();
PVSData.prototype={initialize:function(){
},createNode:function(doc,_13b,_13c,_13d){
var e=doc.createElement(_13b);
if(_13c!=null){
_13c.each(function(_13f){
e.setAttribute(_13f.name,_13f.value);
});
}
if(_13d!=null){
var eTxt=doc.createTextNode(_13d);
e.appendChild(eTxt);
}
return e;
},appendDoc:function(e,doc){
var _143=e.nodeType==Node.DOCUMENT_NODE?e:e.ownerDocument;
var _144=doc.documentElement;
if(typeof (_143.importNode)!="undefined"){
e.appendChild(_143.importNode(_144,true));
}else{
e.appendChild(_144.cloneNode(true));
}
},serializeToDocument:function(){
var _145=Sarissa.getDomDocument();
return _145;
},serialize:function(_146,_147,_148){
return new XMLSerializer().serializeToString(this.serializeToDocument());
},log:function(sMsg){
pvs.log(sMsg);
},logError:function(sMsg){
pvs.logError(sMsg);
},debug:function(sMsg){
pvs.debug(sMsg);
}};
var Detail=Class.create();
Object.extend(Detail.prototype,PVSData.prototype);
Object.extend(Detail.prototype,{initialize:function(){
PVSData.prototype.initialize.call(this);
this.sName=null;
this.sValue=null;
},load:function(_14c){
this.setName(_14c.getAttribute("name"));
this.setValue(_14c.getAttribute("value"));
this.debug("[Detail] load() complete ("+this.getName()+" = "+this.getValue()+")");
},getName:function(){
return this.sName;
},setName:function(_14d){
this.sName=_14d;
},getValue:function(){
return this.sValue;
},setValue:function(_14e){
this.sValue=_14e;
}});
var PVSComponent=Class.create();
PVSComponent.prototype={initialize:function(pvs,_150,_151){
this.pvs=pvs;
this.sName=_150;
this.eContainer=_151;
},getName:function(){
return this.sName;
},log:function(sMsg){
this.pvs.log("["+this.getName()+"] "+sMsg);
},logError:function(sMsg){
this.pvs.logError("["+this.getName()+"] "+sMsg);
},debug:function(sMsg){
this.pvs.debug("["+this.getName()+"] "+sMsg);
}};
var PVSUIContent=Class.create();
PVSUIContent.prototype={initialize:function(_155,_156){
this.oContent=_155;
this.eContainer=_156;
this.aListeners=new Array();
},getID:function(){
return this.oContent.getID();
},getTitle:function(){
return this.oContent.getTitle();
},getContent:function(){
return this.oContent;
},getContainer:function(){
return this.eContainer;
},addEventListener:function(_157,_158,fn){
Event.observe(_157,_158,fn);
this.aListeners.push({target:_157,type:_158,fn:fn});
},destroy:function(){
this.aListeners.each(function(_15a){
Event.stopObserving(_15a.target,_15a.type,_15a.fn);
});
Element.remove(this.eContainer);
}};
var PVSListenerManager=Class.create();
PVSListenerManager.prototype={initialize:function(){
this.aListeners=new Array();
},addListener:function(_15b,_15c,fn){
Event.observe(_15b,_15c,fn);
this.aListeners.push({target:_15b,type:_15c,fn:fn});
},removeListeners:function(){
this.aListeners.each(function(_15e){
Event.stopObserving(_15e.target,_15e.type,_15e.fn);
});
}};
var PVSRequest=Class.create();
PVSRequest.prototype={initialize:function(){
this.sOperator=null;
this.sServerURL=null;
this.sBridgeURL=null;
this.cbSuccess=null;
this.cbFailed=null;
this.aResponseParams=new Array();
},setOperator:function(_15f){
this.sOperator=_15f;
},setServerURL:function(_160){
this.sServerURL=_160;
},setBridgeURL:function(_161){
this.sBridgeURL=_161;
},setResponseHandlers:function(_162,_163){
this.cbSuccess=_162;
this.cbFailed=_163;
},setSecondaryPayload:function(_164){
this.oSecondaryPayload=_164;
},addResponseParams:function(_165){
this.aResponseParams=_165;
},sendGet:function(){
if(this.sServerURL!=null){
var _166=this.sServerURL;
var _167=this.sBridgeURL;
var _168=this;
var _169=this.onResponse;
var _16a=this.onFailedResponse;
pvs.log("[PVSRequest] sendGet() "+_166);
new Ajax.Request(_166,{parameters:"?ck="+Math.random(),method:"get",onException:function(){
pvs.log("[PVSRequest] sendGet() onException()");
if(_167!=null){
_166=_167+"?method=get&url="+escape(_166)+"&ck="+Math.random();
pvs.log("[PVSRequest] sendGet() onException() "+_166);
new Ajax.Request(_166,{method:"get",onException:function(){
pvs.log("[PVSRequest] sendGet() onException() onException()");
_16a.apply(_168);
},onSuccess:function(_16b){
pvs.log("[PVSRequest] sendGet() onException() onSuccess() "+_16b.responseText);
if(_169){
_169.apply(_168,new Array(_16b.responseText));
}else{
_16a.apply(_168);
}
},onFailure:function(){
pvs.log("[PVSRequest] sendGet() onException() onFailure()");
_16a.apply(_168);
}});
}else{
_16a.apply(_168);
}
},onSuccess:function(_16c){
pvs.log("[PVSRequest] sendGet() onSuccess() "+_16c.responseText);
if(_169){
_169.apply(_168,new Array(_16c.responseText));
}else{
_16a.apply(_168);
}
},onFailure:function(){
pvs.log("[PVSRequest] sendGet() onFailure()");
_16a.apply(_168);
}});
}
},send:function(){
var sXML=this.serialize();
if(this.sServerURL!=null&&sXML!=null){
var _16e=this.sServerURL;
var _16f=this.sBridgeURL;
var _170=this;
var _171=this.onResponse;
var _172=this.onFailedResponse;
pvs.log("[PVSRequest] send() "+_16e);
pvs.log("[PVSRequest] send() data: "+sXML);
new Ajax.Request(_16e,{method:"post",postBody:sXML,onException:function(){
pvs.log("[PVSRequest] send() onException()");
if(_16f!=null){
_16e=_16f+"?method=post&url="+escape(_16e);
pvs.log("[PVSRequest] send() "+_16e);
new Ajax.Request(_16e,{method:"post",postBody:sXML,onException:function(){
pvs.log("[PVSRequest] send() onException() onException()");
_172.apply(_170);
},onSuccess:function(_173){
pvs.log("[PVSRequest] send() onException() onSuccess() "+_173.responseText);
if(_171){
_171.apply(_170,new Array(_173.responseText));
}else{
_172.apply(_170);
}
},onFailure:function(){
pvs.log("[PVSRequest] send() onException() onFailure()");
_172.apply(_170);
}});
}else{
_172.apply(_170);
}
},onSuccess:function(_174){
pvs.log("[PVSRequest] send() onSuccess() "+_174.responseText);
if(_171){
_171.apply(_170,new Array(_174.responseText));
}else{
_172.apply(_170);
}
},onFailure:function(){
pvs.log("[PVSRequest] send() onFailure()");
_172.apply(_170);
}});
}
},onResponse:function(sXML){
var _176=Sarissa.getDomDocument();
_176=(new DOMParser()).parseFromString(sXML,"text/xml");
_176.setProperty("SelectionLanguage","XPath");
this.interpretResponse(_176);
},interpretResponse:function(_177){
this.onFailedResponse();
},onSuccessfulResponse:function(_178){
if(this.cbSuccess!=null){
var _179=new Array();
if(_178!=null){
_179.push(_178);
}
this.aResponseParams.each(function(_17a){
_179.push(_17a);
});
this.cbSuccess.apply(this,_179);
}
},onFailedResponse:function(){
if(this.cbFailed!=null){
this.cbFailed.apply(this,this.aResponseParams);
}
},log:function(sMsg){
pvs.log(sMsg);
},logError:function(sMsg){
pvs.logError(sMsg);
},debug:function(sMsg){
pvs.debug(sMsg);
},createNode:function(doc,_17f,_180,_181){
var e=doc.createElement(_17f);
if(_180!=null){
_180.each(function(_183){
e.setAttribute(_183.name,_183.value);
});
}
if(_181!=null){
var eTxt=doc.createTextNode(_181);
e.appendChild(eTxt);
}
return e;
},appendDoc:function(e,doc){
var _187=e.nodeType==Node.DOCUMENT_NODE?e:e.ownerDocument;
var _188=doc.documentElement;
if(typeof (_187.importNode)!="undefined"){
e.appendChild(_187.importNode(_188,true));
}else{
e.appendChild(_188.cloneNode(true));
}
},serializeToDocument:function(_189,_18a,_18b){
var _18c=Sarissa.getDomDocument();
var _18d=_18c.createElement("gotuit");
var _18e=_18c.createElement("request");
if(this.sOperator!=null){
_18e.appendChild(this.createNode(_18c,"operator",null,this.sOperator));
}
if(_189!=null){
_18e.appendChild(this.createNode(_18c,"type",null,_189));
}
if(_18a!=null){
_18e.appendChild(this.createNode(_18c,"param",[{name:"name",value:"action"}],_18a));
}
if(_18b!=null){
var _18f=this;
_18b.each(function(_190){
_18f.appendDoc(_18e,_190);
});
}
_18d.appendChild(_18e);
_18c.appendChild(_18d);
return _18c;
},serialize:function(_191,_192,_193){
return new XMLSerializer().serializeToString(this.serializeToDocument(_191,_192,_193));
}};
var SendToAFriendRequest=Class.create();
Object.extend(SendToAFriendRequest.prototype,PVSRequest.prototype);
Object.extend(SendToAFriendRequest.prototype,{initialize:function(_194,_195,_196,sURL,sMsg){
PVSRequest.prototype.initialize.call(this);
this.sFromName=_194;
this.sFromEmail=_195;
this.sToEmail=_196;
this.sURL=sURL;
this.sMsg=(sMsg!=null)?sMsg:"Check out this video!";
},interpretResponse:function(_199){
this.onSuccessfulResponse();
},serializeToDocument:function(){
var _19a=Sarissa.getDomDocument();
var _19b=_19a.createElement("gotuit");
var _19c=_19a.createElement("request");
if(this.sOperator!=null){
_19c.appendChild(this.createNode(_19a,"operator",null,this.sOperator));
}
_19c.appendChild(this.createNode(_19a,"type",null,"emailfriend"));
_19c.appendChild(this.createNode(_19a,"param",[{name:"name",value:"name"}],this.sFromName));
_19c.appendChild(this.createNode(_19a,"param",[{name:"name",value:"email"}],this.sFromEmail));
_19c.appendChild(this.createNode(_19a,"param",[{name:"name",value:"to"}],this.sToEmail));
_19c.appendChild(this.createNode(_19a,"param",[{name:"name",value:"chan"}],"PVS"));
_19c.appendChild(this.createNode(_19a,"param",[{name:"name",value:"pid"}],"1"));
_19c.appendChild(this.createNode(_19a,"param",[{name:"name",value:"sid"}],"1"));
_19c.appendChild(this.createNode(_19a,"param",[{name:"name",value:"url"}],this.sURL));
_19c.appendChild(this.createNode(_19a,"param",[{name:"name",value:"path"}],"1"));
_19c.appendChild(this.createNode(_19a,"param",[{name:"name",value:"msg"}],this.sMsg));
_19b.appendChild(_19c);
_19a.appendChild(_19b);
return _19a;
},serialize:function(){
return new XMLSerializer().serializeToString(this.serializeToDocument());
}});
var SearchRequest=Class.create();
Object.extend(SearchRequest.prototype,PVSRequest.prototype);
Object.extend(SearchRequest.prototype,{initialize:function(_19d,_19e,_19f){
PVSRequest.prototype.initialize.call(this);
},interpretResponse:function(_1a0){
var _1a1=_1a0.selectNodes("/gotuit/response/*");
var _1a2=new Array(),_1a3;
var _1a4=this;
for(var x=0;x<_1a1.length;x++){
_1a3=this.getSearchContentObject(_1a1[x]);
if(_1a3){
_1a2.push(_1a3);
}
}
this.onSuccessfulResponse(_1a2);
},getSearchContentObject:function(_1a6){
var _1a7=null;
var nHit=_1a6.selectSingleNode("./hit");
if(nHit){
_1a7=new Object();
_1a7.type=_1a6.nodeName;
_1a7.id=nHit.getAttribute("id");
_1a7.title=nHit.getAttribute("title");
_1a7.description=nHit.getAttribute("description");
_1a7.details=new Array();
for(var x=0;x<nHit.attributes.length;x++){
_1a7.details.push({name:nHit.attributes[x].name,value:nHit.attributes[x].value});
}
var _1aa=nHit.getAttribute("context");
if(_1aa){
var _1ab=_1aa.split(" /");
if(_1ab.length>0){
_1a7.channel=_1ab[0];
}
}
switch(_1a6.nodeName){
case "segment":
_1a7.contentType="#SearchSegment#";
_1a7.canopen=false;
_1a7.playlist=nHit.getAttribute("parent_id");
break;
case "playlist":
_1a7.contentType="#SearchPlaylist#";
_1a7.canopen=true;
_1a7.playlist=nHit.getAttribute("id");
break;
}
}
return _1a7;
},send:function(){
PVSRequest.prototype.sendGet.call(this);
}});
var PVSConfig=Class.create();
PVSConfig.prototype={initialize:function(){
this.xmlConfig=null;
this.DETAIL_DEFAULT="#Title#";
this.DETAIL_PARENT="#Parent#";
this.DETAIL_PRIMARY="primary";
this.DETAIL_SECONDARY="secondary";
this.DETAIL_TERTIARY="tertiary";
},setDocument:function(xml){
this.xmlConfig=xml;
},getValue:function(_1ad){
if(_1ad){
_1ad=_1ad.replace(/\n/g,"");
}
return _1ad;
},getAttribValue:function(_1ae,_1af){
if(_1ae){
if(!_1af){
_1af="value";
}
var _1b0=_1ae.getAttribute(_1af);
return (_1b0=="")?null:this.getValue(_1b0);
}
return null;
},getNodeValue:function(_1b1){
if(_1b1){
if(_1b1.childNodes.length==1){
return this.getValue(_1b1.childNodes[0].nodeValue);
}else{
if(_1b1.childNodes.length==3){
return this.getValue(_1b1.childNodes[1].nodeValue);
}
}
}
return null;
},getSystemURL:function(_1b2){
var nURL=this.xmlConfig.selectSingleNode("/gotuit/pvs/system/url[@name='"+_1b2+"']");
return this.getAttribValue(nURL,"value");
},getSystemParam:function(_1b4,_1b5){
var _1b6=this.xmlConfig.selectSingleNode("/gotuit/pvs/system/param[@name='"+_1b4+"']");
if(_1b5!=null){
return this.getAttribValue(_1b6,_1b5);
}else{
return this.getNodeValue(_1b6);
}
},getComponentURL:function(_1b7,_1b8){
var nURL=this.xmlConfig.selectSingleNode("/gotuit/pvs/components/"+_1b7+"/url[@name='"+_1b8+"']");
return this.getAttribValue(nURL,"value");
},getComponentParam:function(_1ba,_1bb,_1bc){
var _1bd=this.xmlConfig.selectSingleNode("/gotuit/pvs/components/"+_1ba+"/param[@name='"+_1bb+"']");
if(_1bc!=null){
return this.getAttribValue(_1bd,_1bc);
}else{
return this.getNodeValue(_1bd);
}
},getComponentParams:function(_1be,_1bf,_1c0){
var _1c1=new Array();
var _1c2=this.xmlConfig.selectNodes("/gotuit/pvs/components/"+_1be+"/param[@name='"+_1bf+"']");
var _1c3;
for(var x=0;x<_1c2.length;x++){
_1c3=_1c2[x];
if(_1c0!=null){
_1c1.push(this.getAttribValue(_1c3,_1c0));
}else{
_1c1.push(this.getNodeValue(_1c3));
}
}
return _1c1;
},getChannelDetailMap:function(_1c5,_1c6,_1c7){
var _1c8=new Array();
var _1c9="/gotuit/pvs/channels/channel[@title=\""+_1c5+"\"]/detailmap/"+_1c6+"/"+_1c7;
pvs.debug("[PVSConfig] getChannelDetailMap() xpath query: "+_1c9);
var _1ca=this.xmlConfig.selectNodes(_1c9);
pvs.debug("[PVSConfig] getChannelDetailMap() num hits: "+_1ca.length);
for(var x=0;x<_1ca.length;x++){
_1c8.push(this.getNodeValue(_1ca[x]));
}
return _1c8;
},getChannelComponentURL:function(_1cc,_1cd,_1ce){
_1cc=Sarissa.escape(_1cc);
var nURL=this.xmlConfig.selectSingleNode("/gotuit/pvs/channels/channel[@title='"+_1cc+"']/components/"+_1cd+"/url[@name='"+_1ce+"']");
return this.getAttribValue(nURL,"value");
},getChannelComponentParam:function(_1d0,_1d1,_1d2,_1d3){
_1d0=Sarissa.escape(_1d0);
var _1d4=this.xmlConfig.selectSingleNode("/gotuit/pvs/channels/channel[@title='"+_1d0+"']/components/"+_1d1+"/param[@name='"+_1d2+"']");
return this.getAttribValue(_1d4,_1d3);
}};
Event.observe(window,"load",PVS_OnLoad);
var pvs=new PVS();
var gtv=null;

