/*
ua.js revision 0.200 2001-12-03

Contributor(s): Bob Clary, Netscape Communications, Copyright 2001

Netscape grants you a royalty free license to use, modify and 
distribute this software provided that this copyright notice 
appears on all copies.  This software is provided "AS IS," 
without a warranty of any kind.
*/

function xbDetectBrowser()
{
  var oldOnError = window.onerror;
  var element = null;

  window.onerror = null;
  
  // work around bug in xpcdom Mozilla 0.9.1
  window.saveNavigator = window.navigator;

  navigator.OS    = '';
  navigator.version  = parseFloat(navigator.appVersion);
  navigator.org    = '';
  navigator.family  = '';

  var platform;
  if (typeof(window.navigator.platform) != 'undefined')
  {
    platform = window.navigator.platform.toLowerCase();
    if (platform.indexOf('win') != -1)
      navigator.OS = 'win';
    else if (platform.indexOf('mac') != -1)
      navigator.OS = 'mac';
    else if (platform.indexOf('unix') != -1 || platform.indexOf('linux') != -1 || platform.indexOf('sun') != -1)
      navigator.OS = 'nix';
  }

  var i = 0;
  var ua = window.navigator.userAgent.toLowerCase();
  
  if (ua.indexOf('opera') != -1)
  {
    i = ua.indexOf('opera');
    navigator.family  = 'opera';
    navigator.org    = 'opera';
    navigator.version  = parseFloat('0' + ua.substr(i+6), 10);
  }
  else if ((i = ua.indexOf('msie')) != -1)
  {
    navigator.org    = 'microsoft';
    navigator.version  = parseFloat('0' + ua.substr(i+5), 10);
    
    if (navigator.version < 4)
      navigator.family = 'ie3';
    else
      navigator.family = 'ie4'
  }
  else if (ua.indexOf('gecko') != -1)
  {
    navigator.family = 'gecko';
    var rvStart = navigator.userAgent.indexOf('rv:') + 3;
    var rvEnd = navigator.userAgent.indexOf(')', rvStart);
    var rv = navigator.userAgent.substring(rvStart, rvEnd);
    var decIndex = rv.indexOf('.');
    if (decIndex != -1)
    {
      rv = rv.replace(/\./g, '')
      rv = rv.substring(0, decIndex-1) + '.' + rv.substr(decIndex)
    }
    navigator.version = parseFloat(rv);

    if (ua.indexOf('netscape') != -1)
      navigator.org = 'netscape';
    else if (ua.indexOf('compuserve') != -1)
      navigator.org = 'compuserve';
    else
      navigator.org = 'mozilla';
  }
  else if ((ua.indexOf('mozilla') !=-1) && (ua.indexOf('spoofer')==-1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('opera')==-1)&& (ua.indexOf('webtv')==-1) && (ua.indexOf('hotjava')==-1))
  {
    var is_major = parseFloat(navigator.appVersion);
    
    if (is_major < 4)
      navigator.version = is_major;
    else
    {
      i = ua.lastIndexOf('/')
      navigator.version = parseFloat('0' + ua.substr(i+1), 10);
    }
    navigator.org = 'netscape';
    navigator.family = 'nn' + parseInt(navigator.appVersion);
  }
  else if ((i = ua.indexOf('aol')) != -1 )
  {
    // aol
    navigator.family  = 'aol';
    navigator.org    = 'aol';
    navigator.version  = parseFloat('0' + ua.substr(i+4), 10);
  }
  else if ((i = ua.indexOf('hotjava')) != -1 )
  {
    // hotjava
    navigator.family  = 'hotjava';
    navigator.org    = 'sun';
    navigator.version  = parseFloat(navigator.appVersion);
  }

  window.onerror = oldOnError;
}

/*** Microsoft Scheduled critical security update for Internet Explorer on 04/11. 
This update changes the way in which Internet Explorer handles some web pages that use ActiveX controls, 
disallowing interaction with these controls until they are enabled. 
Users cannot directly interact with Microsoft ActiveX controls loaded by the APPLET, EMBED, or OBJECT elements. 
Users can interact with such controls after activating their user interfaces.
Inorder to prevent this, we are creating these controls externally in this Java script. 
***/

function createObjectControl(DivID, CLSID, ObjectID, WIDTH, HEIGHT, ALIGN, HSPACE, SCALE, BGCOLOR, URL){
 
 var d = document.getElementById(DivID);
 
 d.innerHTML = '<OBJECT classid=' + CLSID + ' codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" '+
 ' WIDTH=' + WIDTH + ' HEIGHT=' + HEIGHT + ' id=' + ObjectID + ' ALIGN=' + ALIGN + ' HSPACE=' + HSPACE +' > ' +
 ' <PARAM NAME="movie" VALUE=' + URL + '> ' +
 ' <PARAM NAME="quality" VALUE=high>  ' +
 ' <PARAM NAME="bgcolor" VALUE=' + BGCOLOR + '> ' +
 ' <EMBED src='+ URL + ' quality="high" bgcolor=' + BGCOLOR + ' WIDTH=' + WIDTH + ' HEIGHT=' + HEIGHT + ' NAME=' + ObjectID  + ' SCALE=' + SCALE  +  
 ' TYPE="application/x-shockwave-flash" PLUGINSPAGE="https://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>';
}

// Use this function if the classid is the same as included in this function for the flash movie OBJECT. 

function createObjectControl(DivID, ObjectID, WIDTH, HEIGHT, ALIGN, HSPACE, SCALE, BGCOLOR, URL){
 
 var d = document.getElementById(DivID);
 
 if (BGCOLOR == null || BGCOLOR == "")
 {
	// Use this if back ground color is already defined for the form/table/Row/Column.

	 d.innerHTML = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" '+
	 ' WIDTH=' + WIDTH + ' HEIGHT=' + HEIGHT + ' id=' + ObjectID + ' ALIGN=' + ALIGN + ' HSPACE=' + HSPACE +' > ' +
	 ' <PARAM NAME="movie" VALUE=' + URL + '> ' +
	 ' <PARAM NAME="quality" VALUE=high>  ' +
	 ' <EMBED src='+ URL + ' quality="high" WIDTH=' + WIDTH + ' HEIGHT=' + HEIGHT + ' NAME=' + ObjectID  + ' SCALE=' + SCALE  +
	 ' TYPE="application/x-shockwave-flash" PLUGINSPAGE="https://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>';
 }
 else
 {
	 d.innerHTML = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" '+
	 ' WIDTH=' + WIDTH + ' HEIGHT=' + HEIGHT + ' id=' + ObjectID + ' ALIGN=' + ALIGN + ' HSPACE=' + HSPACE +' > ' +
	 ' <PARAM NAME="movie" VALUE=' + URL + '> ' +
	 ' <PARAM NAME="quality" VALUE=high>  ' +
	 ' <PARAM NAME="bgcolor" VALUE=' + BGCOLOR + '> ' +
	 ' <EMBED src='+ URL + ' quality="high" bgcolor=' +BGCOLOR +' WIDTH=' + WIDTH + ' HEIGHT=' + HEIGHT + ' NAME=' + ObjectID  + ' SCALE=' + SCALE  +
	 ' TYPE="application/x-shockwave-flash" PLUGINSPAGE="https://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>';
 }
}

// Use this function if the classid is the same as included in this function for the flash movie OBJECT
// and the flash movie OBJECT is to be Transparent

function createTransparentObjectControl(DivID, ObjectID, WIDTH, HEIGHT, ALIGN, HSPACE, SCALE, BGCOLOR, URL){
 
 var d = document.getElementById(DivID);
 
 if (BGCOLOR == null || BGCOLOR == "")
 {
	// Use this if back ground color is already defined for the form/table/Row/Column.
	 d.innerHTML = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" '+
	 ' WIDTH=' + WIDTH + ' HEIGHT=' + HEIGHT + ' id=' + ObjectID + ' ALIGN=' + ALIGN + ' HSPACE=' + HSPACE +' > ' +
	 ' <PARAM NAME="movie" VALUE=' + URL + '> ' +
	 ' <PARAM NAME="quality" VALUE=high>  ' +
	 ' <PARAM NAME="wmode" VALUE=transparent> ' +
	 ' <EMBED src='+ URL + ' quality="high" WIDTH=' + WIDTH + ' HEIGHT=' + HEIGHT + ' NAME=' + ObjectID  + ' SCALE=' + SCALE  +
	 '  WMODE=transparent ' +
	 ' TYPE="application/x-shockwave-flash" PLUGINSPAGE="https://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>';
 }
 else
 {
	 d.innerHTML = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" '+
	 ' WIDTH=' + WIDTH + ' HEIGHT=' + HEIGHT + ' id=' + ObjectID + ' ALIGN=' + ALIGN + ' HSPACE=' + HSPACE +' > ' +
	 ' <PARAM NAME="movie" VALUE=' + URL + '> ' +
	 ' <PARAM NAME="quality" VALUE=high>  ' +
	 ' <PARAM NAME="wmode" VALUE=transparent> ' +
	 ' <EMBED src='+ URL + ' quality="high" bgcolor=' +BGCOLOR +' WIDTH=' + WIDTH + ' HEIGHT=' + HEIGHT + ' NAME=' + ObjectID  + ' SCALE=' + SCALE  +
	 '  WMODE=transparent ' +
	 ' TYPE="application/x-shockwave-flash" PLUGINSPAGE="https://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>';
 }
}

function createFlashObject(DivID, CLASS, ObjectID, WIDTH, HEIGHT, ALIGN, HSPACE, SCALE, BGCOLOR, URL){
 
 var d = document.getElementById(DivID);
 
 d.innerHTML = '<OBJECT class=' + CLASS + ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" '+
 ' WIDTH=' + WIDTH + ' HEIGHT=' + HEIGHT + ' id=' + ObjectID + ' ALIGN=' + ALIGN + ' HSPACE=' + HSPACE +' > ' +
 ' <PARAM NAME="_cx" VALUE="4498"> ' + 
 ' <PARAM NAME="_cy" VALUE="1826"> '+ 
 ' <PARAM NAME="FlashVars" VALUE="4498"> ' + 
 ' <PARAM NAME="movie" VALUE=' + URL + '> ' +
 ' <PARAM NAME="Src" VALUE=' +URL + '> ' +
 ' <PARAM NAME="WMode" VALUE="Window"> '+ 
 ' <PARAM NAME="Play" VALUE="-1"> ' +
 ' <PARAM NAME="Loop" VALUE="-1"> ' +
 ' <PARAM NAME="SAlign" VALUE=""> ' +
 ' <PARAM NAME="Menu" VALUE="-1"> ' +
 ' <PARAM NAME="Base" VALUE=""> ' + 
 ' <PARAM NAME="AllowScriptAccess" VALUE="always"> ' +
 ' <PARAM NAME="Scale" VALUE="ShowAll"> ' + 
 ' <PARAM NAME="DeviceFont" VALUE="0"> ' + 
 ' <PARAM NAME="EmbedMovie" VALUE="0"> ' + 
 ' <PARAM NAME="BGColor" VALUE=""> ' + 
 ' <PARAM NAME="SWRemote" VALUE=""> ' + 
 ' <PARAM NAME="quality" VALUE=high>  ' +
 ' <PARAM NAME="bgcolor" VALUE=' + BGCOLOR + '> ' +
 ' <EMBED src='+ URL + ' quality="high" bgcolor=' +BGCOLOR +' WIDTH=' + WIDTH + ' HEIGHT=' + HEIGHT + ' NAME=' + ObjectID  + ' SCALE=' + SCALE  +
 ' TYPE="application/x-shockwave-flash" PLUGINSPAGE="https://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>';
}

// Use this function to load applet externally. 

function loadApplet(DivID, ARCHIVE, CODE, CODEBASE, WIDTH, HEIGHT, PARAM){
 
 var d = document.getElementById(DivID);
 
 if (PARAM == null || PARAM == "")
 {
	 d.innerHTML = '<applet archive=' + ARCHIVE + ' code='  + CODE + ' codebase=' + CODEBASE + ' width=' + WIDTH + ' height=' + HEIGHT + '>' + '</applet>';
 }
 else
 {
	  d.innerHTML = '<applet archive=' + ARCHIVE + ' code='  + CODE + ' codebase=' + CODEBASE + ' width=' + WIDTH + ' height=' + HEIGHT + '>' + 
	  PARAM + '</applet>';

 }

}

// Use this function to load applet externally. 

function loadApplets(DivID, CODE, CODEBASE, WIDTH, HEIGHT){

 var d = document.getElementById(DivID);
 d.innerHTML = '<applet  code='  + CODE + ' codebase=' + CODEBASE + ' width=' + WIDTH + ' height=' + HEIGHT + '>' + '</applet>';
}

function CreateWMControl(DivID, ObjectID,WIDTH, HEIGHT, URL)
{
  //  alert('<OBJECT ID="' + ObjectID + '" WIDTH=' + WIDTH + ' HEIGHT=' + HEIGHT +' CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" STANDBY="Loading Windows Media Player components..." TYPE="application/x-oleobject"> ' + '<PARAM NAME="ShowControls" VALUE="true"> ' + '<PARAM NAME="FileName" VALUE="' + URL + '"> ' +	'<EMBED TYPE="application/x-mplayer2" SRC="' + URL + '" NAME="MediaPlayer" WIDTH=' + WIDTH + '  HEIGHT=' + HEIGHT + ' showControls=1></EMBED>' + '</OBJECT>');
	 var d = document.getElementById(DivID);
  d.innerHTML = '<OBJECT ID="' + ObjectID + '" WIDTH=' + WIDTH + ' HEIGHT=' + HEIGHT +' CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" STANDBY="Loading Windows Media Player components..." TYPE="application/x-oleobject"> ' +
				'<PARAM NAME="ShowControls" VALUE="true"> ' +
				'<PARAM NAME="FileName" VALUE="' + URL + '"> ' +
				'<EMBED TYPE="application/x-mplayer2" SRC="' + URL + '" NAME="MediaPlayer" WIDTH=' + WIDTH + '  HEIGHT=' + HEIGHT + ' showControls=1></EMBED>' +
				'</OBJECT>';
}

function CreateRealControl(DivID,ObjectID, WIDTH, HEIGHT, URL, AUTOSTART)
{
	var d = document.getElementById(DivID);
	d.innerHTML = '<EMBED name="stream1" SRC="' + URL +  '" CONTROLS=ImageWindow WIDTH=' + WIDTH + ' HEIGHT=' + HEIGHT + ' CONSOLE="1" AUTOSTART="' + AUTOSTART + '" NOJAVA="false" MAINTAINASPECT="True" type="audio/x-pn-realaudio-plugin"></embed>';
	'</td><td width="93"><img src="gfx/blank.gif" width="93" height="23"></td></tr><tr><td align="center" valign="middle" colspan="3"><EMBED name="stream2" SRC="' + URL +  '" CONTROLS="PlayButton" WIDTH="31" HEIGHT="20" CONSOLE="1" NOJAVA="false" type="audio/x-pn-realaudio-plugin"></embed><EMBED name="stream4" SRC="' + URL +  '" CONTROLS="StopButton" WIDTH="21" HEIGHT="20" CONSOLE="1" NOJAVA="false" type="audio/x-pn-realaudio-plugin"></embed><EMBED name="stream5" "' + URL +  '" CONTROLS="VolumeSlider" WIDTH="30" HEIGHT="20" CONSOLE="1" NOJAVA="false" type="audio/x-pn-realaudio-plugin"></embed><EMBED name="stream3" SRC="' + URL +  '" CONTROLS="StatusBar" WIDTH="228" HEIGHT="20" CONSOLE="1" NOJAVA="false" type="audio/x-pn-realaudio-plugin"></embed>';
}

function CreateRealPlayerControls(DivID,playButtonWidth,playButtonHeight,stopButtonWidth,stopButtonHeight,volumesliderWidth,volumesliderHeight,statusbarWidth,statusbarHeight, URL ) 
{
var d = document.getElementById(DivID);
d.innerHTML = '<EMBED name="stream2" SRC="' + URL +  '" CONTROLS="PlayButton" WIDTH="' + playButtonWidth + '" HEIGHT="' + playButtonHeight + '" CONSOLE="1" NOJAVA="false" type="audio/x-pn-realaudio-plugin"></embed><EMBED name="stream4" SRC="' + URL +  '" CONTROLS="StopButton" WIDTH="' + stopButtonWidth + '" HEIGHT="'+ stopButtonHeight + '" CONSOLE="1" NOJAVA="false" type="audio/x-pn-realaudio-plugin"></embed><EMBED name="stream5" SRC="' + URL +  '" CONTROLS="VolumeSlider" WIDTH="' + volumesliderWidth + '" HEIGHT="' + volumesliderHeight + '" CONSOLE="1" NOJAVA="false" type="audio/x-pn-realaudio-plugin"></embed><EMBED name="stream3" SRC="' + URL +  '"  CONTROLS="StatusBar" WIDTH="' + statusbarWidth + '" HEIGHT="' + statusbarHeight + '" CONSOLE="1" NOJAVA="false" type="audio/x-pn-realaudio-plugin"></embed>';
}


xbDetectBrowser();

