// Ajax Connection code
function makeRequestVideos(url) {
	new Ajax.Request(url,{onSuccess:processResponseVideos});
}

function processResponseVideos(transport) {
	var xmldoc = transport.responseXML;
	// Get the form fields
	var num_videos = xmldoc.getElementsByTagName('video').length - 1;		
	var str_tmp = '';
	
	
	for (var i = 0; i <= num_videos; i++) {
		var intID = xmldoc.getElementsByTagName('vidId').item(i).firstChild.data;
		var str_Filename = xmldoc.getElementsByTagName('streams').item(i).firstChild.data;
		if (str_Filename == 'undefined') str_Filename = '/images/spacer.gif';

		str_tmp = str_tmp +'<object id="videoPlayer" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="870" height="360">';
		str_tmp = str_tmp +'<param name="movie" value="/videoSlider/phantom.swf" />';
		str_tmp = str_tmp +'<param name="FlashVars" value="videos=/videoSlider/xml.cfm?videoId='+intID+'"/>';//'+intID+'/video.xml" />';
		str_tmp = str_tmp +'<param name="allowFullScreen" value="true" />';
		str_tmp = str_tmp +'<param NAME="wmode" VALUE="opaque" />';
		str_tmp = str_tmp +'<embed src="/videoSlider/phantom.swf" FlashVars="videos=/videoSlider/xml.cfm?videoId='+intID+'" wmode="opaque" allowFullScreen="true" width="870"  height="356" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/>';//'+intID+'/video.xml" wmode="transparent" allowFullScreen="false" width="732"  height="360" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
		str_tmp = str_tmp +'</object>';
	}

	$('widgetMainVideo').innerHTML = str_tmp;
	//setTimeout(playMovieNow('videoPlayer'),500);
	playMovieNow('videoPlayer');

} //function


function playMovieNow(str_objectID) {
	try {
		thisMovie(str_objectID).playVideo();
	} catch (e) {
		setTimeout(function(){playMovieNow('videoPlayer')},100);	
	}
}

function thisMovie(movieName){
	if (window.document[movieName]) return window.document[movieName];
	if (navigator.appName.indexOf("Microsoft Internet")==-1){
		if (document.embeds && document.embeds[movieName]) return document.embeds[movieName]; 
		else return document.getElementById(movieName);
	}
}

//************************    Large Video Request Code    ******************

// Ajax Connection code
function makeRequestVideosLarge(url) {
	new Ajax.Request(url,{onSuccess:processResponseVideosLarge});
}

function processResponseVideosLarge(transport) {
	var xmldoc = transport.responseXML;

	// Get the form fields
	var num_videos = xmldoc.getElementsByTagName('video').length - 1;		
	var str_tmp = '';
	
	for (var i = 0; i <= num_videos; i++) {
		var intID = xmldoc.getElementsByTagName('vidId').item(i).firstChild.data;
		var str_Filename = xmldoc.getElementsByTagName('streams').item(i).firstChild.data;
		if (str_Filename == 'undefined') str_Filename = '/images/spacer.gif';
		
		str_tmp = str_tmp +'<object id="videoPlayer" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="270" height="190">';
		str_tmp = str_tmp +'<param name="movie" value="/videoSlider/phantom.swf" />';
		str_tmp = str_tmp +'<param name="FlashVars" value="videos=/videoSlider/xml.cfm?videoId='+intID+'" />';
		str_tmp = str_tmp +'<param name="allowFullScreen" value="true" />';
		str_tmp = str_tmp +'<param NAME="wmode" VALUE="opaque" />';
		str_tmp = str_tmp +'<embed src="/videoSlider/phantom.swf" FlashVars="videos=/videoSlider/xml.cfm?videoId='+intID+'" allowFullScreen="true" width="270" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
		str_tmp = str_tmp +'</object>';
		//str_tmp = str_tmp +'</noscript>';
	}
	
	$('widgetMainVideo').innerHTML = str_tmp;
	//setTimeout(playMovieNow('videoPlayer'),500);
	playMovieNow('videoPlayer');

} //function


function playMovieNow(str_objectID) {
	try {
		thisMovie(str_objectID).playVideo();
	} catch (e) {
		setTimeout(function(){playMovieNow('videoPlayer')},100);	
	}
}

function thisMovie(movieName){
	if (window.document[movieName]) return window.document[movieName];
	if (navigator.appName.indexOf("Microsoft Internet")==-1){
		if (document.embeds && document.embeds[movieName]) return document.embeds[movieName]; 
		else return document.getElementById(movieName);
	}
}







//************************** end of large video request *************************


//centenary code

// Ajax Connection code
function makeRequestVideosCent(url) {
	new Ajax.Request(url,{onSuccess:processResponseVideosCent});
}

function processResponseVideosCent(transport) {
	var xmldoc = transport.responseXML;

	// Get the form fields
	var num_videos = xmldoc.getElementsByTagName('video').length - 1;		
	var str_tmp = '';
	
	for (var i = 0; i <= num_videos; i++) {
		var intID = xmldoc.getElementsByTagName('vidId').item(i).firstChild.data;
		var str_Filename = xmldoc.getElementsByTagName('streams').item(i).firstChild.data;
		if (str_Filename == 'undefined') str_Filename = '/images/spacer.gif';
		
		//str_tmp = str_tmp +'<script type="text/javascript">AC_FL_RunContent( \'codebase\',\'http:\/\/download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\',\'width\',\'270\',\'height\',\'190\',\'allowFullScreen\',\'false\',\'pluginspage\',\'http:\/\/www.macromedia.com/go/getflashplayer\',\'movie\',\'\/templates\/widgets\/phantom\',\'FlashVars\',\'videos=/images/videos/'+str_Filename+'\' ); ';
		//str_tmp = str_tmp +'\n</script><noscript>';
		str_tmp = str_tmp +'<object id="videoPlayer" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="270" height="190">';
		str_tmp = str_tmp +'<param name="movie" value="/videoSlider/phantom.swf" />';
		str_tmp = str_tmp +'<param name="FlashVars" value="videos=/videoSlider/file'+intID+'.xml" />';
		str_tmp = str_tmp +'<param name="allowFullScreen" value="true" />';
		str_tmp = str_tmp +'<param NAME="wmode" VALUE="opaque" />';
		str_tmp = str_tmp +'<embed src="/videoSlider/phantom.swf" FlashVars="videos=/videoSlider/file'+intID+'.xml" allowFullScreen="true" width="270" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
		str_tmp = str_tmp +'</object>';
		//str_tmp = str_tmp +'</noscript>';
	}

	$('widgetMainVideo' + intID).innerHTML = str_tmp;
	//setTimeout(playMovieNow('videoPlayer'),500);
	playMovieNow('videoPlayer');

} //function



