var TVS, theButton, searchVal;

function ajaxSearch(searchVal) {
    TVS = new TruveoVideoSearch('bc4e3c7450acc8f2a');
    TVS.results = 50; // 1 - 50
    searchQuery = searchVal + ' channel:Redskins.com';
    TVS.getVideos(searchQuery);
    TVS.initialize();
    TVS.attachEvent('onupdate', "insertResults(searchVal);");
}
function insertResults() {
    var theHTML = '&nbsp;&nbsp;Results for: <b>"' + searchVal + '"</b>';
    document.getElementById('resultstext').innerHTML = theHTML;

    var theHTML = '';
    for (var i = 0; i < TVS.VideoSet.totalResultsReturned; i++) {
        if (TVS.VideoSet.Video[i] != null) {
            theHTML += '<li>' +
                       '<a href="' + TVS.VideoSet.Video[i].videoUrl + '" ' +
                       'title="' + TVS.VideoSet.Video[i].title + '" ' +
                //						'target="_blank" rel="external"' +
                       '><img src="' + TVS.VideoSet.Video[i].thumbnailUrl + '"' + '/>' +
                       '</a></li>';
        }
		//<li><a href="" title="" target="_blank"><img src="" /></a></li>
    }
    if (theHTML == '') {
        theHTML = 'No results for ' + searchVal;
    }
    document.getElementById('resultslist').innerHTML = theHTML;
    return false;
}