OS = "";
BROWSER="";
AVAILPLAYERS = "";
IDONTSUCK = "1"; //gets unset if they do suck
FLASH = "";
CONNECTION="low";

function stristr(needle,haystack){
	str = new String(haystack);
	str = str.toLowerCase();
	needle = needle.toLowerCase();
	return  (str.indexOf(needle)>-1 )?1:0;
}

function connTest(){
	clearInterval(theTimer);
	if(theTime<2)CONNECTION="hi";
}
system = navigator.platform;
browseName = navigator.appName;
browseVer = parseInt(navigator.appVersion);

if( stristr("win32",system))		OS="win";
if( stristr("mac",system))			OS="mac";
if( stristr("internet explorer",browseName) || stristr("msie",browseName))	BROWSER="ie";
if( stristr("netscape",browseName))	BROWSER="ns";

//available players & plugs checking for real,wmp and quicktime & of course flash
rp ="";
wmp="";
qt ="";

if(BROWSER=="ns" || OS=="mac"){
	if(hasplugs = navigator.plugins){
		navigator.plugins.refresh();
		for (i = 0; i < navigator.plugins.length; i++){
	  		plug = navigator.plugins[i].name.toLowerCase().replace(/\s/g,"");
			if(stristr("realplayer",plug)) rp="rp:" ;
			if(stristr("quicktime",plug)) qt="qt:";
			if(stristr("windowsmedia",plug)) wmp="wmp:";
			if(stristr("Flash 5",navigator.plugins[i].description)) FLASH="yes";
		}
	}else{
		IDONTSUCK=""; //Sucky Mac IE 4.5 doesn't have a plugins object
	}
}else{
	if(BROWSER=="ie" && OS=="win"){
	document.write('<sc'+'ript ',
				   'language=VBScript>\n ',
				   '\non error resume next\n\nfunction chval(val)\n	chval=val\nend function\n\nif(not isObject(createObject("WMPlayer.OCX.7"))) then \n	w=chval("")\nelse\n	wmp=chval("wmp:")\nend if\n\nif(isNull(CreateObject("rmocx.RealPlayer G2 Control")))then\n	w=chval("")\nelse\n	rp=chval("rp:")\nend if\n\nif(isNull(CreateObject("RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)")))then\n	w=chval("")\nelse\n	rp=chval("rp:")\nend if\n\nif(IsNull(CreateObject("RealVideo.RealVideo(tm) ActiveX Control (32-bit)")))then\n	w=chval("")\nelse\n	rp=chval("rp:")\nend if\n\nif(isNull(CreateObject("QuickTimeCheckObject.QuickTimeCheck.1")))then \n	w=chval("")\nelse\n	qt=chval("qt:")\nend if\n\nif(NOT isObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5")))then\n	FLASH=chval("")\nelse\n	FLASH=chval("yes")\nend if\n',
				   '</scri'+'pt>');
	}
}
AVAILPLAYERS = rp+wmp+qt;

theTime = 0;
theTimer = setInterval("theTime++",1000); 
document.write("<img src=assets/test_img.jpg onLoad='connTest()' height=1 width=1 border=0><br>");





if(!AVAILPLAYERS)IDONTSUCK="";//no plugs or ActiveX
function changePrefs(changeMode){
	
}

function autoselect(){
	if(PLAYER&&CONN)return;
	forceplayer = "";
	if(OS=="mac" && stristr("qt",AVAILPLAYERS)){
		forceplayer = "qt";
	}
	if(OS=="win" && stristr("wmp",AVAILPLAYERS)){
		forceplayer="wmp";
	}
	theForm = document.preferences
	if(!PLAYER){
		players = theForm.player.options
		for(i=0;i<players.length;i++){
			if(players[i].value==forceplayer){
				theForm.player.selectedIndex=i;
				break;
			}
		}
	}
	if(!CONN){
		conns =  theForm.connection.options
		for(i=0;i<conns.length;i++){
			if(conns[i].value==CONNECTION){
				theForm.connection.selectedIndex = i;
				break;
			}
		}
	}
	if(!FLASH){
		theForm.s_type.selectedIndex=1;
	}
}

