/**
 * @author mharpur
 */
		var bcExp;
		var modVP;
		var modEx;
		var modAd;
		// called when template loads, this function stores a reference to the player and modules.
		function onTemplateLoaded(pEvent) {
		    //alert("EVENT: TEMPLATE_LOAD");
		 	bcExp = brightcove.getExperience(pEvent);
			//modAd = bcExp.getModule(APIModules.ADVERTISING);
			//modAd.addEventListener(BCAdvertisingEvent.EXTERNAL_AD, onExternalAd);
			//modEx = bcExp.getModule(APIModules.EXPERIENCE);
			//modEx.addEventListener(BCExperienceEvent.CONTENT_LOAD, onContentLoaded);
			modVP = bcExp.getModule(APIModules.VIDEO_PLAYER);
			//modVP.addEventListener(BCVideoEvent.STREAM_START, getCurrentDetails);
		}
		function onContentLoaded(evt){
			//alert("EVENT: CONTENT_LOADED");
			// enable external ads
			modAd.enableExternalAds(true);
		}
		function getCurrentDetails(evt) {
			//alert("EVENT: STREAM_START");
			var currentVideo = modVP.getCurrentVideo();
			var titleName = currentVideo.displayName;
			var titleTag = currentVideo.tags[0];
			// pass title values to ivw
	   		// videoivw('Videocenter', titleName, titleTag);
			/*
			// get playlist name if required ('playlist' in BC3 = 'lineup' in BC2)
			var con = bcExp.getModule(APIModules.CONTENT);
			var playListDTO = con.getPlaylist(currentVideo.lineupId);
			var playlistName = playListDTO.displayName;
			// videoivw('Videocenter', titleName, playlistName);
			*/
	    }
		function onExternalAd(pAdString){
			//alert("EVENT: EXTERNAL AD");
		//	new ExternalAd(pAdString); 
		}
		
		function loadvid(vidid){
			//alert("EVENT: video pre loaded");
			modVP.loadVideo(vidid);
			//alert("EVENT: video loaded");
		}
