var cnnLockToggle = false;

function CNN_getCookies() {
	var hash = new Array;
	if ( document.cookie ) {
		var cookies = document.cookie.split( '; ' );
		for ( var i = 0; i < cookies.length; i++ ) {
			var namevaluePairs = cookies[i].split( '=' );
			hash[namevaluePairs[0]] = unescape( namevaluePairs[1] ) || null;
		}
	}
	return hash;
}

function CNN_parseCookieData( cookieDataString ) {
	var cookieValues = new Object();
	var separatePairs = cookieDataString.split( '&' );
	for ( var i = 0; i < separatePairs.length; i++  ) {
		var separateValues = separatePairs[i].split( ':' );
		cookieValues[separateValues[0]] = separateValues[1] || null;
	}
	return cookieValues;
}

function CNN_setCookie( name, value, hours, path, domain, secure ) {
		var numHours = 0;

		if ( hours) { 
			if ( (typeof(hours) == 'string') && Date.parse(hours) ) { // already a Date string
				numHours = hours;
			} else if ( typeof(hours) == 'number' ) { // calculate Date from number of hours
				numHours = ( new Date((new Date()).getTime() + hours*3600000) ).toGMTString();
			}
		}
		
		document.cookie = name + '=' + escape(value) + ((numHours)?(';expires=' + numHours):'') + ((path)?';path=' + path:'') + ((domain)?';domain=' + domain:'') + ((secure && (secure == true))?'; secure':''); // Set the cookie, adding any parameters that were specified.
	
}


function CNN_killCookie( name, path, domain ) {
	var allCookies = CNN_getCookies();

	var theValue = allCookies[ name ] || null; // We need the value to kill the cookie
	if ( theValue ) {
		document.cookie = name + '=' + theValue + '; expires=Fri, 13-Apr-1970 00:00:00 GMT' + ((path)?';path=' + path:'') + ((domain)?';domain=' + domain:''); // set an already-expired cookie
	}
}


var allCookies = CNN_getCookies();
var cnnDomainArray = location.hostname.split( '.' );
var cnnCurrDomain = ( cnnDomainArray.length > 1 ) ? '.' + cnnDomainArray[cnnDomainArray.length-2] + '.' + cnnDomainArray[cnnDomainArray.length-1] : '';

var pagetypeTS=""; 

function cnnRenderTimeStamp(date,timeString) {
	var cnnIsIntl = (location.hostname.indexOf('edition.') > -1) ? true : false;
	cnnStoryPublishTime = (date) ? new Date(date) : cnnStoryPublishTime;
	var days = new Array('Sun','Mon','Tue','Wed','Thur','Fri','Sat');
	var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');

    var cnnTimeStampDiff = cnnCurrTime.getTime() - cnnStoryPublishTime.getTime();

    var daysDifference = Math.floor(cnnTimeStampDiff/1000/60/60/24);
    
    cnnTimeStampDiff -= daysDifference*1000*60*60*24

    var hoursDifference = Math.floor(cnnTimeStampDiff/1000/60/60);

    cnnTimeStampDiff -= hoursDifference*1000*60*60

    var minutesDifference = Math.floor(cnnTimeStampDiff/1000/60);

    cnnTimeStampDiff -= minutesDifference*1000*60

	var cnnDays = (daysDifference > 1) ? "days" : "day";
	var cnnHours = (hoursDifference > 1) ? "hours" : "hour";
	var cnnMinutes = (minutesDifference > 1) ? "minutes" : "minute";
	var cnnHPMinutes = "min";
	var cnnCMSTimeString = '';
	var cnnBlankString = "";

	if (timeString) {
		cnnCMSTimeString = (cnnIsIntl) ? timeString[0] : timeString[1];
	}	else { //for legacy support
		cnnCMSTimeString = "updated " + (!cnnIsIntl ? days[cnnStoryPublishTime.getUTCDay()] : '') + " " + months[cnnStoryPublishTime.getUTCMonth()] + " " + cnnStoryPublishTime.getUTCDate() + ", " + cnnStoryPublishTime.getUTCFullYear();
	}


	if (hoursDifference > 4 && daysDifference >= 0 || daysDifference >= 1) {
		switch(pagetypeTS) {
			case "homepage": //t2 formatted
				return cnnBlankString;					
			break;
			case "mosaic":
				return "<div class=\"cnnGryTmeStmp\">" + cnnCMSTimeString + "<\/div>";
			break;
			case "section":
			default:
				if (pagetypeTS == 'section' && cnnIsIntl) {
					return "<div class=\"cnnGryTmeStmp\">" + cnnCMSTimeString + "<\/div>";
				} else {
					return "<div class=\"cnnGryTmeStmp\">updated " + (!cnnIsIntl ? days[cnnStoryPublishTime.getUTCDay()] : '') + " " + months[cnnStoryPublishTime.getUTCMonth()] + " " + cnnStoryPublishTime.getUTCDate() + ", " + cnnStoryPublishTime.getUTCFullYear() + "<\/div>";			
				}
		}
	} else if( hoursDifference <= 4 && hoursDifference >= 1) {
		switch(pagetypeTS) {
			case "homepage": //t2 formatted
				return cnnBlankString;					
			break;
			case "mosaic":
			default:
				if (minutesDifference > 0) {
					return "<div class=\"cnnGryTmeStmp\">updated " + hoursDifference + " "+cnnHours+", " + minutesDifference + " "+cnnMinutes+" ago<\/div>";
				} else {
					return "<div class=\"cnnGryTmeStmp\">updated " + hoursDifference + " "+cnnHours+" ago<\/div>";
				}				
		}
	} else {
		switch(pagetypeTS) { 
			case "homepage": //t2 formatted
				if(hoursDifference < 1 && minutesDifference > 0){
					return '<span>' + minutesDifference + " min<\/span>";		
				} else {
					return "<span>1 min<\/span>";
				}
			break;
			case "mosaic":
			default:
				if(hoursDifference < 1 && minutesDifference > 0){
					return "updated " + minutesDifference + " "+cnnMinutes+" ago";
				} else {
					return "updated 1 minute ago";
				}
		}

	}
}


function cnnRenderT1TimeStamp(date,useLongFormat) {

	cnnStoryPublishTime = (date) ? new Date(date) : cnnStoryPublishTime;
	var cnnTimeStampString;
	var nullString="";



    var cnnTimeStampDiff = cnnCurrTime.getTime() - cnnStoryPublishTime.getTime();

    var daysDifference = Math.floor(cnnTimeStampDiff/1000/60/60/24);
    
    cnnTimeStampDiff -= daysDifference*1000*60*60*24

    var hoursDifference = Math.floor(cnnTimeStampDiff/1000/60/60);

    cnnTimeStampDiff -= hoursDifference*1000*60*60

    var minutesDifference = Math.floor(cnnTimeStampDiff/1000/60);

    cnnTimeStampDiff -= minutesDifference*1000*60

    var secondsDifference = Math.floor(cnnTimeStampDiff/1000);	


	var cnnDays = (daysDifference > 1) ? "days" : "day";
	var cnnHours = (hoursDifference > 1) ? "hours" : "hour";
	var cnnMinutes = (minutesDifference > 1) ? "minutes" : "minute";
	var cnnSeconds = (secondsDifference > 1) ? "seconds" : "second";
	var cnnHPMinutes = (minutesDifference > 1) ? "minutes" : "minutes";
	var cnnHPSeconds = (secondsDifference > 1) ? "secs" : "sec";
	
	if (pagetypeTS=='homepage') {

			cnnTimeStampString = 'updated ';

		if(hoursDifference < 1 && minutesDifference > 0){
			cnnTimeStampString += minutesDifference + " "+(useLongFormat?cnnMinutes:cnnHPMinutes)+" ago";
		} else if(hoursDifference < 1 && minutesDifference < 1) {
			cnnTimeStampString += secondsDifference + " "+(useLongFormat?cnnSeconds:cnnHPSeconds)+" ago";
		} else if(hoursDifference >= 1) {
			return nullString;
		}
		return cnnTimeStampString;
	}		

}


function CNN_submitUserComment(form) {
var cnnSubmitForm = true;

if(typeof(cnnThread) != "undefined") {
	$(form).threadName.value = cnnThread;
}
if(typeof(cnnForum) != "undefined") {
  $(form).forumName.value  = cnnForum;
}

var errorDivs = $('cnnROCSubFrm').getElementsByClassName('cnnError');
for (var i = 0; i<errorDivs.length; i++) {
	errorDivs[i].remove();
}

allFormEls = Form.getElements(form);
for(i = 0; i < allFormEls.length; i++) {
    //do something to each form field
    allFormEls[i].value = allFormEls[i].value.strip().stripScripts().stripTags();
    if (allFormEls[i].value == "") {
    		if (allFormEls[i].name == "name") {
    			new Insertion.Before('cnnUserResponseName',' <span id="cnnUserResponseNameError" class="cnnError">&raquo;<\/span>');
    		}
    		if (allFormEls[i].name == "location") {
    			new Insertion.Before('cnnUserResponseLocation',' <span id="cnnUserResponseNameError" class="cnnError">&raquo;<\/span>');
    		}
    		if (allFormEls[i].name == "body") {
    			new Insertion.Before('cnnUserResponseComment',' <span id="cnnUserResponseNameError" class="cnnError">&raquo;<\/span>');
    		}
    	cnnSubmitForm = false;	
	}
}

	if (cnnSubmitForm) {
  		
			new Effect.Opacity('cnnROCFrm',
					{
						duration:1.0,
						from:1.0,
						to:0,
						beforeStart:function() {
					  		document.cnnROCSubFrm.submit();
						},
						afterFinish: function(obj)
							{
							Form.reset(form);					      		$('cnnROCFrmComplete').innerHTML = "Thank you for contributing. Comments are moderated by CNN and will not appear on this story until after they have been reviewed and deemed appropriate for posting. Unfortunately, due to the volume of comments we receive, not all comments can be posted.<br><br><a href=\"javascript:void(0);\" onclick=\"CNN_toggleSubmissionForm('cnnROCFrm','cnnROCFrmComplete')\">Post another comment<\/a>";
									new Effect.Opacity('cnnROCFrmComplete',
										{
											duration:1.0,
											from:0,
											to:1.0,
											beforeUpdate:function(obj) {
												$('cnnROCFrm').hide();
												obj.element.show();
											}
										}
									);			
							}

					}
				);  	
	}  	
}

function CNN_toggleSubmissionForm(show,hide) {

new Effect.Opacity(hide,
					{
						duration:1.0,
						from:1.0,
						to:0,
						afterFinish: function(obj)
							{
								new Effect.Opacity(show,
										{
											duration:1.0,
											from:0,
											to:1.0,
											beforeUpdate:function(obj) {
												$(hide).hide();
												obj.element.show();
											}
										}
									);			
							}
					}
				)


}

function cnnShowExtendedComments(el) {
	var block = document.getElementsByClassName('cnnExtended',el.parentNode.parentNode);
	if (block && block.length > 0) {
		cnnToggleUGC(block[0],el);
		el.style.display = "none";
	}
}

function cnnHideExtendedComments(el) {
	var block = el.parentNode.parentNode;
	var blockLinks = block.parentNode.getElementsByTagName('a');
	if (block) {
		cnnToggleUGC(block,el);
			for (var i=0; i < blockLinks.length; i++) {
				blockLinks[i].style.display = "inline";
		}
	}
}

function cnnShowMore(el) {
	var block = document.getElementsByClassName('cnnExtended',el.parentNode.parentNode);
	var initialGraph = el.parentNode.getElementsByTagName('p');
	if (block && block.length > 0) {
el.parentNode.hide();
block[0].show();
	}
}

function cnnShowLess(el) {
	var block = el.parentNode.parentNode;
	var blockLinks = block.parentNode.getElementsByTagName('p');
	
	block.hide();
	blockLinks[0].show();
	
}

function cnnToggleUGC(el,lnk) {
	if (cnnLockToggle) {
		return;
	}
	
	cnnLockToggle = true;
	var cnnToggleClass = (lnk.parentNode.className.indexOf('Closed') > -1) ? true : false;
	
		Effect.toggle(el,'blind',
		{
			beforeStart:function(obj) {
				try {
					lnk.blur();
				} catch(e) {};
				if (cnnToggleClass) {
				switch(lnk.parentNode.className) {
					case 'cnnOpinionClosed':
						lnk.parentNode.className = 'cnnOpinion';
					break;
					case 'cnnIReportClosed':
						lnk.parentNode.className = 'cnnIReport';
					break;
					case 'cnnBlogsClosed':
						lnk.parentNode.className = 'cnnBlogs';
						Sphere.Widget.search();
					break;
					default:
				}
				}
			
			},
			afterFinish:function(obj) {
				if (!cnnToggleClass) {
				switch(lnk.parentNode.className) {
					case 'cnnOpinion':
						lnk.parentNode.className = 'cnnOpinionClosed';
					break;
					case 'cnnIReport':
						lnk.parentNode.className = 'cnnIReportClosed';
					break;
					case 'cnnBlogs':
						lnk.parentNode.className = 'cnnBlogsClosed';
					break;
					default:
				}
				}
				cnnLockToggle = false;
			}	
		}
	);
}

function cnnToggleNestedContent(el,lnk,num,desc) {
if (cnnLockToggle) {
	return;
}

cnnLockToggle = true;
var cnnLnkTxt = "Last 3 comments only";
		Effect.toggle(el,'blind',
		{
			duration:0.5,
			afterFinish: function() {
				if(!desc) {
					if (lnk.innerHTML == cnnLnkTxt) {
						lnk.innerHTML = "See all " + num + " comments";
					} else {
						lnk.innerHTML = cnnLnkTxt;
					}
				}
				cnnLockToggle = false;
			},
			beforeStart: function() {
				if(desc) {
					$(lnk).style.display = "none";
				}
			
			}
		}
		
		);


}


function CNN_displayBlogContent(widgetLoading,widgetContent) {
	if (!$(widgetLoading) || !$(widgetContent)) {
		return;
	}

			Effect.BlindUp(widgetLoading,
				{
					afterFinish:function(obj) {
						$(obj.element.id).remove();
					}
				}
			);
			Effect.BlindDown(widgetContent);
}


var cnnHasOpenPopup = 0;
// this is for opening pop-up windows
function CNN_openPopup( url, name, widgets, openerUrl )
{
	var host = location.hostname;
	if (window == top) { window.top.name = "opener"; }
	var popupWin = window.open( url, name, widgets );
	if(popupWin) {cnnHasOpenPopup = 1;}
	if ( popupWin && popupWin.opener ) {
		if ( openerUrl )
		{
			popupWin.opener.location = openerUrl;
		}
	}
	if ( popupWin) {
		popupWin.focus();
	}
}

function cnnImgSwap( strId, intSwap ) {
	// assumes 2 images: image.gif and image_over.gif
	var imgObj = (typeof(strId) == "object") ? strId.getElementsByTagName('img')[0] : document.getElementById( strId );
	var strTemp = imgObj.src;
	var intStrLength = strTemp.length;
	var intChop, strEnd; 
	
	if ( intSwap ) {
		if (strTemp.indexOf('_over.gif') == -1) {
			intChop = intStrLength - 4;	
			strEnd = '_over.gif';
		}
	} else {
		if (strTemp.indexOf('_over.gif') > -1) {	
			intChop = intStrLength - 9;	
			strEnd = '.gif';
		}
	}
	
	if (typeof(intChop) != "undefined") {
		strTemp = strTemp.substring( 0, intChop );
	}
	
	if (typeof(strEnd) != "undefined") {
		imgObj.src = strTemp + strEnd;
	}	
}

/*

Flash Detect and Render
=======================

The CNN_FlashObject takes a few required arguments...

	name ......... the id/name of the object/embed
	src .......... the URL of the swf
	width ........ (i think this should be required)
	height ....... (i think this should be required)

...and some optional arguments...

	parameters ... this is a "hash" of keys and values
		{ menu: "true", play: "false", loop: "false" }
		(or set this to null or an empty string to skip)

	flashVars .... this is a hash or a string
		{ cs_url: "/football/nfl/scoreboards/today/" }
		- or -
		"cs_url=/football/nfl/scoreboards/today/"


Sample Usage:
if ( new CNN_FlashDetect().detectVersion( 6 ) ) {

	var cnn_Scoreboard = new CNN_FlashObject( "cnnScoreboard",
		"/.element/img/2.0/swf/nfl_scoreboard.swf",
		420, 85, null, "cs_url=/football/nfl/scoreboards/today/" );

	cnn_Scoreboard.writeHtml();

} else {
	document.write( 'alternate html' );
}

Of course, if you plan to have Flash in lots of places on a page,
it might make more sense to make a global variable for the detection.
You could go as far as creating a session-based cookie...

*/

var VBS_Result = false;

function CNN_FlashDetect() { }

CNN_FlashDetect.prototype.maxVersionToDetect = 8;
CNN_FlashDetect.prototype.minVersionToDetect = 3;

CNN_FlashDetect.prototype.hasPlugin = ( navigator.mimeTypes &&
		navigator.mimeTypes.length &&
		navigator.mimeTypes["application/x-shockwave-flash"] &&
		navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin );

CNN_FlashDetect.prototype.hasActiveX = window.ActiveXObject;

CNN_FlashDetect.prototype.hasWinIE = ( navigator.userAgent &&
		( navigator.userAgent.indexOf( "MSIE" ) != -1 ) &&
		navigator.appVersion &&
		( navigator.appVersion.indexOf( "Win" ) != -1 ) );

CNN_FlashDetect.prototype.getVersion = function () {
	var versionNum = 0;
	var i = 0;

	if ( this.hasActiveX ) {
		var activeXObject = false;
		for ( i = this.maxVersionToDetect; i >= this.minVersionToDetect && !activeXObject; versionNum = ( activeXObject ? i : versionNum ), i-- ) {
			try {
				activeXObject = new ActiveXObject( "ShockwaveFlash.ShockwaveFlash." + i );
			} catch( e ) {
				// do nothing
			}
		}
	} else if ( this.hasWinIE ) {
		VBS_Result = false;
		for ( i = this.maxVersionToDetect; i >= this.minVersionToDetect && !VBS_Result; versionNum = ( VBS_Result ? i : versionNum ), i-- ) {
			execScript( 'on error resume next: VBS_Result = IsObject( CreateObject( "ShockwaveFlash.ShockwaveFlash.' + i + '" ) )', 'VBScript' );
		}
	} else if ( this.hasPlugin ) {
		if ( navigator.plugins && navigator.plugins.length && navigator.plugins["Shockwave Flash"] ) {
			var words = navigator.plugins["Shockwave Flash"].description.split( " " );
			for ( i = 0; i < words.length; ++i ) {
				if ( isNaN( parseInt( words[i] ) ) )
					continue;
				versionNum = words[i];
			}
		}
	}

	return ( versionNum );
}

CNN_FlashDetect.prototype.detectVersion = function ( num ) {
	var isVersionSupported = false;

	if ( ! isNaN( num ) ) {
		isVersionSupported = ( this.getVersion() >= parseInt( num ) );
	}

	return ( isVersionSupported );
}


function CNN_FlashObject( p_name, p_src, p_width, p_height, p_parameters, p_flashVars ) {
	this.m_name			= p_name;
	this.m_src			= p_src;
	this.m_width		= p_width;
	this.m_height		= p_height;
	this.m_flashVars	= p_flashVars;

// constructor
	if ( p_parameters )
	{
		this.setParams( p_parameters );
	}
}

// Declare member properties
CNN_FlashObject.prototype.m_name = '';
CNN_FlashObject.prototype.m_src = '';
CNN_FlashObject.prototype.m_width = '';
CNN_FlashObject.prototype.m_height = '';
CNN_FlashObject.prototype.m_flashVars = '';

CNN_FlashObject.prototype.m_params = {
	menu:		"false",
	quality:	"high",
	allowScriptAccess:		"always",
	wmode:		"transparent"

};

CNN_FlashObject.prototype.setParam = function ( p_name, p_value ) {
	this.m_params[ p_name ] = p_value;
}

CNN_FlashObject.prototype.setParams = function ( p_paramHash ) {
	if ( typeof p_paramHash == "object" ) {
		for ( var param in p_paramHash ) {
			if ( p_paramHash[param] ) {
				this.setParam( param, p_paramHash[param] );
			}
		}
	}
}

CNN_FlashObject.prototype.getParam = function ( p_name ) {
	return ( this.m_params[ p_name ] );
}

CNN_FlashObject.prototype.getParams = function () {
	return ( this.m_params );
}

CNN_FlashObject.prototype.getFlashVarsString = function () {
	var flashVarsString = '';

	if ( typeof this.m_flashVars == "string" ) {
		flashVarsString = this.m_flashVars;
	} else if ( typeof this.m_flashVars == "object" ) {
		for ( var flashVar in this.m_flashVars ) {
			if ( flashVarsString != '' ) {
				flashVarsString += "&";
			}
			flashVarsString += flashVar + "=" + escape( this.m_flashVars[flashVar] );
		}
	}

	return ( flashVarsString );
}

CNN_FlashObject.prototype.getAttributeString = function ( p_attr, p_value ) {
	return ( p_value ? ' ' + p_attr + '="' + p_value + '"' : '' );
}

CNN_FlashObject.prototype.getParamTag = function ( p_name, p_value ) {
	return ( p_value ? '<param name="' + p_name + '" value="' + p_value + '">' : '' );
}

CNN_FlashObject.prototype.getHtml = function () {
	var htmlString = '';
	var eachParam = '';
	var flashUrl = 'http://www.macromedia.com/go/getflashplayer';

// open object
	htmlString += '<object type="application/x-shockwave-flash" \
					classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
	htmlString += this.getAttributeString( 'pluginspage', flashUrl );
	htmlString += this.getAttributeString( 'id', this.m_name );
	htmlString += this.getAttributeString( 'data', this.m_src );
	htmlString += this.getAttributeString( 'width', this.m_width );
	htmlString += this.getAttributeString( 'height', this.m_height );
	htmlString += '>';
	htmlString += this.getParamTag( 'movie', this.m_src );
	for ( eachParam in this.getParams() ) {
		htmlString += this.getParamTag( eachParam, this.getParam( eachParam ) );
	}
	htmlString += this.getParamTag( 'flashVars', this.getFlashVarsString() );

// open embed
	htmlString += '<embed type="application/x-shockwave-flash"';
	htmlString += this.getAttributeString( 'pluginspage', flashUrl );
	htmlString += this.getAttributeString( 'name', this.m_name );
	htmlString += this.getAttributeString( 'src', this.m_src );
	htmlString += this.getAttributeString( 'width', this.m_width );
	htmlString += this.getAttributeString( 'height', this.m_height );
	for ( eachParam in this.getParams() ) {
		htmlString += this.getAttributeString( eachParam, this.getParam( eachParam ) );
	}
	htmlString += this.getAttributeString( 'flashVars', this.getFlashVarsString() );
	htmlString += '>';

// close embed
	htmlString += '<\/embed>';

// close object
	htmlString += '<\/object>';

	return ( htmlString );
}

CNN_FlashObject.prototype.writeHtml = function () {
	document.write( this.getHtml() );
}

CNN_FlashObject.prototype.writeMosaicHtml = function (id) {
	document.getElementById(id).innerHTML =  this.getHtml();
}

		function CNN_loadReaderOpinion(obj)
		{
			var CNN_comment = '';

		if(!obj || !obj.rss || !obj.rss.channel || !obj.rss.channel.item) {
    	CNN_comment += '		<div class="cnnUGCBox">';
    	CNN_comment += '			<div class="cnnUGCBoxHeader"><img src="/.element/img/2.0/mosaic/base_skins/UGC/b_ugc_TL.gif" alt="" width="4" height="4"><\/div>';		
    	CNN_comment += '			<div class="cnnBoxContent">';
    	CNN_comment += '<p style="margin-left:6px;">No comments yet.<\/p>';    	
    	CNN_comment += '			<\/div>';
    	CNN_comment += '			<div class="clear"><img src="http://i.l.cnn.net/cnn/images/1.gif" width="1" height="1" border="0" alt=""></div><div class="cnnUGCBoxFooter"><img src="/.element/img/2.0/mosaic/base_skins/UGC/b_ugc_BL.gif" alt="" width="4" height="4"><\/div>';
    	CNN_comment += '		<\/div>';    	
		
			return CNN_comment;
		}


    if (typeof(obj.rss.channel.item.length) == "undefined") {
				var clObject = obj.rss.channel.item;
    	CNN_comment += '		<div id="cnnOpinionSubContainer"><div class="cnnUGCBox">';
    	CNN_comment += '			<div class="cnnUGCBoxHeader"><img src="/.element/img/2.0/mosaic/base_skins/UGC/b_ugc_TL.gif" alt="" width="4" height="4"><\/div>';		
    	CNN_comment += '			<div class="cnnBoxContent">';
    	CNN_comment += '				<div class="cnnMeta">';
    	CNN_comment += 					'<span class="cnnContributor">'+clObject['jf:author']+'<\/span><br>';
    	CNN_comment += cnnRenderTimeStamp(clObject['pubDate']);
    	CNN_comment += '				<\/div>';
    	CNN_comment += '				<p>';
    	CNN_comment += clObject['description'].truncate(300,' ...<a href="javascript:void(0);" onclick="cnnShowMore(this);return false">more<\/a>'); 
    	CNN_comment += '				<\/p>';
    	
      	CNN_comment += '				<div class="cnnExtended" style="display:none;"><p>';
    	CNN_comment += clObject['description']; 
    	CNN_comment += '				<a href="javascript:void(0);" onclick="cnnShowLess(this);return false;">less<\/a><\/p><\/div>';  	
    	
    	
    	CNN_comment += '			<\/div>';
    	CNN_comment += '			<div class="clear"><img src="http://i.l.cnn.net/cnn/images/1.gif" width="1" height="1" border="0" alt=""></div><div class="cnnUGCBoxFooter"><img src="/.element/img/2.0/mosaic/base_skins/UGC/b_ugc_BL.gif" alt="" width="4" height="4"><\/div>';
    	CNN_comment += '		<\/div><\/div>';
    	
		return CNN_comment;	

    }			
			

		
		var cnnShowExpandedCont = $('cnnOpinionContainer').parentNode.getElementsByTagName('a')[0];

		var cnnShowExpandedLnk = $('cnnOpinionContainer').getElementsByClassName('cnnExpandCommentsLnk');
		
			var cnnInitialDisplay = 3

			var numLength = obj.rss.channel.item.length;
			var displayNum = numLength - 1;
			if (numLength > 3) {
				cnnShowExpandedLnk[0].innerHTML = '<a href="javascript:void(0)" onclick="cnnToggleNestedContent(\'cnnOpinionSubContainer\',this, \''+numLength+'\',null)">See all '+numLength+' comments<\/a>';
			}
		if (numLength >= 1 && (typeof(cnnReaderOpinions) != "undefined" && cnnReaderOpinions)) {
			cnnToggleUGC('cnnOpinionContainer',cnnShowExpandedCont)
		}

    for (var xx = 0; xx < numLength; xx++) {
				var clObject = obj.rss.channel.item[xx];

				if(xx == cnnInitialDisplay)
				{
					CNN_comment+='<div id="cnnOpinionSubContainer" style="display:none;">';
				}
				
    	CNN_comment += '		<div class="cnnUGCBox">';
    	CNN_comment += '			<div class="cnnUGCBoxHeader"><img src="/.element/img/2.0/mosaic/base_skins/UGC/b_ugc_TL.gif" alt="" width="4" height="4"><\/div>';		
    	CNN_comment += '			<div class="cnnBoxContent">';
    	CNN_comment += '				<div class="cnnMeta">';
    	CNN_comment += 					'<span class="cnnContributor">'+clObject['jf:author']+'<\/span><br>';
    	CNN_comment += cnnRenderTimeStamp(clObject['pubDate']);
    	CNN_comment += '				<\/div>';
    	CNN_comment += '				<p>';
    	CNN_comment += clObject['description'].truncate(300,' ...<a href="javascript:void(0);" onclick="cnnShowMore(this);return false">more<\/a>'); 
    	CNN_comment += '				<\/p>';
    	
      	CNN_comment += '				<div class="cnnExtended" style="display:none;"><p>';
    	CNN_comment += clObject['description']; 
    	CNN_comment += '				<a href="javascript:void(0);" onclick="cnnShowLess(this);return false;">less<\/a><\/p><\/div>';  	
    	
    	
    	CNN_comment += '			<\/div>';
    	CNN_comment += '			<div class="clear"><img src="http://i.l.cnn.net/cnn/images/1.gif" width="1" height="1" border="0" alt=""></div><div class="cnnUGCBoxFooter"><img src="/.element/img/2.0/mosaic/base_skins/UGC/b_ugc_BL.gif" alt="" width="4" height="4"><\/div>';
    	CNN_comment += '		<\/div>';
    	
    	
				if(xx == displayNum)
				{
					CNN_comment+='<\/div>';
				}    	
    	
    }			
			
		return CNN_comment;	
		}
		
/* main page market box 
====================================================== */
/* called on focus */
function cnnMbChangeTxtClass( obj ) {
	if(obj.className == 'cnnTxtMBGetQuote') {
		obj.value = '';
		obj.className = 'cnnTxtMBGetQuoteType';
	}
}

/* called on blur */
function cnnMbCheckTxtClass( obj ) {
	if((obj.className == 'cnnTxtMBGetQuoteType') && (obj.value == '')) {
		obj.className = 'cnnTxtMBGetQuote';
		obj.value = 'enter symbol';
	}
}
/* end main page market box 
====================================================== */		


/* main page more stories [previously 'other news'] 
===================================================================== */
var cnnMpOnCurPage = 0;
var cnnMpOnNumPages = 5; // default number of pages - can be over-ridden in the page

function cnnMpOnBlur( lnk ) {
	try {
		lnk.blur();
	} catch(e) {};
}

function cnnMpOnJumpTo( intPage, lnk ) {
	cnnMpOnBlur(lnk);
	if(cnnMpOnCurPage != intPage) {
		var fadeOutId = 'cnnOnSects' + cnnMpOnCurPage;
		var fadeInId = 'cnnOnSects' + intPage;
		cnnMpOnTransition( fadeInId, fadeOutId );
		cnnMpOnCurPage = intPage;
		cnnMpOnUpdateBtns();
	}
}

function cnnMpOnPrev(lnk) {
	cnnMpOnBlur(lnk);
	if(cnnMpOnCurPage > 0) {
		var fadeOutId = 'cnnOnSects' + cnnMpOnCurPage;
		var fadeInId = 'cnnOnSects' + (cnnMpOnCurPage - 1);
		cnnMpOnTransition( fadeInId, fadeOutId );
		cnnMpOnCurPage--;
		cnnMpOnUpdateBtns();
	}
}

function cnnMpOnNext(lnk) {
	cnnMpOnBlur(lnk);
	if(cnnMpOnCurPage < (cnnMpOnNumPages-1)) {
		var fadeOutId = 'cnnOnSects' + cnnMpOnCurPage;
		var fadeInId = 'cnnOnSects' + (cnnMpOnCurPage + 1);
		cnnMpOnTransition( fadeInId, fadeOutId );
		cnnMpOnCurPage++;
		cnnMpOnUpdateBtns();
	}
}



function cnnMpOnTransition( fadeInId, fadeOutId ) {
	new Effect.Fade(fadeOutId, 
		{ duration: 1.7
		});
	new Effect.Appear(fadeInId);
}
	

function cnnMpOnUpdateBtns() {
	// left btn
	if(cnnMpOnCurPage > 0) {
		$('cnnMpOnL').style.cursor ='auto';
		$('cnnMpOnL').src = '/.element/img/2.0/content/in_the_news/left_red_btn.gif';
		$('cnnMpOnL').onmouseover = function() {this.src='/.element/img/2.0/content/in_the_news/left_red_over_btn.gif';}
		$('cnnMpOnL').onmouseout = function() {this.src='/.element/img/2.0/content/in_the_news/left_red_btn.gif';}
	}
	else {
		$('cnnMpOnL').style.cursor ='default';
		$('cnnMpOnL').src = '/.element/img/2.0/content/in_the_news/left_gray_btn.gif';
		$('cnnMpOnL').onmouseover = function() {}
		$('cnnMpOnL').onmouseout = function() {}
	}

	// move the dot
	for(i=0;i<cnnMpOnNumPages;i++) {
		$('cnnMpOnDot'+i).src = '/.element/img/2.0/content/in_the_news/gray_status.gif';
		$('cnnMpOnDot'+i).onmouseover = function() {this.src = '/.element/img/2.0/content/in_the_news/gray_active_status.gif';}
		$('cnnMpOnDot'+i).onmouseout = function() {this.src = '/.element/img/2.0/content/in_the_news/gray_status.gif';}
	}
	$('cnnMpOnDot'+cnnMpOnCurPage).src = '/.element/img/2.0/content/in_the_news/gray_active_status.gif';
	$('cnnMpOnDot'+cnnMpOnCurPage).onmouseover = function() {}
	$('cnnMpOnDot'+cnnMpOnCurPage).onmouseout = function() {}
	
	// right btn
	if(cnnMpOnCurPage < (cnnMpOnNumPages-1)) {
		$('cnnMpOnR').src = '/.element/img/2.0/content/in_the_news/right_red_btn.gif';
		$('cnnMpOnR').onmouseover = function() {this.src='/.element/img/2.0/content/in_the_news/right_red_over_btn.gif';}
		$('cnnMpOnR').onmouseout = function() {this.src='/.element/img/2.0/content/in_the_news/right_red_btn.gif';}
	}
	else {
		$('cnnMpOnR').src = '/.element/img/2.0/content/in_the_news/right_gray_btn.gif';
		$('cnnMpOnR').onmouseover = function() {}
		$('cnnMpOnR').onmouseout = function() {}
	}
}

function cnnInitOtherNews() {
	// must use javascript to initially hide or scriptaculous effect won't work
	for(i=0;i<8;i++) { // setting a max possible of 8 pages here
		if($('cnnOnSects' + i)) {
			$('cnnOnSects' + i).style.display = 'none';
		}
	}
	cnnDrawOnButtons();
	$('cnnOnSects0').style.display = 'block';
	$('cnnOtherNews').style.display = 'block';
}

function cnnDrawOnButtons() {
	var str = '';
	str += '<a href="javascript:void(0);" onclick="javascript:cnnMpOnPrev(this);return false;"><img src="/.element/img/2.0/content/in_the_news/left_gray_btn.gif" alt="" class="cnnONBtn" border="0" height="19" width="26" id="cnnMpOnL"></a>';
	str += '<a href="javascript:void(0);" onclick="javascript:cnnMpOnJumpTo(0,this);return false;"><img src="/.element/img/2.0/content/in_the_news/gray_active_status.gif" class="cnnONStatus" alt="" border="0" height="5" width="5" id="cnnMpOnDot0"></a>';
	for(i=1;i<cnnMpOnNumPages;i++) {
		str += '<a href="javascript:void(0);" onclick="javascript:cnnMpOnJumpTo(' + i + ',this);return false;"><img src="/.element/img/2.0/content/in_the_news/gray_status.gif" onmouseover="this.src=\'/.element/img/2.0/content/in_the_news/gray_active_status.gif\'" onmouseout="this.src=\'/.element/img/2.0/content/in_the_news/gray_status.gif\'" class="cnnONStatus" alt="" border="0" height="5" width="5" id="cnnMpOnDot'+ i +'"></a>';
	}
	str += '<a href="javascript:void(0);" onclick="javascript:cnnMpOnNext(this);return false;"><img src="/.element/img/2.0/content/in_the_news/right_red_btn.gif" alt="" onmouseover="this.src=\'/.element/img/2.0/content/in_the_news/right_red_over_btn.gif\'" onmouseout="this.src=\'/.element/img/2.0/content/in_the_news/right_red_btn.gif\'" class="cnnONBtn" border="0" height="19" width="26" id="cnnMpOnR"></a>';
	$('cnnONBtns').innerHTML = str;
}
/* end main page more stories
===================================================================== */


/* international home page bullet bins
===================================================================== */

var cnnIntlMoreNewsLock = false;
var strIntlMoreBtns1 = '<img src="http://i.l.cnn.net/cnn/.element/img/2.0/content/in_the_news/left_gray_btn.gif" width="26" height="19" border="0" class="cnnIntlBtnL"><a href="javascript:cnnIntlMoreNewsGoToPage(\'2\');"><img src="http://i.l.cnn.net/cnn/.element/img/2.0/content/in_the_news/right_red_btn.gif" width="26" height="19" border="0" class="cnnIntlBtnR" onmouseover="this.src=\'http://i.l.cnn.net/cnn/.element/img/2.0/content/in_the_news/right_red_over_btn.gif\'" onmouseout="this.src=\'http://i.l.cnn.net/cnn/.element/img/2.0/content/in_the_news/right_red_btn.gif\'"></a>';
var strIntlMoreBtns2 = '<a href="javascript:cnnIntlMoreNewsGoToPage(\'1\');"><img src="http://i.l.cnn.net/cnn/.element/img/2.0/content/in_the_news/left_red_btn.gif" width="26" height="19" border="0" class="cnnIntlBtnL" onmouseover="this.src=\'http://i.l.cnn.net/cnn/.element/img/2.0/content/in_the_news/left_red_over_btn.gif\'" onmouseout="this.src=\'http://i.l.cnn.net/cnn/.element/img/2.0/content/in_the_news/left_red_btn.gif\'"></a><img src="http://i.l.cnn.net/cnn/.element/img/2.0/content/in_the_news/right_gray_btn.gif" class="cnnIntlBtnR" width="26" height="19" border="0">';

function cnnInitIntlBullets() {
	$('cnnMoreNewsTab1').style.display = "block";
	$('cnnMoreNewsTab2').style.display = "none";
	$('cnnIntlMoreNewsBtns').innerHTML = strIntlMoreBtns1;
	$('cnnIntlMoreNews').style.display = "block";
}

function cnnIntlMoreNewsGoToPage( strPage ) {
	if(!cnnIntlMoreNewsLock){
		var gotopage = eval('strIntlMoreBtns' + strPage);
		$('cnnIntlMoreNewsBtns').innerHTML = gotopage;
		switch(strPage) {
			case '1':
				fadeInId = 'cnnMoreNewsTab' + strPage;
				fadeOutId = 'cnnMoreNewsTab' + '2';
				cnnIntlMoreNewsLock = true;
				cnnMpOnTransition( fadeInId, fadeOutId );
				setTimeout("cnnIntlMoreNewsLock = false;",1700);
				break;
			case '2':
				fadeInId = 'cnnMoreNewsTab' + strPage;
				fadeOutId = 'cnnMoreNewsTab' + '1';
				cnnIntlMoreNewsLock = true;
				cnnMpOnTransition( fadeInId, fadeOutId );
				setTimeout("cnnIntlMoreNewsLock = false;",1700);
				break;
			default:
				break;
		}
	}
}

/* end international home page bullet bins
===================================================================== */


/* search functions
===================================================================== */

function cnnSearch( frm ) {
	if($('cnnHeadSrchTxt').value != '') {
		var strSearchLoc = cnnGetSearchLoc();
		strSearchLoc += 'query=' + $('cnnHeadSrchTxt').value;
		
		
		strSearchLoc += '&';
		strSearchLoc += 'type=' + $('cnnHeadSrchType').value;
		strSearchLoc += '&';
		strSearchLoc += 'sortBy=date';
		if(location.hostname.indexOf('edition') < 0) {
			strSearchLoc += '&';
			strSearchLoc += 'intl=false';
		} else {
			strSearchLoc += '&';
			strSearchLoc += 'intl=true';
		}
		location.href = strSearchLoc;
		
		return false;
	}
	else {
		return false;
	}
}

function cnnGetSearchLoc() {
	//var strSearchLoc = 'http://cnnp1srchqai1/cnnrelaunch/search.jsp?'; // dev
	
	var strSearchLoc = 'http://search.cnn.com/search.jsp?'; // default
	
	if(location.hostname.indexOf('qai') != -1) {
		strSearchLoc = 'http://search.qai.cnn.com/cnnrelaunch/search.jsp?'
	}
	else if(location.hostname.indexOf('beta') != -1) {
		strSearchLoc = 'http://search.cnn.com/search.jsp?'
	}

	return strSearchLoc;
}

function cnnFootSearch( frm ) {
	if($('cnnFootSrchTxt').value != '') {
		var strSearchLoc = cnnGetSearchLoc();
		strSearchLoc += 'query=' + $('cnnFootSrchTxt').value;
		strSearchLoc += '&';
		strSearchLoc += 'type=web';
		strSearchLoc += '&';
		strSearchLoc += 'sortBy=date';
		if(location.hostname.indexOf('edition') < 0) {
			strSearchLoc += '&';
			strSearchLoc += 'intl=false';
		} else {
			strSearchLoc += '&';
			strSearchLoc += 'intl=true';
		}
		location.href = strSearchLoc;
		return false;
	}
	else {
		return false;
	}
}

function cnnUpdateSrchType( searchType ) {
	if($('cnnHeadSrchType')) {
		$('cnnHeadSrchType').value = searchType;
	}
	cnnUpdateSrchTypeLnks( searchType );
}

function cnnUpdateSrchTypeLnks( searchType ) {
	if($('cnnHeadSrchTypeArea')) {
		switch(searchType) {
			case 'web':
				$('cnnHeadSrchTypeArea').innerHTML = '<span class="cnnSearchLabel">Web</span> | <a href="javascript:cnnUpdateSrchType(\'news\');">CNN News</a> | <a href="javascript:cnnUpdateSrchType(\'video\');">CNN Videos</a>';
				break;
			case 'news':
				$('cnnHeadSrchTypeArea').innerHTML = '<a href="javascript:cnnUpdateSrchType(\'web\');">Web</a> | <span class="cnnSearchLabel">CNN News</span> | <a href="javascript:cnnUpdateSrchType(\'video\');">CNN Videos</a>';
				break;
			case 'video':
				$('cnnHeadSrchTypeArea').innerHTML = '<a href="javascript:cnnUpdateSrchType(\'web\');">Web</a> | <a href="javascript:cnnUpdateSrchType(\'news\');">CNN News</a> | <span class="cnnSearchLabel">CNN Videos</span>';
				break;
			default:
				break;
		}
	}
}

/* end search functions
===================================================================== */

/* cnn live video popup
===================================================================== */
var cnnVidServer = '';
function cnnLiveVideo( strWhich ) {
	if(!strWhich) {
		strWhich = '1';
	}
	var strVidLoc = cnnVidServer + '/video/live/live.html?stream=stream' + strWhich;
	javascript:CNN_openPopup(strVidLoc,'liveplayer','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=672,height=540')
}
/* end cnn live video popup
===================================================================== */


function cnnVideo(mode, arg, expiration) {
	video_url = '/video/#' + arg;
	
	if(mode == 'live') { cnnLiveVideo(arg); }
	else if(top.location == self.location) { location.href = video_url; }
	else { vid_win = window.open(video_url, 'vid_win'); }
}


/* main page video box (domestic & intl) 
===================================================================== */
var cnnMpVpCurPage = 1;
var cnnMpVpLock = false;
function cnnMpVpBlur( lnk ) {
	try {
		lnk.blur();
	} catch(e) {};
}
/*
 * cnnMpVpNext() and cnnMpVpPrev()
 * are called from previous and next buttons
 */
function cnnMpVpNext( lnk ) {
	cnnMpVpBlur( lnk );
	if((cnnMpVpCurPage < 3)&&(!cnnMpVpLock)) {
		cnnMpVpSlideLeft();
	}
}

function cnnMpVpPrev( lnk ) {
	cnnMpVpBlur( lnk );
	if((cnnMpVpCurPage > 1)&&(!cnnMpVpLock)) {
		cnnMpVpSlideRight();
	}
}

/*
 * cnnMpVpPage( intPage )
 * called from clicking on gray dot icon
 */
function cnnMpVpPage( intPage, lnk ) {
	cnnMpVpBlur( lnk );
	if((cnnMpVpCurPage != intPage)&&(!cnnMpVpLock)) {
		if(cnnMpVpCurPage < intPage) {
			if((intPage - cnnMpVpCurPage) > 1) {
				cnnMpVpSlideDoubleLeft();
			}
			else {
				cnnMpVpSlideLeft();
			}
		}
		else {
			if((cnnMpVpCurPage - intPage) > 1) {
				cnnMpVpSlideDoubleRight();
			}
			else {
				cnnMpVpSlideRight();
			}
		}
	}
}

function cnnLockMpVp( intDur ) {
	var cnnLockDur = intDur * 100;
	cnnMpVpLock = true;
	setTimeout(function() { cnnMpVpLock = false; },cnnLockDur);
}
function cnnMpVpSlideLeft() {
	cnnLockMpVp(3);
	new Effect.MoveBy( 'cnnMpVidCtnt0', 0, -336 , {duration: 0.3} );
	new Effect.MoveBy( 'cnnMpVidCtnt1', 0, -336 , {duration: 0.3} );
	new Effect.MoveBy( 'cnnMpVidCtnt2', 0, -336 , {duration: 0.3} );
	cnnMpVpCurPage++;
	cnnMpVpMoveDot();
	cnnMpVpUpdateBtns();
}

function cnnMpVpSlideDoubleLeft() {
	cnnLockMpVp(6);
	new Effect.MoveBy( 'cnnMpVidCtnt0', 0, -672 , {duration: 0.6} );
	new Effect.MoveBy( 'cnnMpVidCtnt1', 0, -672 , {duration: 0.6} );
	new Effect.MoveBy( 'cnnMpVidCtnt2', 0, -672 , {duration: 0.6} );
	cnnMpVpCurPage++;
	cnnMpVpCurPage++;
	cnnMpVpMoveDot();
	cnnMpVpUpdateBtns();
}

function cnnMpVpSlideRight() {
	cnnLockMpVp(3);
	new Effect.MoveBy( 'cnnMpVidCtnt0', 0, 336 , {duration: 0.3} );
	new Effect.MoveBy( 'cnnMpVidCtnt1', 0, 336 , {duration: 0.3} );
	new Effect.MoveBy( 'cnnMpVidCtnt2', 0, 336 , {duration: 0.3} );
	cnnMpVpCurPage--;
	cnnMpVpMoveDot();
	cnnMpVpUpdateBtns();
}

function cnnMpVpSlideDoubleRight() {
	cnnLockMpVp(6);
	new Effect.MoveBy( 'cnnMpVidCtnt0', 0, 672 , {duration: 0.6} );
	new Effect.MoveBy( 'cnnMpVidCtnt1', 0, 672 , {duration: 0.6} );
	new Effect.MoveBy( 'cnnMpVidCtnt2', 0, 672 , {duration: 0.6} );
	cnnMpVpCurPage--;
	cnnMpVpCurPage--;
	cnnMpVpMoveDot();
	cnnMpVpUpdateBtns();
}

function cnnMpDotMouseOver( id ) {
	$(id).src = '/.element/img/2.0/content/in_the_news/gray_active_status.gif';
}

// image change functions
function cnnMpVpMoveDot() {
	for(i=1;i<4;i++) {
		$('cnnMpVidDot'+i).src = '/.element/img/2.0/content/in_the_news/gray_status.gif';
		$('cnnMpVidDot'+i).onmouseover = function() {this.src = '/.element/img/2.0/content/in_the_news/gray_active_status.gif';}
		$('cnnMpVidDot'+i).onmouseout = function() {this.src = '/.element/img/2.0/content/in_the_news/gray_status.gif';}
	}
	$('cnnMpVidDot'+cnnMpVpCurPage).src = '/.element/img/2.0/content/in_the_news/gray_active_status.gif';
	$('cnnMpVidDot'+cnnMpVpCurPage).onmouseover = function() {}
	$('cnnMpVidDot'+cnnMpVpCurPage).onmouseout = function() {}
}
function cnnMpVpUpdateBtns() {
	if(cnnMpVpCurPage > 1) {
		$('cnnMpVidBtnL').style.cursor ='auto';
		$('cnnMpVidBtnL').src = '/.element/img/2.0/content/in_the_news/left_red_btn.gif';
		$('cnnMpVidBtnL').onmouseover = function() { this.src='/.element/img/2.0/content/in_the_news/left_red_over_btn.gif'; }
		$('cnnMpVidBtnL').onmouseout = function() { this.src='/.element/img/2.0/content/in_the_news/left_red_btn.gif'; }
	}
	else {
		$('cnnMpVidBtnL').style.cursor ='default';
		$('cnnMpVidBtnL').src = '/.element/img/2.0/content/in_the_news/left_gray_btn.gif';
		$('cnnMpVidBtnL').onmouseover = function() {}
		$('cnnMpVidBtnL').onmouseout = function() {}
	}

	if(cnnMpVpCurPage < 3) {
		$('cnnMpVidBtnR').style.cursor ='auto';
		$('cnnMpVidBtnR').src = '/.element/img/2.0/content/in_the_news/right_red_btn.gif';
		$('cnnMpVidBtnR').onmouseover = function() {this.src = '/.element/img/2.0/content/in_the_news/right_red_over_btn.gif';}
		$('cnnMpVidBtnR').onmouseout = function() {this.src = '/.element/img/2.0/content/in_the_news/right_red_btn.gif';}
	}
	else {
		$('cnnMpVidBtnR').style.cursor ='default';
		$('cnnMpVidBtnR').src = '/.element/img/2.0/content/in_the_news/right_gray_btn.gif';
		$('cnnMpVidBtnR').onmouseover = function() {}
		$('cnnMpVidBtnR').onmouseout = function() {}
	}
}
/* end main page video box
===================================================================== */


/* intl market box
===================================================================== */
function cnnWbMarkets( intWhich ) {
	for(i=1;i<4;i++) {
		if(i==intWhich) {
			$('cnnWbMarkets' + i).style.display = 'block';
			$('cnnWbMarketsTab' + i).className = 'active';
		}
		else {
			$('cnnWbMarkets' + i).style.display = 'none';
			$('cnnWbMarketsTab' + i).className = '';
		}
	}
}
/* end intl market box
===================================================================== */



function cnnMosaicLoadGal( gal, lnk ) {
var cnn_gallery_config = (location.hostname.indexOf('edition.') > -1) ? 'intl' : 'www';
if ( new CNN_FlashDetect().detectVersion( 6 ) ) {
var cnn_Photos = new CNN_FlashObject( "cnnPhotos2", "http://i.l.cnn.net/cnn/.element/swf/2.0/gallery/image.gallery.swf", 585, 425, null, "galleryUrl="+gal+"&configUrl=http://i.l.cnn.net/cnn/.element/ssi/"+cnn_gallery_config+"/misc/2.0/omni/config.xml&emailHandler=onEmailClicked&pageType=mosaic&pageURL="+window.location.pathname);
cnn_Photos.writeMosaicHtml('cnnPhotoPlayer');
} else {
CNN_noFlash();
} 
	
	// change the id
	if($('cnnCurGal')) {
		$('cnnCurGal').id = '';
	}
	lnk.parentNode.parentNode.id = 'cnnCurGal';
	
}

function cnnMosaicSelGalTab( intTab ) {
	// change the tabs
	for(i=1;i<7;i++) {
		if($('cnnPT'+i)) {
			tabObj = $('cnnPT'+i);
			if(i != intTab) {
				tabObj.className = '';
			}
			else {
				tabObj.className = 'cnnPTCurrent';
			}
		}
	}
	
	// show/hide the sections
	for(i=1;i<7;i++) {
		if($('cnnPPSect'+i)) {
			obj = $('cnnPPSect'+i);
			if(i != intTab) {
				obj.style.display = 'none';
			}
			else {
				obj.style.display = 'block';
			}
		}
	}	
}

/* minor topic search */
function cnnUpdateMtSrch(obj){
	obj.value='';
	obj.style.color=(obj.style.color==""?"#000000":"")
}

/* local box main page */
function cnnUpdateTxtElem(obj, strTxt) {
	if(obj.value == strTxt) {
		obj.value='';
		obj.style.color=(obj.style.color==""?"#000":"");
	}
	else if(obj.value == '') {
		obj.value = strTxt;
		obj.style.color=(obj.style.color==""?"#ccc":"");
	}// else user entered something, leave it alone
}

/* breaking news banners
=========================================================================== */
function cnnRenderGenericBanner(object,flashURL,leftColor,rightColor)
{
	if (allCookies['cnnLastClosedBannerId'] == object.id)
	{
		// don't render anything if the banner has been closed.
		return '';
	}

	var myHtml = '<div id="cnnBannerContent"><div id="cnnBannerTopic" class="'+leftColor+'">';
	
	if (object.type != 'Live Breaking News' || !(new CNN_FlashDetect().detectVersion( 8 )))
	{
		myHtml += '<div id="cnnBannerHeader"><div id="cnnBannerHeaderTxt">'+object.title+'<\/div><\/div>';
	}
	else
	{
		var cnn_AnimatedBanner = new CNN_FlashObject( "cnnAnimatedBannerTitle", flashURL, 211, 73, null, { bn_title: object.title } );
		myHtml += cnn_AnimatedBanner.getHtml();
	}
	
	myHtml += '<\/div><div id="cnnBannerBox" class="'+rightColor+'">';
	myHtml += '<div id="cnnBannerBoxContent"><a href="#" onMouseOver="cnnImgSwap(this,1);" onMouseOut="cnnImgSwap(this,0);" onClick="CNN_setCookie(\'cnnLastClosedBannerId\',\''+object.id+'\'); $(\'cnnBannerContainer\').hide(); return true;"><img class="cnnCloseBtn" name="cnnBannerCloseBtn" src="/.element/img/2.0/content/live_news/banner_'+rightColor.substring(3).toLowerCase()+'_btn.gif" width="14" height="14" alt="" /><\/a>';
	
	if (object.type == 'Live Breaking News' && object.image.length > 0)
	{
		myHtml += '<img class="cnnBannerPhoto" src="'+object.image+'" width="87" height="49" alt="" />';
	}
	
	myHtml += '<div id="cnnBannerHeadline"';
	if (object.size == 'small')
	{
		myHtml += ' class="small"';
	}
	myHtml += '>'+object.content+'<\/div>';
	
	if (object.pipe != 0 || object.tv != 0)
	{
		myHtml += '<div id="cnnBannerWatchNow">Watch Now: ';
		if (object.tv != 0)
		{
			myHtml += 'on CNN TV';
			if (object.pipe != 0)
			{
				myHtml += ' <span class="cnnGreyTxt">or <\/span>';
			}
		}
		if (object.pipe != 0)
		{
			myHtml += '<a href="javascript:javascript:cnnLiveVideo(\''+object.pipe+'\');">Live on CNN.com &raquo;<\/a>';
		}
		myHtml += '<\/div>';
	}
	
	myHtml += '<\/div><\/div><\/div><div class="cnnPad12Top" style="clear:both;"> <\/div>';
	
	return myHtml;
}

function cnnRenderDomesticBanner(object){
	var flashURL='/.element/swf/2.0/breaking_news/bn_dom.swf';
	var leftColor='';
	var rightColor='';
	switch (object.type) {
		case 'Live Breaking News':leftColor='cnnRed';rightColor='cnnBlack';break;
		case 'Breaking News':leftColor='cnnBlack';rightColor='cnnRed';break;
		case 'Developing Story':leftColor='cnnBlack';rightColor='cnnYellow';break;
		case 'Watch Now':leftColor='cnnBlue';rightColor='cnnBlue';break;
		default:return '';
	}
	return cnnRenderGenericBanner(object,flashURL,leftColor,rightColor);
}

function cnnRenderInternationalBanner(object){
	var flashURL='/.element/swf/2.0/breaking_news/bn_int.swf';
	var leftColor='';
	var rightColor='cnnYellow';
	switch (object.type) {
		case 'Live Breaking News':leftColor='cnnYellow';rightColor='cnnBlack';break;
		case 'Breaking News':leftColor='cnnBlack';break;
		case 'Developing Story':leftColor='cnnBlack';break;
		case 'Watch Now':leftColor='cnnBlue';rightColor='cnnBlue';break;
		default:return '';
	}
	return cnnRenderGenericBanner(object,flashURL,leftColor,rightColor);
}

/* end breaking news banners
=========================================================================== */


/* styled dropdowns
=========================================================================== */
// Global event handler
function cnnMouseDown(e) {
	cnnDD.mouseDownBody(e);
	return true;
}

// CNN dropdown menu (static instance, JavaScript object literal)
var cnnDD = {
	curId: "", // id of currently-open dropdown
	killMouseDownEvent: false,
	menus: [],

	rowHeight: 17,
	combinedBorderWidth: 20,
	scrollbarWidth: 18,

	minMenuWidth: 105,
	maxMenuWidth: 400,
	defaultMenuWidth: 205,
	defaultRowWidth: 150,
	combinedRowLRPad: 18,
	scrollbarRPad: 12,


	buildDisabledDropdown: function(menuId, buttonWidth, buttonClass, hiddenListSuffix) {
		// default parameters
		if (!buttonWidth) buttonWidth = 140;
		if (!buttonClass) buttonClass = 'cnnDDWireLtg';

		var wrapId = menuId + "_wrap";
		var listId = menuId + "_list" + (hiddenListSuffix ? '_' + hiddenListSuffix : '');

		if ($(wrapId) && $(listId)) {

			// hide the <select>
			$(listId).style.display = "none";

			// Get the displayed value for the first select option
  			var listItems = $(listId).options;
			var buttonText = listItems[0].innerHTML;

			var buttonTextLPad = 10;
			var buttonTextRPad = 34;
			var buttonTextWidth = buttonWidth - (buttonTextLPad + buttonTextRPad);

			var leftBgStyle = 'background:#fff url(http://i.l.cnn.net/cnn/.element/img/2.0/global/dropdowns/btn_ltg_left.gif) 0 0 no-repeat;';
			var rightBgStyle = 'background:url(http://i.l.cnn.net/cnn/.element/img/2.0/global/dropdowns/btn_ltg_right.gif) 100% 0 no-repeat;';

			switch (buttonClass) {
    			case 'cnnDDWire': 
					leftBgStyle = 'background:#fff url(http://i.l.cnn.net/cnn/.element/img/2.0/global/dropdowns/btn_wire_left.gif) 0 0 no-repeat;';
					rightBgStyle = 'background:url(http://i.l.cnn.net/cnn/.element/img/2.0/global/dropdowns/btn_wire_right.gif) 100% 0 no-repeat;';
        			break;
    			case 'cnnBlkBgWhtBox': 
					leftBgStyle = 'background:#fff url(http://i.l.cnn.net/cnn/.element/img/2.0/global/dropdowns/btn_blk_left.gif) 0 0 no-repeat;';
					rightBgStyle = 'background:url(http://i.l.cnn.net/cnn/.element/img/2.0/global/dropdowns/btn_blk_right.gif) 100% 0 no-repeat;';
        			break;
			}


   			// build content for the button
			var strContent = "\n\n\n\n";
   			strContent += '	<div class="cnnDDContainer" style="width:'+buttonWidth+'px;">'+"\n";

			strContent += '		<div class="'+buttonClass+'">'+"\n";
			strContent += '			<div class="cnnDDBtn" onmousedown="return cnnDD.mouseDownBtn(event, \''+menuId+'\');" onclick="return cnnDD.open(\''+menuId+'\')" style="'+rightBgStyle+'">'+"\n";
			strContent += '				<table width="'+buttonWidth+'" border="0" cellspacing="0" cellpadding="0">'+"\n";
			strContent += '					<tr>'+"\n";
			strContent += '						<td width="'+buttonTextLPad+'"><div class="cnnDDBtnLeft" style="'+leftBgStyle+'"></div></td>'+"\n";
			strContent += '						<td width="'+buttonTextWidth+'">'+"\n";
			strContent += '				            <div class="cnnDDValueContainer">'+"\n";
			strContent += '							    <div id="'+menuId+'_Val" class="cnnDDValue" style="width:'+buttonTextWidth+'px;color:#c5c5c5;">'+buttonText+'</div>'+"\n";
			strContent += '						</td>'+"\n";
			strContent += '						<td width="'+buttonTextRPad+'"><img src="http://i.l.cnn.net/cnn/.element/img/2.0/global/dropdowns/btn_icon_disabled.gif" alt="" border="0"></td>'+"\n";
			strContent += '					</tr>'+"\n";
			strContent += '				</table>'+"\n";
   			strContent += '			</div><!--/cnnDDBtn -->'+"\n\n";
   			strContent += '		</div><!--/'+buttonClass+' -->'+"\n\n";

   			strContent += '	</div><!--/cnnDDContainer -->'+"\n";
   			strContent += "\n\n";

			// draw the new content
			$(wrapId).innerHTML = strContent;

			// reset the list
			$(listId).selectedIndex = 0;

		}//else id of select not found [ abort ]
	},

	buildDropdown: function(menuId, buttonWidth, menuWidth, numVisibleRows, buttonClass, hiddenListSuffix) {
		// default parameters
		if (!buttonWidth) buttonWidth = 140;
		if (!menuWidth) menuWidth = this.defaultMenuWidth;
		if (!numVisibleRows) numVisibleRows = 10;
		if (!buttonClass) buttonClass = 'cnnDDWireLtg';

        if (menuWidth < this.minMenuWidth) menuWidth = this.minMenuWidth;
		if (menuWidth > this.maxMenuWidth) menuWidth = this.maxMenuWidth;

		var wrapId = menuId + "_wrap";
		var listId = menuId + "_list" + (hiddenListSuffix ? '_' + hiddenListSuffix : '');

		this.menus[menuId] = new Array();
		this.menus[menuId].listId = listId;
   		this.menus[menuId].updateFirstRow = false;

		if ($(wrapId) && $(listId)) {

			// hide the <select>
			$(listId).style.display = "none";

			var displayedValue = new Array();
			var internalValue = new Array();
			var disabledRow = new Array();

  			var listItems = $(listId).options;
			for (var i=0;i<listItems.length;i++) {
   				displayedValue[i] = listItems[i].innerHTML;
   				internalValue[i] = listItems[i].value;
   				disabledRow[i] = listItems[i].disabled;
			}
			var selectedRow = $(listId).selectedIndex;

            // If no row was explicitly selected
            if (selectedRow == 0) {
                // See if the first row matches one of the later rows
       			for (i=1;i<displayedValue.length;i++) {
	    			if (displayedValue[i] == displayedValue[0]) {
                        selectedRow = i;
                		this.menus[menuId].updateFirstRow = true;
			    		break;
				    }
       			}
            }
            var buttonText = displayedValue[selectedRow];
			var numRows = displayedValue.length;

			var buttonTextLPad = 10;
			var buttonTextRPad = 34;
			var buttonTextWidth = buttonWidth - (buttonTextLPad + buttonTextRPad);

			// minus left and right borders
			var fullRowWidth = menuWidth - this.combinedBorderWidth;

			// without scrollbar
			var visibleRowsHeight = numRows * this.rowHeight;
			var rowWidth = fullRowWidth;

			// with scrollbar
			if (numRows > numVisibleRows) {
				visibleRowsHeight = numVisibleRows * this.rowHeight;
				rowWidth -= 10;
			}

			var leftBgStyle = 'background:#fff url(http://i.l.cnn.net/cnn/.element/img/2.0/global/dropdowns/btn_ltg_left.gif) 0 0 no-repeat;';
			var rightBgStyle = 'background:url(http://i.l.cnn.net/cnn/.element/img/2.0/global/dropdowns/btn_ltg_right.gif) 100% 0 no-repeat;';

			switch (buttonClass) {
    			case 'cnnDDWire': 
					leftBgStyle = 'background:#fff url(http://i.l.cnn.net/cnn/.element/img/2.0/global/dropdowns/btn_wire_left.gif) 0 0 no-repeat;';
					rightBgStyle = 'background:url(http://i.l.cnn.net/cnn/.element/img/2.0/global/dropdowns/btn_wire_right.gif) 100% 0 no-repeat;';
        			break;
    			case 'cnnBlkBgWhtBox': 
					leftBgStyle = 'background:#fff url(http://i.l.cnn.net/cnn/.element/img/2.0/global/dropdowns/btn_blk_left.gif) 0 0 no-repeat;';
					rightBgStyle = 'background:url(http://i.l.cnn.net/cnn/.element/img/2.0/global/dropdowns/btn_blk_right.gif) 100% 0 no-repeat;';
        			break;
			}


   			// build content for the menu
			var strContent = "\n\n\n\n";
   			strContent += '	<div class="cnnDDContainer" style="width:'+buttonWidth+'px;">'+"\n";

			strContent += '		<div class="cnnDDBoxContainer">'+"\n";
   			strContent += '		<div class="cnnDDBox" id="'+menuId+'" style="width:'+menuWidth+'px;" onmousedown="return cnnDD.mouseDown(event, \''+menuId+'\');">'+"\n";
			strContent += '			<div class="cnnDDBoxHeader"><div class="cnnDDBoxHeaderTL"></div><div class="cnnDDBoxHeaderTR"></div></div>'+"\n";
			strContent += '			<div class="cnnDDBoxContent">'+"\n";

   			strContent += '				<div class="cnnDDContent" style="width:'+fullRowWidth+'px;">'+"\n";
   			strContent += '					<div class="cnnPad6Top"></div>'+"\n";
   			strContent += '					<div class="cnnDDList" style="height:'+visibleRowsHeight+'px; width:'+rowWidth+'px;">'+"\n";
			strContent += '						<ul>'+"\n";

   			for (var i=0;i<displayedValue.length;i++) {
				if ((i==0) && (this.menus[menuId].updateFirstRow)) {
					strContent += '						<li id="'+menuId+'_hdnVal"><a href="javascript:cnnDD.select('+i+',\''+this.encodeAttr(displayedValue[i])+'\',\''+this.encodeAttr(internalValue[i])+'\');">'+displayedValue[i]+'</a></li>'+"\n";
				}
   				else if (disabledRow[i]) {
					strContent += '						<li class="cnnDDSeparator"><span>'+displayedValue[i]+'</span></li>'+"\n";
				}
				else {
					strContent += '						<li><a href="javascript:cnnDD.select('+i+',\''+this.encodeAttr(displayedValue[i])+'\',\''+this.encodeAttr(internalValue[i])+'\');">'+displayedValue[i]+'</a></li>'+"\n";
				}
   			}
			strContent += '						</ul>'+"\n";
   			strContent += '					</div>'+"\n";
   			strContent += '					<div class="cnnPad8Top"></div>'+"\n";
   			strContent += '				</div><!-- /cnnDDContent -->'+"\n";

			strContent += '			</div><!-- /cnnDDBoxContent -->'+"\n";
			strContent += '			<div class="cnnDDBoxFooter"><div class="cnnDDBoxFooterBL"></div><div class="cnnDDBoxFooterBR"></div></div>'+"\n";
			strContent += '		</div><!--/cnnDDBox-->'+"\n";
			strContent += '		</div><!--/cnnDDBoxContainer-->'+"\n";

			strContent += '		<div class="'+buttonClass+'">'+"\n";
			strContent += '			<div class="cnnDDBtn" onmousedown="return cnnDD.mouseDownBtn(event, \''+menuId+'\');" onclick="return cnnDD.open(\''+menuId+'\')" style="'+rightBgStyle+'">'+"\n";
			strContent += '				<table width="'+buttonWidth+'" border="0" cellspacing="0" cellpadding="0">'+"\n";
			strContent += '					<tr>'+"\n";
			strContent += '						<td width="'+buttonTextLPad+'"><div class="cnnDDBtnLeft" style="'+leftBgStyle+'"></div></td>'+"\n";
			strContent += '						<td width="'+buttonTextWidth+'">'+"\n";
			strContent += '				            <div class="cnnDDValueContainer">'+"\n";
			strContent += '							    <div id="'+menuId+'_Val" class="cnnDDValue" style="width:'+buttonTextWidth+'px;">'+buttonText+'</div>'+"\n";
			strContent += '						</td>'+"\n";
			strContent += '						<td width="'+buttonTextRPad+'"><img src="http://i.l.cnn.net/cnn/.element/img/2.0/global/dropdowns/btn_icon.gif" alt="" border="0"></td>'+"\n";
			strContent += '					</tr>'+"\n";
			strContent += '				</table>'+"\n";
   			strContent += '			</div><!--/cnnDDBtn -->'+"\n\n";
   			strContent += '		</div><!--/'+buttonClass+' -->'+"\n\n";

   			strContent += '	</div><!--/cnnDDContainer -->'+"\n";
   			strContent += "\n\n";

			// draw the new content
			$(wrapId).innerHTML = strContent;

			// capture mousedown
			document.body.onmousedown = cnnMouseDown;

		}//else id of select not found [ abort ]
	},

	buildOverlay: function(menuId, menuWidth, numVisibleRows, dx, dy) {
		// default parameters
		if (!menuWidth) menuWidth = this.defaultMenuWidth;
		if (!numVisibleRows) numVisibleRows = 10;

        if (menuWidth < this.minMenuWidth) menuWidth = this.minMenuWidth;
		if (menuWidth > this.maxMenuWidth) menuWidth = this.maxMenuWidth;

		var leftPos = -20;
		var topPos = 1;
		if (dx) leftPos += dx;
		if (dy) topPos += dy;

		var wrapId = menuId + "_wrap";
		var listId = menuId + "_list";
		var titleId = menuId + "_title";

		if ($(wrapId) && $(titleId) && $(listId)) {
			// hide the list
			$(listId).style.display = "none";

			var title = $(titleId).innerHTML;

			// Get the displayed value for each select option
			var listItems = $(listId).getElementsByTagName('li');
			var displayedList = new Array();
			for (var i=0;i<listItems.length;i++) {
   				displayedList[i] = listItems[i].innerHTML;
			}

			var numRows = displayedList.length;

			var menuTitleRPad = 60;
			var menuTitleWidth = menuWidth - menuTitleRPad;

			// minus left and right borders
			var fullRowWidth = menuWidth - this.combinedBorderWidth;

			// without scrollbar
			var visibleRowsHeight = numRows * this.rowHeight;
			var rowWidth = menuWidth - this.combinedBorderWidth;

			// with scrollbar
			if (numRows > numVisibleRows) {
				visibleRowsHeight = numVisibleRows * this.rowHeight;
				rowWidth -= 10;
			}


   			// build content for the menu
			var strContent = "\n\n\n\n";
   			strContent += ' <div class="cnnDDOvrBoxContainer">'+"\n";
   			strContent += '		<div class="clear"><img src="http://i.a.cnn.net/cnn/images/1.gif" width="1" height="1" border="0" alt=""></div>'+"\n";
   			strContent += '		<div class="cnnDDOvrBox" id="'+menuId+'" style="width:'+menuWidth+'px;left:'+leftPos+'px; top:'+topPos+'px;" onmousedown="return cnnDD.mouseDown(event, \''+menuId+'\');">'+"\n";
   			strContent += '			<div class="cnnDDBoxHeader"><div class="cnnDDBoxHeaderTL"></div><div class="cnnDDBoxHeaderTR"></div></div>'+"\n";
			strContent += '			<div class="cnnDDBoxContent">'+"\n";
			strContent += '				<div class="cnnDDOvrCloseContainer"><div class="cnnDDOvrClose" onclick="cnnDD.close(); return true;"><img src="http://i.cnn.net/cnn/.element/img/2.0/global/dropdowns/overlay_close.png" width="12" height="12" alt="" border="0"></div></div>'+"\n";
   			strContent += '				<div class="cnnDDContent" style="width:'+fullRowWidth+'px;">'+"\n";
   			strContent += '					<div class="cnnDDOvrTitle" style="width:'+menuTitleWidth+'px;overflow:hidden;">'+title+'</div>'+"\n";
   			strContent += '					<div class="cnnDDList" style="height:'+visibleRowsHeight+'px;width:'+rowWidth+'px;">'+"\n";
			strContent += '						<ul>'+"\n";

			for (var i=0;i<displayedList.length;i++) {
				strContent += '					<li>'+displayedList[i]+'</li>'+"\n";
			}
   			strContent += '						</ul>'+"\n";
			strContent += '					</div><!-- /cnnDDList -->'+"\n";
   			strContent += '					<div class="cnnPad12Top"></div>'+"\n";
   			strContent += '				</div><!-- /cnnDDContent -->'+"\n";
			strContent += '			</div><!-- /cnnDDBoxContent -->'+"\n";
			strContent += '			<div class="cnnDDBoxFooter"><div class="cnnDDBoxFooterBL"></div><div class="cnnDDBoxFooterBR"></div></div>'+"\n";
   			strContent += '		</div><!--/cnnDDOvrBox-->'+"\n";
	   		strContent += ' </div><!--/cnnDDOvrBoxContainer-->'+"\n";
			strContent += "\n\n";
			// draw the new content
			$(wrapId).innerHTML = strContent;

			// capture mousedown
			document.body.onmousedown = cnnMouseDown;

		}//else id of select not found [ abort ]
	},


	select: function(index, displayedValue, internalValue) {
		if ($(this.curId)) {
			var menuId = this.curId;

			// close the dropdown
			this.close();

			// change the displayed dropdown value (button text)
			if ($(menuId + '_Val')) {
				$(menuId + '_Val').innerHTML = displayedValue;
			}

  			// set the first row of the menu to the current value
			if ((this.menus[menuId].updateFirstRow) && $(menuId + '_hdnVal')) {
				$(menuId+'_hdnVal').innerHTML = '<a href="javascript:cnnDD.select(' + index + ',\'' + this.encodeAttr(displayedValue) + '\',\'' + this.encodeAttr(internalValue) + '\')">' + displayedValue + '</a>';
			}

			var listId = this.menus[menuId].listId;
			if ($(listId)) {
				// if the value has changed
				if ($(listId).selectedIndex != index) {
        			// set the index of the selected option for the invisible <select>
					$(listId).selectedIndex = index;

					// If an onchange event handler exists
					if ($(listId).onchange) {
						$(listId).onchange();
					}
				}
			}

            // if a callback function exists
            try {
	            var onChoose = eval(menuId + '_OnChoose');
	            if (onChoose) {
	                onChoose();
	            }
            }
            catch(err) {
            }
		}
	},

	open: function(id) {
		if($(id)) {
			// Was the same menu clicked again?
			var sameMenu = (this.curId == id);

			// If a menu is already open
			this.close();

			// If a different menu was clicked
			if (!sameMenu) {
				$(id).style.display = "block";
				this.curId = id;
			}
		}
	},

	close: function() {
		if ($(this.curId)) {
			$(this.curId).style.display = "none";
			this.curId = '';
		}
	},

	encodeAttr: function(str) {
		str=str.replace(/\\/g,'\\\\');
		str=str.replace(/\'/g,'\\\'');
		str=str.replace(/\"/g,'&quot;');
		str=str.replace(/\0/g,'\\0');
		return str;
	},

	mouseDown: function(e, id) {
		this.killMouseDownEvent = true;
		return true;
	},

	mouseDownBtn: function(e, id) {
		// If the same dropdown was clicked again, kill the event.
		this.killMouseDownEvent = (id && (this.curId == id));
		return true;
	},

	mouseDownBody: function(e) {
		// If the event has not been killed
		if (!this.killMouseDownEvent) {
			this.close();
		}
		this.killMouseDownEvent = false;
		return true;
	}
}
/* end styled dropdowns
=========================================================================== */


/* most popular module
========================================================================= */
var cnnMpActiveId = 'cnnMpStory';
var cnnMpLock = false;
var cnnie = false;
function cnnToggleMP(idShow) {

	if (cnnMpActiveId && cnnMpActiveId != idShow) {

		if(!cnnMpLock) {
			cnnMpLock = true;

			if(cnnie) {
				cnnToggleMPIE(idShow);
			}
			else {
				// hide the old
				var elHide = $(cnnMpActiveId);

				Effect.toggle(elHide,'blind',
				{
					duration:0.25,
					beforeStart:function()
					{
						var cnnHideHead = idShow + '-head';
						$(cnnHideHead).className="active";
					}
				}

				);

				// display the new
				var elShow = $(idShow);

				Effect.toggle(elShow,'blind',
				{
					duration:0.25,
					beforeStart:function(obj)
					{
						var cnnShowHead = cnnMpActiveId + '-head';
						$(cnnShowHead).className = "closed";
					},

					afterFinish:function(obj)
					{
						cnnMpActiveId = idShow;
					}
				}
				);
			}// end if cnnie

			// delay the unlock
			setTimeout("cnnMpLock = false;",250);

		}// end if !cnnMpLock

	}// end same id
}

function cnnToggleMPIE(idShow) {

	var elHide = $(cnnMpActiveId);
	var elShow = $(idShow);

	// hide the red header
	var cnnHideHead = idShow + '-head';
	$(cnnHideHead).className="active";

	new Effect.Parallel(
	[
		new Effect.SlideUp(elHide),
		new Effect.SlideDown(elShow)
	], {
		duration: 0.04
	});

	// show the previously active red header
	var cnnShowHead = cnnMpActiveId + '-head';
	$(cnnShowHead).className = "closed";

	// reset the active id
	cnnMpActiveId = idShow;

}

function cnnToggleMPNoSlide(idShow) {

	if (cnnMpActiveId && cnnMpActiveId != idShow) {

		var elHide = $(cnnMpActiveId);
		var cnnHideHead = idShow + '-head';
		$(cnnHideHead).className="active";
		elHide.style.display='none';

		var elShow = $(idShow);
		var cnnShowHead = cnnMpActiveId + '-head';
		$(cnnShowHead).className = "closed";
		elShow.style.display='block';

		cnnMpActiveId = idShow;

	}

}

/* most popular module tab functions */
function cnnMpStories( intWhich ) {
	for(i=1;i<4;i++) {
		if(i==intWhich) {
			$('cnnMpStories' + i).style.display = 'block';
			$('cnnMpStoriesTab' + i).className = 'active';
		}
		else {
			$('cnnMpStories' + i).style.display = 'none';
			$('cnnMpStoriesTab' + i).className = '';
		}
	}
	$('cnnMpStoriesTab'+ intWhich).blur();
}

function cnnMpVideos( intWhich ) {
	for(i=1;i<4;i++) {
		if(i==intWhich) {
			$('cnnMpVideos' + i).style.display = 'block';
			$('cnnMpVideosTab' + i).className = 'active';
		}
		else {
			$('cnnMpVideos' + i).style.display = 'none';
			$('cnnMpVideosTab' + i).className = '';
		}
	}
	$('cnnMpVideosTab'+ intWhich).blur();
}

/* most popular module init function */
function cnnInitMP() {
	$('cnnMpTopic').style.display = 'none';
	$('cnnMpVideo').style.display = 'none';
	$('cnnMostPopMod').style.display = 'block';
}

/* end most popular module
========================================================================= */

/* cnn affiliates (us section)
========================================================================= */
// Preload the button images
var cnnAffiliates_GoImage = new Array;
cnnAffiliates_GoImage["off"] = new Image();
cnnAffiliates_GoImage["off"].src = "http://i.l.cnn.net/cnn/.element/img/2.0/sect/us/affiliates/go_btn_disabled.gif";
cnnAffiliates_GoImage["on"] = new Image();
cnnAffiliates_GoImage["on"].src = "http://i.l.cnn.net/cnn/.element/img/2.0/sect/us/affiliates/go_btn.gif";

function cnnAffiliates_SetGoBtn(url) {
    var goButtonId = 'cnnAffiliatesGoBtn';
    if ($(goButtonId)) {
        if (url) {
            $(goButtonId).innerHTML = '<a id="cnnAffiliatesGoLink" href="javascript:void(window.open(\''+url+'\'))"><img src="'+cnnAffiliates_GoImage["on"].src+'" width="29" height="23" border="0" alt=""></a>';
        }
        else {
            $(goButtonId).innerHTML = '<img src="'+cnnAffiliates_GoImage["off"].src+'" width="29" height="23" border="0" alt="">';
        }
    }
}

function cnnAffiliates_SelectRegion(selectObj) {
    var region = selectObj.value.toLowerCase();
    if (region) {
        var mapId = 'cnnAffiliatesMap';
        if ($(mapId)) {
            $(mapId).src = 'http://i.l.cnn.net/cnn/.element/img/2.0/sect/us/affiliates/affiliates_' + region + '.gif';
        }
        cnnAffiliates_SetGoBtn();
        cnnDD.buildDropdown('cnnDDAffiliatesCity', 252, 270, 10, 'cnnDDWire', region);
    }
}

function cnnAffiliates_SelectCity(selectObj) {
    var url = selectObj.value;
    cnnAffiliates_SetGoBtn(url);
}

/* end cnn affiliates (us section)
========================================================================= */

/* cnet product reviews widget
=========================================================================== */
function cnnSearchCnet() {
	switch(document.tsearch.nodeid.value) {
		case "more":
		window.open("http://cnn-cnet.com.com/2001-1_7-0.html?part=cnn-cnet&subj=re&tag=search");
		break;
		case "6500":
		window.open("http://cnn-cnet.com.com/4323-6530_7-6509025.html?part=cnn-cnet&subj=re&tag=search");
		break;
		case "6501":
		window.open("http://cnn-cnet.com.com/4323-6530_7-6509037.html?part=cnn-cnet&subj=re&tag=search");
		break;
		case "3504":
		window.open("http://cnn-cnet.com.com/4323-6525_7-6509098.html?part=cnn-cnet&subj=re&tag=search");
		break;
		case "3000":
		window.open("http://cnn-cnet.com.com/4323-6526_7-6509032.html?part=cnn-cnet&subj=re&tag=search");
		break;
		case "3127":
		window.open("http://cnn-cnet.com.com/4323-6522_7-6509058.html?part=cnn-cnet&subj=re&tag=search");
		break;
		case "6463":
		window.open("http://cnn-cnet.com.com/4323-6531_7-6509125.html?part=cnn-cnet&subj=re&tag=search");
		break;
		case "6450":
		window.open("http://cnn-cnet.com.com/4323-6532_7-6509081.html?part=cnn-cnet&subj=re&tag=search");
		break;
		case "3132":
		window.open("http://cnn-cnet.com.com/4323-6528_7-6509067.html?part=cnn-cnet&subj=re&tag=search");
		break;
		case "3243":
		window.open("http://cnn-cnet.com.com/4323-6523_7-6509031.html?part=cnn-cnet&subj=re&tag=search");
		break;
	}
	return false;
}
/* end cnet product reviews widget
=========================================================================== */

/* partner box output
=========================================================================== */
function cnnPartnerRand_Asort(){ return (Math.round(Math.random())-0.5); }

function cnnPrintPartnerOutput() {
	var cnnPartner_Data = new Array();
	// name, logo, feed location, subscribe link, logo link
	cnnPartner_Data[0] = new Array("Time.com","http://i.l.cnn.net/cnn/.element/img/2.0/content/partners/time_partner.gif","/.element/ssi/auto/2.0/sect/MAIN/ftpartners/partner.time.html", "/linkto/time.main.html", "/time/?cnn=yes");
	cnnPartner_Data[1] = new Array("EW.com","http://i.l.cnn.net/cnn/.element/img/2.0/content/partners/entertainment_partner.gif","/.element/ssi/auto/2.0/sect/MAIN/ftpartners/partner.ew.html", "http://subs.timeinc.net/CampaignHandler/ewlinks?source_id=29", "/ew/?cnn=yes");
	cnnPartner_Data[2] = new Array("People.com","http://i.l.cnn.net/cnn/.element/img/2.0/content/partners/partner_people.gif","/.element/ssi/auto/2.0/sect/MAIN/ftpartners/partner.people.html", "https://subs.timeinc.net/PE/pe_cntl0407.jhtml?experience_id=164491&source_id=5&_requestid=84312", "http://www.people.com/people");
	cnnPartner_Data[3] = new Array("CNNMoney.com","http://i.l.cnn.net/cnn/.element/img/2.0/content/partners/money_partner.gif","/.element/ssi/auto/2.0/sect/MAIN/ftpartners/partner.money.txt", "http://money.cnn.com/services/bridge/contact.us.html", "/money/index.html?cnn=yes");
	cnnPartner_Data[4] = new Array("CNNSI.com","http://i.l.cnn.net/cnn/.element/img/2.0/content/partners/si_partner.gif","/.element/ssi/auto/2.0/sect/MAIN/ftpartners/partner.si.txt", "https://subs.timeinc.net/CampaignHandler/si_cnnsi?source_id=19", "/si/?cnn=yes");
	
	cnnPartner_Data.sort(cnnPartnerRand_Asort);

	for(var i = 0;i < 2;i++) {

		var	temp_partner_html = '<div class="cnnWireBox"><div class="cnnBoxHeader"><div></div></div><div class="cnnBoxContent"><div class="cnnPad8TB12LR"><div class="cnnPartnerTop">';
		if(cnnPartner_Data[i][3] != "") {
			temp_partner_html += '<div class="cnnPartnerSubscribe"><a href="' + cnnPartner_Data[i][3] + '" onmouseover="cnnImgSwap(this,1)" onmouseout="cnnImgSwap(this,0)"><img src="/.element/img/2.0/content/partners/btn_subscribe.gif" width="61" height="17" border="0"></a></div>';
		}
		temp_partner_html += '<div>';
		if(cnnPartner_Data[i][4] != "") {
			temp_partner_html += '<a href="' + cnnPartner_Data[i][4] + '">';
		}
		temp_partner_html += '<img src="' + cnnPartner_Data[i][1] + '" class="cnnPartLogo" border="0" alt="">';
		if(cnnPartner_Data[i][4] != "") {
			temp_partner_html += '</a>';
		}		
		temp_partner_html += '</div><div class="clear"></div></div><div id="cnnPartnerInclude_' + i + '">Loading...</div></div></div><div class="cnnBoxFooter"><div></div></div></div>';

		Element.update('randPartner_' + i, temp_partner_html);
		new Ajax.Updater('cnnPartnerInclude_' + i, cnnPartner_Data[i][2], {asynchronous:true, method:'get'});

	}
}
/* end partner box output
=========================================================================== */

/* partner box omniture tracking
=========================================================================== */
var cnnPSproducts="";
var cnnProducts = new Array();
/* end partner box output
=========================================================================== */

/* set edition js
========================================================================= */
var cnnDomestic_Host = 'www.cnn.com';
var cnnIntl_Host = 'edition.cnn.com';
var cnnUserEd_Pref = allCookies['SelectedEdition'];
var cnnShow_setPref = false;
var cnnUEPHost_Val = location.hostname;
var cnnOn_Dom_Flag;

if(location.hostname.indexOf(cnnDomestic_Host) > -1) { cnnOn_Dom_Flag = 1; }

var cnnSetPrefBox_HTML = '<div id="cnnSetCNNEd"><div class="cnnWireSeBox"><div class="cnnWireSeBoxHeader"><img src="http://i.a.cnn.net/cnn/.element/img/2.0/global/set_edition/corner_se_tl.gif" width="4" height="4" alt="" /></div><div id="cnnBoxSeContent"><a href="javascript:cnnSetPrefBox_Close();"><img class="cnnEditionCloseBtn" src="http://i.a.cnn.net/cnn/.element/img/2.0/global/set_edition/se_close_btn.gif" width="14" height="14" alt="" /></a><form id="cnnsetPref_Form"><table align="center" class="cnnSetEdition" cellpadding="0" cellspacing="0" border="0"><tr><td class="setEdText"><b>Set your CNN.com Edition</b></td>';

if(cnnOn_Dom_Flag) { cnnSetPrefBox_HTML += '<td class="cnnEditionRadioTD"><input type="radio" id="edition" name="edition" class="cnnEditionRadioBtn" checked="checked" value="www" /></td><td>CNN U.S.</td><td class="cnnEditionRadioTD"><input type="radio" id="edition" name="edition" class="cnnEditionRadioBtn" value="edition" /></td><td>CNN International</td>'; }
else { cnnSetPrefBox_HTML += '<td class="cnnEditionRadioTD"><input type="radio" id="edition" name="edition" class="cnnEditionRadioBtn" checked="checked" value="edition" /></td><td>CNN International</td><td class="cnnEditionRadioTD"><input type="radio" id="edition" name="edition" class="cnnEditionRadioBtn" value="www" /></td><td>CNN U.S.</td>'; }

cnnSetPrefBox_HTML += '<td><a href="javascript:cnnSetEdPref_cooKie();"><img class="cnnEditionBoxBtn" src="http://i.a.cnn.net/cnn/.element/img/2.0/global/set_edition/se_btn.gif" width="84" height="23" alt="" border="0" /></a></td></tr></table></form></div><div class="cnnWireSeBoxFooter"><img src="http://i.a.cnn.net/cnn/.element/img/2.0/global/set_edition/corner_se_bl.gif" width="4" height="4" alt="" /></div></div></div>';

if(cnnUserEd_Pref) {
	if(location.hostname == "cnn.com") {
		if(cnnUserEd_Pref == 'www') { location.replace('http://' + cnnDomestic_Host); }
		else{ location.replace('http://' + cnnIntl_Host); }
	}
}
else {
	cnnShow_setPref = true;
}

function cnnSetPrefBox_Close(pref_flag) {
	if (document.getElementById) { document.getElementById('cnnSetEditionContainer').style.display = 'none'; }
	else if (document.all) { document.all['cnnSetEditionContainer'].style.display = 'none'; }
}

function cnnSetEditionBox() {

	Element.update('cnnSetEditionContainer', cnnSetPrefBox_HTML);
	if (document.getElementById) { document.getElementById('cnnSetEditionContainer').style.display = 'block'; }
	else if (document.all) { document.all['cnnSetEditionContainer'].style.display = 'block'; }
	if(!cnnUserEd_Pref) {
		if(location.hostname.indexOf(cnnIntl_Host) > -1) { CNN_setCookie('SelectedEdition', 'edition', 8544, '/', '.cnn.com'); }
		else { CNN_setCookie('SelectedEdition', 'www', 8544, '/', '.cnn.com'); }
	}
	
}

function cnnSetEdPref_cooKie() {
	form_obj = document.getElementById('cnnsetPref_Form');
	cookie_val = (form_obj.edition[0].checked) ? form_obj.edition[0].value : form_obj.edition[1].value;
	CNN_setCookie('SelectedEdition', cookie_val, 8544, '/', '.cnn.com');
	cnnSetPrefBox_Close(1);
	current_loc = "" + document.location + '';
	if(cookie_val == 'www') {
		if(location.hostname.indexOf(cnnDomestic_Host) < 0) {
			if(location.hostname.indexOf(cnnIntl_Host) > -1) {
				current_loc = current_loc.replace(/^http:\/\/.+\.com/, 'http://' + cnnDomestic_Host);
				location.replace(current_loc);
			}
		}
	}
	else {
		if(location.hostname.indexOf(cnnIntl_Host) < 0) {
			if(location.hostname.indexOf(cnnDomestic_Host) > -1) {
				current_loc = current_loc.replace(/^http:\/\/.+\.com/, 'http://' + cnnIntl_Host);
				location.replace(current_loc);
			}
		}
	}
}

/* end set edition js
========================================================================= */

var cnnDocDomain='';
if(location.hostname.indexOf('cnn.com')>0) { cnnDocDomain='cnn.com'; }
if(location.hostname.indexOf('turner.com')>0) { cnnDocDomain='turner.com'; }
if(cnnDocDomain) { document.domain = cnnDocDomain;}

