<!-- LISTING ONE - DETECTING MEDIA PLAYER PLUGINS -->
<!--
function GetCookie (name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
		return getCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	}
	return null;
}

function getCookieVal(offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
	endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

function setCookie(name, value, expire ){
	document.cookie = name + "=" + escape(value) + ((expire==null ? "":(";expires=" + expire.toGMTString())));
	//alert('A browser cookie has been set with value: '+value);  
 }
 
 function getExpireDate(){
	var expires = new Date();
	expires.setTime((new Date().getTime()) + 1000*60*60*24*365);
	return expires;
 }
 
 
 var playerString="";
 function setPlayerString(p){
	playerString=p;
 }
 if (navigator.userAgent.indexOf("MSIE") < 0 || navigator.userAgent.indexOf("Win") < 0 )
 {
	numPlugins = navigator.plugins.length;
	for (i= 0; i<numPlugins; i++)
	{
	    currentPlugin = navigator.plugins[i];
	    if (currentPlugin.name.substring(0,10)=="RealPlayer")
	    {
		   playerString+="REAL"+",";
	    }
	    if (currentPlugin.name.substring(0,20)=="Windows Media Player")
	    {
		   playerString+="WMP"+",";
	    }
	    if (currentPlugin.name.substring(0,9)=="QuickTime")
	    {
		   playerString+="QT"+",";
	    }
	}//end for
   setCookie("MediaPlayers", playerString, getExpireDate());
   }//end if 

function selectPlayer(videocliphtml, speed){
	var fileNameLength = videocliphtml.length;
	var strFileName = videocliphtml;
	var videoName = strFileName.substring(0, fileNameLength-4);
	if (GetCookie('MediaPlayers') != 'QT' ){
		videoName = videoName + '_wmv.html';
	} else {
		videoName = videoName + '_mov.html';
	}
	//play the movie
	//first check: movie is QT and high-speed
	//alert (videoName + ', ' + speed);
	if ((speed !='slow') && (videoName.indexOf('wmv') == -1)){
	window.open (videoName,'videocliphtml',"width=320,height=260,status=no,location=no,toolbar=no,menubar=no,scrolling=no,left=160,top=185,resizable=yes");
	//second check: movie is QT and dial-up
	} else if ((speed =='slow') && (videoName.indexOf('wmv')) == -1){
	window.open (videoName,'videocliphtml',"width=160,height=140,status=no,location=no,toolbar=no,menubar=no,scrolling=no,left=160,top=185,resizable=yes");
	//third check: movie is Windows Media Player and highspeed
	} else if ((speed !='slow') && (videoName.indexOf('wmv')) != -1){
	window.open (videoName,'videocliphtml',"width=350,height=350,status=no,location=no,toolbar=no,menubar=no,scrolling=no,left=160,top=185,resizable=yes");
	//if none of the above, serve Windows Media Player - dial-up speed
	} else {
	window.open (videoName,'videocliphtml',"width=200,height=200,status=no,location=no,toolbar=no,menubar=no,scrolling=no,left=160,top=185,resizable=yes");
	}
				
}
-->
