var WMPVer = "unknown";       // Set to WMP version string detected
var fHasWMP = false;          // True if either WMP v6.4 or v7+ found
var fHasWMP64 = false;        // True if WMP v6.4 found
var fHasWMP7 = false;         // True if WMP v7+ (8, 9) found
var fAppletRunning = false;   // True if v9 Applet is in use
var fPluginRunning = false;   // True if v6.4 Netscape plugin is in use

// insert the asx file location here
var streamsrc = "http://www.antfarm.co.za/clients/kayafm/kayafm_22.asx";
var plheight = 50;
var plwidth = 350;

function GetBrowser()
{
   var agt=navigator.userAgent.toLowerCase();
   if( ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)) )
       return "IE";
   else if( ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
         && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
         && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)) )
       return "Netscape";
   else
       return "unknown";
}

function GetPlayerMajorVer()
{
	var strVer = new String(WMPVer);
	s = strVer.split(".");
    return s[0];
}


function GetPlayerMinorVer()
{
	var strVer = new String(WMPVer);
	s = strVer.split(".");
	if (s[1])
		return s[1];
	else
		return("unknown");
}

function IsNSPluginInstalled()
{
    // See if 6.4 pluggin installed
    if (navigator.mimeTypes && navigator.mimeTypes["application/x-mplayer2"] && navigator.mimeTypes["application/x-mplayer2"].enabledPlugin)
		return(true);
	else
		return(false);
}

function AddDownloadLink(MajorVer)
{
 if (!(MajorVer) || MajorVer=="unknown" || MajorVer<9)
  { 
   document.write('<tr><td>You do not have the latest Windows Media Player version.<BR><A HREF="http://windowsmedia.com/download"><IMG SRC="http://www.microsoft.com/windows/windowsmedia/images/Download_88x31_static.gif" WIDTH="88" HEIGHT="31" BORDER="0" ALT="Get Windows Media Player" VSPACE="7"></A></td></tr>');
  } 
}



document.writeln("	<OBJECT classid=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95  codebase=\"../../#Version=6,4,5,715\" height=1 id=WMP64 width=1 VIEWASTEXT></OBJECT>");
document.writeln("	<OBJECT classid=CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6  codebase=\"../../#Version=7,0,0,1954\" height=1 id=WMP7 width=1 VIEWASTEXT></OBJECT>");



	var br = GetBrowser();        

if  (br=="IE"){
      document.write(
         ' <scr' + 'ipt language=VBScript>' + '\n' +
         ' On error resume next' + '\n' +
         ' fHasWMP64 = (WMP64.FileName="")'  + '\n' +
         ' fHasWMP7 = (WMP7.URL = "")' + '\n' +
         '<\/sc' + 'ript>'
      );
				}
	  
	fHasWMP=true;
	if( fHasWMP7 ) WMPVer=WMP7.versionInfo; 
	else if( fHasWMP64 ) WMPVer="6.4";
	else {
	   WMPVer="unknown";
	   fHasWMP=false;
	}   

	
	var pm = GetPlayerMajorVer(); 
	var pn = GetPlayerMinorVer(); 

	if (pm=="unknown" && br=="Netscape" && parseInt(navigator.appVersion)<5 && IsNSPluginInstalled())  
	   {
document.writeln("<APPLET NAME=\"KayaPlayah\" CODE=\"WMPNS.WMP\" HEIGHT=\"" + plheight + "\" WIDTH=\"" + plwidth + "\" MAYSCRIPT VIEWASTEXT>");
document.writeln("<PARAM NAME=\"AutoStart\" VALUE=\"true\">");
document.writeln("<PARAM NAME=\"enabled\" VALUE=\"true\">");
document.writeln("<PARAM NAME=\"balance\" VALUE=\"50\">");
document.writeln("<PARAM NAME=\"ShowStatusBar\" VALUE=\"1\">");
document.writeln("<PARAM NAME=\"ShowControls\" VALUE=\"1\">");
document.writeln("<PARAM NAME=\"ShowTracker\" VALUE=\"0\">");
document.writeln("<PARAM NAME=\"ShowDisplay\" VALUE=\"0\">");
document.writeln("<PARAM NAME=\"ShowPositionControls\" VALUE=\"0\">");
document.writeln("<PARAM NAME=\"volume\" VALUE=\"80\">");
document.writeln("<PARAM NAME=\"URL\" VALUE=\"" + streamsrc + "\">");
document.writeln("<PARAM NAME=\"FileName\" VALUE=\"" + streamsrc + "\">");
document.writeln("</APPLET>");
	   }	
	else if (br=="Netscape") 
	   {
document.writeln("	<Embed type=\"application/x-mplayer2\" pluginspage=\"http://www.microsoft.com/windows/windowsmedia/\" src=\"" + streamsrc + "\"");
document.writeln("Name=\"KayaPlayah\"");
document.writeln("AutoStart=1");
document.writeln("ShowStatusBar=1");
document.writeln("ShowControls=1");
document.writeln("ShowTracker=0");
document.writeln("EnableTracker=0");
document.writeln("ShowPositionControls=0");
document.writeln("EnablePositionControls=0");
document.writeln("width="+plwidth+";");
document.writeln("height="+plheight+";");
document.writeln("</embed>");
	   }
//	else if ((br=="IE" && pm>=7)||(br=="IE" && pm==6 && pn==4))
//	   { //for version 9 + - not implemented for Kaya

//document.writeln("<OBJECT CLASSID=\"clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6\" HEIGHT=\"" + plheight + "\" ID=\"KayaPlayah\" WIDTH=\"" + plwidth + "\">");
//document.writeln("<PARAM NAME=\"AutoSize\" VALUE=\"0\">");
//document.writeln("    <PARAM NAME=\"AutoStart\" VALUE=\"1\">");
//document.writeln("    <PARAM NAME=\"Balance\" VALUE=\"0\">");
//document.writeln("    <PARAM NAME=\"BufferingTime\" VALUE=\"05\">");
//document.writeln("    <PARAM NAME=\"ClickToPlay\" VALUE=\"0\">");
//document.writeln("    <PARAM NAME=\"DisplayMode\" VALUE=\"0\">");
//document.writeln("    <PARAM NAME=\"DisplaySize\" VALUE=\"5\">");
//document.writeln("    <PARAM NAME=\"Enabled\" VALUE=\"-1\">");
//document.writeln("    <PARAM NAME=\"EnableContextMenu\" VALUE=\"-1\">");
//document.writeln("    <PARAM NAME=\"InvokeURLs\" VALUE=\"-1\">");
//document.writeln("    <PARAM NAME=\"PreviewMode\" VALUE=\"0\">");
//document.writeln("    <PARAM NAME=\"Rate\" VALUE=\"1\">");
//document.writeln("	  <param name=\"uiMode\" value=\"mini\">");
//document.writeln("    <PARAM NAME=\"TransparentAtStart\" VALUE=\"0\">");
//document.writeln("    <PARAM NAME=\"enableErrorDialogs\" VALUE=\"1\">");
//document.writeln("    <PARAM NAME=\"Volume\" VALUE=\"80\">");
//document.writeln("    <PARAM NAME=\"WindowlessVideo\" VALUE=\"0\">");
//document.writeln("    <PARAM NAME=\"url\" VALUE=\"" + streamsrc + "\">");
//document.writeln("  </OBJECT>");
//	   }	
	else if ((br=="IE" && pm>=7)||(br=="IE" && pm==6 && pn==4))
	   {


document.writeln("    <OBJECT ID=\"KayaPlayah\" width=" + plwidth + " height=" + plheight + " CLASSID=\"CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95\" codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,5,0803\"  standby=\"Loading Windows Media Player components...\"  type=\"application/x-oleobject\">");
document.writeln("    	<PARAM NAME=\"FileName\" VALUE=\"" + streamsrc + "\">");
document.writeln("    	<PARAM NAME=\"AutoStart\" VALUE=\"1\">");
document.writeln("    	<PARAM NAME=\"AutoSize\" VALUE=\"0\">");
document.writeln("    <PARAM NAME=\"AnimationAtStart\" VALUE=\"0\">");
document.writeln("    <PARAM NAME=\"AllowScan\" VALUE=\"0\">");
document.writeln("    <PARAM NAME=\"AllowChangeDisplaySize\" VALUE=\"-1\">");
document.writeln("    <PARAM NAME=\"AutoRewind\" VALUE=\"0\">");
document.writeln("    <PARAM NAME=\"Balance\" VALUE=\"0\">");
document.writeln("    <PARAM NAME=\"BufferingTime\" VALUE=\"05\">");
document.writeln("    <PARAM NAME=\"ClickToPlay\" VALUE=\"0\">");
document.writeln("    <PARAM NAME=\"CursorType\" VALUE=\"0\">");
document.writeln("    <PARAM NAME=\"CurrentPosition\" VALUE=\"-1\">");
document.writeln("    <PARAM NAME=\"CurrentMarker\" VALUE=\"0\">");
document.writeln("    <PARAM NAME=\"DisplayBackColor\" VALUE=\"0\">");
document.writeln("    <PARAM NAME=\"DisplayForeColor\" VALUE=\"16776015\">");
document.writeln("    <PARAM NAME=\"DisplayMode\" VALUE=\"0\">");
document.writeln("    <PARAM NAME=\"DisplaySize\" VALUE=\"5\">");
document.writeln("    <PARAM NAME=\"Enabled\" VALUE=\"-1\">");
document.writeln("    <PARAM NAME=\"EnableContextMenu\" VALUE=\"-1\">");
document.writeln("    <PARAM NAME=\"EnablePositionControls\" VALUE=\"false\">");
document.writeln("    <PARAM NAME=\"EnableFullScreenControls\" VALUE=\"-1\">");
document.writeln("    <PARAM NAME=\"EnableTracker\" VALUE=\"false\">");
document.writeln("    <PARAM NAME=\"InvokeURLs\" VALUE=\"-1\">");
document.writeln("    <PARAM NAME=\"Language\" VALUE=\"-1\">");
document.writeln("    <PARAM NAME=\"Mute\" VALUE=\"0\">");
document.writeln("    <PARAM NAME=\"PlayCount\" VALUE=\"1\">");
document.writeln("    <PARAM NAME=\"PreviewMode\" VALUE=\"0\">");
document.writeln("    <PARAM NAME=\"Rate\" VALUE=\"1\">");
document.writeln("    <PARAM NAME=\"SelectionStart\" VALUE=\"-1\">");
document.writeln("    <PARAM NAME=\"SelectionEnd\" VALUE=\"-1\">");
document.writeln("    <PARAM NAME=\"SendOpenStateChangeEvents\" VALUE=\"true\">");
document.writeln("    <PARAM NAME=\"SendWarningEvents\" VALUE=\"true\">");
document.writeln("    <PARAM NAME=\"SendErrorEvents\" VALUE=\"true\">");
document.writeln("    <PARAM NAME=\"SendKeyboardEvents\" VALUE=\"0\">");
document.writeln("    <PARAM NAME=\"SendMouseClickEvents\" VALUE=\"0\">");
document.writeln("    <PARAM NAME=\"SendMouseMoveEvents\" VALUE=\"0\">");
document.writeln("    <PARAM NAME=\"SendPlayStateChangeEvents\" VALUE=\"true\">");
document.writeln("    <PARAM NAME=\"ShowCaptioning\" VALUE=\"0\">");
document.writeln("    <PARAM NAME=\"ShowControls\" VALUE=\"-1\">");
document.writeln("    <PARAM NAME=\"ShowAudioControls\" VALUE=\"-1\">");
document.writeln("    <PARAM NAME=\"ShowDisplay\" VALUE=\"0\">");
document.writeln("    <PARAM NAME=\"ShowGotoBar\" VALUE=\"0\">");
document.writeln("    <PARAM NAME=\"ShowPositionControls\" VALUE=\"0\">");
document.writeln("    <PARAM NAME=\"ShowStatusBar\" VALUE=\"1\">");
document.writeln("    <PARAM NAME=\"ShowTracker\" VALUE=\"-1\">");
document.writeln("    <PARAM NAME=\"TransparentAtStart\" VALUE=\"0\">");
document.writeln("    <PARAM NAME=\"VideoBorderWidth\" VALUE=\"0\">");
document.writeln("    <PARAM NAME=\"VideoBorderColor\" VALUE=\"0\">");
document.writeln("    <PARAM NAME=\"VideoBorder3D\" VALUE=\"0\">");
document.writeln("    <PARAM NAME=\"Volume\" VALUE=\"80\">");
document.writeln("    <PARAM NAME=\"WindowlessVideo\" VALUE=\"0\">");
document.writeln("      </OBJECT>");

	   }	   
	else	
	   {
		window.self.location="http://www.antfarm.co.za/needplayer.asp"; 
	   }		
