//***************************************************************************
// *   File Name   :  LoadMediaControl.js		                            *
// *   Description :  This javascript file contains functions for loading   * 
// *				  and activating the following media player ActiveX		*
// *				  controls: Windows Media Player, RealPlayer,			*
// *	  			  QuickTime Player, Flash Player.						* 
// *																	    *
// The functions in this javascript file are compiled from several sources: 
// 1. http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/overview/activating_activex.asp
// 2. http://developer.apple.com/internet/ieembedprep.html
// 3. http://therippa.blogspot.com
//
//***************************************************************************
// *   REVISION HISTORY:                                                    *
// *                                                                        *
// *   Date Created : June 19, 2006		                                    *
// *   Author       : Cris Almodovar		                                *
// *                                                                        *
// *   REVISION TRAIL:                                                      *
// *                                                                        *
// *      Date     By    SIR No         Description                         *
// *   04.23.07    EVC   DX Release		Added id attribute for the 			*
// *									QuickTime Object                    *
// *   07.22.08	   MSC   RMT3432		Omniture Updates                    *
// *   08.26.09	   DTCH   RMT 4471		flex calls this function, passing the layer id, and dimensions                   *
// *																		*
// *																		*
// *																		*
// Global variables
var hiddenDivID = '';

function LoadWindowsMediaPlayer (divID, mediaUrl, controlWidth, controlHeight)
{ 
  SetVisibility (divID, 'hidden');
  hiddenDivID = divID;  
  
  var d = document.getElementById(divID);
  
  d.innerHTML  = '<OBJECT ID="MediaPlayer" ' +
                'NAME="MediaPlayer" ' + 
                'CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" ' +
                'TYPE="application/x-oleobject" ' + 
                'WIDTH="' + controlWidth + '" ' +      // Default width = 320
                'HEIGHT="' + controlHeight + '" ' +    // Default height = 310
                'SHOWASTEXT> ' +
                '<param name="ShowStatusBar" value="true"> ' +
                '<param name="ShowTracker" value="true"> ' +		
		        '<param name="StandBy" value="Loading Microsoft Media Player components..."> ' +
		        '<param name="FileName" value="' + mediaUrl + '" > ' +
		        '<param name="AnimationStart" value="true"> ' +
		        '<param name="AutoStart" value="true"> ' + 
		        '<param name="ShowControls" value="true"> ' +	
		        '<EMBED ShowStatusBar="true" ' + 
		        'ShowTracker="true" ' + 
		        'TYPE="application/x-mplayer2" ' + 
		        'PLUGINSPAGE="http://www.microsoft.com/isapi/redir.dll?sbp=mediaplayer&amp;prd=windows&amp;ar=Media&amp;sba=Plugin" ' +
		        'SRC="' + mediaUrl + '" ' + 
		        'NAME="MediaPlayer" ' + 
		        'SHOWCONTROLS="true" ' + 
		        'WIDTH="' + controlWidth + '" ' +      // Default width = 320
                'HEIGHT="' + controlHeight + '" ' +    // Default height = 310
		        '</EMBED> ' +
		        '</OBJECT><BR>' ;          	                                                       
		            
}


function LoadWindowsMediaPlayer2 (divID, mediaUrl, controlWidth, controlHeight)
{    
  hiddenDivID = '';
  
  document.write ('<OBJECT ID="MediaPlayer" ');
  document.write ('NAME="MediaPlayer" '); 
  document.write ('CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" ');
  document.write ('TYPE="application/x-oleobject" '); 
  document.write ('WIDTH="' + controlWidth + '" ');
  document.write ('HEIGHT="' + controlHeight + '" ');
  document.write ('SHOWASTEXT> ');
  document.write ('<param name="ShowStatusBar" value="true"> ');
  document.write ('<param name="ShowTracker" value="true"> ');		
  document.write ('<param name="StandBy" value="Loading Microsoft Media Player components..."> ');
  document.write ('<param name="FileName" value="' + mediaUrl + '" > ');
  document.write ('<param name="AnimationStart" value="true"> ');
  document.write ('<param name="AutoStart" value="true"> '); 
  document.write ('<param name="ShowControls" value="true"> ');	
  document.write ('<EMBED ShowStatusBar="true" ');
  document.write ('ShowTracker="true" ');
  document.write ('TYPE="application/x-mplayer2" ');
  document.write ('PLUGINSPAGE="http://www.microsoft.com/isapi/redir.dll?sbp=mediaplayer&amp;prd=windows&amp;ar=Media&amp;sba=Plugin" ');
  document.write ('SRC="' + mediaUrl + '" ');
  document.write ('NAME="MediaPlayer" ');
  document.write ('SHOWCONTROLS="true" ');
  document.write ('WIDTH="' + controlWidth + '" ');
  document.write ('HEIGHT="' + controlHeight + '" ');
  document.write ('</EMBED> ');
  document.write ('</OBJECT> ');  
		
}



function LoadRealPlayer (divID, mediaUrl, controlWidth, controlHeight)   
{   
  hiddenDivID = '';
  
  var d = document.getElementById(divID);
  
  d.innerHTML = '<OBJECT ID="Rp1" ' +
                'classid="CLSID:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" ' +                
                'WIDTH="' + controlWidth + '" ' +       // Default width = 320
                'HEIGHT="' + controlHeight + '"> ' +    // Default height = 240                
                '<param name="controls" value="ImageWindow"> ' +
                '<param name="console" value="one"> ' +
                '<param name="maintainaspect" value="true"> ' +
                '<param name="autostart" value="true"> ' + 
                '<EMBED name="Rp1" ' + 
                'src="' + mediaUrl + '" ' +
                'width="' + controlWidth + '" ' +
                'height="' + controlHeight + '" ' +                  
                'autostart="true" ' +
                'nojava="true" ' + 
                'controls="ImageWindow" ' +
                'console="one" ' +
                'mainaspect="true" ' + 
                'pluginspage="http://www.real.com/index.htm"></EMBED>' +
                '</OBJECT><BR>' + 
                '<OBJECT ID="Rp2" ' +
                'classid="CLSID:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" ' + 
                'WIDTH="' + controlWidth + '" ' +
                'HEIGHT="81" > ' +
                '<param name="src" value="' + mediaUrl + '"> ' +
                '<param name="console" value="one"> ' + 
                '<param name="controls" value="All">' + 
                '<param name="loop" value="false">' + 
                '<EMBED name="Rp2" ' + 
                'src="' + mediaUrl + '" ' +
                'width="' + controlWidth + '" ' + 
                'height="81" ' +                 
                'autostart="false" ' +
                'loop="false" ' + 
                'nojava="true" ' + 
                'controls="All" ' +
                'console="video1" > ' + 
                '</EMBED> ' +
                '<NOEMBED> ' +
                '<a href="' + mediaUrl + '">Play first clip</a> ' +
                '</NOEMBED> ' + 
                '</OBJECT><BR>' ;  

}  


function LoadRealPlayer2 (divID, mediaUrl, controlWidth, controlHeight)   
{    
    hiddenDivID = '';

	document.write ('<OBJECT ID="Rp1" ');
	document.write ('classid="CLSID:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" ');                
	document.write ('WIDTH="' + controlWidth + '" ');
	document.write ('HEIGHT="' + controlHeight + '"> ');
	document.write ('<param name="controls" value="ImageWindow"> ');
	document.write ('<param name="console" value="one"> ');
	document.write ('<param name="maintainaspect" value="true"> ');
	document.write ('<param name="autostart" value="true"> '); 
	document.write ('<EMBED name="Rp1" '); 
	document.write ('src="' + mediaUrl + '" ');
	document.write ('TYPE="audio/x-pn-realaudio-plugin" ');
	document.write ('width="' + controlWidth + '" '); 
	document.write ('height="' + controlHeight + '" '); 
	document.write ('autostart="true" ');
	document.write ('nojava="true" '); 
	document.write ('controls="ImageWindow" ');
	document.write ('console="one" ');
	document.write ('mainaspect="true" '); 
	document.write ('pluginspage="http://www.real.com/index.htm"></EMBED> ');
	document.write ('</OBJECT><BR> '); 
	document.write ('<OBJECT ID="Rp2" ');
	document.write ('classid="CLSID:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" '); 
	document.write ('WIDTH="' + controlWidth + '" ');
	document.write ('HEIGHT="81" > ');
	document.write ('<param name="src" value="' + mediaUrl + '"> ');
	document.write ('<param name="console" value="one"> '); 
	document.write ('<param name="controls" value="All"> '); 
	document.write ('<param name="loop" value="false"> '); 
	document.write ('<EMBED name="Rp2" '); 
	document.write ('src="' + mediaUrl + '" ');
	document.write ('TYPE="audio/x-pn-realaudio-plugin" ');
	document.write ('width="' + controlWidth + '" '); 
	document.write ('height="81" '); 
	document.write ('autostart="false" ');
	document.write ('loop="false" '); 
	document.write ('nojava="true" '); 
	document.write ('controls="All" ');
	document.write ('console="video1" > '); 
	document.write ('</EMBED> ');
	document.write ('<NOEMBED> ');
	document.write ('<a href="' + mediaUrl + '">Play first clip</a> ');
	document.write ('</NOEMBED> '); 
	document.write ('</OBJECT><BR>');

} 


// This is not yet used.
function LoadFlashPlayer (divID, mediaUrl, controlWidth, controlHeight)
{  
  hiddenDivID = '';
  
  var d = document.getElementById(divID);  
  
  d.innerHTML = '<OBJECT ID="Flash" ' + 
                'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ' + 
                'CODEBASE="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" ' +
                'width="' + controlWidth + '" ' +       // Default width = 320
                'height="' + controlHeight + '"> ' +    // Default height = 240    
                '<param name="movie" value="' + mediaUrl + '"> ' +
                '<param name="quality" value="high"> ' +
                '<param name="LOOP" value="false"> ' +
                '<EMBED quality="high" ' +
                'align="" ' +
                'type="application/x-shockwave-flash" ' +
                'pluginspage="http://www.macromedia.com/go/getflashplayer" ' + 
                'WIDTH="' + controlWidth + '" ' +       // Default width = 320
                'HEIGHT="' + controlHeight + '" ' +     // Default height = 240    
                'LOOP="false" ' +
                'src="' + mediaUrl + '"> ' +
                '</EMBED> ' +
                '</OBJECT> ' ;

}


// This is not yet used.
function LoadFlashPlayer2 (divID, mediaUrl, controlWidth, controlHeight)
{  
  SetVisibility (divID, 'hidden');
  hiddenDivID = divID;    
  
  document.write ('<OBJECT ID="Flash" ');
  document.write ('classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '); 
  document.write ('CODEBASE="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" ');
  document.write ('width="' + controlWidth + '" ');       // Default width = 320
  document.write ('height="' + controlHeight + '"> ');    // Default height = 240    
  document.write ('<param name="movie" value="' + mediaUrl + '"> ');
  document.write ('<param name="quality" value="high"> ');
  document.write ('<param name="LOOP" value="false"> ');
  document.write ('<EMBED quality="high" ');
  document.write ('align="" ');
  document.write ('type="application/x-shockwave-flash" ');
  document.write ('pluginspage="http://www.macromedia.com/go/getflashplayer" '); 
  document.write ('WIDTH="' + controlWidth + '" ');       // Default width = 320
  document.write ('HEIGHT="' + controlHeight + '" ');     // Default height = 240    
  document.write ('LOOP="false" ');
  document.write ('src="' + mediaUrl + '"> ');
  document.write ('</EMBED> ');
  document.write ('</OBJECT> ');

}



function LoadQuickTimePlayer (divID, mediaUrl, controlWidth, controlHeight)
{  
  hiddenDivID = '';
  
  var d = document.getElementById(divID);  
  d.innerHTML = QT_GenerateOBJECTText(mediaUrl, controlWidth, controlHeight, '', 'CONTROLLER', 'true', 'ShowStatusBar', 'true', 'type', 'video/QuickTime', 'SRC' , mediaUrl, 'QTSRC', mediaUrl, 'id', 'QuickTimePlayer');   

}


function LoadQuickTimePlayer2 (divID, mediaUrl, controlWidth, controlHeight)
{   
  hiddenDivID = '';
  
  QT_WriteOBJECT (mediaUrl, controlWidth, controlHeight, '', 'CONTROLLER', 'true', 'ShowStatusBar', 'true', 'type', 'video/QuickTime', 'SRC' , mediaUrl, 'QTSRC', mediaUrl, 'id', 'QuickTimePlayer');   
}





/* ------------------------------------------------------------------------------------------------

   THE FOLLOWING JAVASCRIPT FUNCTIONS ARE FROM http://developer.apple.com/internet/ieembedprep.html
   
   This file contains functions to generate OBJECT and EMBED tags for QuickTime content. 
   These functions assemble the tags from parameters passed to them as parameters.

    QT_WriteOBJECT()              - generate HTML tags and insert them into the calling document
    QT_WriteOBJECT_XHTML()        - generate XHTML tags and insert them into the calling document

    QT_GenerateOBJECTText()       - generate HTML tags and return them as a string
    QT_GenerateOBJECTText_XHTML() - generate XHTML tags and return them as a string
    
    AC_QuickTimeVersion()         - return the version of this file as a floating point number.

   To call one of these functions, pass the url, width, height, and required ActiveX
   control version as parameters 1 through 4, and pass all other attributes and 
   parameters that you would otherwise specify for the OBJECT, PARAM, and EMBED 
   tags as pairs of parameters:

   <script language="JavaScript" type="text/javascript">
      QT_WriteOBJECT(srcURL, width, height, activeXVersion,
         "attributeName1", "attributeValue1",
         "attributeName1", "attributeValue2",
         "attributeName1", "attributeValue3",
         "attributeName1", "attributeValue4",
         ...
         "attributeNameN", "attributeValueN"
      );
    </script>

   These functions automatically add the "classid", "codebase", and "pluginspage" tags to 
   the OBJECT and/or EMBED tags with standard values if they are not specified in the
   parameter list, so you need not supply these tags unless you require non-standard values.
   
   Although the OBJECT and EMBED tags typically have the same attributes and parameters, it
   is sometimes useful to have different values for each. 
   Any attribute name prefixed with "obj#" is added to the OBJECT tag only, any attribute 
   name prefixed with "emb#" is added to the EMBED tag only.

   <script language="JavaScript" type="text/javascript">
      QT_WriteOBJECT('http://www.domain.com/sample.mov', '480', '288', ''
        , 'emb#bgcolor', '#FFFFFF');
   </script>

 */

/************** LOCALIZABLE GLOBAL VARIABLES ****************/

var gArgCountErr =	'The "%%" function requires an even number of arguments.'
				+	'\nArguments should be in the form "atttributeName", "attributeValue", ...';

/******************** END LOCALIZABLE **********************/

var gTagAttrs				= null;
var gQTGeneratorVersion		= 0.8;

function AC_QuickTimeVersion()	{ return gQTGeneratorVersion; }

function _QTComplain(callingFcnName, errMsg)
{
    errMsg = errMsg.replace("%%", callingFcnName);
	alert(errMsg);
}

function _QTAddAttribute(prefix, slotName, tagName)
{
	var		value;

	value = gTagAttrs[prefix + slotName];
	if ( null == value )
		value = gTagAttrs[slotName];

	if ( null != value )
	{
		if ( 0 == slotName.indexOf(prefix) && (null == tagName) )
			tagName = slotName.substring(prefix.length); 
		if ( null == tagName ) 
			tagName = slotName;
		return tagName + '="' + value + '" ';
	}
	else
		return "";
}

function _QTAddObjectAttr(slotName, tagName)
{
	// don't bother if it is only for the embed tag
	if ( 0 == slotName.indexOf("emb#") )
		return "";		

	if ( 0 == slotName.indexOf("obj#") && (null == tagName) )
		tagName = slotName.substring(4); 

	return _QTAddAttribute("obj#", slotName, tagName);
}

function _QTAddEmbedAttr(slotName, tagName)
{
	// don't bother if it is only for the object tag
	if ( 0 == slotName.indexOf("obj#") )
		return "";

	if ( 0 == slotName.indexOf("emb#") && (null == tagName) )
		tagName = slotName.substring(4); 

	return _QTAddAttribute("emb#", slotName, tagName);
}


function _QTAddObjectParam(slotName, generateXHTML)
{
	var		paramValue;
	var		paramStr = "";
	var		endTagChar = (generateXHTML) ? ' />' : '>';

	if ( -1 == slotName.indexOf("emb#") )
	{
		// look for the OBJECT-only param first. if there is none, look for a generic one
		paramValue = gTagAttrs["obj#" + slotName];
		if ( null == paramValue )
			paramValue = gTagAttrs[slotName];

		if ( 0 == slotName.indexOf("obj#") )
			slotName = slotName.substring(4); 
	
		if ( null != paramValue )
			paramStr = '  <param name="' + slotName + '" value="' + paramValue + '"' + endTagChar + '\n';
	}

	return paramStr;
}

function _QTDeleteTagAttrs()
{
	for ( var ndx = 0; ndx < arguments.length; ndx++ )
	{
		var attrName = arguments[ndx];
		delete gTagAttrs[attrName];
		delete gTagAttrs["emb#" + attrName];
		delete gTagAttrs["obj#" + attrName];
	}
}

		

// generate an embed and object tag, return as a string
function _QTGenerate(callingFcnName, generateXHTML, args)
{
	// is the number of optional arguments even?
	if ( args.length < 4 || (0 != (args.length % 2)) )
	{
		_QTComplain(callingFcnName, gArgCountErr);
		return "";
	}
	
	// allocate an array, fill in the required attributes with fixed place params and defaults
	gTagAttrs = new Array();
	gTagAttrs["src"] = args[0];
	gTagAttrs["width"] = args[1];
	gTagAttrs["height"] = args[2];
	gTagAttrs["classid"] = "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B";
	gTagAttrs["pluginspage"] = "http://www.apple.com/quicktime/download/";

	// set up codebase attribute with specified or default version before parsing args so
	//  anything passed in will override
	var activexVers = args[3]
	if ( (null == activexVers) || ("" == activexVers) )
		activexVers = "6,0,2,0";
	gTagAttrs["codebase"] = "http://www.apple.com/qtactivex/qtplugin.cab#version=" + activexVers;

	var	attrName,
		attrValue;

	// add all of the optional attributes to the array
	for ( var ndx = 4; ndx < args.length; ndx += 2)
	{
		attrName = args[ndx].toLowerCase();
		attrValue = args[ndx + 1];

		// "name" and "id" should have the same value, the former goes in the embed and the later goes in
		//  the object. use one array slot 
		if ( "name" == attrName || "id" == attrName )
			gTagAttrs["name"] = attrValue;

		else 
			gTagAttrs[attrName] = attrValue;
	}

	// init both tags with the required and "special" attributes
	var objTag =  '<object '
					+ _QTAddObjectAttr("classid")
					+ _QTAddObjectAttr("width")
					+ _QTAddObjectAttr("height")
					+ _QTAddObjectAttr("codebase")
					+ _QTAddObjectAttr("name", "id")
					+ _QTAddObjectAttr("tabindex")
					+ _QTAddObjectAttr("hspace")
					+ _QTAddObjectAttr("vspace")
					+ _QTAddObjectAttr("border")
					+ _QTAddObjectAttr("align")
					+ _QTAddObjectAttr("class")
					+ _QTAddObjectAttr("title")
					+ _QTAddObjectAttr("accesskey")
					+ _QTAddObjectAttr("noexternaldata")
					+ '>\n'
					+ _QTAddObjectParam("src", generateXHTML);
	var embedTag = '  <embed '
					+ _QTAddEmbedAttr("src")
					+ _QTAddEmbedAttr("width")
					+ _QTAddEmbedAttr("height")
					+ _QTAddEmbedAttr("pluginspage")
					+ _QTAddEmbedAttr("name")
					+ _QTAddEmbedAttr("align")
					+ _QTAddEmbedAttr("tabindex");

	// delete the attributes/params we have already added
	_QTDeleteTagAttrs("src","width","height","pluginspage","classid","codebase","name","tabindex",
					"hspace","vspace","border","align","noexternaldata","class","title","accesskey");

	// and finally, add all of the remaining attributes to the embed and object
	for ( var attrName in gTagAttrs )
	{
		attrValue = gTagAttrs[attrName];
		if ( null != attrValue )
		{
			embedTag += _QTAddEmbedAttr(attrName);
			objTag += _QTAddObjectParam(attrName, generateXHTML);
		}
	} 

	// end both tags, we're done
	return objTag + embedTag + '> </em' + 'bed>\n</ob' + 'ject' + '>';
}

// return the object/embed as a string
function QT_GenerateOBJECTText()
{
	return _QTGenerate("QT_GenerateOBJECTText", false, arguments);
}

function QT_GenerateOBJECTText_XHTML()
{
	return _QTGenerate("QT_GenerateOBJECTText_XHTML", true, arguments);
}

function QT_WriteOBJECT()
{
	document.writeln(_QTGenerate("QT_WriteOBJECT", false, arguments));
}

function QT_WriteOBJECT_XHTML()
{
	document.writeln(_QTGenerate("QT_WriteOBJECT_XHTML", true, arguments));
}








/*-------------------------------------------------------------------------------------------------

ActivateActiveX

Purpose:  Dynamically replace any elements that will be affected by the new security feature 
          in IE6/IE7 that requires a user to click certain types of elements to activate them 
          before use.

Usage:    Include this file at the end of your html document using the following...
	      <script language="javascript">
	        ActivateActiveX(); 
	      </script>

License:

ActivateActiveX is Copyright (C) 2006 Jason Baker (therippa AT gmail.com). It is available 
as open source code from: http://therippa.blogspot.com

This program is free software; you can redistribute it and/or modify it under the terms 
of the GNU General Public License as published by the Free Software Foundation; 
either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
See the GNU General Public License for more details http://www.gnu.org/licenses/gpl.html

-------------------------------------------------------------------------------------------------*/

function ActivateActiveX ()
{
  // Determine browser, we only need this for Internet Explorer
  
  var ieVersion = GetInternetExplorerVersion();
  var isInAuthoringMode = CheckAuthoringMode();  
  
  if (navigator.appName == "Microsoft Internet Explorer" && 
      ieVersion > 4 &&       
      isInAuthoringMode == false) 
  {	
  
	//Array of elements to be replaced
	var arrElements = new Array(4);
	arrElements[0] = "object";
	arrElements[1] = "embed";
	arrElements[2] = "applet";	
	
	//Loop over element types
	for (n = 0; n < arrElements.length; n++) 
	{
	  try
	  {		  
	    //set object for brevity
	    replaceObj = document.getElementsByTagName(arrElements[n]);
		
	    //loop over element objects returned
	    for (i = 0; i < replaceObj.length; i++ ) 
	    {
	      try
	      {	        
	        var isSkipped = CheckIfSkipped(replaceObj[i].classid);	        	        
	        
	        if (isSkipped == false)
	        {
			       
	          //set parent object for brevity
		      parentObj = replaceObj[i].parentNode;
	
	          //If top nav flash do not reinsert HTML
			  if(parentObj.id != 'flashcontent')
			  {   			  
				//grab the html inside of the element before removing it from the DOM
				newHTML = parentObj.innerHTML;
				
				//remove element from the DOM
				parentObj.removeChild(replaceObj[i]);
				
				//stick the element right back in, but as a new object
				parentObj.innerHTML = newHTML;		
		      }
		    }  
		  }
		  catch (error1)
		  {		    

		  }  
	    }
	  }
	  catch (error2)
	  {	  

	  }	  
    }

  }
  
  // Check if a DIV has been hidden. If yes then make it visible. 
  if (hiddenDivID != '')
  {
    SetVisibility (hiddenDivID, 'visible');
  } 
  
}


// Returns the version of Internet Explorer
function GetInternetExplorerVersion()
{  
  var version = 0;
  
  if (navigator.appName == "Microsoft Internet Explorer") 
  {
    if (navigator.appVersion.indexOf("MSIE") != -1)
    {
      var temp = navigator.appVersion.split("MSIE");
      version = parseFloat(temp[1]);
    }
  }
  
  return version;
}


// This function sets the visibility of a DIV element.
function SetVisibility (divID, value)
{
  var d = document.getElementById(divID);
  d.style.visibility = value;
}


// This function checks if the current page in in authoring mode.
function CheckAuthoringMode ()
{
  var isInAuthoringMode = false;  
  
  var location = document.location.href.toLowerCase();
  var authoringPreview = location.lastIndexOf("authoringpreview");  
  var authoring = location.lastIndexOf("authoring");          
  var authoringNew = location.lastIndexOf("authoringnew");        
  var authoringReEdit = location.lastIndexOf("authoringreedit");
  
  if (authoringNew > -1 || authoringReEdit > -1 || authoring > -1 || authoringPreview > -1)
  {
    isInAuthoringMode = true;
  }
  
  return isInAuthoringMode;
}


function CheckIfSkipped (objectClassID)
{
  var isSkipped = false;
  
  if (objectClassID != null)
  {
    var lowerCaseClassID = objectClassID.toLowerCase();
  
    if (lowerCaseClassID == 'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa' ||   // Real Player                        
        lowerCaseClassID == 'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b')   // QuickTime Player        
    {  
      isSkipped = true;
    }   
  }  

  return isSkipped;
}


function sendOmnitureEvents (eventType,url)
{
if (typeof(s_account)!='undefined')
{
var fileName;
var currentDomain = document.domain;
var resultUrl;
var externalMediaUrl;
var mediafileDomain = url.substring(url.indexOf("/")+2);
mediafileDomain = mediafileDomain.substring(0,mediafileDomain.indexOf("/"));

url = url.toLowerCase();
externalMediaUrl = url + " | " + currentPage;
fileName = url.substring(url.lastIndexOf("/")+1);
fileName = fileName + " | " + currentPage;


var s=s_gi(s_account); 
var UserGuid = RetrieveCookieVal("UserId");

	if (UserGuid!=null){
		s.prop29=UserGuid;
	}

	if ((mediafileDomain == currentDomain) || (url.indexOf("/") == 0)){
	resultUrl = fileName
	}
	else{
	resultUrl = externalMediaUrl
	}
	resultUrl

	switch(eventType)
	{
		case 'event6': 
			s.linkTrackVars='eVar16,prop29,events';
			s.linkTrackEvents='event6';
			s.eVar16=resultUrl;
			s.events='event6';
			s.tl(true,'o','Watch the Video'); 
			break;
		case 'event7':
			s.linkTrackVars='eVar17,prop29,events';
			s.linkTrackEvents='event7';
			s.eVar17=resultUrl;
			s.events='event7';
			s.tl(true,'o','Listen to Audio');
			break;
		case 'event9':
			s.linkTrackVars='eVar19,prop29,events';
			s.linkTrackEvents='event9';
			s.eVar19=url;
			s.events='event9';
			s.tl(true,'o','Rate this Article');
			break;		
		case 'event28':
			s.linkTrackVars='eVar32,prop29,events';
			s.linkTrackEvents='event28';
			s.eVar32=url;
			s.events='event28';
			s.tl(true,'o','Print Article');
			break;
		default:

	}
	}
}


function RetrieveCookieVal(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length + 1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return null;
}


function setSize(w, h) {
   var arrTagEmbed = document.getElementById("Flash").getElementsByTagName("embed");
   if (arrTagEmbed[0] == null) {
      document.getElementById("Flash").getElementsByTagName("embed").width = "100%";
      document.getElementById("Flash").getElementsByTagName("embed").height = "100%";
      }
    else {
      arrTagEmbed[0].width = "100%";
      arrTagEmbed[0].height = "100%";
    }
       
    document.getElementById("Flash").width = "100%";
    document.getElementById("Flash").height = "100%";
    document.getElementById("Flash").parentNode.style.width = w + "px";
    document.getElementById("Flash").parentNode.style.height = h + "px";
}

