var platform = "";
var agent = "";
var theplayer="";
var plugins = pluginDetect();
  
function pluginDetect() {
// Returns pluginlist as the list of plugins detected
// Detects: Flash, Windows Media Player, Java, Shockwave, RealPlayer, QuickTime, Acrobat Reader, SVG Viewer
// theplayer = wmplayer,flash,qtime

// Internet Explorer, Firefox, Opera, Netscape
// agent = firefox,msie,netscape,opera

// Windows, Mac
// platform = win,mac

	var agt=navigator.userAgent.toLowerCase();
	var ff = (agt.indexOf("firefox") != -1);
	var op = (agt.indexOf("opera") != -1);
	var ie  = (agt.indexOf("msie") != -1);
	var ns  = (navigator.appName.indexOf("Netscape") != -1);

	if (op) agent="opera";
	if (ie) agent="msie";  
	if (ns) agent="netscape";
	if (ff) agent="firefox";
	
	var win = ((agt.indexOf("win")!=-1) || (agt.indexOf("32bit")!=-1));
	var mac = (agt.indexOf("mac")!=-1);

	if (win) platform="win";
	if (mac) platform="mac";
	
	var pluginlist = "";

	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) || (op && 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);
	return pluginlist;
}

function initPlayer() {
	theplayer="flash";
		
	initPopups();
}

function initPopups() {
  // add an onclick event to every hyperlink with a class of 'oxplayer'
  var els = document.getElementsByTagName("a");
  for(var i = 0; i < els.length; i++) {
    if (els[i].className.indexOf("oxplayer") !=- 1) {
      els[i].onclick=popup_oxygen;
    }
  }
}

function popup_oxygen() {
  var url=encodeURI('oxygen/MyMP3Player.html?track=' + this.name + '&sys=' + platform + '&agent=' + agent + '&player=' + theplayer + '&title=' + this.title + '&session_id=' + session_id + '&codes=' + prodcodes);
  pWin = window.open (url, 'newWin', 'width=450, height=450, toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=1')
  if (window.pWin) pWin.focus()
  return false;
}



