	function initCall()
    {
		// Create a new request object
		bObj = new JSONscriptRequest(req);

        // Build the dynamic script tag
		bObj.buildScriptTag();

        // Add the script tag to the page
		bObj.addScriptTag();
	}

    function fmtTitle(title)
    {
        if (title.length > 28) {
            title = title.substr(0, 28);
            title = title.substr(0, title.lastIndexOf(' ')) + '...';
        }
        return title;
    }

	// Define the callback function
	// writes out the HTML for each title item in the list
	function response(jsonData)
    {
		var items = jsonData["items"];
        // This block is to filter out any null objects that might have been received from brightcove.  This has been proven to be possible.
        var actualItems = [];

        for (var i = 0, j = items.length; i < j; i++) {
            if (items[i]) {
                actualItems.push(items[i]);
            }
        }
        items = actualItems;

		var tDiv = document.getElementById("videos-container");

        var i = 0;

		var li_class_additional = '';

		var close_open = '';

		var active_or_feature = 'active';

        // Adjust video title lengths
        for (var t = 0; t < items.length; t++) {
            items[t].name = fmtTitle(items[t].name);
        }

        if ( items.length > 0 )
        {
            var str = "";

            str += '<ul>';
        }

		while ( i < items.length )
        {
            var refid = items[i].referenceId.split('.');

            str += '<li>';
            str += '  <p><a class="feature" style="cursor: pointer;" onClick="playTitleFromList(' + items[i].id + ', this.parentNode.parentNode)"><span class="border-overlay"></span><img src="' + items[i].thumbnailURL + '" id="thumbnail_' + refid[0] + '" /></a></p>';
            str += '  <p style="max-width: 100px;"><a class="video-title" style="cursor: pointer;" onClick="playTitleFromList(' + items[i].id + ', this.parentNode.parentNode)">' + items[i].name + '</a></p>';
            str += '  <p class="titles">' + formatTime(items[i].length) + '</p>';
            str += '</li>';

			li_class_additional = '';

			if ( 'active' == active_or_feature )
				active_or_feature = 'feature';

            i++;
		}

        str += '</ul>';
        if (items.length > 0) {
		    tDiv.innerHTML += str;
        }

        setThumbnails();
	}

	// time is stored in milliseconds; we need to convert to a mm:ss display format
	function formatTime(time)
    {
		var t_secs = Math.round(time/1000);

        var mins = Math.floor(t_secs/60);

        var secs = t_secs - (mins*60);

        return mins + ":" + ( secs < 10 ? '0' : '' ) + secs;
	}

	/* Player Interface */

	var player;
	var content;
	var video;

	// called when template loads, we use this to store a reference to the modules
	// and add event listeners for media load (when the user clicks on a video)
	function onTemplateLoaded(player)
    {
		player = brightcove.getExperience(player);

		video = player.getModule(APIModules.VIDEO_PLAYER);

		content = player.getModule(APIModules.CONTENT);

		content.addEventListener(BCContentEvent.MEDIA_LOAD, onMediaLoad);
	}

	// handles click event from list items
	function playTitleFromList(id, el)
    {
		displayVideo();

        // Within video list, clear HTML from span within 'active' class; replace 'active' with 'feature'.
        $('.video-list').find('.active span').html('');
        $('.video-list').find('.active').removeClass('active').addClass('feature');

        // Within clicked ul element, replace 'feature' class with 'active' class, and add Now Playing... indicator.
        $(el).find('.video-image a').removeClass('feature').addClass('active');
        $(el).find('.active span').html('Now Playing...');

		content.getMediaAsynch(id);

	}

	function onMediaLoad(evt)
    {
		video.loadVideo(evt.media.id);

        $('#title').html(evt.media.displayName);

        $('#description').html(evt.media.longDescription);

        $('#duration').html(formatTime(evt.media.length));

	}

