function openW(mypage,myname,w,h,features) {
if(screen.width){
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
}else{winl = 0;wint =0;}
if (winl < 0) winl = 0;
if (wint < 0) wint = 0;
var settings = 'height=' + h + ',';
settings += 'width=' + w + ',';
settings += 'top=' + wint + ',';
settings += 'left=' + winl + ',';
settings += features;
win = window.open(mypage,myname,settings);
win.window.focus();
}

function NewWindow(url, windowName, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable';
win = window.open(url, windowName, winprops);
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

<!-- Import the Video Search AJAX API. -->

<!-- Define all of the Javascript used to access the Video Search API and display search results. -->
//<![CDATA[

// The global variable for the TruveoVideoSearch object used in this application.
var TVS = null;

// Function getVideos() submits the given query to the video search engine.
function getVideos(query) { 
	document.getElementById("TitleBarDiv").innerHTML = 'loading...';
	TVS.getVideos(query);
}

// Function playVideo() opens a new browser window to load the specified videoUrl.
function playVideo(videoUrl, id) {
	window.open(videoUrl, '', 'width=800,height=800,location=no,menubar=no,resizable=yes,scrollbars=yes');
}

// Function handleUpdate() handles all response messages from the TruveoVideoSearchAPI.  Whenever the TruveoVideoSearchAPI
// receives a response to an AJAX request, it fires the onupdate event.  This method handles each onupdate event.
function handleUpdate(methodName) {
	refreshResults(TVS);
}

// Function handleLoad() handles the onload event, which is fired when the initialization of the TruveoVideoSearch object is complete.
function handleLoad(reloadStateFlag) {
	getVideos('');
}

// Function handleError() handles all errors thrown by the TruveoVideoSearch API.  It displays an alert box with the
// error code and error message.
function handleError(errorCode, errorMessage) {
	alert("ERROR: Code " + errorCode + "; " + errorMessage);
}

// Function refreshResults() takes a the Video Search object as an argument and use the data sets in this object
// to display a clickable thumbnail and title for each video search result.  This function also displays the provided
// title above the search results and the submitted query in the search box.
function refreshResults(TVS) {
	var theHTML = '';
	if (TVS.VideoSet && TVS.VideoSet.Video) {
		var VideoSet = TVS.VideoSet;
		var cellsPerRow = 5;
		var rows = 5;
		theHTML += '<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++) {
			theHTML += '<tr>';
			for (var k=0; k < cellsPerRow; k++) {
				var i = (j * cellsPerRow) + k; 
				theHTML += '<td align="center" valign="top" style="padding: 12px 4px 12px 4px;">';
				if (i >= VideoSet.Video.length) { theHTML += '&nbsp;'; }
				else {
					var theVideo = VideoSet.Video[i];
					if (theVideo) {
						theHTML += '<div style="width: 130px;">';
						theHTML += '<a href="javascript:playVideo(\''+theVideo.videoUrl+'\','+theVideo.id+'); void(0);"><img src="'+theVideo.thumbnailUrl+'" class="thumbnail" alt="click to play video"/></a>';
						theHTML += '<div><a href="javascript:playVideo(\''+theVideo.videoUrl+'\','+theVideo.id+'); void(0);">'+theVideo.title+'</a></div>';
						theHTML += '</div>';
					}
				}
				theHTML += '</td>';
			}
			theHTML += '</tr>';
		}
		theHTML += '</table>';
		document.getElementById("ResultsDiv").innerHTML = theHTML;
		document.getElementById("TitleBarDiv").innerHTML = TVS.VideoSet.title;
	}
	else {
		document.getElementById("ResultsDiv").innerHTML = '&nbsp;';
		document.getElementById("TitleBarDiv").innerHTML = 'There are no videos available.';
	}
	document.getElementById('searchBox').value = TVS.query;
}

// Function VSLoad() is called when the containing web page has completed loading.  This function instantiates a single TruveoVideoSearch
// object, sets the state of the object, attaches the appropriate event handlers to this object, and then initializes the object. 
function VSLoad() {
//	TVS = new TruveoVideoSearch('1x1jhj64466mi12ia');
// absxml	TVS = new TruveoVideoSearch('d5449f4a80737cc28');
	TVS = new TruveoVideoSearch('7731df00149eeb501');  //  abbas2000
	TVS.results = 25;
	TVS.attachEvent('onerror', 'handleError(errorCode, errorMessage);');
	TVS.attachEvent('onupdate', 'handleUpdate(methodName);');
	TVS.attachEvent('onload', 'handleLoad(reloadStateFlag);');
	TVS.initialize();
}

//]]>
