// +-------------+
// | NEWS TICKER |
// +-------------+

// ____________________________________________________________________________________________________
//                                                                                          PREFERENCES
var swfobject_targetplayerversion = 8;// minimum player version
var swfobject_instancename        = "NewsTicker_1";
var swfobject_file                = "../images/NewsTicker.swf";
var swfobject_bgcolor             = "#ffffff";
var swfobject_width               = "381";
var swfobject_height              = "100";
var swfobject_launchvariables     = "";


// ____________________________________________________________________________________________________
//                                                                                             GET DATA
// called by flash
// get data which exceeds 256 limit on FlashVars and flash.swf?vars
function getData(){
	var swf = window.document[swfobject_instancename];
	swf.SetVariable("/:hex", hex);
	swf.SetVariable("/:title_string", title_array.join("|"));
	swf.SetVariable("/:headline_string", headline_array.join("|"));
}


// ____________________________________________________________________________________________________
//                                                                                    RENDER SWF OBJECT
var swfobject_isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var swfobject_isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var swfobject_isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
var swfobject_installedversion = -1;

// NS/Opera version >= 3 check for plugin in plugin array
if (navigator.plugins != null && navigator.plugins.length > 0) {
	if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
		var swfobject_swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
		var swfobject_flashDescription = navigator.plugins["Shockwave Flash" + swfobject_swVer2].description;
		var swfobject_descArray = swfobject_flashDescription.split(" ");
		var swfobject_tempArrayMajor = swfobject_descArray[2].split(".");
		var swfobject_installedversion = swfobject_tempArrayMajor[0];
	}
// MSN/WebTV 2.6 supports version 4
} else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1){swfobject_installedversion = 4;
// WebTV 2.5 supports version 3
} else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1){swfobject_installedversion = 3;
// older WebTV supports version 2
} else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1){swfobject_installedversion = 2;
// IE
} else if (swfobject_isIE && swfobject_isWin && !swfobject_isOpera ){
	var swfobject_axo;
	var swfobject_error;
	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
	try {// version will be set for 7.X or greater players
		swfobject_axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		swfobject_installedversion = swfobject_axo.GetVariable("$version");
	} catch (swfobject_error) {}	
	if (!swfobject_installedversion){
		try {// version will be set for 6.X players only
			swfobject_axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			// default to the first public version
			swfobject_installedversion = "WIN 6,0,21,0";
			// throws if AllowScripAccess does not exist (introduced in 6.0r47)
			swfobject_axo.AllowScriptAccess = "always";
			// safe to call for 6.0r47 or greater
			swfobject_installedversion = swfobject_axo.GetVariable("$version");
		} catch (swfobject_error) {}
	}
	if (!swfobject_installedversion){
		try {// version will be set for 4.X or 5.X player
			swfobject_axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			swfobject_installedversion = swfobject_axo.GetVariable("$version");
		} catch (swfobject_error) {}
	}
	if (!swfobject_installedversion){
		try {// version will be set for 3.X player
			swfobject_axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			swfobject_installedversion = "WIN 3,0,18,0";
		} catch (swfobject_error) {}
	}
	if (!swfobject_installedversion){
		try {// version will be set for 2.X player
			swfobject_axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			swfobject_installedversion = "WIN 2,0,0,11";
		} catch (swfobject_error) {
			swfobject_installedversion = -1;
		}
	}
}

swfobject_installed = false;
if (swfobject_installedversion != 0 && swfobject_installedversion != -1) {
	if(swfobject_isIE && swfobject_isWin && !swfobject_isOpera) {
		// Given "WIN 2,0,0,11"
		swfobject_tempArray        = swfobject_installedversion.split(" ");// ["WIN", "2,0,0,11"]
		swfobject_tempString       = swfobject_tempArray[1];	// "2,0,0,11"
		swfobject_versionArray     = swfobject_tempString.split(",");// ['2', '0', '0', '11']
	} else {
		swfobject_versionArray     = swfobject_installedversion.split(".");
	}
	var swfobject_installedversion = swfobject_versionArray[0];
	if (swfobject_installedversion >= swfobject_targetplayerversion) {
		swfobject_installed = true;
	}
}
if (swfobject_installed) {
	// create swf object
	var swfobject_quality = "high";
	if (swfobject_isIE && swfobject_isWin && !swfobject_isOpera){
		document.write(''
		+'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
						  +' id="'+swfobject_instancename+'"'
						  +' width="'+swfobject_width+'"'
						  +' height="'+swfobject_height+'">'
		+'<param name="allowScriptAccess"'+' value="always"/>'
		+'<param name="base"'             +' value=""/>'
		+'<param name="movie"'            +' value="'+swfobject_file+'"/>'
		+'<param name="bgcolor"'          +' value="'+swfobject_bgcolor+'"/>'
		+'<param name="menu"'             +' value="false"/>'
		+'<param name="quality"'          +' value="'+swfobject_quality+'"/>'
		+'<param name="devicefont"'       +' value="true"/>'
		+'<param name="flashvars"'        +' value="'+swfobject_launchvariables+'"/>'
		+'</object>');
	} else {
		document.write(''
		+'<embed'
			+' type="application/x-shockwave-flash"'
			+' name="'+swfobject_instancename+'"'
			+' width="'+swfobject_width+'" height="'+swfobject_height+'"'
			+' allowScriptAccess="always"'
			+' base=""'
			+' src="'+swfobject_file+'"'
			+' bgcolor="'+swfobject_bgcolor+'"'
			+' menu="false"'
			+' quality="'+swfobject_quality+'"'
			+' devicefont="true"'
			+' flashvars="'+swfobject_launchvariables+'"></embed>');
	}

// upgrade/install messages
} else {
	if(swfobject_installedversion>0){
		document.write("You will need to update your existing Flash "+swfobject_installedversion+" player to version "+swfobject_targetplayerversion+" or above to use this chat application.<br>Please visit the <a href='http://www.adobe.com/go/getflash' target='_blank'>Adobe site</a> to update.");
	} else {
		document.write("You will need to install the Flash Player to use this chat application.<br>Please visit the <a href='http://www.adobe.com/go/getflash' target='_blank'>Adobe site</a> for more details and to download.");
	}	
}
