var undefined;
var agt=navigator.userAgent.toLowerCase();
var ie=(agt.indexOf("msie")!=-1);
var ns=(navigator.appName.indexOf("Netscape")!=-1);
var win=((agt.indexOf("win")!=-1)||(agt.indexOf("32bit")!=-1));
var mac=(agt.indexOf("mac")!=-1);
if(ie&&win){
	pluginlist=detectIE("Adobe.SVGCtl","SVG Viewer")+detectIE("SWCtl.SWCtl.1","Shockwave Director")+detectIE("ShockwaveFlash.ShockwaveFlash.1","Shockwave Flash")+detectIE("rmocx.RealPlayer G2 Control.1","RealPlayer")+detectIE("QuickTimeCheckObject.QuickTimeCheck.1","QuickTime")+detectIE("MediaPlayer.MediaPlayer.1","Windows Media Player")+detectIE("PDF.PdfCtrl.5","Acrobat Reader");
}
if(ns||!win){
	nse="";
	for(var i=0;i<navigator.mimeTypes.length;i++)nse+=navigator.mimeTypes[i].type.toLowerCase();
	pluginlist=detectNS("image/svg-xml","SVG Viewer")+detectNS("application/x-director","Shockwave Director")+detectNS("application/x-shockwave-flash","Shockwave Flash")+detectNS("audio/x-pn-realaudio-plugin","RealPlayer")+detectNS("video/quicktime","QuickTime")+detectNS("application/x-mplayer2","Windows Media Player")+detectNS("application/pdf","Acrobat Reader");
}
function detectIE(ClassID,name){
	result=false;
	document.write('<SCRIPT LANGUAGE=VBScript>\n on error resume next \n result = IsObject(CreateObject("'+ClassID+'"))</SCRIPT>\n');
	if(result)return name+',';
	else return'';
}
function detectNS(ClassID,name){
	n="";
	if(nse.indexOf(ClassID)!=-1)if(navigator.mimeTypes[ClassID].enabledPlugin!=null)n=name+",";
	return n;
}
pluginlist+=navigator.javaEnabled()?"Java,":"";
if(pluginlist.length>0)pluginlist=pluginlist.substring(0,pluginlist.length-1);

function choose_wm(){
	if(pluginlist.indexOf("Windows Media Player")!=-1){
		document.getElementById('wm-link').href="player.php?format=wm&plugin=wm&station="+station;
		document.getElementById('wm-btn').href="player.php?format=wm&plugin=wm&station="+station;
		return'wm';
	}
	return'none';
}
function choose_mp3(){
	if(pluginlist.indexOf("RealPlayer")!=-1){
		document.getElementById('mp3-link').href="player.php?format=mp3&plugin=real&station="+station;
		document.getElementById('mp3-btn').href="player.php?format=mp3&plugin=real&station="+station;
		return'real';
	}
	if(pluginlist.indexOf("Windows Media Player")!=-1){
		document.getElementById('mp3-link').href="player.php?format=mp3&plugin=wm&station="+station;
		document.getElementById('mp3-btn').href="player.php?format=mp3&plugin=wm&station="+station;
		return'wm';
	}
	if(pluginlist.indexOf("QuickTime")!=-1){
		document.getElementById('mp3-link').href="player.php?format=mp3&plugin=qt&station="+station;
		document.getElementById('mp3-btn').href="player.php?format=mp3&plugin=qt&station="+station;
		return'qt';
	}
	if(pluginlist.indexOf("Java")!=-1){
		document.getElementById('ogg-link').href="player.php?format=ogg&plugin=java&station="+station;
		document.getElementById('ogg-btn').href="player.php?format=ogg&plugin=java&station="+station;
		return'java';
	}
	document.getElementById('mp3-link').href="player.php?format=mp3&plugin=none&station="+station;
	document.getElementById('mp3-btn').href="player.php?format=mp3&plugin=none&station="+station;
	return'none';
}
function choose_ogg(){
	document.getElementById('ogg-link').href="player.php?format=ogg&plugin=java&station="+station;
	document.getElementById('ogg-btn').href="player.php?format=ogg&plugin=java&station="+station;
	return'none';
}
function choose_aac(){
	if(pluginlist.indexOf("QuickTime")!=-1){
		document.getElementById('aac-link').href="player.php?format=aac&plugin=qt&station="+station;
		document.getElementById('aac-btn').href="player.php?format=aac&plugin=qt&station="+station;
		return'qt';
	}
	return'none';
}

function choose_em() {
	if(document.getElementById('mp3-link') != undefined && document.getElementById('mp3-btn') != undefined)
		choose_mp3();
	if(document.getElementById('wm-link') != undefined && document.getElementById('wm-btn') != undefined)
		choose_wm();
	if(document.getElementById('ogg-link') != undefined && document.getElementById('ogg-btn') != undefined)
		choose_ogg();
	if(document.getElementById('aac-link') != undefined && document.getElementById('aac-btn') != undefined)
		choose_aac();
}

