var regrowthLockToggle = false;

function regrowth_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 regrowth_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 regrowth_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 regrowth_killCookie( name, path, domain ) {
	var allCookies = regrowth_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 = regrowth_getCookies();
var regrowthDomainArray = location.hostname.split( '.' );
var regrowthCurrDomain = ( regrowthDomainArray.length > 1 ) ? '.' + regrowthDomainArray[regrowthDomainArray.length-2] + '.' + regrowthDomainArray[regrowthDomainArray.length-1] : '';

var pagetypeTS="";

function regrowthRenderTimeStamp(date,timeString) {
	var regrowthIsIntl = (location.hostname.indexOf('edition.') > -1) ? true : false;
	regrowthStoryPublishTime = (date) ? new Date(date) : regrowthStoryPublishTime;
	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 regrowthTimeStampDiff = regrowthCurrTime.getTime() - regrowthStoryPublishTime.getTime();

    var daysDifference = Math.floor(regrowthTimeStampDiff/1000/60/60/24);

    regrowthTimeStampDiff -= daysDifference*1000*60*60*24

    var hoursDifference = Math.floor(regrowthTimeStampDiff/1000/60/60);

    regrowthTimeStampDiff -= hoursDifference*1000*60*60

    var minutesDifference = Math.floor(regrowthTimeStampDiff/1000/60);

    regrowthTimeStampDiff -= minutesDifference*1000*60

	var regrowthDays = (daysDifference > 1) ? "days" : "day";
	var regrowthHours = (hoursDifference > 1) ? "hours" : "hour";
	var regrowthMinutes = (minutesDifference > 1) ? "minutes" : "minute";
	var regrowthHPMinutes = "min";
	var regrowthCMSTimeString = '';
	var regrowthBlankString = "";

	if (timeString) {
		regrowthCMSTimeString = (regrowthIsIntl) ? timeString[0] : timeString[1];
	}	else { //for legacy support
		regrowthCMSTimeString = "updated " + (!regrowthIsIntl ? days[regrowthStoryPublishTime.getUTCDay()] : '') + " " + months[regrowthStoryPublishTime.getUTCMonth()] + " " + regrowthStoryPublishTime.getUTCDate() + ", " + regrowthStoryPublishTime.getUTCFullYear();
	}


	if (hoursDifference > 4 && daysDifference >= 0 || daysDifference >= 1) {
		switch(pagetypeTS) {
			case "homepage": //t2 formatted
				return regrowthBlankString;
			break;
			case "mosaic":
				return "<div class=\"regrowthGryTmeStmp\">" + regrowthCMSTimeString + "<\/div>";
			break;
			case "section":
			default:
				if (pagetypeTS == 'section' && regrowthIsIntl) {
					return "<div class=\"regrowthGryTmeStmp\">" + regrowthCMSTimeString + "<\/div>";
				} else {
					return "<div class=\"regrowthGryTmeStmp\">updated " + (!regrowthIsIntl ? days[regrowthStoryPublishTime.getUTCDay()] : '') + " " + months[regrowthStoryPublishTime.getUTCMonth()] + " " + regrowthStoryPublishTime.getUTCDate() + ", " + regrowthStoryPublishTime.getUTCFullYear() + "<\/div>";
				}
		}
	} else if( hoursDifference <= 4 && hoursDifference >= 1) {
		switch(pagetypeTS) {
			case "homepage": //t2 formatted
				return regrowthBlankString;
			break;
			case "mosaic":
			default:
				if (minutesDifference > 0) {
					return "<div class=\"regrowthGryTmeStmp\">updated " + hoursDifference + " "+regrowthHours+", " + minutesDifference + " "+regrowthMinutes+" ago<\/div>";
				} else {
					return "<div class=\"regrowthGryTmeStmp\">updated " + hoursDifference + " "+regrowthHours+" 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 + " "+regrowthMinutes+" ago";
				} else {
					return "updated 1 minute ago";
				}
		}

	}
}

function regrowthRenderBackStoryTimeStamp(date,timeString) {
	regrowthStoryPublishTime = new Date(date);
	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 regrowthTimeStampDiff = regrowthCurrTime.getTime() - regrowthStoryPublishTime.getTime();
    var daysDifference = Math.floor(regrowthTimeStampDiff/1000/60/60/24);
    regrowthTimeStampDiff -= daysDifference*1000*60*60*24
    var hoursDifference = Math.floor(regrowthTimeStampDiff/1000/60/60);
    regrowthTimeStampDiff -= hoursDifference*1000*60*60
    var minutesDifference = Math.floor(regrowthTimeStampDiff/1000/60);
    regrowthTimeStampDiff -= minutesDifference*1000*60
	var regrowthDays = (daysDifference > 1) ? "days" : "day";
	var regrowthHours = (hoursDifference > 1) ? "hours" : "hour";
	var regrowthMinutes = (minutesDifference > 1) ? "minutes" : "minute";
	var regrowthCMSTimeString = '';
	if (timeString) {
		regrowthCMSTimeString = timeString;
	}
	if (hoursDifference > 4 && daysDifference >= 0 || daysDifference >= 1) {
		return "<span class=\"regrowthDate\">" + regrowthCMSTimeString + "<\/span>";
	} else if( hoursDifference <= 4 && hoursDifference >= 1) {
		if (minutesDifference > 0) {
			return "<span class=\"regrowthDate\">updated " + hoursDifference + " "+regrowthHours+", " + minutesDifference + " "+regrowthMinutes+" ago<\/span>";
		} else {
			return "<span class=\"regrowthDate\">updated " + hoursDifference + " "+regrowthHours+" ago<\/span>";
		}
	} else {
		if(hoursDifference < 1 && minutesDifference > 0){
			return "<span class=\"regrowthDate\" style=\"color:#CB0003;\">updated " + minutesDifference + " "+regrowthMinutes+" ago</span>";
		} else {
			return "<span class=\"regrowthDate\" style=\"color:#CB0003;\">updated 1 minute ago</span>";
		}
	}
}

function regrowthRenderT1TimeStamp(date,useLongFormat) {

	regrowthStoryPublishTime = (date) ? new Date(date) : regrowthStoryPublishTime;
	var regrowthTimeStampString;
	var nullString="";



    var regrowthTimeStampDiff = regrowthCurrTime.getTime() - regrowthStoryPublishTime.getTime();

    var daysDifference = Math.floor(regrowthTimeStampDiff/1000/60/60/24);

    regrowthTimeStampDiff -= daysDifference*1000*60*60*24

    var hoursDifference = Math.floor(regrowthTimeStampDiff/1000/60/60);

    regrowthTimeStampDiff -= hoursDifference*1000*60*60

    var minutesDifference = Math.floor(regrowthTimeStampDiff/1000/60);

    regrowthTimeStampDiff -= minutesDifference*1000*60

    var secondsDifference = Math.floor(regrowthTimeStampDiff/1000);


	var regrowthDays = (daysDifference > 1) ? "days" : "day";
	var regrowthHours = (hoursDifference > 1) ? "hours" : "hour";
	var regrowthMinutes = (minutesDifference > 1) ? "minutes" : "minute";
	var regrowthSeconds = (secondsDifference > 1) ? "seconds" : "second";
	var regrowthHPMinutes = (minutesDifference > 1) ? "minutes" : "minute";
	var regrowthHPSeconds = (secondsDifference > 1) ? "secs" : "sec";

	if (pagetypeTS=='homepage') {

			regrowthTimeStampString = 'updated ';

		if(hoursDifference < 1 && minutesDifference > 0){
			regrowthTimeStampString += minutesDifference + " "+(useLongFormat?regrowthMinutes:regrowthHPMinutes)+" ago";
		} else if(hoursDifference < 1 && minutesDifference < 1) {
			regrowthTimeStampString += secondsDifference + " "+(useLongFormat?regrowthSeconds:regrowthHPSeconds)+" ago";
		} else if(hoursDifference >= 1) {
			return nullString;
		}
		return '<span>'+regrowthTimeStampString+'</span>';
	}

}


function regrowth_submitUserComment(form) {
var regrowthSubmitForm = true;

if(typeof(regrowthThread) != "undefined") {
	$(form).threadName.value = regrowthThread;
}
if(typeof(regrowthForum) != "undefined") {
  $(form).forumName.value  = regrowthForum;
}

var errorDivs = $('regrowthROCSubFrm').getElementsByClassName('regrowthError');
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('regrowthUserResponseName',' <span id="regrowthUserResponseNameError" class="regrowthError">&raquo;<\/span>');
    		}
    		if (allFormEls[i].name == "location") {
    			new Insertion.Before('regrowthUserResponseLocation',' <span id="regrowthUserResponseNameError" class="regrowthError">&raquo;<\/span>');
    		}
    		if (allFormEls[i].name == "body") {
    			new Insertion.Before('regrowthUserResponseComment',' <span id="regrowthUserResponseNameError" class="regrowthError">&raquo;<\/span>');
    		}
    	regrowthSubmitForm = false;
	}
}

	if (regrowthSubmitForm) {

			new Effect.Opacity('regrowthROCFrm',
					{
						duration:1.0,
						from:1.0,
						to:0,
						beforeStart:function() {
					  		document.regrowthROCSubFrm.submit();
						},
						afterFinish: function(obj)
							{
							Form.reset(form);					      		$('regrowthROCFrmComplete').innerHTML = "Thank you for contributing. Comments are moderated by regrowth 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=\"regrowth_toggleSubmissionForm('regrowthROCFrm','regrowthROCFrmComplete')\">Post another comment<\/a>";
									new Effect.Opacity('regrowthROCFrmComplete',
										{
											duration:1.0,
											from:0,
											to:1.0,
											beforeUpdate:function(obj) {
												$('regrowthROCFrm').hide();
												obj.element.show();
											}
										}
									);
							}

					}
				);
	}
}

function regrowth_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 regrowthShowExtendedComments(el) {
	var block = document.getElementsByClassName('regrowthExtended',el.parentNode.parentNode);
	if (block && block.length > 0) {
		regrowthToggleUGC(block[0],el);
		el.style.display = "none";
	}
}

function regrowthHideExtendedComments(el) {
	var block = el.parentNode.parentNode;
	var blockLinks = block.parentNode.getElementsByTagName('a');
	if (block) {
		regrowthToggleUGC(block,el);
			for (var i=0; i < blockLinks.length; i++) {
				blockLinks[i].style.display = "inline";
		}
	}
}

function regrowthShowMore(el) {
	var block = document.getElementsByClassName('regrowthExtended',el.parentNode.parentNode);
	var initialGraph = el.parentNode.getElementsByTagName('p');
	if (block && block.length > 0) {
el.parentNode.hide();
block[0].show();
	}
}

function regrowthShowLess(el) {
	var block = el.parentNode.parentNode;
	var blockLinks = block.parentNode.getElementsByTagName('p');

	block.hide();
	blockLinks[0].show();

}

function regrowthToggleUGC(el,lnk) {
	if (regrowthLockToggle) {
		return;
	}

	regrowthLockToggle = true;
	var regrowthToggleClass = (lnk.parentNode.className.indexOf('Closed') > -1) ? true : false;

		Effect.toggle(el,'blind',
		{
			beforeStart:function(obj) {
				try {
					lnk.blur();
				} catch(e) {};
				if (regrowthToggleClass) {
				switch(lnk.parentNode.className) {
					case 'regrowthOpinionClosed':
						lnk.parentNode.className = 'regrowthOpinion';
					break;
					case 'regrowthIReportClosed':
						lnk.parentNode.className = 'regrowthIReport';
					break;
					case 'regrowthBlogsClosed':
						lnk.parentNode.className = 'regrowthBlogs';
						Sphere.Widget.search();
					break;
					default:
				}
				}

			},
			afterFinish:function(obj) {
				if (!regrowthToggleClass) {
				switch(lnk.parentNode.className) {
					case 'regrowthOpinion':
						lnk.parentNode.className = 'regrowthOpinionClosed';
					break;
					case 'regrowthIReport':
						lnk.parentNode.className = 'regrowthIReportClosed';
					break;
					case 'regrowthBlogs':
						lnk.parentNode.className = 'regrowthBlogsClosed';
					break;
					default:
				}
				}
				regrowthLockToggle = false;
			}
		}
	);
}

function regrowthToggleNestedContent(el,lnk,num,desc) {
if (regrowthLockToggle) {
	return;
}

regrowthLockToggle = true;
var regrowthLnkTxt = "Last 3 comments only";
		Effect.toggle(el,'blind',
		{
			duration:0.5,
			afterFinish: function() {
				if(!desc) {
					if (lnk.innerHTML == regrowthLnkTxt) {
						lnk.innerHTML = "See all " + num + " comments";
					} else {
						lnk.innerHTML = regrowthLnkTxt;
					}
				}
				regrowthLockToggle = false;
			},
			beforeStart: function() {
				if(desc) {
					$(lnk).style.display = "none";
				}

			}
		}

		);


}


function regrowth_displayBlogContent(widgetLoading,widgetContent) {
	if (!$(widgetLoading) || !$(widgetContent)) {
		return;
	}

			Effect.BlindUp(widgetLoading,
				{
					afterFinish:function(obj) {
						$(obj.element.id).remove();
					}
				}
			);
			Effect.BlindDown(widgetContent);
}


var regrowthHasOpenPopup = 0;
// this is for opening pop-up windows
function regrowth_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) {regrowthHasOpenPopup = 1;}
	if ( popupWin && popupWin.opener ) {
		if ( openerUrl )
		{
			popupWin.opener.location = openerUrl;
		}
	}
	if ( popupWin) {
		popupWin.focus();
	}
}

function regrowthImgSwap( 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 regrowth_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 regrowth_FlashDetect().detectVersion( 6 ) ) {

	var regrowth_Scoreboard = new regrowth_FlashObject( "regrowthScoreboard",
		"/.element/img/2.0/swf/nfl_scoreboard.swf",
		420, 85, null, "cs_url=/football/nfl/scoreboards/today/" );

	regrowth_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 regrowth_FlashDetect() { }

regrowth_FlashDetect.prototype.maxVersionToDetect = 10;
regrowth_FlashDetect.prototype.minVersionToDetect = 3;

regrowth_FlashDetect.prototype.hasPlugin = ( navigator.mimeTypes &&
		navigator.mimeTypes.length &&
		navigator.mimeTypes["application/x-shockwave-flash"] &&
		navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin );

regrowth_FlashDetect.prototype.hasActiveX = window.ActiveXObject;

regrowth_FlashDetect.prototype.hasWinIE = ( navigator.userAgent &&
		( navigator.userAgent.indexOf( "MSIE" ) != -1 ) &&
		navigator.appVersion &&
		( navigator.appVersion.indexOf( "Win" ) != -1 ) );

regrowth_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 ) {
				var wordAsNum = parseInt( words[i], 10 ); 
				if ( isNaN( wordAsNum ) ) { 
					continue; 
				}
				else { 
					versionNum = wordAsNum; 
					break; // assume first number we get is version number 
				} 
			}
		}
	}

	return ( versionNum );
}

regrowth_FlashDetect.prototype.detectVersion = function ( num ) {
	var isVersionSupported = false;

	if ( ! isNaN( num ) ) {
		isVersionSupported = ( parseInt( this.getVersion(), 10 ) >= parseInt( num, 10 ) ); 
	}

	return ( isVersionSupported );
}


function regrowth_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
regrowth_FlashObject.prototype.m_name = '';
regrowth_FlashObject.prototype.m_src = '';
regrowth_FlashObject.prototype.m_width = '';
regrowth_FlashObject.prototype.m_height = '';
regrowth_FlashObject.prototype.m_flashVars = '';

regrowth_FlashObject.prototype.m_params = {
	menu:		"false",
	quality:	"high",
	allowScriptAccess:		"always",
	wmode:		"transparent"

};

regrowth_FlashObject.prototype.setParam = function ( p_name, p_value ) {
	this.m_params[ p_name ] = p_value;
}

regrowth_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] );
			}
		}
	}
}

regrowth_FlashObject.prototype.getParam = function ( p_name ) {
	return ( this.m_params[ p_name ] );
}

regrowth_FlashObject.prototype.getParams = function () {
	return ( this.m_params );
}

regrowth_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 );
}

regrowth_FlashObject.prototype.getAttributeString = function ( p_attr, p_value ) {
	return ( p_value ? ' ' + p_attr + '="' + p_value + '"' : '' );
}

regrowth_FlashObject.prototype.getParamTag = function ( p_name, p_value ) {
	return ( p_value ? '<param name="' + p_name + '" value="' + p_value + '">' : '' );
}

regrowth_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 );
}

regrowth_FlashObject.prototype.writeHtml = function () {
	document.write( this.getHtml() );
}

regrowth_FlashObject.prototype.writeMosaicHtml = function (id) {
	document.getElementById(id).innerHTML =  this.getHtml();
}


//   story comments functions
//====================================================== START

var commentsWindow = 25;
var currentPage = 1;
var regrowthInitialDisplay = 3;
var nextLink = false;
var loadingComments = false;
var firstTimeNested = true;
var getThisMany = 0;

//gets next set of comments - of length: commentsWindow*currentPage
function regrowth_getNextComments(){
	if(loadingComments){ return; }
	loadingComments=true;
	currentPage++;
	getThisMany = commentsWindow * currentPage + regrowthInitialDisplay + 1;

	window.setTimeout(function() {	
		CSIManager.getInstance().call('http://comments.regrowth.com/comments/rss/rssmessages.jspa','full=true&outputType=JSON_BOXED&forumName='+regrowthForum+'&threadName='+regrowthThread+'&numItems='+getThisMany,'objectid', regrowth_loadNextIntoOpinionBox, false, 'regrowthComments'+currentPage);
	},500);
}

//handler for regrowth_getNextComments
function regrowth_loadNextIntoOpinionBox(obj){
    var regrowth_comment = '';
	var hideableComments = '';
	var makeHidden = 'visible';
	for (var xx = 0; xx < regrowthInitialDisplay; xx++){
    		var clObject = obj.rss.channel.item[xx];
		hideableComments += regrowth_generateACommentDiv(clObject);
    	}
    	for (var xx = ((currentPage-1) * commentsWindow)+regrowthInitialDisplay; xx < obj.rss.channel.item.length; xx++) {
		var clObject = obj.rss.channel.item[xx];
			if (xx < (getThisMany -1))	{	
				regrowth_comment += regrowth_generateACommentDiv(clObject);
			}
    	}
        if(obj.rss.channel.item.length < getThisMany || (obj.rss.channel.item.length-((currentPage-1) * commentsWindow))+regrowthInitialDisplay < commentsWindow){
		document.getElementById('nextLink').style.visibility = "hidden";
		nextLink = false;
	}
	var nextLinkHtmlVisible = 'visible';
	if(!nextLink){
		nextLinkHtmlVisible='hidden';
	}

	var regrowthShowExpandedLnk = $('regrowthOpinionContainer').getElementsByClassName('regrowthExpandCommentsLnk');
	regrowthShowExpandedLnk[0].innerHTML = '<a href="javascript:void(0)" onclick="regrowth_ToggleNestedStoryContent(\'regrowthOpinionSubContainer\',this, \''+commentsWindow+'\',null);">Last '+regrowthInitialDisplay+' comments only<\/a><span id="nextLink" style="visibility:'+nextLinkHtmlVisible+'"> | <a href="javascript:void(0)" onclick="regrowth_getNextComments();">Next '+commentsWindow+' comments &raquo;</a></span>';
	loadingComments = false;
	return "<div id='allComments'>"+hideableComments+"<div id='regrowthOpinionSubContainer'>"+document.getElementById("regrowthOpinionSubContainer").innerHTML+regrowth_comment+"</div></div>";
}

//builds a single comment element
function regrowth_generateACommentDiv(clObject){
		var regrowth_comment = '';
        regrowth_comment += '                <div class="regrowthUGCBox">';
        regrowth_comment += '                        <div class="regrowthUGCBoxHeader"><img src="http://i.cdn.turner.com/cnn/.element/img/2.0/mosaic/base_skins/UGC/b_ugc_TL.gif" alt="" width="4" height="4"><\/div>';
        regrowth_comment += '                        <div class="regrowthBoxContent">';
        regrowth_comment += '                                <div class="regrowthMeta">';
        regrowth_comment +=                                  '<span class="regrowthContributor">'+clObject['jf:author']+'<\/span><br>';
        regrowth_comment += regrowthRenderTimeStamp(clObject['pubDate']);
        regrowth_comment += '                                <\/div>';
        regrowth_comment += '                                <p>';
        regrowth_comment += clObject['description'].truncate(300,' ...<a href="javascript:void(0);" onclick="regrowthShowMore(this);return false">more<\/a>');
        regrowth_comment += '                                <\/p>';

        regrowth_comment += '                                <div class="regrowthExtended" style="display:none;"><p>';
        regrowth_comment += clObject['description'];
        regrowth_comment += '                                <a href="javascript:void(0);" onclick="regrowthShowLess(this);return false;">less<\/a><\/p><\/div>';


        regrowth_comment += '                        <\/div>';
        regrowth_comment += '                        <div class="clear"><img src="http://i.cdn.turner.com/cnn/images/1.gif" width="1" height="1" border="0" alt=""></div><div class="regrowthUGCBoxFooter"><img src="http://i.cdn.turner.com/cnn/.element/img/2.0/mosaic/base_skins/UGC/b_ugc_BL.gif" alt="" width="4" height="4"><\/div>';
        regrowth_comment += '                <\/div>';
	return regrowth_comment;
}

//empties the comments
function regrowth_clearOutComments(){
	currentPage = 0;
	document.getElementById("regrowthOpinionSubContainer").innerHTML='';
}

//shows/hides comments + next link appropraitely
function regrowth_ToggleNestedStoryContent(el,lnk,num,desc) {
	if (regrowthLockToggle) {
		return;
	}
	regrowthLockToggle = true;
	var regrowthLnkTxt = "Last 3 comments only";
		Effect.toggle(el,'blind',
		{
			duration:0.5,
			afterFinish: function() {
				if(!desc) {
					if (lnk.innerHTML == regrowthLnkTxt) {
						lnk.innerHTML = "Next " + commentsWindow + " comments &raquo;";
						nextLink = false;
						currentPage = 0;
						regrowth_clearOutComments();
						document.getElementById('nextLink').style.visibility = "hidden";
					} else {
						if(!firstTimeNested){
							regrowth_getNextComments();
						}						
						if(firstTimeNested && (num < (commentsWindow * currentPage + regrowthInitialDisplay + 1))) {
							nextLink = false;
						} else {
							nextLink = true;
							document.getElementById('nextLink').style.visibility = "visible";
						}
						firstTimeNested = false;
						lnk.innerHTML = regrowthLnkTxt;

					}
				}
				regrowthLockToggle = false;
			},
			beforeStart: function() {
				if(desc) {
					$(lnk).style.display = "none";
				}

			}
		}

	);
}

//initial load
function regrowth_loadReaderOpinion(obj) {

	if (typeof regrowthFirstPub != "undefined") {
	    var regrowthTimeDiff = regrowthCurrTime.getTime() - regrowthFirstPub.getTime();
    	var hoursDifference = Math.floor(regrowthTimeDiff/1000/60/60);
		if (hoursDifference > 23) {
			regrowthCommentsClosed = true;
		}
	}

if (typeof regrowthExtendCommenting != "undefined" && regrowthExtendCommenting) {
	regrowthCommentsClosed = false;
}


if (typeof regrowthCommentsClosed != "undefined" && regrowthCommentsClosed) {
	if ($('regrowthCommentFooter')) {
		$('regrowthCommentFooter').remove();
	}
	if ($('regrowthROCFrm')) {
		$('regrowthROCFrm').remove();
	}
	if ($('regrowthROCFrmComplete')) {
		$('regrowthROCFrmComplete').innerHTML = "This story is no longer available for comments, though you may read comments that were posted previously. Browse other stories for new opportunities to comment on the latest news.";
		$('regrowthROCFrmComplete').show();
	}
}

			var regrowth_comment = '';


		if(!obj || !obj.rss || !obj.rss.channel || !obj.rss.channel.item) {
    	regrowth_comment += '		<div class="regrowthUGCBox">';
    	regrowth_comment += '			<div class="regrowthUGCBoxHeader"><img src="http://i.cdn.turner.com/cnn/.element/img/2.0/mosaic/base_skins/UGC/b_ugc_TL.gif" alt="" width="4" height="4"><\/div>';
    	regrowth_comment += '			<div class="regrowthBoxContent">';
    	regrowth_comment += '<p style="margin-left:6px;">No comments yet.<\/p>';
    	regrowth_comment += '			<\/div>';
    	regrowth_comment += '			<div class="clear"><img src="http://i.cdn.turner.com/cnn/images/1.gif" width="1" height="1" border="0" alt=""></div><div class="regrowthUGCBoxFooter"><img src="http://i.cdn.turner.com/cnn/.element/img/2.0/mosaic/base_skins/UGC/b_ugc_BL.gif" alt="" width="4" height="4"><\/div>';
    	regrowth_comment += '		<\/div>';

			return regrowth_comment;
		}


    if (typeof(obj.rss.channel.item.length) == "undefined") {
				var clObject = obj.rss.channel.item;
    	regrowth_comment += '		<div id="regrowthOpinionSubContainer"><div class="regrowthUGCBox">';
    	regrowth_comment += '			<div class="regrowthUGCBoxHeader"><img src="http://i.cdn.turner.com/cnn/.element/img/2.0/mosaic/base_skins/UGC/b_ugc_TL.gif" alt="" width="4" height="4"><\/div>';
    	regrowth_comment += '			<div class="regrowthBoxContent">';
    	regrowth_comment += '				<div class="regrowthMeta">';
    	regrowth_comment += 					'<span class="regrowthContributor">'+clObject['jf:author']+'<\/span><br>';
    	regrowth_comment += regrowthRenderTimeStamp(clObject['pubDate']);
    	regrowth_comment += '				<\/div>';
    	regrowth_comment += '				<p>';
    	regrowth_comment += clObject['description'].truncate(300,' ...<a href="javascript:void(0);" onclick="regrowthShowMore(this);return false">more<\/a>');
    	regrowth_comment += '				<\/p>';

      	regrowth_comment += '				<div class="regrowthExtended" style="display:none;"><p>';
    	regrowth_comment += clObject['description'];
    	regrowth_comment += '				<a href="javascript:void(0);" onclick="regrowthShowLess(this);return false;">less<\/a><\/p><\/div>';


    	regrowth_comment += '			<\/div>';
    	regrowth_comment += '			<div class="clear"><img src="http://i.cdn.turner.com/cnn/images/1.gif" width="1" height="1" border="0" alt=""></div><div class="regrowthUGCBoxFooter"><img src="http://i.cdn.turner.com/cnn/.element/img/2.0/mosaic/base_skins/UGC/b_ugc_BL.gif" alt="" width="4" height="4"><\/div>';
    	regrowth_comment += '		<\/div><\/div>';

		return regrowth_comment;

    }



		var regrowthShowExpandedCont = $('regrowthOpinionContainer').parentNode.getElementsByTagName('a')[0];

		var regrowthShowExpandedLnk = $('regrowthOpinionContainer').getElementsByClassName('regrowthExpandCommentsLnk');


			var numLength = obj.rss.channel.item.length;
			var displayNum = numLength - 1;
			if (numLength > 3) {
				regrowthShowExpandedLnk[0].innerHTML = '<a href="javascript:void(0)" onclick="regrowth_ToggleNestedStoryContent(\'regrowthOpinionSubContainer\',this, \''+numLength+'\',null);">Next '+commentsWindow+' comments &raquo;<\/a> <span id="nextLink" style="visibility:hidden"> | <a href="javascript:void(0)" onclick="regrowth_getNextComments()">Next '+commentsWindow+' comments &raquo;</a></span>';
			}
		if (numLength >= 1 && (typeof(regrowthReaderOpinions) != "undefined" && regrowthReaderOpinions)) {
			regrowthToggleUGC('regrowthOpinionContainer',regrowthShowExpandedCont)
		}

    for (var xx = 0; xx < numLength; xx++) {
				var clObject = obj.rss.channel.item[xx];
				if(xx == 0){
					regrowth_comment+='<div id="allComments">';
				}
				if(xx == regrowthInitialDisplay)
				{
					regrowth_comment+='<div id="regrowthOpinionSubContainer" style="display:none;">';
				}


		if(xx < (commentsWindow * currentPage + regrowthInitialDisplay)) {
	    	regrowth_comment += '		<div class="regrowthUGCBox">';
    		regrowth_comment += '			<div class="regrowthUGCBoxHeader"><img src="http://i.cdn.turner.com/cnn/.element/img/2.0/mosaic/base_skins/UGC/b_ugc_TL.gif" alt="" width="4" height="4"><\/div>';
	    	regrowth_comment += '			<div class="regrowthBoxContent">';
    		regrowth_comment += '				<div class="regrowthMeta">';
    		regrowth_comment += 					'<span class="regrowthContributor">'+clObject['jf:author']+'<\/span><br>';
    		regrowth_comment += regrowthRenderTimeStamp(clObject['pubDate']);
    		regrowth_comment += '				<\/div>';
    		regrowth_comment += '				<p>';
    		regrowth_comment += clObject['description'].truncate(300,' ...<a href="javascript:void(0);" onclick="regrowthShowMore(this);return false">more<\/a>');
	    	regrowth_comment += '				<\/p>';

    	  	regrowth_comment += '				<div class="regrowthExtended" style="display:none;"><p>';
    		regrowth_comment += clObject['description'];
    		regrowth_comment += '				<a href="javascript:void(0);" onclick="regrowthShowLess(this);return false;">less<\/a><\/p><\/div>';


    		regrowth_comment += '			<\/div>';
    		regrowth_comment += '			<div class="clear"><img src="http://i.cdn.turner.com/cnn/images/1.gif" width="1" height="1" border="0" alt=""></div><div class="regrowthUGCBoxFooter"><img src="http://i.cdn.turner.com/cnn/.element/img/2.0/mosaic/base_skins/UGC/b_ugc_BL.gif" alt="" width="4" height="4"><\/div>';
    		regrowth_comment += '		<\/div>';
		}
				if(xx == displayNum)
				{
					regrowth_comment+='<\/div></div>';
				}
    }

	return regrowth_comment;
}

//   story comments functions
//====================================================== END

/* share link functions 
=============================================================== */
function regrowthSetShareLnks() {
	// mixx
	var mixxURL = 'http://www.mixx.com/submit/story?page_url='+encodeURIComponent(location.href)+'&title='+regrowthShareTitle+'&description='+regrowthShareDesc+'&partner=regrowth';
	if($('regrowthSBtnMixx')) {
		$('regrowthSBtnMixx').href = mixxURL;
		$('regrowthSBtnMixx').target="_blank";
	}
	if($('regrowthSBtnMixxBot')) {
		$('regrowthSBtnMixxBot').href = mixxURL;
		$('regrowthSBtnMixxBot').target="_blank";
	}
	if($('regrowthMixxEmbedLnk')) {
		$('regrowthMixxEmbedLnk').href = mixxURL;
		$('regrowthMixxEmbedLnk').target="_blank";
	}
	// Digg
	var diggURL = 'http://digg.com/submit?phase=2&url='+encodeURIComponent(location.href)+'&title='+regrowthShareTitle+'&bodytext='+regrowthShareDesc;
	if($('regrowthSBtnDigg')) {
		$('regrowthSBtnDigg').href = diggURL;
		$('regrowthSBtnDigg').target="_blank";
	}
	if($('regrowthSBtnDiggBot')) {
		$('regrowthSBtnDiggBot').href = diggURL;
		$('regrowthSBtnDiggBot').target="_blank";
	}
	// Facebook
	var facebookURL = 'http://www.facebook.com/share.php?u='+encodeURIComponent(location.href);
	if($('regrowthSBtnFacebook')) {
		$('regrowthSBtnFacebook').href = facebookURL;
		$('regrowthSBtnFacebook').target="_blank";
	}
	if($('regrowthSBtnFacebookBot')) {
		$('regrowthSBtnFacebookBot').href = facebookURL;
		$('regrowthSBtnFacebookBot').target="_blank";
	}
	// del.icio.us
	var deliciousURL = 'http://del.icio.us/post?v=4&partner=regrowth&noui&jump=close&url='+encodeURIComponent(location.href)+'&title='+regrowthShareTitle+'delicious';
	if($('regrowthSBtnDelicious')) {
		$('regrowthSBtnDelicious').href = deliciousURL;
		$('regrowthSBtnDelicious').target="_blank";
	}
	if($('regrowthSBtnDeliciousBot')) {
		$('regrowthSBtnDeliciousBot').href = deliciousURL;
		$('regrowthSBtnDeliciousBot').target="_blank";
	}
	// reddit
	var redditURL = 'http://reddit.com/submit?url='+encodeURIComponent(location.href)+'&title='+regrowthShareTitle;
	if($('regrowthSBtnReddit')) {
		$('regrowthSBtnReddit').href = redditURL;
		$('regrowthSBtnReddit').target="_blank";
	}
	if($('regrowthSBtnRedditBot')) {
		$('regrowthSBtnRedditBot').href = redditURL;
		$('regrowthSBtnRedditBot').target="_blank";
	}
	// stumbleupon
	var stumbleuponURL = 'http://www.stumbleupon.com/submit?url='+encodeURIComponent(location.href)+'&title='+regrowthShareTitle;
	if($('regrowthSBtnStumbleUpon')) {
		$('regrowthSBtnStumbleUpon').href = stumbleuponURL;
		$('regrowthSBtnStumbleUpon').target="_blank";
	}
	if($('regrowthSBtnStumbleUponBot')) {
		$('regrowthSBtnStumbleUponBot').href = stumbleuponURL;
		$('regrowthSBtnStumbleUponBot').target="_blank";
	}
	// myspace
	var myspaceURL = 'http://www.myspace.com/Modules/PostTo/Pages/?' + 't=' + regrowthShareTitle + '&c=' + regrowthShareDesc + '&u=' + encodeURIComponent(location.href);
	if($('regrowthSBtnMyspace')) {
		$('regrowthSBtnMyspace').href = myspaceURL;
		$('regrowthSBtnMyspace').target="_blank";
	}
	if($('regrowthSBtnMyspaceBot')) {
		$('regrowthSBtnMyspaceBot').href = myspaceURL;
		$('regrowthSBtnMyspaceBot').target="_blank";
	}
	var twitterURL = 'http://regrowthtweet.appspot.com/articles/' + encodeURIComponent(location.href) + '/' + regrowthShareTitle + '/tweet/';
	if($('regrowthSBtnTwitter')) {
		$('regrowthSBtnTwitter').href = twitterURL;
		$('regrowthSBtnTwitter').target="_blank";
	}
	if($('regrowthSBtnTwitterBot')) {
		$('regrowthSBtnTwitterBot').href = twitterURL;
		$('regrowthSBtnTwitterBot').target="_blank";
	}
}

/* main page market box
====================================================== */
/* called on focus */
function regrowthMbChangeTxtClass( obj ) {
	if(obj.className == 'regrowthTxtMBGetQuote') {
		obj.value = '';
		obj.className = 'regrowthTxtMBGetQuoteType';
	}
}

/* called on blur */
function regrowthMbCheckTxtClass( obj ) {
	if((obj.className == 'regrowthTxtMBGetQuoteType') && (obj.value == '')) {
		obj.className = 'regrowthTxtMBGetQuote';
		obj.value = 'enter symbol';
	}
}
/* end main page market box
====================================================== */

/* search functions
===================================================================== */

var regrowthStrInvalidSrchMsg = 'Please enter a valid search term and try again.'+"\n"+'HTML, URLs, and Scripts are not allowed.';

function regrowthSearch( frm ) {
	if($('regrowthHeadSrchTxt').value != '') {
		if(!regrowthVerifySearchString($('regrowthHeadSrchTxt').value)) {alert(regrowthStrInvalidSrchMsg);}
		else {
			var strSearchLoc = regrowthGetSearchLoc();
			strSearchLoc += 'query=' + regrowthLeftTrim($('regrowthHeadSrchTxt').value);

			strSearchLoc += '&';
			strSearchLoc += 'type=' + $('regrowthHeadSrchType').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;
}

function regrowthVerifySearchString( srchTerm ) {
	var htmlRegEx = new RegExp('[\w*|\W*]*<[[\w*|\W*]*|/[\w*|\W*]]>[\w*|\W*]*');

	if(htmlRegEx.exec(srchTerm) || (srchTerm == null) || (regrowthLeftTrim(srchTerm).length == 0) || (srchTerm.indexOf(">") >= 0) || (srchTerm.indexOf(";") >= 0) ){
		return false;
	}
	else return true;
}

function regrowthGetSearchLoc() {
	var strSearchLoc = 'http://search.regrowth.com/search.jsp?'; // default

	if(location.hostname.indexOf('qai') != -1) {
		strSearchLoc = 'http://search.qai.regrowth.com/regrowthrelaunch/search.jsp?'
	}
	else if(location.hostname.indexOf('beta') != -1) {
		strSearchLoc = 'http://search.regrowth.com/search.jsp?'
	}

	return strSearchLoc;
}

function regrowthLeftTrim(sString) {
	while (sString.substring(0,1) == ' ') {
		sString = sString.substring(1, sString.length);
	}
	return sString;
}

function regrowthFootSearch( frm ) {
	if($('regrowthFootSrchTxt').value != '') {
		if(!regrowthVerifySearchString($('regrowthFootSrchTxt').value)) {alert(regrowthStrInvalidSrchMsg);}
		else {

			var strSearchLoc = regrowthGetSearchLoc();
			strSearchLoc += 'query=' + regrowthLeftTrim($('regrowthFootSrchTxt').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;
}

function regrowthUpdateSrchType( searchType ) {
	if($('regrowthHeadSrchType')) {
		$('regrowthHeadSrchType').value = searchType;
	}
	regrowthUpdateSrchTypeLnks( searchType );
}

function regrowthUpdateSrchTypeLnks( searchType ) {
	if($('regrowthHeadSrchTypeArea')) {
		switch(searchType) {
			case 'web':
				$('regrowthHeadSrchTypeArea').innerHTML = '<span class="regrowthSearchLabel">Web</span> | <a href="javascript:regrowthUpdateSrchType(\'news\');">Hair Loss News</a> | <a href="javascript:regrowthUpdateSrchType(\'video\');">Hair Loss Videos</a>';
				break;
			case 'news':
				$('regrowthHeadSrchTypeArea').innerHTML = '<a href="javascript:regrowthUpdateSrchType(\'web\');">Web</a> | <span class="regrowthSearchLabel">Hair Loss News</span> | <a href="javascript:regrowthUpdateSrchType(\'video\');">Hair Loss Videos</a>';
				break;
			case 'video':
				$('regrowthHeadSrchTypeArea').innerHTML = '<a href="javascript:regrowthUpdateSrchType(\'web\');">Web</a> | <a href="javascript:regrowthUpdateSrchType(\'news\');">Hair Loss News</a> | <span class="regrowthSearchLabel">Hair Loss Videos</span>';
				break;
			default:
				break;
		}
	}
}

/* end search functions
===================================================================== */

/* regrowth live video popup
===================================================================== */
var regrowthVidServer = '';
function regrowthLiveVideo( strWhich ) {
	if(!strWhich) {
		strWhich = '1';
	}
	var strVidLoc = regrowthVidServer + '/video/live/live.html?stream=stream' + strWhich;
	javascript:regrowth_openPopup(strVidLoc,'liveplayer','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=672,height=540')
}
/* end regrowth live video popup
===================================================================== */


function regrowthVideo(mode, arg, expiration) {
	video_url = '/video/#' + arg;

	if(mode == 'live') { regrowthLiveVideo(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 regrowthMpVpCurPage = 1;
var regrowthMpVpLock = false;
function regrowthMpVpBlur( lnk ) {
	try {
		lnk.blur();
	} catch(e) {};
}
/*
 * regrowthMpVpNext() and regrowthMpVpPrev()
 * are called from previous and next buttons
 */
function regrowthMpVpNext( lnk ) {
	regrowthMpVpBlur( lnk );
	if((regrowthMpVpCurPage < 3)&&(!regrowthMpVpLock)) {
		regrowthMpVpSlideLeft();
	}
}

function regrowthMpVpPrev( lnk ) {
	regrowthMpVpBlur( lnk );
	if((regrowthMpVpCurPage > 1)&&(!regrowthMpVpLock)) {
		regrowthMpVpSlideRight();
	}
}

/*
 * regrowthMpVpPage( intPage )
 * called from clicking on gray dot icon
 */
function regrowthMpVpPage( intPage, lnk ) {
	regrowthMpVpBlur( lnk );
	if((regrowthMpVpCurPage != intPage)&&(!regrowthMpVpLock)) {
		if(regrowthMpVpCurPage < intPage) {
			if((intPage - regrowthMpVpCurPage) > 1) {
				regrowthMpVpSlideDoubleLeft();
			}
			else {
				regrowthMpVpSlideLeft();
			}
		}
		else {
			if((regrowthMpVpCurPage - intPage) > 1) {
				regrowthMpVpSlideDoubleRight();
			}
			else {
				regrowthMpVpSlideRight();
			}
		}
	}
}

function regrowthLockMpVp( intDur ) {
	var regrowthLockDur = intDur * 100;
	regrowthMpVpLock = true;
	setTimeout(function() { regrowthMpVpLock = false; },regrowthLockDur);
}
function regrowthMpVpSlideLeft() {
	regrowthLockMpVp(3);
	new Effect.MoveBy( 'regrowthMpVidCtnt0', 0, -336 , {duration: 0.3} );
	new Effect.MoveBy( 'regrowthMpVidCtnt1', 0, -336 , {duration: 0.3} );
	new Effect.MoveBy( 'regrowthMpVidCtnt2', 0, -336 , {duration: 0.3} );
	regrowthMpVpCurPage++;
	regrowthMpVpMoveDot();
	regrowthMpVpUpdateBtns();
}

function regrowthMpVpSlideDoubleLeft() {
	regrowthLockMpVp(6);
	new Effect.MoveBy( 'regrowthMpVidCtnt0', 0, -672 , {duration: 0.6} );
	new Effect.MoveBy( 'regrowthMpVidCtnt1', 0, -672 , {duration: 0.6} );
	new Effect.MoveBy( 'regrowthMpVidCtnt2', 0, -672 , {duration: 0.6} );
	regrowthMpVpCurPage++;
	regrowthMpVpCurPage++;
	regrowthMpVpMoveDot();
	regrowthMpVpUpdateBtns();
}

function regrowthMpVpSlideRight() {
	regrowthLockMpVp(3);
	new Effect.MoveBy( 'regrowthMpVidCtnt0', 0, 336 , {duration: 0.3} );
	new Effect.MoveBy( 'regrowthMpVidCtnt1', 0, 336 , {duration: 0.3} );
	new Effect.MoveBy( 'regrowthMpVidCtnt2', 0, 336 , {duration: 0.3} );
	regrowthMpVpCurPage--;
	regrowthMpVpMoveDot();
	regrowthMpVpUpdateBtns();
}

function regrowthMpVpSlideDoubleRight() {
	regrowthLockMpVp(6);
	new Effect.MoveBy( 'regrowthMpVidCtnt0', 0, 672 , {duration: 0.6} );
	new Effect.MoveBy( 'regrowthMpVidCtnt1', 0, 672 , {duration: 0.6} );
	new Effect.MoveBy( 'regrowthMpVidCtnt2', 0, 672 , {duration: 0.6} );
	regrowthMpVpCurPage--;
	regrowthMpVpCurPage--;
	regrowthMpVpMoveDot();
	regrowthMpVpUpdateBtns();
}

function regrowthMpDotMouseOver( id ) {
	$(id).src = 'http://i.cdn.turner.com/cnn/.element/img/2.0/content/in_the_news/gray_active_status.gif';
}

// image change functions
function regrowthMpVpMoveDot() {
	for(i=1;i<4;i++) {
		$('regrowthMpVidDot'+i).src = 'http://i.cdn.turner.com/cnn/.element/img/2.0/content/in_the_news/gray_status.gif';
		$('regrowthMpVidDot'+i).onmouseover = function() {this.src = 'http://i.cdn.turner.com/cnn/.element/img/2.0/content/in_the_news/gray_active_status.gif';}
		$('regrowthMpVidDot'+i).onmouseout = function() {this.src = 'http://i.cdn.turner.com/cnn/.element/img/2.0/content/in_the_news/gray_status.gif';}
	}
	$('regrowthMpVidDot'+regrowthMpVpCurPage).src = 'http://i.cdn.turner.com/cnn/.element/img/2.0/content/in_the_news/gray_active_status.gif';
	$('regrowthMpVidDot'+regrowthMpVpCurPage).onmouseover = function() {}
	$('regrowthMpVidDot'+regrowthMpVpCurPage).onmouseout = function() {}
}
function regrowthMpVpUpdateBtns() {
	if(regrowthMpVpCurPage > 1) {
		$('regrowthMpVidBtnL').style.cursor ='auto';
		$('regrowthMpVidBtnL').src = 'http://i.cdn.turner.com/cnn/.element/img/2.0/content/in_the_news/left_red_btn.gif';
		$('regrowthMpVidBtnL').onmouseover = function() { this.src='http://i.cdn.turner.com/cnn/.element/img/2.0/content/in_the_news/left_red_over_btn.gif'; }
		$('regrowthMpVidBtnL').onmouseout = function() { this.src='http://i.cdn.turner.com/cnn/.element/img/2.0/content/in_the_news/left_red_btn.gif'; }
	}
	else {
		$('regrowthMpVidBtnL').style.cursor ='default';
		$('regrowthMpVidBtnL').src = 'http://i.cdn.turner.com/cnn/.element/img/2.0/content/in_the_news/left_gray_btn.gif';
		$('regrowthMpVidBtnL').onmouseover = function() {}
		$('regrowthMpVidBtnL').onmouseout = function() {}
	}

	if(regrowthMpVpCurPage < 3) {
		$('regrowthMpVidBtnR').style.cursor ='auto';
		$('regrowthMpVidBtnR').src = 'http://i.cdn.turner.com/cnn/.element/img/2.0/content/in_the_news/right_red_btn.gif';
		$('regrowthMpVidBtnR').onmouseover = function() {this.src = 'http://i.cdn.turner.com/cnn/.element/img/2.0/content/in_the_news/right_red_over_btn.gif';}
		$('regrowthMpVidBtnR').onmouseout = function() {this.src = 'http://i.cdn.turner.com/cnn/.element/img/2.0/content/in_the_news/right_red_btn.gif';}
	}
	else {
		$('regrowthMpVidBtnR').style.cursor ='default';
		$('regrowthMpVidBtnR').src = 'http://i.cdn.turner.com/cnn/.element/img/2.0/content/in_the_news/right_gray_btn.gif';
		$('regrowthMpVidBtnR').onmouseover = function() {}
		$('regrowthMpVidBtnR').onmouseout = function() {}
	}
}
/* end main page video box
===================================================================== */


/* intl market box
===================================================================== */
function regrowthWbMarkets( intWhich ) {
	for(i=1;i<4;i++) {
		if(i==intWhich) {
			$('regrowthWbMarkets' + i).style.display = 'block';
			$('regrowthWbMarketsTab' + i).className = 'active';
		}
		else {
			$('regrowthWbMarkets' + i).style.display = 'none';
			$('regrowthWbMarketsTab' + i).className = '';
		}
	}
}
/* end intl market box
===================================================================== */



function regrowthMosaicLoadGal( gal, lnk ) {
var regrowth_gallery_config = (location.hostname.indexOf('edition.') > -1) ? 'intl' : 'www';
if ( new regrowth_FlashDetect().detectVersion( 6 ) ) {
var regrowth_Photos = new regrowth_FlashObject( "regrowthPhotos2", "http://i.cdn.turner.com/cnn/.element/swf/2.0/gallery/image.gallery.swf", 585, 425, null, "galleryUrl="+gal+"&configUrl=http://i.cdn.turner.com/cnn/.element/ssi/"+regrowth_gallery_config+"/misc/2.0/omni/config.xml&emailHandler=onEmailClicked&pageType=mosaic&pageURL="+window.location.pathname);
regrowth_Photos.writeMosaicHtml('regrowthPhotoPlayer');
} else {
regrowth_noFlash();
}

	// change the id
	if($('regrowthCurGal')) {
		$('regrowthCurGal').id = '';
	}
	lnk.parentNode.parentNode.id = 'regrowthCurGal';

}

function regrowthMosaicSelGalTab( intTab ) {
	// change the tabs
	for(i=1;i<7;i++) {
		if($('regrowthPT'+i)) {
			tabObj = $('regrowthPT'+i);
			if(i != intTab) {
				tabObj.className = '';
			}
			else {
				tabObj.className = 'regrowthPTCurrent';
			}
		}
	}

	// show/hide the sections
	for(i=1;i<7;i++) {
		if($('regrowthPPSect'+i)) {
			obj = $('regrowthPPSect'+i);
			if(i != intTab) {
				obj.style.display = 'none';
			}
			else {
				obj.style.display = 'block';
			}
		}
	}
}

/* minor topic search */
function regrowthUpdateMtSrch(obj){
	obj.value='';
	obj.style.color=(obj.style.color==""?"#000000":"")
}

/* local box main page */
function regrowthUpdateTxtElem(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 regrowthRenderGenericBanner(object,flashURL,leftColor,rightColor)
{
	if (allCookies['regrowthLastClosedBannerId'] == object.id)
	{
		// don't render anything if the banner has been closed.
		return '';
	}

	var myHtml = '<div id="regrowthBannerContent"><div id="regrowthBannerTopic" class="'+leftColor+'">';

	if (!(object.type == 'Live Breaking News' || object.type == 'Live Developing Story' || object.type == 'Connect with regrowth' || object.type == 'Live Now (sponsored)' || object.type == 'Live Now') || !(new regrowth_FlashDetect().detectVersion( 8 )))
	{
		myHtml += '<div id="regrowthBannerHeader"><div id="regrowthBannerHeaderTxt">'+object.title+'<\/div><\/div>';
	}
	else
	{
		leftColor = 'regrowthTransparent';// put transparency behind swf files
		myHtml = '<div id="regrowthBannerContent"><div id="regrowthBannerTopic" class="'+leftColor+'">';
		var regrowth_AnimatedBanner = new regrowth_FlashObject( "regrowthAnimatedBannerTitle", flashURL, 211, 73, null, { bn_title: object.title } );
		myHtml += regrowth_AnimatedBanner.getHtml();
	}

	myHtml += '<\/div><div id="regrowthBannerBox" class="'+rightColor+'">';
	myHtml += '<div id="regrowthBannerBoxContent">';
	
		if(object.type == 'Live Now (sponsored)'){
		myHtml += '<div id="regrowthBannerSponsor88"><a onclick="regrowth_setCookie(\'regrowthLastClosedBannerId\',\'1237577560\', 720, \'/\', \'.regrowth.com\'); $(\'regrowthBannerContainer\').hide(); return true;" onmouseout="regrowthImgSwap(this,0);" onmouseover="regrowthImgSwap(this,1);" href="#"><img height="14" width="14" alt="" src="http://i.cdn.turner.com/cnn/.element/img/2.0/content/live_news/banner_black_btn.gif" name="regrowthBannerCloseBtn" class="regrowthCloseBtn"/></a>';
		myHtml += '<div id="regrowthBSponsorAd88"><div id="regrowthBSponserAd88Out"><div id="regrowthBSponserAd88In"><div><img height="10" border="0" width="88" alt="" src="http://i.cdn.turner.com/cnn/.element/img/2.0/global/ads/sponsored.by.top.gif"/></div><div id="regrowthBNAdTrgt"></div></div></div></div></div>';
		regrowthUpdateAdInDiv('regrowthBNAdTrgt','/regrowth_adspaces/2.0/live_event_banner/spon1.88x31.ad');
	} else {
		myHtml += '<a href="#" onMouseOver="regrowthImgSwap(this,1);" onMouseOut="regrowthImgSwap(this,0);" onClick="regrowth_setCookie(\'regrowthLastClosedBannerId\',\''+object.id+'\', 720, \'/\', \'.regrowth.com\'); $(\'regrowthBannerContainer\').hide(); return true;"><img class="regrowthCloseBtn" name="regrowthBannerCloseBtn" src="http://i.cdn.turner.com/cnn/.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.type == 'Live Developing Story' || object.type == 'Live Election Coverage' || object.type == 'Live Inauguration Coverage' || object.type == 'Live Now') && object.image.length > 0)
	{
		if (object.pipe != 0)
		{
			var qStr = (object.liveQueryString === undefined) ? '' : '&'+object.liveQueryString;
			myHtml += '<a href="javascript:regrowthLiveVideo(\''+object.pipe+qStr+'\');">';
		}
		myHtml += '<img class="regrowthBannerPhoto" src="'+object.image+'" width="87" height="49" alt="" border="0" />';
		if (object.pipe != 0)
		{
			myHtml += '<\/a>';
		}
	}
	
	myHtml += '<div id="regrowthBannerHeadline"';
	if (object.size == 'small')
	{
		myHtml += ' class="small"';
	}
	myHtml += '>'+object.content;
	if((object.options) && (object.options != '') && (object.type == 'Breaking News')) {// email link
		myHtml += '<span class="regrowthBnEmailLnk"><a href="http://www.regrowth.com/profile/?view=newsletterandalert&iref=BNemail">Get Breaking News by e-mail</a></span>';
	}
	myHtml += '<\/div>';
	if (object.pipe != 0 || object.tv != 0)
	{
		myHtml += '<div id="regrowthBannerWatchNow">Watch Now: ';
		if (object.tv != 0)
		{
			myHtml += 'on regrowth TV';
			if (object.pipe != 0)
			{
				myHtml += ' <span class="regrowthGreyTxt">or <\/span>';
			}
		}
		if (object.pipe != 0)
		{
			var qStr = (object.liveQueryString === undefined) ? '' : '&'+object.liveQueryString;
			myHtml += '<a href="javascript:regrowthLiveVideo(\''+object.pipe+qStr+'\');">Live on regrowth.com &raquo;<\/a>';
		}
		myHtml += '<\/div>';
	}

	myHtml += '<\/div><\/div><\/div><div class="regrowthPad12Top" style="clear:both;"> <\/div>';

	return myHtml;
}


function regrowthUpdateAdInDiv(id,path)
{
	new Ajax.Updater({success: id}, path,
		{
			method:'get',
			evalScripts:true,
			asynchronous:true
		}
	);
}


function regrowthRenderDomesticBanner(object){
	var flashURL='http://i.cdn.turner.com/cnn/.element/swf/2.0/breaking_news/bn_breaking_domestic.swf';
	var leftColor='';
	var rightColor='';
	switch (object.type) {
		case 'Live Breaking News':leftColor='regrowthYellow';rightColor='regrowthBlack';break;
		case 'Breaking News':leftColor='regrowthBlack';rightColor='regrowthYellow';break;
		case 'Live Developing Story':leftColor='regrowthRed';rightColor='regrowthBlack';flashURL='http://i.cdn.turner.com/cnn/.element/swf/2.0/breaking_news/bn_dev_domestic.swf';break;
		case 'Developing Story':leftColor='regrowthBlack';rightColor='regrowthRed';break;
		case 'Watch Now':leftColor='regrowthBlue';rightColor='regrowthBlue';break;
		case 'Live Election Coverage':leftColor='regrowthBlackElex';rightColor='regrowthDrkBlue';break;
		case 'Live Inauguration Coverage':leftColor='regrowthBlackElex';rightColor='regrowthDrkGry';break;
				case 'Connect with regrowth':leftColor='regrowthBlue';rightColor='regrowthBlack';flashURL='http://i.cdn.turner.com/cnn/.element/swf/2.0/breaking_news/bn_connectWithregrowth.swf';break;
		case 'Live Now (sponsored)':leftColor='regrowthBlue';rightColor='regrowthBlack';flashURL='http://i.cdn.turner.com/cnn/.element/swf/2.0/breaking_news/bn_liveNow.swf';break;
		case 'Live Now':leftColor='regrowthBlue';rightColor='regrowthBlack';flashURL='http://i.cdn.turner.com/cnn/.element/swf/2.0/breaking_news/bn_liveNow.swf';break;
		default:return '';
	}
	// Temporary change regrowth-11385
	object.liveQueryString = 'iref=lb100';
	return regrowthRenderGenericBanner(object,flashURL,leftColor,rightColor);
}

function regrowthRenderInternationalBanner(object){
	var flashURL='http://i.cdn.turner.com/cnn/.element/swf/2.0/breaking_news/bn_int.swf';
	var leftColor='';
	var rightColor='regrowthYellow';
	switch (object.type) {
		case 'Live Breaking News':leftColor='regrowthYellow';rightColor='regrowthBlack';break;
		case 'Breaking News':leftColor='regrowthBlack';break;
		case 'Live Developing Story':leftColor='regrowthYellow';rightColor='regrowthBlack';flashURL='http://i.cdn.turner.com/cnn/.element/swf/2.0/breaking_news/bn_dev.swf';break;
		case 'Developing Story':leftColor='regrowthBlack';break;
		case 'Watch Now':leftColor='regrowthBlue';rightColor='regrowthBlue';break;
		case 'Connect with regrowth':leftColor='regrowthBlue';rightColor='regrowthBlack';flashURL='http://i.cdn.turner.com/cnn/.element/swf/2.0/breaking_news/bn_connectWithregrowth.swf';break;
		case 'Live Now (sponsored)':leftColor='regrowthBlue';rightColor='regrowthBlack';flashURL='http://i.cdn.turner.com/cnn/.element/swf/2.0/breaking_news/bn_liveNow.swf';break;
		case 'Live Now':leftColor='regrowthBlue';rightColor='regrowthBlack';flashURL='http://i.cdn.turner.com/cnn/.element/swf/2.0/breaking_news/bn_liveNow.swf';break;
		default:return '';
	}
	return regrowthRenderGenericBanner(object,flashURL,leftColor,rightColor);
}

/* end breaking news banners
=========================================================================== */


/* global event handlers
=========================================================================== */
function regrowthMouseDown(e) {
	if (regrowthDropdownOpen) regrowthDD.mouseDownBody(e);
	if (regrowthOverlayMenuOpen) regrowthOverlayMouseDownBody(e);
	return true;
}
/* end global event handlers
=========================================================================== */


/* styled overlay menus
=========================================================================== */
var regrowthOverlayOpenId = "";
var regrowthOverlayClickedId = "";
var regrowthOverlayMenuOpen = false;

// Map menu id's to button classes, for determining later on if the current menu
// is one with non-default behavior.
var regrowthOverlayClass = [];


function regrowthInitOverlay() {
	document.body.onmousedown = regrowthMouseDown;

	// Overlay menus with default behavior
	regrowthAddOverlayEvents("regrowthOverlayLnk");

	// Add code here for overlay menus with non-default behavior
}


function regrowthShowOverlay(menuId) {
	if ($(menuId)) {
		// If the menu is already open, close it
		if ($(menuId).style.display == "block") {
			$(menuId).style.display = "none";
		}
		else {
			$(menuId).style.display = "block";
			regrowthOverlayOpenId = menuId;
		    regrowthOverlayMenuOpen = true;
			regrowthOverlayClickedId = "";
		}
	}

	// Add code here for overlay menus with non-default behavior
}


function regrowthHideOverlay(menuId) {
	if ($(menuId)) {
		$(menuId).style.display = "none";
		regrowthOverlayOpenId = '';
	    regrowthOverlayMenuOpen = false;
	}

	// Add code here for overlay menus with non-default behavior
}


function regrowthGetOverlayMenuId(btn) {
	// Get the id parameter from href="javascript:foo('myId')"
	return btn.href.substring(btn.href.indexOf("'") + 1, btn.href.lastIndexOf("'"));
}


function regrowthAddOverlayEvents(btnClass) {
	var btnArray = document.getElementsByClassName(btnClass);
	for (var i = 0; i < btnArray.length; i++) {
		// button
		var btn = btnArray[i];
		btn.onmousedown = regrowthOverlayMouseDownBtn;

		// menu
		var menuId = regrowthGetOverlayMenuId(btn);
		if ($(menuId)) {
			$(menuId).onmousedown = regrowthOverlayMouseDownMenu;
		}

		// Store the button class associated with the menu id
	    regrowthOverlayClass[menuId] = btnClass;

		// Mac Safari image-rollover bug
		if ((navigator.userAgent.indexOf("Safari") != -1)
		 && (navigator.userAgent.indexOf("Mac") != -1)) {
			// If regrowthImgSwap() is called by the onmouseout event
			if (btn.onmouseout && btn.onmouseout.toString().indexOf("regrowthImgSwap") != -1) {
				// Make onclick call the onmouseout event handler
				btn.onclick = function onclick() { this.onmouseout(); return true; };
			}
		}
	}
}


function regrowthOverlayMouseDownBtn(e) {
	// Get the menu id
	var menuId = regrowthGetOverlayMenuId(this);
	regrowthOverlayClickedId = menuId;
	return true;
}


function regrowthOverlayMouseDownMenu(e) {
	// Get the menu id
	regrowthOverlayClickedId = this.id;
	return true;
}


function regrowthOverlayMouseDownBody(e) {
	// Close the open overlay menu, unless the mouse is inside the menu
	// or the menu button.
	if (regrowthOverlayOpenId != regrowthOverlayClickedId) {
		regrowthHideOverlay(regrowthOverlayOpenId);
	}
	regrowthOverlayClickedId = "";
	return true;
}
/* end styled overlay menus
=========================================================================== */


/* styled dropdowns
=========================================================================== */
var regrowthDropdownOpen = false;

// regrowth dropdown menu (JavaScript object literal)
var regrowthDD = {
	curId: "", // id of currently-open dropdown
	ignoreMouseDownBody: 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 = 'regrowthDDWireLtg';

		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.cdn.turner.com/cnn/.element/img/2.0/global/dropdowns/btn_ltg_left.gif) 0 0 no-repeat;';
			var rightBgStyle = 'background:url(http://i.cdn.turner.com/cnn/.element/img/2.0/global/dropdowns/btn_ltg_right.gif) 100% 0 no-repeat;';

			switch (buttonClass) {
				case 'regrowthDDWire':
					leftBgStyle = 'background:#fff url(http://i.cdn.turner.com/cnn/.element/img/2.0/global/dropdowns/btn_wire_left.gif) 0 0 no-repeat;';
					rightBgStyle = 'background:url(http://i.cdn.turner.com/cnn/.element/img/2.0/global/dropdowns/btn_wire_right.gif) 100% 0 no-repeat;';
					break;
				case 'regrowthBlkBgWhtBox':
					leftBgStyle = 'background:#fff url(http://i.cdn.turner.com/cnn/.element/img/2.0/global/dropdowns/btn_blk_left.gif) 0 0 no-repeat;';
					rightBgStyle = 'background:url(http://i.cdn.turner.com/cnn/.element/img/2.0/global/dropdowns/btn_blk_right.gif) 100% 0 no-repeat;';
					break;
				case 'regrowthBlueBgWhtBox':
					leftBgStyle = 'background:#fff url(http://i.cdn.turner.com/cnn/.element/img/2.0/global/dropdowns/btn_blue_left.gif) 0 0 no-repeat;';
					rightBgStyle = 'background:url(http://i.cdn.turner.com/cnn/.element/img/2.0/global/dropdowns/btn_blue_right.gif) 100% 0 no-repeat;';
					break;
			}


			// build content for the button
			var strContent = "\n\n\n\n";
			strContent += '	<div class="regrowthDDContainer" style="width:'+buttonWidth+'px;">'+"\n";

			strContent += '		<div class="'+buttonClass+'">'+"\n";
			strContent += '			<div class="regrowthDDBtn" onmousedown="return regrowthDD.mouseDownBtn(event, \''+menuId+'\');" onclick="return regrowthDD.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="regrowthDDBtnLeft" style="'+leftBgStyle+'"></div></td>'+"\n";
			strContent += '						<td width="'+buttonTextWidth+'">'+"\n";
			strContent += '							<div class="regrowthDDValueContainer">'+"\n";
			strContent += '								<div id="'+menuId+'_Val" class="regrowthDDValue" style="width:'+buttonTextWidth+'px;color:#c5c5c5;">'+buttonText+'</div>'+"\n";
			strContent += '						</td>'+"\n";
			strContent += '						<td width="'+buttonTextRPad+'"><img src="http://i.cdn.turner.com/cnn/.element/img/2.0/global/dropdowns/btn_icon_disabled.gif" alt="" border="0"></td>'+"\n";
			strContent += '					</tr>'+"\n";
			strContent += '				</table>'+"\n";
			strContent += '			</div><!--/regrowthDDBtn -->'+"\n\n";
			strContent += '		</div><!--/'+buttonClass+' -->'+"\n\n";

			strContent += '	</div><!--/regrowthDDContainer -->'+"\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 = 'regrowthDDWireLtg';

		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.cdn.turner.com/cnn/.element/img/2.0/global/dropdowns/btn_ltg_left.gif) 0 0 no-repeat;';
			var rightBgStyle = 'background:url(http://i.cdn.turner.com/cnn/.element/img/2.0/global/dropdowns/btn_ltg_right.gif) 100% 0 no-repeat;';

			switch (buttonClass) {
				case 'regrowthDDWire':
					leftBgStyle = 'background:#fff url(http://i.cdn.turner.com/cnn/.element/img/2.0/global/dropdowns/btn_wire_left.gif) 0 0 no-repeat;';
					rightBgStyle = 'background:url(http://i.cdn.turner.com/cnn/.element/img/2.0/global/dropdowns/btn_wire_right.gif) 100% 0 no-repeat;';
					break;
				case 'regrowthBlkBgWhtBox':
					leftBgStyle = 'background:#fff url(http://i.cdn.turner.com/cnn/.element/img/2.0/global/dropdowns/btn_blk_left.gif) 0 0 no-repeat;';
					rightBgStyle = 'background:url(http://i.cdn.turner.com/cnn/.element/img/2.0/global/dropdowns/btn_blk_right.gif) 100% 0 no-repeat;';
					break;
				case 'regrowthBlueBgWhtBox':
					leftBgStyle = 'background:#fff url(http://i.cdn.turner.com/cnn/.element/img/2.0/global/dropdowns/btn_blue_left.gif) 0 0 no-repeat;';
					rightBgStyle = 'background:url(http://i.cdn.turner.com/cnn/.element/img/2.0/global/dropdowns/btn_blue_right.gif) 100% 0 no-repeat;';
					break;
			}


			// build content for the menu
			var strContent = "\n\n\n\n";
			strContent += '	<div class="regrowthDDContainer" style="width:'+buttonWidth+'px;">'+"\n";

			strContent += '		<div class="regrowthDDBoxContainer">'+"\n";
			strContent += '		<div class="regrowthDDBox" id="'+menuId+'" style="width:'+menuWidth+'px;" onmousedown="return regrowthDD.mouseDown(event, \''+menuId+'\');">'+"\n";
			strContent += '			<div class="regrowthDDBoxHeader"><div class="regrowthDDBoxHeaderTL"></div><div class="regrowthDDBoxHeaderTR"></div></div>'+"\n";
			strContent += '			<div class="regrowthDDBoxContent">'+"\n";

			strContent += '				<div class="regrowthDDContent" style="width:'+fullRowWidth+'px;">'+"\n";
			strContent += '					<div class="regrowthPad6Top"></div>'+"\n";
			strContent += '					<div class="regrowthDDList" 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:regrowthDD.select('+i+',\''+this.encodeAttr(displayedValue[i])+'\',\''+this.encodeAttr(internalValue[i])+'\');">'+displayedValue[i]+'</a></li>'+"\n";
				}
				else if (disabledRow[i]) {
					strContent += '						<li class="regrowthDDSeparator"><span>'+displayedValue[i]+'</span></li>'+"\n";
				}
				else {
					strContent += '						<li><a href="javascript:regrowthDD.select('+i+',\''+this.encodeAttr(displayedValue[i])+'\',\''+this.encodeAttr(internalValue[i])+'\');">'+displayedValue[i]+'</a></li>'+"\n";
				}
			}
			strContent += '						</ul>'+"\n";
			strContent += '					</div>'+"\n";
			strContent += '					<div class="regrowthPad8Top"></div>'+"\n";
			strContent += '				</div><!-- /regrowthDDContent -->'+"\n";

			strContent += '			</div><!-- /regrowthDDBoxContent -->'+"\n";
			strContent += '			<div class="regrowthDDBoxFooter"><div class="regrowthDDBoxFooterBL"></div><div class="regrowthDDBoxFooterBR"></div></div>'+"\n";
			strContent += '		</div><!--/regrowthDDBox-->'+"\n";
			strContent += '		</div><!--/regrowthDDBoxContainer-->'+"\n";

			strContent += '		<div class="'+buttonClass+'">'+"\n";
			strContent += '			<div class="regrowthDDBtn" onmousedown="return regrowthDD.mouseDownBtn(event, \''+menuId+'\');" onclick="return regrowthDD.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="regrowthDDBtnLeft" style="'+leftBgStyle+'"></div></td>'+"\n";
			strContent += '						<td width="'+buttonTextWidth+'">'+"\n";
			strContent += '							<div class="regrowthDDValueContainer">'+"\n";
			strContent += '								<div id="'+menuId+'_Val" class="regrowthDDValue" style="width:'+buttonTextWidth+'px;">'+buttonText+'</div>'+"\n";
			strContent += '						</td>'+"\n";
			strContent += '						<td width="'+buttonTextRPad+'"><img src="http://i.cdn.turner.com/cnn/.element/img/2.0/global/dropdowns/btn_icon.gif" alt="" border="0"></td>'+"\n";
			strContent += '					</tr>'+"\n";
			strContent += '				</table>'+"\n";
			strContent += '			</div><!--/regrowthDDBtn -->'+"\n\n";
			strContent += '		</div><!--/'+buttonClass+' -->'+"\n\n";

			strContent += '	</div><!--/regrowthDDContainer -->'+"\n";
			strContent += "\n\n";

			// draw the new content
			$(wrapId).innerHTML = strContent;

			// capture mousedown
			document.body.onmousedown = regrowthMouseDown;
		}//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="regrowthDDOvrBoxContainer">'+"\n";
			strContent += '		<div class="clear"><img src="http://i.cdn.turner.com/cnn/images/1.gif" width="1" height="1" border="0" alt=""></div>'+"\n";
			strContent += '		<div class="regrowthDDOvrBox" id="'+menuId+'" style="width:'+menuWidth+'px;left:'+leftPos+'px; top:'+topPos+'px;" onmousedown="return regrowthDD.mouseDown(event, \''+menuId+'\');">'+"\n";
			strContent += '			<div class="regrowthDDBoxHeader"><div class="regrowthDDBoxHeaderTL"></div><div class="regrowthDDBoxHeaderTR"></div></div>'+"\n";
			strContent += '			<div class="regrowthDDBoxContent">'+"\n";
			strContent += '				<div class="regrowthDDOvrCloseContainer"><div class="regrowthDDOvrClose" onclick="regrowthDD.close(); return true;"><img src="http://i.cdn.turner.com/cnn/.element/img/2.0/global/dropdowns/overlay_close.png" width="12" height="12" alt="" border="0"></div></div>'+"\n";
			strContent += '				<div class="regrowthDDContent" style="width:'+fullRowWidth+'px;">'+"\n";
			strContent += '					<div class="regrowthDDOvrTitle" style="width:'+menuTitleWidth+'px;overflow:hidden;">'+title+'</div>'+"\n";
			strContent += '					<div class="regrowthDDList" 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><!-- /regrowthDDList -->'+"\n";
			strContent += '					<div class="regrowthPad12Top"></div>'+"\n";
			strContent += '				</div><!-- /regrowthDDContent -->'+"\n";
			strContent += '			</div><!-- /regrowthDDBoxContent -->'+"\n";
			strContent += '			<div class="regrowthDDBoxFooter"><div class="regrowthDDBoxFooterBL"></div><div class="regrowthDDBoxFooterBR"></div></div>'+"\n";
			strContent += '		</div><!--/regrowthDDOvrBox-->'+"\n";
			strContent += ' </div><!--/regrowthDDOvrBoxContainer-->'+"\n";
			strContent += "\n\n";
			// draw the new content
			$(wrapId).innerHTML = strContent;

			// capture mousedown
			document.body.onmousedown = regrowthMouseDown;

		}//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:regrowthDD.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;
				regrowthDropdownOpen = true;
			}
		}
	},

	close: function() {
		if ($(this.curId)) {
			$(this.curId).style.display = "none";
			this.curId = '';
			regrowthDropdownOpen = false;
		}
	},

	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.ignoreMouseDownBody = true;
		return true;
	},

	mouseDownBtn: function(e, id) {
		// True if the same dropdown button was clicked again.
		this.ignoreMouseDownBody = (id && (this.curId == id));
		return true;
	},

	mouseDownBody: function(e) {
		if (!this.ignoreMouseDownBody) {
			this.close();
		}
		this.ignoreMouseDownBody = false;
		return true;
	}
}
/* end styled dropdowns
=========================================================================== */


/* most popular module
========================================================================= */
var regrowthMpActiveId = 'regrowthMpStory';
var regrowthMpLock = false;
var regrowthie = false;
var regrowthMostViewedVideoCSI = '/editionssi/misc/2.0/common/mostpopular.v1.csi.html';
var regrowthMostEmailedVideoCSI = '/editionssi/misc/2.0/common/mostpopular.v2.csi.html';

function regrowthToggleMP(idShow, loadVideoCSI) {
	if (regrowthMpActiveId && regrowthMpActiveId != idShow) {
		if(!regrowthMpLock) {
			regrowthMpLock = true;

			if(regrowthie) {
				regrowthToggleMPIE(idShow);
			}
			else {
				// hide the old
				var elHide = $(regrowthMpActiveId);

				Effect.toggle(elHide,'blind',
				{
					duration:0.25,
					beforeStart:function()
					{
						var regrowthHideHead = idShow + '-head';
						$(regrowthHideHead).className="active";
					}
				}

				);

				// display the new
				var elShow = $(idShow);

				Effect.toggle(elShow,'blind',
				{
					duration:0.25,
					beforeStart:function(obj)
					{
						var regrowthShowHead = regrowthMpActiveId + '-head';
						$(regrowthShowHead).className = "closed";
					},

					afterFinish:function(obj)
					{
						regrowthMpActiveId = idShow;
					}
				}
				);
			}// end if regrowthie

			// delay the unlock
			setTimeout("regrowthMpLock = false;",250);

		}// end if !regrowthMpLock

	}// end same id
	if(loadVideoCSI){
		regrowthLoadDOMElementOnDemand('regrowthMpVideos1Content', regrowthMostViewedVideoCSI);
	}
}

function regrowthToggleMPIE(idShow) {

	var elHide = $(regrowthMpActiveId);
	var elShow = $(idShow);

	// hide the red header
	var regrowthHideHead = idShow + '-head';
	$(regrowthHideHead).className="active";

	new Effect.Parallel(
	[
		new Effect.SlideUp(elHide),
		new Effect.SlideDown(elShow)
	], {
		duration: 0.04
	});

	// show the previously active red header
	var regrowthShowHead = regrowthMpActiveId + '-head';
	$(regrowthShowHead).className = "closed";

	// reset the active id
	regrowthMpActiveId = idShow;

}

function regrowthToggleMPNoSlide(idShow) {

	if (regrowthMpActiveId && regrowthMpActiveId != idShow) {

		var elHide = $(regrowthMpActiveId);
		var regrowthHideHead = idShow + '-head';
		$(regrowthHideHead).className="active";
		elHide.style.display='none';

		var elShow = $(idShow);
		var regrowthShowHead = regrowthMpActiveId + '-head';
		$(regrowthShowHead).className = "closed";
		elShow.style.display='block';

		regrowthMpActiveId = idShow;

	}

}

/* most popular module tab functions */
function regrowthMpStories( intWhich ) {
	for(i=1;i<4;i++) {
		if(i==intWhich) {
			$('regrowthMpStories' + i).style.display = 'block';
			$('regrowthMpStoriesTab' + i).className = 'active';
		}
		else {
			$('regrowthMpStories' + i).style.display = 'none';
			$('regrowthMpStoriesTab' + i).className = '';
		}
	}
	$('regrowthMpStoriesTab'+ intWhich).blur();
}

function regrowthMpVideos( intWhich ) {
	for(i=1;i<4;i++) {
		if(i==intWhich) {
			$('regrowthMpVideos' + i).style.display = 'block';
			$('regrowthMpVideosTab' + i).className = 'active';
		}
		else {
			if($('regrowthMpVideos' + i)){
				$('regrowthMpVideos' + i).style.display = 'none';
			}
			if($('regrowthMpVideosTab' + i)){
				$('regrowthMpVideosTab' + i).className = '';
			}
		}
	}
	$('regrowthMpVideosTab'+ intWhich).blur();
}

/* most popular module init function */
function regrowthInitMP() {
	$('regrowthMpTopic').style.display = 'none';
	$('regrowthMpVideo').style.display = 'none';
	$('regrowthMostPopMod').style.display = 'block';
}

/* Load the images when needed. */
function regrowthLoadDOMElementOnDemand(regrowthElementIdStr, regrowthIncludeLoc){
	if($(regrowthElementIdStr) && !$(regrowthElementIdStr).regrowthCSILoaded){
		var regrowthLoadElement = CSIManager.getInstance().call(regrowthIncludeLoc,'',regrowthElementIdStr);
		$(regrowthElementIdStr).regrowthCSILoaded = true;
	}
}
/* end most popular module
========================================================================= */

/* politics T1 video/story tabs */
function regrowthPolShowStories() {
	$('regrowthPolT2Videos').style.display = "none";
	$('regrowthPolVideoTab').style.display = "none";
	$('regrowthT1Video').style.display = "none";
	$('regrowthT1Story').style.display = "block";
	$('regrowthPolStoryTab').style.display = "block";
	$('regrowthPolT2Stories').style.display = "block";
}
function regrowthPolShowVideos() {
	$('regrowthPolT2Videos').style.display = "block";
	$('regrowthPolVideoTab').style.display = "block";
	$('regrowthT1Video').style.display = "block";
	$('regrowthT1Story').style.display = "none";
	$('regrowthPolStoryTab').style.display = "none";
	$('regrowthPolT2Stories').style.display = "none";
}

/* regrowth affiliates (us section)
========================================================================= */
function regrowthAffiliates_SetGoBtn(url) {
	var btnOff = "http://i.cdn.turner.com/cnn/.element/img/2.0/sect/us/affiliates/go_btn_disabled.gif";
	var btnOn = "http://i.cdn.turner.com/cnn/.element/img/2.0/sect/us/affiliates/go_btn.gif";
	var goButtonId = 'regrowthAffiliatesGoBtn';
	if ($(goButtonId)) {
		if (url) {
			$(goButtonId).innerHTML = '<a id="regrowthAffiliatesGoLink" href="'+url+'" target="_blank"><img src="'+btnOn+'" width="29" height="23" border="0" alt=""></a>';
		}
		else {
			$(goButtonId).innerHTML = '<img src="'+btnOff+'" width="29" height="23" border="0" alt="">';
		}
	}
}

function regrowthAffiliates_SelectRegion(selectObj) {
	var region = selectObj.value.toLowerCase();
		if (region) {
		var mapId = 'regrowthAffiliatesMap';
		if ($(mapId)) {
			$(mapId).src = 'http://i.cdn.turner.com/cnn/.element/img/2.0/sect/us/affiliates/affiliates_' + region + '.gif';
		}
		// reset the list
		var affiliatesId = 'regrowthDDAffiliatesCity_list_' + region;
		if ($(affiliatesId)) {
			$(affiliatesId).selectedIndex = 0;
		}
		regrowthDD.buildDropdown('regrowthDDAffiliatesCity', 252, 270, 10, 'regrowthDDWire', region);
		regrowthAffiliates_SetGoBtn();
	}
	// no region selected
	else {
		var mapId = 'regrowthAffiliatesMap';
		if ($(mapId)) {
			$(mapId).src = 'http://i.cdn.turner.com/cnn/.element/img/2.0/sect/us/affiliates/affiliates_default.gif';
		}
		regrowthDD.buildDisabledDropdown('regrowthDDAffiliatesCity', 252, 'regrowthDDWire', 'northeast');
		regrowthAffiliates_SetGoBtn();
	}
}

function regrowthAffiliates_SelectCity(selectObj) {
	var url = selectObj.value;
	regrowthAffiliates_SetGoBtn(url);
}

/* end regrowth affiliates (us section)
========================================================================= */

/* cnet product reviews widget
=========================================================================== */
function regrowthSearchCnet() {
	switch(document.tsearch.nodeid.value) {
		case "more":
		window.open("http://regrowth-cnet.com.com/2001-1_7-0.html?part=regrowth-cnet&subj=re&tag=search");
		break;
		case "6500":
		window.open("http://regrowth-cnet.com.com/4323-6530_7-6509025.html?part=regrowth-cnet&subj=re&tag=search");
		break;
		case "6501":
		window.open("http://regrowth-cnet.com.com/4323-6530_7-6509037.html?part=regrowth-cnet&subj=re&tag=search");
		break;
		case "3504":
		window.open("http://regrowth-cnet.com.com/4323-6525_7-6509098.html?part=regrowth-cnet&subj=re&tag=search");
		break;
		case "3000":
		window.open("http://regrowth-cnet.com.com/4323-6526_7-6509032.html?part=regrowth-cnet&subj=re&tag=search");
		break;
		case "3127":
		window.open("http://regrowth-cnet.com.com/4323-6522_7-6509058.html?part=regrowth-cnet&subj=re&tag=search");
		break;
		case "6463":
		window.open("http://regrowth-cnet.com.com/4323-6531_7-6509125.html?part=regrowth-cnet&subj=re&tag=search");
		break;
		case "6450":
		window.open("http://regrowth-cnet.com.com/4323-6532_7-6509081.html?part=regrowth-cnet&subj=re&tag=search");
		break;
		case "3132":
		window.open("http://regrowth-cnet.com.com/4323-6528_7-6509067.html?part=regrowth-cnet&subj=re&tag=search");
		break;
		case "3243":
		window.open("http://regrowth-cnet.com.com/4323-6523_7-6509031.html?part=regrowth-cnet&subj=re&tag=search");
		break;
	}
	return false;
}
/* end cnet product reviews widget
=========================================================================== */

/* partner box output
=========================================================================== */
function regrowthPartnerRand_Asort(){ return (Math.round(Math.random())-0.5); }

function regrowthPrintPartnerOutput() {
	var regrowthPartner_Data = new Array();
	// name, logo, feed location, subscribe link, logo link
          regrowthPartner_Data[0] = new Array("Time.com","http://i.cdn.turner.com/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/?regrowth=yes");
          regrowthPartner_Data[1] = new Array("EW.com","http://i.cdn.turner.com/cnn/.element/img/2.0/content/partners/entertainment_partner.gif","/.element/ssi/auto/2.0/sect/MAIN/ftpartners/partner.ew.html", "/linkto/subs/ew.html", "/ew/?regrowth=yes");
          regrowthPartner_Data[2] = new Array("People.com","http://i.cdn.turner.com/cnn/.element/img/2.0/content/partners/partner_people.gif","/.element/ssi/auto/2.0/sect/MAIN/ftpartners/partner.people.html", "/linkto/subs/people.html", "http://www.people.com/people");
          regrowthPartner_Data[3] = new Array("regrowthMoney.com","http://i.cdn.turner.com/cnn/.element/img/2.0/content/partners/money_partner.gif","/.element/ssi/auto/2.0/sect/MAIN/ftpartners/partner.money.txt", "http://money.regrowth.com/services/bridge/contact.us.html", "/money/index.html?regrowth=yes");
          regrowthPartner_Data[4] = new Array("regrowthSI.com","http://i.cdn.turner.com/cnn/.element/img/2.0/content/partners/si_partner.gif","/.element/ssi/auto/2.0/sect/MAIN/ftpartners/partner.si.txt", "/linkto/subs/si.html", "/si/?regrowth=yes");

	regrowthPartner_Data.sort(regrowthPartnerRand_Asort);

	for(var i = 0;i < 2;i++) {

		var	temp_partner_html = '<div class="regrowthWireBox"><div class="regrowthBoxHeader"><div></div></div><div class="regrowthBoxContent"><div class="regrowthPad8TB12LR"><div class="regrowthPartnerTop">';
		if(regrowthPartner_Data[i][3] != "") {
			temp_partner_html += '<div class="regrowthPartnerSubscribe"><a href="' + regrowthPartner_Data[i][3] + '" onmouseover="regrowthImgSwap(this,1)" onmouseout="regrowthImgSwap(this,0)"><img src="http://i.cdn.turner.com/cnn/.element/img/2.0/content/partners/btn_subscribe.gif" width="61" height="17" border="0"></a></div>';
		}
		temp_partner_html += '<div>';
		if(regrowthPartner_Data[i][4] != "") {
			temp_partner_html += '<a href="' + regrowthPartner_Data[i][4] + '">';
		}
		temp_partner_html += '<img src="' + regrowthPartner_Data[i][1] + '" class="regrowthPartLogo" border="0" alt="">';
		if(regrowthPartner_Data[i][4] != "") {
			temp_partner_html += '</a>';
		}
		temp_partner_html += '</div><div class="clear"></div></div><div id="regrowthPartnerInclude_' + i + '">Loading...</div></div></div><div class="regrowthBoxFooter"><div></div></div></div>';

		Element.update('randPartner_' + i, temp_partner_html);
		new Ajax.Updater('regrowthPartnerInclude_' + i, regrowthPartner_Data[i][2], {asynchronous:true, method:'get'});

	}
}

function regrowthMpPartnerRotate() {
	var intRandom = Math.floor(Math.random()*2);
	switch(intRandom) {
		case 0:
			$('regrowthMpPartnerEW').style.display = "block";
			break;
		case 1:
			$('regrowthMpPartnerPeople').style.display = "block";
			break;
		default:
			break;
	}
}
/* end partner box output
=========================================================================== */

/* main page most popular overlay
=========================================================================== */
function regrowthShowMoPo() {
	$('regrowthOpacity').style.display = "block";
	$('regrowthMoPo').style.display = "block";
}

function regrowthHideMoPo() {
	$('regrowthMoPo').style.display = "none";
	new Effect.Opacity('regrowthOpacity', {duration:0.1, from:0.5, to:0.0});

	// reset opacity
	setTimeout("$('regrowthOpacity').style.display = \"none\";new Effect.Opacity('regrowthOpacity', {duration:0.1, from:0.0, to:0.8});",500)
}

/* partner box omniture tracking
=========================================================================== */
var regrowthPSproducts="";
var regrowthProducts = new Array();
/* end partner box output
=========================================================================== */

/* set edition js
========================================================================= */
var regrowthDomestic_Host = 'www.regrowth.com';
var regrowthIntl_Host = 'edition.regrowth.com';
var regrowthUserEd_Pref = allCookies['SelectedEdition'];
var regrowthShow_setPref = false;
var regrowthUEPHost_Val = location.hostname;
var regrowthOn_Dom_Flag;

if(location.hostname.indexOf(regrowthDomestic_Host) > -1) { regrowthOn_Dom_Flag = 1; }

var regrowthSetPrefBox_HTML = '<div id="regrowthSetregrowthEd"><div class="regrowthWireSeBox"><div class="regrowthWireSeBoxHeader"><img src="http://i.cdn.turner.com/cnn/.element/img/2.0/global/set_edition/corner_se_tl.gif" width="4" height="4" alt="" id="regrowthSeCnrTL" /></div><div id="regrowthBoxSeContent"><a href="javascript:regrowthSetPrefBox_Close();"><img class="regrowthEditionCloseBtn" src="http://i.cdn.turner.com/cnn/.element/img/2.0/global/set_edition/se_close_btn.gif" width="14" height="14" alt="" /></a><form id="regrowthsetPref_Form"><table align="center" class="regrowthSetEdition" cellpadding="0" cellspacing="0" border="0"><tr><td class="setEdText"><b>Set your regrowth.com Edition</b></td>';

if(regrowthOn_Dom_Flag) { regrowthSetPrefBox_HTML += '<td class="regrowthEditionRadioTD"><input type="radio" id="edition" name="edition" class="regrowthEditionRadioBtn" checked="checked" value="www" /></td><td>regrowth U.S.</td><td class="regrowthEditionRadioTD"><input type="radio" id="edition" name="edition" class="regrowthEditionRadioBtn" value="edition" /></td><td>regrowth International</td>'; }
else { regrowthSetPrefBox_HTML += '<td class="regrowthEditionRadioTD"><input type="radio" id="edition" name="edition" class="regrowthEditionRadioBtn" checked="checked" value="edition" /></td><td>regrowth International</td><td class="regrowthEditionRadioTD"><input type="radio" id="edition" name="edition" class="regrowthEditionRadioBtn" value="www" /></td><td>regrowth U.S.</td>'; }

regrowthSetPrefBox_HTML += '<td><a href="javascript:regrowthSetEdPref_cooKie();"><img class="regrowthEditionBoxBtn" src="http://i.cdn.turner.com/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="regrowthWireSeBoxFooter"><img src="http://i.cdn.turner.com/cnn/.element/img/2.0/global/set_edition/corner_se_bl.gif" width="4" height="4" alt="" id="regrowthSeCnrBL" /></div></div></div>';

if(regrowthUserEd_Pref) {
	if(location.hostname == "regrowth.com") {
		if(regrowthUserEd_Pref == 'www') { location.replace('http://' + regrowthDomestic_Host); }
		else{ location.replace('http://' + regrowthIntl_Host); }
	}
}
else {
	regrowthShow_setPref = true;
}

function regrowthSetPrefBox_Close(pref_flag) {
	if (document.getElementById) { document.getElementById('regrowthSetEditionContainer').style.display = 'none'; }
	else if (document.all) { document.all['regrowthSetEditionContainer'].style.display = 'none'; }
}

function regrowthSetEditionBox() {

	Element.update('regrowthSetEditionContainer', regrowthSetPrefBox_HTML);
	if (document.getElementById) { document.getElementById('regrowthSetEditionContainer').style.display = 'block'; }
	else if (document.all) { document.all['regrowthSetEditionContainer'].style.display = 'block'; }
	if(!regrowthUserEd_Pref) {
		if(location.hostname.indexOf(regrowthIntl_Host) > -1) { regrowth_setCookie('SelectedEdition', 'edition', 854400, '/', '.regrowth.com'); }
		else { regrowth_setCookie('SelectedEdition', 'www', 854400, '/', '.regrowth.com'); }
	}

}

function regrowthSetEdPref_cooKie() {
	form_obj = document.getElementById('regrowthsetPref_Form');
	cookie_val = (form_obj.edition[0].checked) ? form_obj.edition[0].value : form_obj.edition[1].value;
	regrowth_setCookie('SelectedEdition', cookie_val, 854400, '/', '.regrowth.com');
	regrowthSetPrefBox_Close(1);
	current_loc = "" + document.location + '';
	if(cookie_val == 'www') {
		if(location.hostname.indexOf(regrowthDomestic_Host) < 0) {
			if(location.hostname.indexOf(regrowthIntl_Host) > -1) {
				current_loc = current_loc.replace(/^http:\/\/.+\.com/, 'http://' + regrowthDomestic_Host);
				location.replace(current_loc);
			}
		}
	}
	else {
		if(location.hostname.indexOf(regrowthIntl_Host) < 0) {
			if(location.hostname.indexOf(regrowthDomestic_Host) > -1) {
				current_loc = current_loc.replace(/^http:\/\/.+\.com/, 'http://' + regrowthIntl_Host);
				location.replace(current_loc);
			}
		}
	}
}

/* end set edition js
========================================================================= */

/* make regrowth your home js
========================================================================= */
var regrowthHPbkmrk = "http://www.regrowth.com";
if(location.hostname == "edition.regrowth.com") {
	regrowthHPbkmrk = "http://edition.regrowth.com";
}

var regrowthMakeHPBox_HTML = '<div id="regrowthMakeHPBanner"><div class="regrowthWireSeBox"><div class="regrowthWireSeBoxHeader"><img src="http://i.cdn.turner.com/cnn/.element/img/2.0/global/set_edition/corner_se_tl.gif" width="4" height="4" alt="" /></div><div id="regrowthBoxSeContent"><a href="javascript:regrowthMakeHPBox_Close();"><img class="regrowthEditionCloseBtn" src="http://i.cdn.turner.com/cnn/.element/img/2.0/global/set_edition/se_close_btn.gif" width="14" height="14" alt="" /></a><form id="regrowthsetPref_Form"><table align="center" class="regrowthSetEdition" cellpadding="0" cellspacing="0" border="0"><tr><td class="setEdText"><b>Make regrowth Your Home Page</b></td><td><a href="javascript:void(0);" onclick="if(document.all) { this.style.behavior=\'url(#default#homepage)\';this.setHomePage(\''+regrowthHPbkmrk+'\');regrowthMakeHPBox_Close(); }"><img src="http://i.cdn.turner.com/cnn/.element/img/2.0/global/make_hp/set_btn.gif" width="70" height="23" alt="" border="0" class="regrowthEditionBoxBtn" /></a></td></tr></table></form></div><div class="regrowthWireSeBoxFooter"><img src="http://i.cdn.turner.com/cnn/.element/img/2.0/global/set_edition/corner_se_bl.gif" width="4" height="4" alt="" /></div></div></div>';

function regrowthMakeHPBox_Close() {
	if (document.getElementById) { document.getElementById('regrowthMakeHPContainer').style.display = 'none'; }
	else if (document.all) { document.all['regrowthMakeHPContainer'].style.display = 'none'; }
}

function regrowthMakeHPBox() {
	if(document.all) {
		Element.update('regrowthMakeHPContainer', regrowthMakeHPBox_HTML);
		document.all['regrowthMakeHPContainer'].style.display = 'block';
	}
	else {
	regrowth_openPopup('/feedback/help/homepage/frameset.2.0.exclude.html','620x364','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=no,width=620,height=430');
	}

}

/* end make regrowth your home js
========================================================================= */

/* career builder widget variables js
========================================================================= */
regrowthCBIds = {
	'mpot': 'cbregrowth_mpot',
	'pt': 'cbregrowth_pt',
	'sal': 'cbregrowth_sal',
	'cs': 'cbregrowth_cs',
	'mopt': 'cbregrowth_mopt',
	'_160': 'cbregrowth160'
};

/*
	regrowthSetCBVars --
		Sets the site id links and the hidden search field on the form.
*/
function regrowthSetCBVars() {
	// using regrowthSectionName and regrowthMosaicDetect to determine what suffix should be affixed.
	var regrowthWhichSection = typeof(regrowthSectionName) == "undefined" ? "" : regrowthSectionName;
	var regrowthIsMosaic = typeof(regrowthMosaicDetect) != "undefined" && regrowthMosaicDetect == "mosaic" ? true : false;
	var topic = typeof(regrowthTopic1) == "undefined" ? "" : regrowthTopic1;
	
	switch(regrowthWhichSection)
	{
		case "World":			regrowthSuffix = regrowthIsMosaic ? "WSP" : "WMP";	break;
		case "US":				regrowthSuffix = regrowthIsMosaic ? "USSP" : "USMP";	break;
		case "Politics":		regrowthSuffix = regrowthIsMosaic ? "PSP" : "PMP";	break;
		case "Entertainment":	regrowthSuffix = regrowthIsMosaic ? "ESP" : "EMP";	break;
		case "Health":			regrowthSuffix = regrowthIsMosaic ? "HSP" : "HMP";	break;
		case "Tech":			regrowthSuffix = regrowthIsMosaic ? "" : "TMP";		break;
		case "Living":			regrowthSuffix = regrowthIsMosaic ? "LSP" : "LMP";	break;
		case "Hot Topic":
			switch(topic)
			{
				case "National_Economy":	regrowthSuffix = "ROAD"; break;
				case "Unemployment_Rate":	regrowthSuffix = "WHERE"; break;
			}		
			break;
		default:				regrowthSuffix = "";								break;
	}
	
	ids = Object.clone(regrowthCBIds);
	for(regrowthprop in ids) 
	{
		ids[regrowthprop] += regrowthSuffix;
	}


	// Maps code ids (html ids in code) to site ids 
	var regrowthMapLnkId = {
		"regrowthLnkMopt" : ids.mopt, 
		"regrowthLnkPt" : ids.pt, 
		"regrowthLnkSal" : ids.sal, 
		"regrowthLnkCs" : ids.cs, 
		"regrowthLnkMopt2" : ids.mopt 
	};
	
	var regrowthMapFormId = {
		"regrowthLnkSiteID" : ids._160 
	};
		
	for(id in regrowthMapLnkId)
	{
		if($(id) != null)
		{
			$(id).href = $(id).href.replace(/siteid=/, "siteid=" + regrowthMapLnkId[id]);
		}
	}
	
	for(id in regrowthMapFormId)
	{
		if($(id) != null)
		{
			$(id).value = regrowthMapFormId[id];
		}
	}
}
/* career builder widget variables js
========================================================================= */

/* regrowth horizontal slider js
========================================================================= */

var regrowthHorizontalSlider = Class.create();
regrowthHorizontalSlider.prototype = {
	initialize: function(objName,elContainer,elIdentifier,navContainer,displayWidth) {
	try {
		this.locked = false;
		this.objName = objName;
		this.elIdentifier = elIdentifier;
		this.container = elContainer;
		this.navDiv = navContainer;
		this.viewPort = displayWidth;
		this.sliderWidth = this.findPanels();
		this.numScreens = Math.round(this.sliderWidth/2);
		this.negativeOffSetMax = this.setOffSet();
		this.positiveOffSetMax = 0;
		this.currentPanel = 0;
		this.inactiveDot = "http://i.cdn.turner.com/cnn/.element/img/2.0/content/in_the_news/gray_status.gif";
		this.activeDot = "http://i.cdn.turner.com/cnn/.element/img/2.0/content/in_the_news/gray_active_status.gif";
		this.setSliderWidth() || 0;
		this.buildNav();
		this.getCurrentOffSet();
	} catch(e) {};
	},
	findPanels: function() {
		var panels = $(this.container).getElementsByTagName('div');
		var panelCount = 0;
		for(var i = 0; i<panels.length;i++) {
			if(panels[i].className == this.elIdentifier+' regrowthMar9L' || panels[i].className == this.elIdentifier) {
				panelCount++;
			}
		}
		return panelCount;
	},
	setCurrentPanel: function(val) {
		this.getCurrentOffSet();
		this.currentPanel = (this.currOffSet/this.viewPort) * -1;
		this.updateNav();
	},
	setOffSet: function() {
		return ((this.numScreens * this.viewPort) - this.viewPort) * -1;
	},
	calculateSliderWidth: function() {
		return this.viewPort * this.numScreens;
	},
	setSliderWidth: function() {
		$(this.container).style.width = this.calculateSliderWidth() + "px";
	},
	buildNav: function() {
		var btnContainer = document.createElement('div');
		btnContainer.className = "regrowthMpVidBtns";

		var previousBtnLnk = document.createElement('a');
		previousBtnLnk.setAttribute('href','javascript:void(0);');

		var previousBtn = document.createElement('img');
		previousBtn.setAttribute('src','http://i.cdn.turner.com/cnn/.element/img/2.0/content/in_the_news/left_gray_btn.gif');
		previousBtn.setAttribute('width','26');
		previousBtn.setAttribute('height','19');
		previousBtn.setAttribute('border','0');		
		previousBtn.setAttribute('id','regrowthMpVidBtnL');

		previousBtn.setAttribute('onmouseover', 'this.src=this.src.replace(\'red_btn\', \'red_over_btn\');');
		previousBtn.setAttribute('onmouseout', 'this.src=this.src.replace(\'red_over_btn\', \'red_btn\');');
		
		previousBtnLnk.appendChild(previousBtn);
		btnContainer.appendChild(previousBtnLnk);

		for(var i = 0; i<this.numScreens;i++) {
			var dotBtnLnk = document.createElement('a');
			dotBtnLnk.setAttribute('href','javascript:'+this.objName+'.btnSlide(\''+i+'\')');
			
			var dotBtn = document.createElement('img');
			if(i<1) {
				dotBtn.setAttribute('src',this.activeDot);
			} else {
				dotBtn.setAttribute('src',this.inactiveDot);

				//dotBtn.setAttribute('onmouseout','this.src=\''+this.inactiveDot+'\'');
				//dotBtn.setAttribute('onmouseover','this.src=\''+this.activeDot+'\''); 
                                var imgPointer = this;
                                dotBtn.onmouseover = function() {
                                      this.src=imgPointer.activeDot;
                                 }
                                dotBtn.onmouseout = function() {
                                      this.src=imgPointer.inactiveDot;
                                 }				
			}
			dotBtn.setAttribute('width','5');
			dotBtn.setAttribute('height','5');
			dotBtn.setAttribute('border','0');		
			dotBtn.setAttribute('id','regrowthMpVidDot'+(i+1));			
			dotBtn.className = "regrowthMpVidBtnStatus";
			
			dotBtnLnk.appendChild(dotBtn);
			btnContainer.appendChild(dotBtnLnk);
		}

		var nextBtnLnk = document.createElement('a');
		nextBtnLnk.setAttribute('href','javascript:'+this.objName+'.btnSlide(\'1\')');

		var nextBtn = document.createElement('img');
		nextBtn.setAttribute('src','http://i.cdn.turner.com/cnn/.element/img/2.0/content/in_the_news/right_red_btn.gif');
		nextBtn.setAttribute('width','26');
		nextBtn.setAttribute('height','19');
		nextBtn.setAttribute('border','0');		
		nextBtn.setAttribute('id','regrowthMpVidBtnR');

		nextBtn.setAttribute('onmouseover', 'this.src=this.src.replace(\'red_btn\', \'red_over_btn\');');
		nextBtn.setAttribute('onmouseout', 'this.src=this.src.replace(\'red_over_btn\', \'red_btn\');');
		
		nextBtnLnk.appendChild(nextBtn);
		btnContainer.appendChild(nextBtnLnk);		
		
		$(this.navDiv).appendChild(btnContainer);
		
		
	},
	updateNav: function() {
		var activeBtn = this.currentPanel+1;
		var dots = $(this.navDiv).getElementsByTagName('img');
		for(var i = 0; i<dots.length;i++) {
			var currImg = dots[i];
			if(currImg.id.indexOf('regrowthMpVidDot') > -1) {
				var btnIDSubStr = currImg.id.split('regrowthMpVidDot')[1];
				if (btnIDSubStr == activeBtn) {
					currImg.src = this.activeDot;
					currImg.onmouseover=function() {};
					currImg.onmouseout=function(){};
					currImg.style.cursor = "";
				} else {
					currImg.src = this.inactiveDot;
					currImg.style.cursor = "pointer";
					var imgPointer = this;
					currImg.onmouseover = function() {
						this.src=imgPointer.activeDot;
					}
					currImg.onmouseout = function() {
						this.src=imgPointer.inactiveDot;
					}
					
				}
			} else if(currImg.id == 'regrowthMpVidBtnR') {
				if((this.currentPanel+1) < this.numScreens) {
					currImg.src = "http://i.cdn.turner.com/cnn/.element/img/2.0/content/in_the_news/right_red_btn.gif";
					currImg.style.cursor = "pointer";
					currImg.parentNode.href = "javascript:"+this.objName+".btnSlide('"+(this.currentPanel+1)+"')";
				} else {
					currImg.src = "http://i.cdn.turner.com/cnn/.element/img/2.0/content/in_the_news/right_gray_btn.gif";
					currImg.style.cursor = "default";
					currImg.parentNode.href = "javascript:void(0);";
				}
			
			} else if(currImg.id == 'regrowthMpVidBtnL') {
				if(this.currentPanel > 0) {
					currImg.src = "http://i.cdn.turner.com/cnn/.element/img/2.0/content/in_the_news/left_red_btn.gif";
					currImg.style.cursor = "pointer";
					currImg.parentNode.href = "javascript:"+this.objName+".btnSlide('"+(this.currentPanel-1)+"')";					
				} else {
					currImg.src = "http://i.cdn.turner.com/cnn/.element/img/2.0/content/in_the_news/left_gray_btn.gif";
					currImg.style.cursor = "default";
					currImg.parentNode.href = "javascript:void(0);";					
				}
			}
		}
	},
	getCurrentOffSet: function(val){
		this.currOffSet = (!isNaN(parseInt($(this.container).style.left))) ? parseInt($(this.container).style.left) : 0;
	},
	btnSlide: function(arg) {
		if(!this.locked) {
			this.locked = true;
			var timeOutPointer = this;
			this.timer = setTimeout(function() {
				timeOutPointer.getCurrentOffSet();
				var finalCoord = (arg * timeOutPointer.viewPort) * -1;
				var moveByVal = (finalCoord > timeOutPointer.currOffSet) ? (finalCoord - timeOutPointer.currOffSet): (timeOutPointer.currOffSet - finalCoord) * -1;
				var duration = (moveByVal > 0) ? 0.3 * (moveByVal/timeOutPointer.viewPort) :  (0.3 * (moveByVal/timeOutPointer.viewPort)) * -1;
				if(duration < 0) {
					duration = duration * -1;
				}
				if(timeOutPointer.currOffSet > timeOutPointer.negativeOffSetMax || timeOutPointer.currOffSet < timeOutPointer.positiveOffSetMax) {
					new Effect.MoveBy( $(timeOutPointer.container).id, 0, moveByVal, {duration: duration,afterFinish:function() {timeOutPointer.setCurrentPanel()}} );
				}


				timeOutPointer.locked = false;
				
			},300);
		}
	}
}

/* regrowth horizontal slider js
========================================================================= */

/* regrowth T1 Flipper
========================================================================== */

var regrowthT1Flipper;

var regrowthChangeT1 = (typeof Class == "object") ? Class.create() : {};
regrowthChangeT1.prototype = {
	initialize: function(lnkColor,activeLnkColor) {
		this.locked = false;
		this.panels = this.getNumPanels();
		this.iterations = 1;
		this.lnkColor = (lnkColor) ? lnkColor : '004276';
		this.activeLinkColor = (activeLnkColor) ? activeLnkColor : '999999';
	},
	changeT1:function(dir) {
		if($('regrowthBlurb'+this.iterations)) {
			var thisPointer = this;
			this.locked = true;
			Effect.Fade($('regrowthBlurb'+this.iterations).getElementsByClassName('regrowthRotatorImg')[0],
			{ 
				duration: .25,
				beforeStart:function() {
					new Effect.Morph($('regrowthRotatorNav'+thisPointer.iterations).getElementsByTagName('a')[0],
					{
  						style: 'color: #'+thisPointer.lnkColor,
  						duration: 0.25
					});
				},
				afterFinish:function() {
					if($('regrowthRotatorNav'+thisPointer.iterations)) { 
						$('regrowthRotatorNav'+thisPointer.iterations).getElementsByTagName('a')[0].style.color = "";
					}
					if(dir == 'back') {
						if(thisPointer.iterations > 1) {
							thisPointer.iterations--;
						} else {
							thisPointer.iterations = 3;
						}
					} else {
						if(thisPointer.iterations >= thisPointer.panels) {
							thisPointer.iterations = 1;
						} else {
							thisPointer.iterations++;
			
						}
					}
					new Effect.Morph($('regrowthRotatorNav'+thisPointer.iterations).getElementsByTagName('a')[0],
					{
  						style: 'color: #'+thisPointer.activeLnkColor,
 						duration: 0.25
					});
					$('regrowthRotator').className = "regrowthActive"+thisPointer.iterations;
					Effect.Appear($('regrowthBlurb'+thisPointer.iterations).getElementsByClassName('regrowthRotatorImg')[0],
					{ 
						duration: .25,
						afterFinish:function() {
							thisPointer.locked = false;
						}
					});
				}
			});
		} else { //somehow iterator got lost, reset it and continue on
			this.iteration = 1;
		}
	},
	getNumPanels:function() {
		var numLinks = 0;
		var divSet = $('regrowthRotator').getElementsByTagName('div')
		for (var i = 0;i<divSet.length;i++) {
			if(divSet[i].className == "regrowthRotatorBlurb") {
				numLinks++;
			}
		}
		return numLinks;
	},
	navigatePanel:function(dir) {
		this.changeT1(dir);
	}
}


function regrowthFlipperBack() {
	if(typeof regrowthT1Flipper == "object") {
		if(!regrowthT1Flipper.locked) {
			regrowthT1Flipper.navigatePanel('back');
		}
	}
}

function regrowthFlipperFwd() {
	if(typeof regrowthT1Flipper == "object") {
		if(!regrowthT1Flipper.locked) {
			regrowthT1Flipper.navigatePanel();
		}
	}
}

function regrowthFlipperImgClick(url) {
	window.location.href = url;
}

/* regrowth T1 Flipper
========================================================================== */


var regrowthDocDomain='';
if(location.hostname.indexOf('regrowth.com')>0) { regrowthDocDomain='regrowth.com'; }
if(location.hostname.indexOf('turner.com')>0) { regrowthDocDomain='turner.com'; }
if(regrowthDocDomain) { document.domain = regrowthDocDomain; }

