<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Advanced TRUVEO Video Search"
title_url="http://vaish.rajan.googlepages.com/"
description="Search your favorite vidoes using AOL's Truveo Video Search Engine,with 5 addtional User Preferences and special Video search on US Elections,2008 "
height="370"
width="300"
screenshot="http://vaish.rajan.googlepages.com/screenshot_gg_truveo.JPG"
thumbnail="http://vaish.rajan.googlepages.com/thumbnail_gg_truveo.JPG"
scrolling="true"
author="Rajan Vaish"
author_affiliation=""
author_email="vaish.rajan@gmail.com"
author_location="Lucknow,India"
author_link=""
author_photo=""
author_aboutme="http://linkedin.com/in/rajanvaish"
author_quote="Think Big,To Grow Big">
<Require feature="analytics" />
</ModulePrefs>
<Content type="html">

<![CDATA[
<script type="text/javascript" src="http://xml.truveo.com/TruveoVideoSearchAPIv3.js">
</script>
<script type="text/javascript">


var TVS = null;
var querychan=' ';
var querylang=' ';
var querycat=' ';
var queryrun=' ';
var querysort=' ';

function addchan(chanval) {
querychan=chanval;
}
function addlang(langval) {
querylang=langval;
}
function addcat(catval) {
querycat=catval;
}
function addrun(runval) {
queryrun=runval;
}
function addsort(sortval) {
querysort=sortval;
}

function nextPage() {
document.getElementById("TitleDiv").innerHTML = ' Loading...';
document.getElementById("ResultsDiv").innerHTML = '';
scroll(0,0);
TVS.nextPage();
}

function previousPage() {
document.getElementById("TitleDiv").innerHTML = ' Loading...';
document.getElementById("ResultsDiv").innerHTML = '';
scroll(0,0);
TVS.previousPage();
}

function USPolitics(){
var PageIndex2,myVal;
PageIndex2=document.Politics.Politics.selectedIndex;
myVal=document.Politics.Politics.options[PageIndex2].value;
TVS.getVideos(myVal);
}



function getVideos(query) {
query=query + ' ' + querychan + ' '+ querylang + ' ' + querycat + ' ' + queryrun + ' ' + querysort ;
TVS.getVideos(query);
}


function playVideo(videoUrl, id) {
window.open(videoUrl, '', 'width=500,height=500,location=no,menubar=no,resizable=yes,scrollbars=yes');
}


function handleUpdate(methodName) {
refreshResults(TVS);
}


function handleLoad(reloadStateFlag) {
getVideos('');
USPolitics(' ');
}


function handleError(errorCode, errorMessage) {
alert("ERROR: Code " + errorCode + "; " + errorMessage);
}


function refreshResults(TVS) {
var HTML1 = '';
if (TVS.VideoSet && TVS.VideoSet.Video) {
var VideoSet = TVS.VideoSet;
var cellsPerRow = 1;
var rows = 20;
HTML1 += '<table style="width: 100%; margin: 0 0 0 0; border: 0px; border-style: none; border-collapse: collapse; vertical-align: top;">';
for (var j=0; j < rows; j++) {
HTML1 += '<tr>';
for (var k=0; k < cellsPerRow; k++) {
var i = (j * cellsPerRow) + k;
HTML1 += '<td align="center" valign="top" style="padding: 12px 4px 12px 4px;">';
if (i >= VideoSet.Video.length) { HTML1 += '&nbsp;'; }
else {
var theVideo = VideoSet.Video[i];
if (theVideo) {
HTML1 += '<div style="width: 130px;text-align:center; font-family: Arial, sans-serif; font-size: 9pt;">';
HTML1 += '<a href="javascript:playVideo(\''+theVideo.videoUrl+'\','+theVideo.id+'); void(0);"><img src="'+theVideo.thumbnailUrl+'" style="width: 75px; height: 56px; border: 2px solid #6600CC;" alt="click to play video"/></a>';
HTML1 += '<div><a href="javascript:playVideo(\''+theVideo.videoUrl+'\','+theVideo.id+'); void(0);">'+theVideo.title+'</a></div>';
}
}
HTML1 += '</td>';
}
HTML1 += '</tr>';
}
HTML1 += '</table>';
document.getElementById("ResultsDiv").innerHTML = HTML1;
document.getElementById("TitleDiv").innerHTML = ' ' + TVS.VideoSet.title;
var HTML2 = '';
HTML2 += '<table style="width: 100%; margin: 0 0 0 0; border: 0px; border-style: none; border-collapse: collapse;" cellpadding="0">';
HTML2 += '<tr>';
HTML2 += '<td style="text-align: left;">';
if (TVS.hasPreviousPage()) { HTML2 += '<a href="javascript:previousPage(); void(0);">&lt;&lt;previous</a>'; } else { HTML2 += '&nbsp;'; }
HTML2 += '</td>';
HTML2 += '<td style="text-align: right;">';
if (TVS.hasNextPage()) { HTML2 += '<a href="javascript:nextPage(); void(0);">next&gt;&gt;</a>'; } else { HTML2 += '&nbsp;'; }
HTML2 += '</td>';
HTML2 += '</tr>';
HTML2 += '</table>';
document.getElementById("FooterDiv").innerHTML = HTML2;
}
else {
document.getElementById("ResultsDiv").innerHTML = '&nbsp;';
document.getElementById("TitleDiv").innerHTML = 'No videos available now,Please Query your Search.';
}

}


function VSLoad() {
TVS = new TruveoVideoSearch('6a200bf903ee90cad');
TVS.results = 20;
TVS.attachEvent('onerror', 'handleError(errorCode, errorMessage);');
TVS.attachEvent('onupdate', 'handleUpdate(methodName);');
TVS.attachEvent('onload', 'handleLoad(reloadStateFlag);');
TVS.initialize();
getVideos("");
}

_IG_RegisterOnloadHandler(VSLoad);

</script>
<body background="http://vaish.rajan.googlepages.com/truback.JPG" >
<div id="bodyDiv">
<br>
<div id="logo" align="center" ><img src="http://vaish.rajan.googlepages.com/trulogo.JPG" /></div>

<form name="searchForm" onsubmit="javascript:getVideos(document.getElementById('searchBox').value); return(false);" style="margin:0;">
<div style="width:100%; text-align:center;">
<input type="text" name="searchBox" id="searchBox" size="20" value="" />
<br />
<select name="Channels" onChange="addchan(this.options[this.selectedIndex].value);" >
<option value="" selected="selected">Channels</option>
<option value="channel:MSN">MSN</option>
<option value="channel:YouTube">YouTube</option>
<option value="channel:Google Video" >Google Video</option>
<option value="channel:MYSPACE">MySpace</option>
<option value="channel:AOL">AOL</option>
<option value="channel:Yahoo!">Yahoo!</option>
<option value="channel:BBC">BBC</option>
<option value="channel:FOX">FOX</option>
<option value="channel:CNN">CNN</option>
<option value="channel:USA TODAY">USA Today</option>
</select>
<select name="Language" onChange="addlang(this.options[this.selectedIndex].value);">
<option value="" selected="selected">Languages</option>
<option value="language:en">English</option>
<option value="language:es">Spanish</option>
<option value="language:fr">French</option>
<option value="language:de" >German</option>
</select>
<select name="Category" onChange="addcat(this.options[this.selectedIndex].value);">
<option value="" selected="selected">Category</option>
<option value="category:news">NEWS</option>
<option value="category:sports">Sports</option>
<option value="category:entertainment">Entertainment</option>
<option value="category:business" >Business</option>
<option value="category:technology OR category:science" >Technology&Science</option>
<option value="category:comedy" >Comedy</option>
<option value="category:movies OR category:music" >Movies&Music</option>
<option value="category:health & fitness" >Health&Fitness</option>
<option value="category:pets & animals" >Pets&Animals</option>
</select>
<select name="RunTime" onChange="addrun(this.options[this.selectedIndex].value);">
<option value="" selected="selected">RunTime</option>
<option value="runtime:<1">Less than 1 min.</option>
<option value="runtime:<5">Less than 5 mins.</option>
<option value="runtime:>5">More than 5 mins.</option>
</select>
<select name="Sorter" onChange="addsort(this.options[this.selectedIndex].value);">
<option value="" selected="selected">Sort it!</option>
<option value="sort:mostRecent">Most Recent</option>
<option value="sort:mostPopular">Most Popular</option>
<option value="sort:highestRated">Highest Rated</option>
<option value="sort:mostRelevant" >Most Relevant</option>
</select>
<input type="submit" name="searchButton" id="searchBox" value="Search" />
<input name=B2 type=reset value=Reset>
</div>
</form>
<form name="Politics">
<div style="width:100%; text-align:center;">
<div id="logo"><img src="http://vaish.rajan.googlepages.com/USElections08.jpg" /></div>
<select name="Politics">
<option value="US Elections" selected="selected">US Elections'08</option>
<option value="john mccain -show:JohnMcCain">John McCain</option>
<option value="barack obama -channel:BarackTV">Barack Obama</option>
<option value="hillary clinton -channel:hillary for president ">Hillary Clinton</option>
<option value="mike huckabee -distributor:explorehuckabee">Mike Huckabee</option>
<option value="rudy giuliani -show:Rudy Giuliani -channel:blip tv ">Rudy Giuliani</option>
<option value="mitt romney -channel:mitt romney ">Mitt Romney</option>
<option value="john edwards -distributor:johnedwards">John Edwards</option>
<option value="Sarah Palin">Sarah Palin</option>
<option value="Local Coverage us elections ">Local Coverage</option>
<option value="National Coverage us elections">National Coverage</option>
<option value="International Coverage us elections">International Coverage</option>
</select>
<input type="button" name="go" id="go" value="Go!" onClick="USPolitics()" />

</div>
</form>
<br />
<div id="ResultsDiv">&nbsp;</div>
<div id="TitleDiv">&nbsp;</div>
<div id="FooterDiv">&nbsp;</div>
</div>
</body>

]]>
</Content>
</Module>
