MSIE    = (navigator.appName.indexOf('Microsoft Internet Explorer')!=-1);
Opera   = (navigator.userAgent.indexOf('Opera')!=-1);
Nav     = ((navigator.appName.indexOf('Netscape')!=-1) && (!Opera));
Nav4    = (document.layers);	
Firefox = (navigator.userAgent.indexOf("Firefox")!=-1);	
Safari = (navigator.userAgent.indexOf("Safari")!=-1);
MSIE4   = (document.all);
Win     = (navigator.userAgent.indexOf("Win")!=-1);
Mac     = (navigator.userAgent.indexOf("mac")!=-1)  || (navigator.userAgent.indexOf("Mac")!=-1);
OS2     = (navigator.userAgent.indexOf("os/2")!=-1) || (navigator.userAgent.indexOf("OS/2")!=-1);
Linux   = (navigator.userAgent.indexOf("inux")!=-1);
Other   = (!Win && !Mac && !OS2 && !Linux);
version = parseFloat(navigator.appVersion);
//alert(navigator.userAgent);
if(navigator.userAgent.indexOf("Safari")!=-1){
    var versionindex=navigator.userAgent.indexOf("Version")+8;
    var versionendindex=navigator.userAgent.indexOf("Safari");
    version = navigator.userAgent.substring(versionindex,versionendindex);
}
if(navigator.userAgent.indexOf("Firefox")!=-1){
    var versionindex=navigator.userAgent.indexOf("Firefox")+8;
    version = navigator.userAgent.substring(versionindex,navigator.userAgent.length);
}

////if (navigator.userAgent.indexOf('Opera')!=-1) {
////    var versionindex=navigator.userAgent.indexOf("Opera")+6;
////    var versionendindex=navigator.userAgent.indexOf("(");
////    version = navigator.userAgent.substring(versionindex,versionendindex);
////}
width   = screen.width;
height  = screen.height;
colors  = screen.colorDepth;
colorpix= screen.pixelDepth;
RealP   = 0;
MediaP  = 0;
CookieT = 0;
Proxy   = 0;
fHasWMP52 = navigator.mimeTypes && navigator.mimeTypes["application/x-mplayer2"] &&  navigator.mimeTypes["application/x-mplayer2"].enabledPlugin;
fHasWMP64 = navigator.mimeTypes && navigator.mimeTypes["video/x-ms-wm"] &&  navigator.mimeTypes["video/x-ms-wm"].enabledPlugin && navigator.mimeTypes["video/x-ms-wmv"] && navigator.mimeTypes["video/x-ms-wmv"].enabledPlugin;
RealMode=0;
RealPlayer5=0;
RealPlayer4=0;
RealPlayerG2=0;
today = new Date();
expiry = new Date(today.getTime() + 60000); // plus 1 minute

//loop through Netscape plugin directory for one called Real Player
if (navigator.userAgent.indexOf("MSIE")<0 ) {
	numPlugins = navigator.plugins.length;
	for (i = 0; i < numPlugins; i++){
		plugin = navigator.plugins[i];
		if (plugin.name.substring(0,10)=="RealPlayer") {
			RealMode=1;
		}
  	}
}

document.write('<SCRIPT LANGUAGE=VBScript\> \n');
document.write('<!-- \n');
document.write('on error resume next \n');
document.write('RealPlayerG2 = (NOT IsNull(CreateObject("rmocx.RealPlayer G2 Control")))\n');
document.write('RealPlayer5 = (NOT IsNull(CreateObject("RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)")))\n');
document.write('RealPlayer4 = (NOT IsNull(CreateObject("RealVideo.RealVideo(tm) ActiveX Control (32-bit)")))\n');
document.write('//--> \n');
document.write('</SCRIPT\> \n');
document.write('<OBJECT ID="NSPlay" WIDTH=1 HEIGHT=1 classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" \n');
document.write(' CODEBASE="#Version=6,4,5,715"> \n');
document.write('</OBJECT> \n');
document.write('<SCRIPT LANGUAGE=VBScript\> \n');
document.write('<!-- \n');
document.write('on error resume next \n');
document.write('fHasWMP52 = (IsObject(CreateObject("MediaPlayer.MediaPlayer.1") ) )\n');
document.write('fHasWMP64 = (NSPlay.FileName="")\n');
document.write('//--> \n');
document.write('</SCRIPT\> \n');

/*MSIE5*/ 
if (MSIE4) {
	x = navigator.userAgent.lastIndexOf("MSIE");
	version = parseFloat(navigator.userAgent.substring(x+5,x+10));
} 
/*Opera*/ 
if ((Opera) && (navigator.userAgent.lastIndexOf(") ")!=-1)){
	x = navigator.userAgent.lastIndexOf(") ");
	version = parseFloat(navigator.userAgent.substring(x+2,x+10));
} 
if ((Opera) && (version==0)){
	x = navigator.userAgent.lastIndexOf("Opera");
	version = parseFloat(navigator.userAgent.substring(x+6,x+12));
} 
/*MSIE3*/ 
if ((MSIE) && (version == 2)){ 
	version = 3.0;
}
if (Nav){ 
	CSS = Nav4;
	goodCSS = (version>4.99);
	CSSP = CSS;
}
if (MSIE){
	CSS = (version>2.99);
	goodCSS = (version>3.99);
	CSSP = goodCSS;
}
if (Opera){
	CSS = (version>3.49);
	goodCSS = CSS;    
	CSSP = (version>3.99);
}
getMediaPlayerDetails();
getRealPlayerDetails();
testCookie();

function getMediaPlayerDetails()
{
  if( fHasWMP64 ) MediaP="version 6.4 or higher.";
  else if( fHasWMP52 ) MediaP="version 5.2 or higher.";
  else MediaP="not installed.";
}
function getRealPlayerDetails(){
	if( RealPlayerG2 ) RealP="version G2 or higher.";
	else if( RealPlayer5 ) RealP="version 5.";
	else if( RealPlayer4 ) RealP="version 4.";
	else if (RealMode) RealP="installed.";
	else RealP="not installed.";
}
function testCookie(){
	setCookie("canIcookies", "Cookies are enabled.");
	CookieT=getCookie("canIcookies")||"Please enable cookies.";
}

function getCookie(name) {
// use: getCookie("name");
	var index = document.cookie.indexOf(name + "=");
	if (index == -1) return null;
	index = document.cookie.indexOf("=", index) + 1;
	var endstr = document.cookie.indexOf(";", index);
	if (endstr == -1) endstr = document.cookie.length;
	return unescape(document.cookie.substring(index, endstr));
}

function setCookie(name, value) {
// use: setCookie("name", value);
	if (value!=null && value!=""){
		document.cookie=name + "=" + escape(value) + "; expires=" + expiry.toGMTString();
	}
}
