/**
* Core additions/extensions to JS objects.
* @author Kaiser Shahid [2007 to infinity]
*/


/* NATIVE PROTOTYPES */
String.prototype.trim = function() { return this.replace( /^\s+/g, '' ).replace( /\s+$/g, '' ); }
String.prototype.ltrim = function() { return this.replace( /^\s+/g, '' ); }
String.prototype.rtrim = function() { return this.replace( /\s+$/g, '' ); }
String.__ord_map = { " ": 32, "!": 33, '"': 34, "#": 35, "$": 36, "%": 37, "&": 38, "'": 39, "(": 40, ")": 41, "*": 42, "+": 43, ",": 44, "-": 45, ".": 46, "/": 47, "0": 48, "1": 49, "2": 50, "3": 51, "4": 52, "5": 53, "6": 54, "7": 55, "8": 56, "9": 57, ":": 58, ";": 59, "<": 60, "=": 61, ">": 62, "?": 63, "@": 64, "A": 65, "B": 66, "C": 67, "D": 68, "E": 69, "F": 70, "G": 71, "H": 72, "I": 73, "J": 74, "K": 75, "L": 76, "M": 77, "N": 78, "O": 79, "P": 80, "Q": 81, "R": 82, "S": 83, "T": 84, "U": 85, "V": 86, "W": 87, "X": 88, "Y": 89, "Z": 90, "[": 91, "\\": 92, "]": 93, "^": 94, "_": 95, "`": 96, "a": 97, "b": 98, "c": 99, "d": 100, "e": 101, "f": 102, "g": 103, "h": 104, "i": 105, "j": 106, "k": 107, "l": 108, "m": 109, "n": 110, "o": 111, "p": 112, "q": 113, "r": 114, "s": 115, "t": 116, "u": 117, "v": 118, "w": 119, "x": 120, "y": 121, "z": 122, "{": 123, "|": 124, "}": 125, "~": 126 };
String.__chr_map = { '32': " ", '33': "!", '34': '"', '35': "#", '36': "$", '37': "%", '38': "&", '39': "'", '40': "(", '41': ")", '42': "*", '43': "+", '44': ",", '45': "-", '46': ".", '47': "/", '48': "0", '49': "1", '50': "2", '51': "3", '52': "4", '53': "5", '54': "6", '55': "7", '56': "8", '57': "9", '58': ":", '59': ";", '60': "<", '61': "=", '62': ">", '63': "?", '64': "@", '65': "A", '66': "B", '67': "C", '68': "D", '69': "E", '70': "F", '71': "G", '72': "H", '73': "I", '74': "J", '75': "K", '76': "L", '77': "M", '78': "N", '79': "O", '80': "P", '81': "Q", '82': "R", '83': "S", '84': "T", '85': "U", '86': "V", '87': "W", '88': "X", '89': "Y", '90': "Z", '91': "[", "\\": 92, '93': "]", '94': "^", '95': "_", '96': "`", '97': "a", '98': "b", '99': "c", '100': "d", '101': "e", '102': "f", '103': "g", '104': "h", '105': "i", '106': "j", '107': "k", '108': "l", '109': "m", '110': "n", '111': "o", '112': "p", '113': "q", '114': "r", '115': "s", '116': "t", '117': "u", '118': "v", '119': "w", '120': "x", '121': "y", '122': "z", '123': "{", '124': "|", '125': "}", '126': "~" };


// gets ASCII value of char c
// TODO: make this work nice with chars 128-255?
String.ord = function( c )
{
	c = c.charAt( 0 );
	if ( String.__ord_map[c] )
		return String.__ord_map[c];
	else
		return -1;
}

// gets ASCII character of int c
String.chr = function( c )
{
	c = c + '';
	if ( String.__chr_map[c] )
		return String.__chr_map[c];
	else
		return null;
}


var $__inspect = {};

/**
* To utilize innerHTML in IE (i.e. using ids to access the new elements), 
* we'd first have to inspect the parent of these elements and build a list of ids 
* pointing to the new elements. 
*
* @param Element parent The parent whose innerHTML was updated
* @todo Make this.
*/

function $inspect( parent )
{
	
}



/**
* World's favorite $ function, with a tiny twist.
* @param  id The id of the DOM Element
* @return Element The DOM Element, or null
*/

function $( id )
{
	var obj = document.getElementById( id );
	if ( !obj ) obj = $__inspect[id];
	
	return obj;
}

/**
* Merges all arguments together into a new object. Only does a top-level merge.
* @param object One or more objects
* @return object An object with all the merged properties of the objects passed to it.
* @todo Recursive merge? Or have a new function for that?
*/

function $merge()
{
	if ( arguments.length < 2 )
		return arguments[0];
	
	var obj = {};
	for ( var i = 0; i < arguments.length; i++ )
	{
		for ( var j in arguments[i] )
			obj[j] = arguments[i][j];
	}
	
	return obj;
}


var $debugger_id = 'aarp_debugger_box';
var $debugger = null;

/**
* Global debugger tool. Finally.
* @param  str The message you want to log
* @param int level The logging level (default is dbg.MARK)
* @param  clear If not null, clear the debugger box
*/

function dbg( str, level, clear )
{
	if ( $debugger == null )
		$debugger = $( $debugger_id );
	
	if ( $debugger == null ) return;
	
	if ( level == null )
		level = dbg.MARK;
	
	if ( clear ) $debugger.value = "! clearing!\n";
	
	if ( level & dbg.LOG_LEVEL )
	{
		var l = dbg.LEVEL_MAP[level] ? dbg.LEVEL_MAP[level] : 'NOTICE';
		$debugger.value += '# [' + l + '] ' + str + "\n";
	}
}

dbg.DEBUG = 1;
dbg.INFO = 2;
dbg.MARK = 4;
dbg.WARN = 8;
dbg.ERROR = 16;
dbg.LOG_LEVEL = ~256; // all levels
dbg.LEVEL_MAP = { '1': 'DEBUG', '2': 'INFO', '4': 'MARK', '8': 'WARN', '16': 'ERROR' };

/**
* Creates a nested string representation of an object.
* @param object obj The object to inspect
* @todo Fix indenting
*/

function print_r( obj )
{
	indent = '';
	if ( arguments.length > 1 ) indent = arguments[1];
	
	if ( obj == null ) return '';
	
	var nindent = indent + "\t";
	var buff = '';
	
	for ( var k in obj )
	{
		var v = obj[k];
		if ( typeof( v ) == 'object' )
			buff += indent + k + " => Object\n" + print_r( v, nindent );
		else
		{
			if ( typeof( v ) != 'function' ) buff += indent + k + " => " + v + "\n";
			//else buff += indent + k + " => #function\n";
		}
	}
	
	return buff;
}

/**
* Mechanism for queueing functions for later execution.
*/

var startup = {
	queue: []
	
	/**
	* @param function callback
	*/
	, add: function( callback ) { this.queue.push( callback ); }
	
	/**
	*
	*/
	, go: function()
	{
		for ( var i = 0; i < this.queue.length; i++ )
		{
			try { this.queue[i](); dbg( 'startup.go(): finished ' + i ); }
			catch ( e ) { dbg( 'startup.go(): error on ' + i ); dbg( e.toString() ); dbg( this.queue[i] ); }
		}
	}
}

startup.add( function() {
	var ta = document.createElement( 'textarea' );
	ta.id = $debugger_id;
	ta.style.width = '100%';
	ta.style.height = '100px';
	ta.style.margin = '10px 0';
	// only shows debugger if 'debug' is part of a parameter name
	if ( !document.location.toString().match( /\?(debug|.+&debug)/ ) )
		ta.style.display = 'none';
	
	document.getElementsByTagName( 'body' )[0].appendChild( ta );
	
	dbg( 'if you see this, injecting debugger works!' );
} );

window.onload = function() { startup.go(); }

// some compatibility
if ( typeof( Event ) == 'undefined' )
	var Event = {};
else
	var oldEvent = Event;

Event.observe = function( obj, evt, func )
{
	if ( obj == window && evt == 'load' )
		startup.add( func );
	else
	{
		try { oldEvent.observe( obj, evt, func ); }
		catch ( e ) { dbg( 'Event.observe(): ' + e.toString(), dbg.ERROR ); }
	}
}

/**
* Set of functions to easily handle cookie retrieval/manipulation. Code
* adapted from http://www.quirksmode.org/js/cookies.html
* @author Kaiser Shahid, 2007-09-17
*/

var Cookies = {
	__version__: ''
	, cookies: {}
	, domain: 'aarp.org'
	, path: '/'
	, load: function()
	{
		dbg( 'Cookies.load(): ' + document.cookie, dbg.INFO );
		var ca = document.cookie.split( ';' );
		for ( var i = 0; i < ca.length; i++ )
		{
			var c = ca[i].ltrim();
			var kv = c.split( '=', 2 );
			// unescape value if hexcodes are in
			if ( kv[1] && kv[1].match( /\%[0-9a-zA-Z]+/ ) )
				kv[1] = unescape( kv[1] );
			this.cookies[kv[0]] = kv[1];
		}
	}
	
	, get: function( key )
	{
		if ( this.cookies[key] )
			return this.cookies[key];
		else
			return null;
	}
	
	/**
	* Parameters: key, val, expiry, domain, path.
	* Expiry should be in seconds. Use helper methods to convert other times.
	*/
	
	, set: function( key, val )
	{
		var buffer = escape( key ) + '=' + escape( val );
		var expiry = arguments[2];
		var domain = this.domain;
		var path = this.path;
		
		if ( expiry )
		{
			// CHANGED: if possible, figure out a way to account for DST, since 
			// getTime() seems to need a couple of hours padded on to actually persist.
			// --> getTime() returns milliseconds. duh.
			var date = new Date();
			date.setTime( date.getTime() + expiry*1000 );
			buffer += '; expires=' + date.toUTCString();
		}
		
		if ( arguments.length > 3 )
			domain = arguments[3];
		if ( arguments.length > 4 )
			path = arguments[4];
		
		buffer += '; path=' + path + '; domain=' + domain; // + '; domain=' + domain;
		document.cookie = buffer;
		this.cookies[key] = val;
		
		dbg( "Cookies.set(): " + buffer, dbg.INFO );
	}
	
	/**
	* Parameters: key, domain, path.
	*/
	
	, expire: function( key )
	{
		var domain = this.domain;
		var path = this.path;
		
		if ( arguments.length > 1 )
			domain = arguments[1];
		if ( arguments.length > 2 )
			path = arguments[2];
		
		this.set( key, 'x', -1, domain, path );
		delete this.cookies[key];
		
		dbg( "Cookies.unset(): " + key, dbg.INFO );
	}
	
	, debug: function()
	{
		var str = '';
		for ( var k in this.cookies )
			str += k + '=>' + this.cookies[k] + "\n";
	}
}

//startup.add( function() { Cookies.load(); } );
Cookies.load();

var Template = function( tstring )
{
	var tokens = {};
	var template = '';
	var cleanup = /\\#\{([^}]+)/g;
	var token_matcher = /(.?)#\{([^}]+)\}/g;
	
	/**
	* parse tstring into tokens by finding all matches of #{...} (excluding
	* \#{...}).
	*/
	
	this.parse = function( str )
	{
		template = str;
		var tmp = str.match( token_matcher );
		var tmp2 = {};
		
		if ( tmp != null )
		{
			var ph = '', sStart = 2;
			for ( var i = 0; i < tmp.length; i++ )
			{
				// if the placeholder isn't escaped, grab the nam being held
				// within {...} and create a compiled RegExp to handle replaces later
				// this should speed this up a good amount since the pattern is compiled
				// once, and therefore, reusable without the overhead.
				
				if ( tmp[i].charAt( 0 ) != '\\' )
				{
					// tmp[i] starts with either '?#{' or '#{', so figure out where to start chopping
					if ( tmp[i].charAt( 1 ) == '{' ) sStart = 2;
					else sStart = 3;
					ph = tmp[i].substring( sStart, tmp[i].length - 1 );
					tmp2[ph] = new RegExp( '([^\\\\]?)#\\{' + ph + '\\}', 'g' );
				}
			}
		}
		
		tokens = tmp2;
	}
	
	this.parse( tstring );
		
	this.fill = function( mapping )
	{
		var buffer = template;
		var robj = null;
		
		for ( i in tokens )
		{
			robj = tokens[i];
			
			// TODO: figure out why there's an undefined element in tokens, and make sure the code below doesn't execute on an undefined (which is appears to do)
			if ( mapping[i] != undefined && i != undefined)
				buffer = buffer.replace( robj, '$1' + mapping[i] );
		}
		
		// transform \#{...} to #{...}
		return buffer.replace( cleanup, '#{$1' );
	}
	
	this.evaluate = this.fill; // for those used to prototype.js
};

/* Work in progress. Emulate prototype.

var Form = {
	getElements
	, extract: function( form )
	{
		if ( typeof( form ) == 'string' )
			form = $( form );
		
		if ( !form ) return {};
		
		var data = {}, name = '', tmp = null, value = null;
		var controls = Form.getElements( form );
		
		for ( i = 0; i < controls.length; i++ )
		{
			if ( controls[i].disabled || controls[i].type.match( /reset|submit|button/ ) != null )
				continue;
			
			name = controls[i].name;
			value = controls[i].getValue();
			data[name] = value;
		}
		
		return data;
	}
	, serialize: function( form )
	{
		var data = Form.extract( form );
		
	}
}
*/

function removeDoubleQoutes( str ) {
	charToRemove = '"' ;
	regExp = new RegExp( "[" + charToRemove + "]", "g" ) ;
	return str.replace( regExp, "" ) ;
} ;

eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('f 17={7p:"1.5.0",8L:{8z:!!C.5x},62:"(?:<7q.*?>)((\\n|\\r|.)*?)(?:</7q>)",3p:7(){},K:7(x){c x}};f 1l={1k:7(){c 7(){6.1S.2d(6,L)}}};f 1s=I l();l.k=7(8w,8s){O(f 8v in 8s){8w[8v]=8s[8v]}c 8w};l.k(l,{V:7(3u){1t{if(3u===P){c"P"}if(3u===N){c"N"}c 3u.V?3u.V():3u.20()}1G(e){if(e gF gE){c"..."}2h e}},bW:7(b1){f 8x=[];O(f b0 in b1){8x.v(b0)}c 8x},1Q:7(8q){f 8j=[];O(f b2 in 8q){8j.v(8q[b2])}c 8j},4E:7(b3){c l.k({},b3)}});9a.m.1j=7(){f b5=6,8m=$A(L),b4=8m.94();c 7(){c b5.2d(b4,8m.1u($A(L)))}};9a.m.gB=7(8p){f aZ=6,8o=$A(L),8p=8o.94();c 7(aY){c aZ.2d(8p,[(aY||1d.gq)].1u(8o).1u($A(L)))}};l.k(go.m,{gp:7(){f 8n=6.20(16);if(6<16){c"0"+8n}c 8n},7g:7(){c 6+1},d9:7(aT){$R(0,6,Y).J(aT);c 6}});f br={bq:7(){f 8N;O(f i=0,aS=L.E;i<aS;i++){f aR=L[i];1t{8N=aR();11}1G(e){}}c 8N}};f aU=1l.1k();aU.m={1S:7(aV,aX){6.3J=aV;6.3m=aX;6.5N=U;6.2Z()},2Z:7(){6.3t=eo(6.3e.1j(6),6.3m*82)},7O:7(){if(!6.3t){c}gN(6.3t);6.3t=N},3e:7(){if(!6.5N){1t{6.5N=Y;6.3J(6)}gO{6.5N=U}}}};1Z.8f=7(8Q){c 8Q==N?"":1Z(8Q)};l.k(1Z.m,{23:7(aW,5Q){f 4g="",2M=6,3T;5Q=L.h5.8b(5Q);1g(2M.E>0){if(3T=2M.14(aW)){4g+=2M.3O(0,3T.b6);4g+=1Z.8f(5Q(3T));2M=2M.3O(3T.b6+3T[0].E)}W{4g+=2M,2M=""}}c 4g},h8:7(b7,5w,4i){5w=6.23.8b(5w);4i=4i===P?1:4i;c 6.23(b7,7(8G){if(--4i<0){c 8G[0]}c 5w(8G)})},h9:7(bi,bh){6.23(bi,bh);c 6},h0:7(4l,4a){4l=4l||30;4a=4a===P?"...":4a;c 6.E>4l?6.3O(0,4l-4a.E)+4a:6},4J:7(){c 6.1W(/^\\s+/,"").1W(/\\s+$/,"")},b9:7(){c 6.1W(/<\\/?[^>]+>/gi,"")},2a:7(){c 6.1W(I 6F(17.62,"bj"),"")},bg:7(){f bk=I 6F(17.62,"bj");f bl=I 6F(17.62,"im");c(6.14(bk)||[]).1m(7(bm){c(bm.14(bl)||["",""])[1]})},3G:7(){c 6.bg().1m(7(bf){c 6X(bf)})},gY:7(){f T=C.4O("T");f ba=C.gX(6);T.6T(ba);c T.2t},gn:7(){f T=C.4O("T");T.2t=6.b9();c T.2v[0]?(T.2v.E>1?$A(T.2v).2c("",7(b8,bb){c b8+bb.5a}):T.2v[0].5a):""},7j:7(bc){f 7P=6.4J().14(/([^?#]*)(#.*)?$/);if(!7P){c{}}c 7P[1].3d(bc||"&").2c({},7(2H,3W){if((3W=3W.3d("="))[0]){f 32=be(3W[0]);f 5O=3W[1]?be(3W[1]):P;if(2H[32]!==P){if(2H[32].3o!=1q){2H[32]=[2H[32]]}if(5O){2H[32].v(5O)}}W{2H[32]=5O}}c 2H})},2k:7(){c 6.3d("")},7g:7(){c 6.3O(0,6.E-1)+1Z.fS(6.fR(6.E-1)+1)},7m:7(){f 2Q=6.3d("-"),7K=2Q.E;if(7K==1){c 2Q[0]}f 7N=6.5D(0)=="-"?2Q[0].5D(0).1K()+2Q[0].7L(1):2Q[0];O(f i=1;i<7K;i++){7N+=2Q[i].5D(0).1K()+2Q[i].7L(1)}c 7N},eZ:7(){c 6.5D(0).1K()+6.7L(1).1D()},fy:7(){c 6.23(/::/,"/").23(/([A-Z]+)([A-Z][a-z])/,"#{1}4h#{2}").23(/([a-z\\d])([A-Z])/,"#{1}4h#{2}").23(/-/,"4h").1D()},fw:7(){c 6.23(/4h/,"-")},V:7(bd){f 7Y=6.1W(/\\\\/g,"\\\\\\\\");if(bd){c"\\""+7Y.1W(/"/g,"\\\\\\"")+"\\""}W{c"\'"+7Y.1W(/\'/g,"\\\\\'")+"\'"}}});1Z.m.23.8b=7(63){if(1h 63=="7"){c 63}f aQ=I 5i(63);c 7(aP){c aQ.5x(aP)}};1Z.m.fH=1Z.m.7j;f 5i=1l.1k();5i.ar=/(^|.|\\r|\\n)(#\\{(.*?)\\})/;5i.m={1S:7(at,as){6.au=at.20();6.av=as||5i.ar},5x:7(ax){c 6.au.23(6.av,7(67){f 8d=67[1];if(8d=="\\\\"){c 67[2]}c 8d+1Z.8f(ax[67[3]])})}};f $11=I l();f $6B=I l();f 1E={J:7(aw){f ap=0;1t{6.2q(7(aq){1t{aw(aq,ap++)}1G(e){if(e!=$6B){2h e}}})}1G(e){if(e!=$11){2h e}}c 6},aD:7(5Z,ak){f 5T=-5Z,87=[],88=6.2k();1g((5T+=5Z)<88.E){87.v(88.3O(5T,5T+5Z))}c 87.1m(ak)},6V:7(aj){f 5f=Y;6.J(7(ai,al){5f=5f&&!!(aj||17.K)(ai,al);if(!5f){2h $11}});c 5f},gk:7(am){f 7Z=U;6.J(7(ao,an){if(7Z=!!(am||17.K)(ao,an)){2h $11}});c 7Z},cd:7(ay){f 8S=[];6.J(7(az,aK){8S.v((ay||17.K)(az,aK))});c 8S},ce:7(aJ){f 9C;6.J(7(9D,aL){if(aJ(9D,aL)){9C=9D;2h $11}});c 9C},cp:7(aM){f 9B=[];6.J(7(9G,aO){if(aM(9G,aO)){9B.v(9G)}});c 9B},hd:7(aI,aH){f 9u=[];6.J(7(9A,aC){f aN=9A.20();if(aN.14(aI)){9u.v((aH||17.K)(9A,aC))}});c 9u},18:7(aA){f 9J=U;6.J(7(aB){if(aB==aA){9J=Y;2h $11}});c 9J},ig:7(9z,4Z){4Z=4Z===P?N:4Z;c 6.aD(9z,7(6v){1g(6v.E<9z){6v.v(4Z)}c 6v})},2c:7(6b,aE){6.J(7(aG,aF){6b=aE(6b,aG,aF)});c 6b},i4:7(bn){f bo=$A(L).3O(1);c 6.1m(7(9K){c 9K[bn].2d(9K,bo)})},iy:7(c8){f 4P;6.J(7(4Q,c7){4Q=(c8||17.K)(4Q,c7);if(4P==P||4Q>=4P){4P=4Q}});c 4P},io:7(c9){f 4x;6.J(7(4M,ca){4M=(c9||17.K)(4M,ca);if(4x==P||4M<4x){4x=4M}});c 4x},hr:7(cc){f 91=[],8V=[];6.J(7(98,cb){((cc||17.K)(98,cb)?91:8V).v(98)});c[91,8V]},4s:7(ah){f 8X=[];6.J(7(c6,hh){8X.v(c6[ah])});c 8X},hk:7(c5){f 8Y=[];6.J(7(8Z,c0){if(!c5(8Z,c0)){8Y.v(8Z)}});c 8Y},hA:7(bZ){c 6.1m(7(9n,bY){c{15:9n,9p:bZ(9n,bY)}}).hM(7(c1,c2){f a=c1.9p,b=c2.9p;c a<b?-1:a>b?1:0}).4s("15")},2k:7(){c 6.1m()},hT:7(){f 9k=17.K,5o=$A(L);if(1h 5o.7V()=="7"){9k=5o.hL()}f c4=[6].1u(5o).1m($A);c 6.1m(7(hD,c3){c 9k(c4.4s(c3))})},ci:7(){c 6.2k().E},V:7(){c"#<1E:"+6.2k().V()+">"}};l.k(1E,{1m:1E.cd,e9:1E.ce,1N:1E.cp,hl:1E.18,hu:1E.2k});f $A=1q.hV=7(3D){if(!3D){c[]}if(3D.2k){c 3D.2k()}W{f 9c=[];O(f i=0,co=3D.E;i<co;i++){9c.v(3D[i])}c 9c}};l.k(1q.m,1E);if(!1q.m.6U){1q.m.6U=1q.m.5F}l.k(1q.m,{2q:7(cr){O(f i=0,cq=6.E;i<cq;i++){cr(6[i])}},eb:7(){6.E=0;c 6},4A:7(){c 6[0]},7V:7(){c 6[6.E-1]},cl:7(){c 6.1N(7(ct){c ct!=N})},96:7(){c 6.2c([],7(cs,4H){c cs.1u(4H&&4H.3o==1q?4H.96():[4H])})},9g:7(){f cn=$A(L);c 6.1N(7(cm){c!cn.18(cm)})},bV:7(cg){O(f i=0,ch=6.E;i<ch;i++){if(6[i]==cg){c i}}c-1},5F:7(cf){c(cf!==U?6:6.2k()).6U()},ck:7(){c 6.E>1?6:6[0]},hE:7(){c 6.2c([],7(5S,7r){c 5S.18(7r)?5S:5S.1u([7r])})},4E:7(){c[].1u(6)},ci:7(){c 6.E},V:7(){c"["+6.1m(l.V).2y(", ")+"]"}});1q.m.2k=1q.m.4E;7 $w(4T){4T=4T.4J();c 4T?4T.3d(/\\s+/):[]}if(1d.2s){1q.m.1u=7(){f 4X=[];O(f i=0,5M=6.E;i<5M;i++){4X.v(6[i])}O(f i=0,5M=L.E;i<5M;i++){if(L[i].3o==1q){O(f j=0,cj=L[i].E;j<cj;j++){4X.v(L[i][j])}}W{4X.v(L[i])}}c 4X}}f 1O=7(5G){l.k(6,5G||{})};l.k(1O,{3v:7(5G){f 5y=[];6.m.2q.iu(5G,7(2f){if(!2f.1a){c}if(2f.15&&2f.15.3o==1q){f 5P=2f.15.cl();if(5P.E<2){2f.15=5P.ck()}W{1a=5C(2f.1a);5P.J(7(4Y){4Y=4Y!=P?5C(4Y):"";5y.v(1a+"="+5C(4Y))});c}}if(2f.15==P){2f[1]=""}5y.v(2f.1m(5C).2y("="))});c 5y.2y("&")}});l.k(1O.m,1E);l.k(1O.m,{2q:7(bX){O(f 1a in 6){f 4f=6[1a];if(4f&&4f==1O.m[1a]){6B}f 6s=[1a,4f];6s.1a=1a;6s.15=4f;bX(6s)}},bW:7(){c 6.4s("1a")},1Q:7(){c 6.4s("15")},hS:7(bA){c $H(bA).2c(6,7(75,77){75[77.1a]=77.15;c 75})},4F:7(){f 2D;O(f i=0,bz=L.E;i<bz;i++){f 6c=6[L[i]];if(6c!==P){if(2D===P){2D=6c}W{if(2D.3o!=1q){2D=[2D]}2D.v(6c)}}hH 6[L[i]]}c 2D},3v:7(){c 1O.3v(6)},V:7(){c"#<1O:{"+6.1m(7(by){c by.1m(l.V).2y(": ")}).2y(", ")+"}>"}});7 $H(4o){if(4o&&4o.3o==1O){c 4o}c I 1O(4o)}69=1l.1k();l.k(69.m,1E);l.k(69.m,{1S:7(bB,3c,bC){6.5b=bB;6.3c=3c;6.bD=bC},2q:7(bE){f 4p=6.5b;1g(6.18(4p)){bE(4p);4p=4p.7g()}},18:7(6a){if(6a<6.5b){c U}if(6.bD){c 6a<6.3c}c 6a<=6.3c}});f $R=7(bx,3c,bw){c I 69(bx,3c,bw)};f Q={9b:7(){c br.bq(7(){c I bI()},7(){c I bp("g5.bs")},7(){c I bp("g3.bs")})||U},71:0};Q.3C={56:[],2q:7(bt){6.56.2q(bt)},bR:7(7n){if(!6.18(7n)){6.56.v(7n)}},g1:7(bv){6.56=6.56.9g(bv)},6q:7(7D,bu,bF,bG){6.J(7(6I){if(1h 6I[7D]=="7"){1t{6I[7D].2d(6I,[bu,bF,bG])}1G(e){}}})}};l.k(Q.3C,1E);Q.3C.bR({bU:7(){Q.71++},2j:7(){Q.71--}});Q.65=7(){};Q.65.m={6n:7(bQ){6.D={1L:"4y",5E:Y,bK:"6Z/x-gS-M-gT",6W:"h2-8",4w:""};l.k(6.D,bQ||{});6.D.1L=6.D.1L.1D();if(1h 6.D.4w=="57"){6.D.4w=6.D.4w.7j()}}};Q.4K=1l.1k();Q.4K.ae=["gr","gJ","gK","gL","7c"];Q.4K.m=l.k(I Q.65(),{76:U,1S:7(1x,bS){6.1b=Q.9b();6.6n(bS);6.95(1x)},95:7(1x){6.1x=1x;6.1L=6.D.1L;f 2C=6.D.4w;if(!["bT","4y"].18(6.1L)){2C["gt"]=6.1L;6.1L="4y"}2C=1O.3v(2C);if(2C&&/3s|3Q|3I/.2B(1M.2x)){2C+="&4h="}if(6.1L=="bT"&&2C){6.1x+=(6.1x.bV("?")>-1?"&":"?")+2C}1t{Q.3C.6q("bU",6,6.1b);6.1b.fM(6.1L.1K(),6.1x,6.D.5E);if(6.D.5E){3f(7(){6.7C(1)}.1j(6),10)}6.1b.9U=6.7u.1j(6);6.bJ();f bP=6.1L=="4y"?(6.D.gg||2C):N;6.1b.fZ(bP);if(!6.D.5E&&6.1b.bL){6.7u()}}1G(e){6.5h(e)}},7u:7(){f 7o=6.1b.bO;if(7o>1&&!((7o==4)&&6.76)){6.7C(6.1b.bO)}},bJ:7(){f 3h={"X-hv-ho":"bI","X-17-7p":17.7p,"hy":"3H/a2, 3H/12, 6Z/bH, 3H/bH, */*"};if(6.1L=="4y"){3h["af-2n"]=6.D.bK+(6.D.6W?"; gj="+6.D.6W:"");if(6.1b.bL&&(1M.2x.14(/f0\\/(\\d{4})/)||[0,bN])[1]<bN){3h["iw"]="ip"}}if(1h 6.D.bM=="is"){f 3S=6.D.bM;if(1h 3S.v=="7"){O(f i=0,cu=3S.E;i<cu;i+=2){3h[3S[i]]=3S[i+1]}}W{$H(3S).J(7(6Y){3h[6Y.1a]=6Y.15})}}O(f 7y in 3h){6.1b.hp(7y,3h[7y])}},2I:7(){c!6.1b.5B||(6.1b.5B>=hB&&6.1b.5B<hF)},7C:7(9S){f 53=Q.4K.ae[9S];f 5n=6.1b,6y=6.a8();if(53=="7c"){1t{6.76=Y;(6.D["43"+6.1b.5B]||6.D["43"+(6.2I()?"iG":"hK")]||17.3p)(5n,6y)}1G(e){6.5h(e)}if((6.7l("af-2n")||"3H/a2").4J().14(/^(3H|6Z)\\/(x-)?(hR|hO)7q(;.*)?$/i)){6.ag()}}1t{(6.D["43"+53]||17.3p)(5n,6y);Q.3C.6q("43"+53,6,5n,6y)}1G(e){6.5h(e)}if(53=="7c"){6.1b.9U=17.3p}},7l:7(a7){1t{c 6.1b.hi(a7)}1G(e){c N}},a8:7(){1t{f 7t=6.7l("X-iv");c 7t?6X("("+7t+")"):N}1G(e){c N}},ag:7(){1t{c 6X(6.1b.5r)}1G(e){6.5h(e)}},5h:7(9l){(6.D.a1||17.3p)(6,9l);Q.3C.6q("a1",6,9l)}});Q.8c=1l.1k();l.k(l.k(Q.8c.m,Q.4K.m),{1S:7(3x,1x,a5){6.6C={2I:(3x.2I||3x),9M:(3x.9M||(3x.2I?N:3x))};6.1b=Q.9b();6.6n(a5);f a4=6.D.2j||17.3p;6.D.2j=(7(ad,a3){6.9T();a4(ad,a3)}).1j(6);6.95(1x)},9T:7(){f 4k=6.6C[6.2I()?"2I":"9M"];f 4v=6.1b.5r;if(!6.D.3G){4v=4v.2a()}if(4k=$(4k)){if(6.D.a6){I 6.D.a6(4k,4v)}W{4k.6N(4v)}}if(6.2I()){if(6.2j){3f(6.2j.1j(6),10)}}}});Q.ab=1l.1k();Q.ab.m=l.k(I Q.65(),{1S:7(9X,1x,9Z){6.6n(9Z);6.2j=6.D.2j;6.3m=(6.D.3m||2);6.2V=(6.D.2V||1);6.8e={};6.6C=9X;6.1x=1x;6.5b()},5b:7(){6.D.2j=6.9V.1j(6);6.3e()},7O:7(){6.8e.D.2j=P;g9(6.3t);(6.2j||17.3p).2d(6,L)},9V:7(80){if(6.D.2V){6.2V=(80.5r==6.9R?6.2V*6.D.2V:1);6.9R=80.5r}6.3t=3f(6.3e.1j(6),6.2V*6.3m*82)},3e:7(){6.8e=I Q.8c(6.6C,6.1x,6.D)}});7 $(5d){if(L.E>1){O(f i=0,7H=[],aa=L.E;i<aa;i++){7H.v($(L[i]))}c 7H}if(1h 5d=="57"){5d=C.hb(5d)}c h.k(5d)}if(17.8L.8z){C.ac=7(9Y,a9){f 8P=[];f 8h=C.5x(9Y,$(a9)||C,N,gw.gz,N);O(f i=0,9W=8h.gu;i<9W;i++){8P.v(8h.gs(i))}c 8P}}C.99=7(8W,8i){if(17.8L.8z){f q=".//*[gI(1u(\' \', @fa, \' \'), \' "+8W+" \')]";c C.ac(q,8i)}W{f 8k=($(8i)||C.1C).4j("*");f 8y=[],5I;O(f i=0,a0=8k.E;i<a0;i++){5I=8k[i];if(h.5R(5I,8W)){8y.v(h.k(5I))}}c 8y}};if(!1d.h){f h=I l()}h.k=7(1A){if(!1A||78||1A.5z==3){c 1A}if(!1A.fc&&1A.1c&&1A!=1d){f 3Y=l.4E(h.1e),fd=h.k.7e;if(1A.1c=="i7"){l.k(3Y,G.1e)}if(["gG","gC","gD"].18(1A.1c)){l.k(3Y,G.h.1e)}l.k(3Y,h.1e.7a);O(f 6K in 3Y){f 8M=3Y[6K];if(1h 8M=="7"&&!(6K in 1A)){1A[6K]=fd.7h(8M)}}}1A.fc=Y;c 1A};h.k.7e={7h:7(5J){c 6[5J]=6[5J]||7(){c 5J.2d(N,[6].1u($A(L)))}}};h.1e={7k:7(fe){c $(fe).o.2o!="6p"},dw:7(41){41=$(41);h[h.7k(41)?"ff":"fg"](41);c 41},ff:7(8H){$(8H).o.2o="6p";c 8H},fg:7(7S){$(7S).o.2o="";c 7S},4F:7(45){45=$(45);45.21.6R(45);c 45},6N:7(7T,12){12=1h 12=="P"?"":12.20();$(7T).2t=12.2a();3f(7(){12.3G()},10);c 7T},1W:7(2i,12){2i=$(2i);12=1h 12=="P"?"":12.20();if(2i.fb){2i.fb=12.2a()}W{f 7W=2i.dl.dk();7W.6M(2i);2i.21.h6(7W.dm(12.2a()),2i)}3f(7(){12.3G()},10);c 2i},V:7(59){59=$(59);f 8a="<"+59.1c.1D();$H({"id":"id","6i":"fa"}).J(7(3M){f f6=3M.4A(),f5=3M.7V();f 7X=(59[f6]||"").20();if(7X){8a+=" "+f5+"="+7X.V(Y)}});c 8a+">"},5L:7(31,f7){31=$(31);f 89=[];1g(31=31[f7]){if(31.5z==1){89.v(h.k(31))}}c 89},fs:7(f8){c $(f8).5L("21")},fk:7(f9){c $A($(f9).4j("*"))},gQ:7(25){if(!(25=$(25).5X)){c[]}1g(25&&25.5z!=1){25=25.6k}if(25){c[25].1u($(25).6r())}c[]},9v:7(fh){c $(fh).5L("gV")},6r:7(fi){c $(fi).5L("6k")},gW:7(52){52=$(52);c 52.9v().5F().1u(52.6r())},14:7(fq,50){if(1h 50=="57"){50=I 1z(50)}c 50.14($(fq))},fJ:7(fr,ft,fp){c 1z.3V($(fr).fs(),ft,fp)},g8:7(fo,fj,fl){c 1z.3V($(fo).fk(),fj,fl)},fY:7(fm,fn,f4){c 1z.3V($(fm).9v(),fn,f4)},g4:7(f3,eM,eL){c 1z.3V($(f3).6r(),eM,eL)},ie:7(){f 97=$A(L),eN=$(97.94());c 1z.9t(eN,97)},99:7(eO,fv){c C.99(fv,eO)},9o:7(3z,u){3z=$(3z);if(C.6V&&!1d.2s){f t=h.1P;if(t.1Q[u]){c t.1Q[u](3z,u)}if(t.5U[u]){u=t.5U[u]}f 8U=3z.4z[u];if(8U){c 8U.5a}}c 3z.dd(u)},hZ:7(eP){c $(eP).7s().2O},i1:7(eK){c $(eK).7s().2P},3b:7(eJ){c I h.6l(eJ)},5R:7(6L,9d){if(!(6L=$(6L))){c}f 6G=6L.6i;if(6G.E==0){c U}if(6G==9d||6G.14(I 6F("(^|\\\\s)"+9d+"(\\\\s|$)"))){c Y}c U},ik:7(4I,eF){if(!(4I=$(4I))){c}h.3b(4I).83(eF);c 4I},iD:7(4G,eE){if(!(4G=$(4G))){c}h.3b(4G).4F(eE);c 4G},ix:7(3A,6O){if(!(3A=$(3A))){c}h.3b(3A)[3A.5R(6O)?"4F":"83"](6O);c 3A},3Z:7(){1f.3Z.2d(1f,L);c $A(L).4A()},64:7(){1f.64.2d(1f,L);c $A(L).4A()},iq:7(3F){3F=$(3F);f 1w=3F.5X;1g(1w){f eG=1w.6k;if(1w.5z==3&&!/\\S/.2B(1w.5a)){3F.6R(1w)}1w=eG}c 3F},cB:7(eH){c $(eH).2t.14(/^\\s*$/)},fu:7(3N,6J){3N=$(3N),6J=$(6J);1g(3N=3N.21){if(3N==6J){c Y}}c U},eI:7(4q){4q=$(4q);f 3P=2r.4N(4q);1d.eI(3P[0],3P[1]);c 4q},1o:7(1R,1T){1R=$(1R);if(["f2","5p"].18(1T)){1T=(1h 1R.o.5k!="P"?"5k":"5p")}1T=1T.7m();f 1v=1R.o[1T];if(!1v){if(C.72&&C.72.eQ){f 7b=C.72.eQ(1R,N);1v=7b?7b[1T]:N}W{if(1R.eR){1v=1R.eR[1T]}}}if((1v=="58")&&["2P","2O"].18(1T)&&(1R.1o("2o")!="6p")){1v=1R["1H"+1T.eZ()]+"1U"}if(1d.2s&&["1B","1F","eW","cv"].18(1T)){if(h.1o(1R,"1n")=="8J"){1v="58"}}if(1T=="6H"){if(1v){c 3r(1v)}if(1v=(1R.1o("3q")||"").14(/4t\\(6H=(.*)\\)/)){if(1v[1]){c 3r(1v[1])/f1}}c 1}c 1v=="58"?N:1v},hm:7(1J,6P){1J=$(1J);O(f u in 6P){f 2T=6P[u];if(u=="6H"){if(2T==1){2T=(/f0/.2B(1M.2x)&&!/3s|3Q|3I/.2B(1M.2x))?0.hP:1;if(/70/.2B(1M.2x)&&!1d.2s){1J.o.3q=1J.1o("3q").1W(/4t\\([^\\)]*\\)/gi,"")}}W{if(2T==""){if(/70/.2B(1M.2x)&&!1d.2s){1J.o.3q=1J.1o("3q").1W(/4t\\([^\\)]*\\)/gi,"")}}W{if(2T<0.hU){2T=0}if(/70/.2B(1M.2x)&&!1d.2s){1J.o.3q=1J.1o("3q").1W(/4t\\([^\\)]*\\)/gi,"")+"4t(6H="+2T*f1+")"}}}}W{if(["f2","5p"].18(u)){u=(1h 1J.o.5k!="P")?"5k":"5p"}}1J.o[u.7m()]=2T}c 1J},7s:7(2l){2l=$(2l);f 7A=$(2l).1o("2o");if(7A!="6p"&&7A!=N){c{2P:2l.4b,2O:2l.42}}f 29=2l.o;f eT=29.7E;f eX=29.1n;f eY=29.2o;29.7E="6D";29.1n="3k";29.2o="i5";f eS=2l.dZ;f eU=2l.dY;29.2o=eY;29.1n=eX;29.7E=eT;c{2P:eS,2O:eU}},hx:7(2w){2w=$(2w);f 3P=h.1o(2w,"1n");if(3P=="8J"||!3P){2w.74=Y;2w.o.1n="5u";if(1d.2s){2w.o.1F=0;2w.o.1B=0}}c 2w},hq:7(1V){1V=$(1V);if(1V.74){1V.74=P;1V.o.1n=1V.o.1F=1V.o.1B=1V.o.cv=1V.o.eW=""}c 1V},iC:7(2b){2b=$(2b);if(2b.48){c 2b}2b.48=2b.o.6w||"58";if((h.1o(2b,"6w")||"7k")!="6D"){2b.o.6w="6D"}c 2b},iB:7(2e){2e=$(2e);if(!2e.48){c 2e}2e.o.6w=2e.48=="58"?"":2e.48;2e.48=N;c 2e}};l.k(h.1e,{d0:h.1e.fu});h.1P={};h.1P.5U={hW:"ht",hC:"hI",hj:"hf",i0:"ii",i8:"i9",ia:"g6",gh:"gU",gP:"gR",db:"h4",i6:"gM"};h.1P.1Q={7v:7(eC,dc){c eC.dd(dc,2)},5e:7(de,73){c $(de).6d(73)?73:N},o:7(df){c df.o.gZ.1D()},dg:7(dh){f 1w=dh.d5("dg");c 1w.d4?1w.5a:N}};l.k(h.1P.1Q,{gl:h.1P.1Q.7v,he:h.1P.1Q.7v,2G:h.1P.1Q.5e,ey:h.1P.1Q.5e,db:h.1P.1Q.5e,g0:h.1P.1Q.5e});h.1e.7a={6d:7(da,5g){f t=h.1P;5g=t.5U[5g]||5g;c $(da).d5(5g).d4}};if(C.6V&&!1d.2s){h.1e.6N=7(2p,12){2p=$(2p);12=1h 12=="P"?"":12.20();f 6Q=2p.1c.1K();if(["d3","7w","7z","d6"].18(6Q)){f T=C.4O("T");5c(6Q){1i"d3":1i"7w":T.2t="<2N><2K>"+12.2a()+"</2K></2N>";5K=2;11;1i"7z":T.2t="<2N><2K><6t>"+12.2a()+"</6t></2K></2N>";5K=3;11;1i"d6":T.2t="<2N><2K><6t><d7>"+12.2a()+"</d7></6t></2K></2N>";5K=4}$A(2p.2v).J(7(1w){2p.6R(1w)});5K.d9(7(){T=T.5X});$A(T.2v).J(7(1w){2p.6T(1w)})}W{2p.2t=12.2a()}3f(7(){12.3G()},10);c 2p}}l.k(h,h.1e);f 78=U;if(/3s|3Q|3I/.2B(1M.2x)){["","G","hX","ij","iA"].J(7(6g){f 7d="iF"+6g+"h";if(1d[7d]){c}f d8=1d[7d]={};d8.m=C.4O(6g?6g.1D():"T").hw})}h.eV=7(di){l.k(h.1e,di||{});7 4r(7f,7i,6j){6j=6j||U;f dj=h.k.7e;O(f 6m in 7f){f du=7f[6m];if(!6j||!(6m in 7i)){7i[6m]=dj.7h(du)}}}if(1h 79!="P"){4r(h.1e,79.m);4r(h.1e.7a,79.m,Y);4r(G.1e,hn.m);[hz,iz,i2].J(7(dt){4r(G.h.1e,dt.m)});78=Y}};f dv=I l();dv.2o=h.dw;1s.1p=7(dy){6.7x=dy};1s.1p.m={1S:7(dx,7B){6.B=$(dx);6.5W=7B.2a();if(6.7x&&6.B.ds){1t{6.B.ds(6.7x,6.5W)}1G(e){f dr=6.B.1c.1K();if(["7w","7z"].18(dr)){6.3E(6.dn())}W{2h e}}}W{6.2L=6.B.dl.dk();if(6.3B){6.3B()}6.3E([6.2L.dm(6.5W)])}3f(7(){7B.3G()},10)},dn:7(){f T=C.4O("T");T.2t="<2N><2K>"+6.5W+"</2K></2N>";c $A(T.2v[0].2v[0].2v)}};f 1p=I l();1p.dq=1l.1k();1p.dq.m=l.k(I 1s.1p("il"),{3B:7(){6.2L.ir(6.B)},3E:7(dp){dp.J((7(d2){6.B.21.6S(d2,6.B)}).1j(6))}});1p.d1=1l.1k();1p.d1.m=l.k(I 1s.1p("hs"),{3B:7(){6.2L.6M(6.B);6.2L.cI(Y)},3E:7(cG){cG.5F(U).J((7(cF){6.B.6S(cF,6.B.5X)}).1j(6))}});1p.cH=1l.1k();1p.cH.m=l.k(I 1s.1p("hN"),{3B:7(){6.2L.6M(6.B);6.2L.cI(6.B)},3E:7(cK){cK.J((7(cJ){6.B.6T(cJ)}).1j(6))}});1p.cE=1l.1k();1p.cE.m=l.k(I 1s.1p("hG"),{3B:7(){6.2L.hJ(6.B)},3E:7(cD){cD.J((7(cy){6.B.21.6S(cy,6.B.6k)}).1j(6))}});h.6l=1l.1k();h.6l.m={1S:7(eD){6.B=$(eD)},2q:7(cx){6.B.6i.3d(/\\s+/).1N(7(u){c u.E>0}).2q(cx)},9i:7(cw){6.B.6i=cw},83:7(9h){if(6.18(9h)){c}6.9i($A(6).1u(9h).2y(" "))},4F:7(9f){if(!6.18(9f)){c}6.9i($A(6).9g(9f).2y(" "))},20:7(){c $A(6).2y(" ")}};l.k(h.6l.m,1E);f 1z=1l.1k();1z.m={1S:7(cz){6.3y={3b:[]};6.4W=cz.20().4J();6.cA();6.cX()},cA:7(){7 5l(cC){2h"iE it in cV: "+cC}if(6.4W==""){5l("cB 4W")}f 2Y=6.3y,1Y=6.4W,22,9q,4D,9r;1g(22=1Y.14(/^(.*)\\[([a-9e-9j:-]+?)(?:([~\\|!]?=)(?:"([^"]*)"|([^\\]\\s]*)))?\\]$/i)){2Y.4z=2Y.4z||[];2Y.4z.v({u:22[2],60:22[3],15:22[4]||22[5]||""});1Y=22[1]}if(1Y=="*"){c 6.3y.cL=Y}1g(22=1Y.14(/^([^a-9e-9j-])?([a-9e-9j-]+)(.*)/i)){9q=22[1],4D=22[2],9r=22[3];5c(9q){1i"#":2Y.id=4D;11;1i".":2Y.3b.v(4D);11;1i"":1i P:2Y.1c=4D.1K();11;5H:5l(1Y.V())}1Y=9r}if(1Y.E>0){5l(1Y.V())}},cY:7(){f 3w=6.3y,1X=[],2g;if(3w.cL){1X.v("Y")}if(2g=3w.id){1X.v("B.9o(\\"id\\") == "+2g.V())}if(2g=3w.1c){1X.v("B.1c.1K() == "+2g.V())}if((2g=3w.3b).E>0){O(f i=0,cM=2g.E;i<cM;i++){1X.v("B.5R("+2g[i].V()+")")}}if(2g=3w.4z){2g.J(7(2m){f 4B="B.9o("+2m.u.V()+")";f 9m=7(cW){c 4B+" && "+4B+".3d("+cW.V()+")"};5c(2m.60){1i"=":1X.v(4B+" == "+2m.15.V());11;1i"~=":1X.v(9m(" ")+".18("+2m.15.V()+")");11;1i"|=":1X.v(9m("-")+".4A().1K() == "+2m.15.1K().V());11;1i"!=":1X.v(4B+" != "+2m.15.V());11;1i"":1i P:1X.v("B.6d("+2m.u.V()+")");11;5H:2h"hQ 60 "+2m.60+" in cV"}})}c 1X.2y(" && ")},cX:7(){6.14=I 9a("B","if (!B.1c) c U;       B = $(B);       c "+6.cY())},dA:7(2X){f 2W;if(2W=$(6.3y.id)){if(6.14(2W)){if(!2X||h.d0(2W,2X)){c[2W]}}}2X=(2X||C).4j(6.3y.1c||"*");f 90=[];O(f i=0,cZ=2X.E;i<cZ;i++){if(6.14(2W=2X[i])){90.v(h.k(2W))}}c 90},20:7(){c 6.4W}};l.k(1z,{cO:7(cT,cU){f 8T=I 1z(cU);c cT.1N(8T.14.1j(8T)).1m(h.k)},3V:7(cN,4S,92){if(1h 4S=="hg"){92=4S,4S=U}c 1z.cO(cN,4S||"*")[92||0]},9t:7(eg,cP){c cP.1m(7(cQ){c cQ.14(/[^\\s"]+(?:"[^"]*"[^\\s"]+)*/g).2c([N],7(cS,1Y){f dz=I 1z(1Y);c cS.2c([],7(cR,eh){c cR.1u(dz.dA(eh||eg))})})}).96()}});7 $$(){c 1z.9t(C,$A(L))}f G={7F:7(M){$(M).7F();c M},el:7(ei,ej){f 9s=ei.2c({},7(2J,4e){if(!4e.2G&&4e.u){f 1a=4e.u,5A=$(4e).1y();if(5A!=P){if(2J[1a]){if(2J[1a].3o!=1q){2J[1a]=[2J[1a]]}2J[1a].v(5A)}W{2J[1a]=5A}}}c 2J});c ej?9s:1O.3v(9s)}};G.1e={5q:7(M,ek){c G.el(G.3K(M),ek)},3K:7(M){c $A($(M).4j("*")).2c([],7(9L,9Q){if(G.h.4n[9Q.1c.1D()]){9L.v(h.k(9Q))}c 9L})},i3:7(M,6A,u){M=$(M);f 6z=M.4j("66");if(!6A&&!u){c $A(6z).1m(h.k)}O(f i=0,9N=[],ef=6z.E;i<ef;i++){f 6x=6z[i];if((6A&&6x.2n!=6A)||(u&&6x.u!=u)){6B}9N.v(h.k(6x))}c 9N},em:7(M){M=$(M);M.3K().J(7(9P){9P.ex();9P.2G="Y"});c M},en:7(M){M=$(M);M.3K().J(7(ee){ee.2G=""});c M},e8:7(M){c $(M).3K().e9(7(6u){c 6u.2n!="6D"&&!6u.2G&&["66","1N","9F"].18(6u.1c.1D())})},hY:7(M){M=$(M);M.e8().ec();c M}};l.k(G,G.1e);G.h={9w:7(9O){$(9O).9w();c 9O},1N:7(9I){$(9I).1N();c 9I}};G.h.1e={5q:7(3j){3j=$(3j);if(!3j.2G&&3j.u){f 9y=3j.1y();if(9y!=P){f 3M={};3M[3j.u]=9y;c 1O.3v(3M)}}c""},1y:7(4u){4u=$(4u);f ea=4u.1c.1D();c G.h.4n[ea](4u)},eb:7(9x){$(9x).15="";c 9x},ih:7(ed){c $(ed).15!=""},ec:7(2A){2A=$(2A);2A.9w();if(2A.1N&&(2A.1c.1D()!="66"||!["7J","7F","ic"].18(2A.2n))){2A.1N()}c 2A},em:7(4m){4m=$(4m);4m.2G=Y;c 4m},en:7(3L){3L=$(3L);3L.ex();3L.2G=U;c 3L}};l.k(G.h,G.h.1e);f ib=G.h;f $F=G.h.1y;G.h.4n={66:7(6e){5c(6e.2n.1D()){1i"e7":1i"e6":c G.h.4n.ew(6e);5H:c G.h.4n.9F(6e)}},ew:7(9H){c 9H.ey?9H.15:N},9F:7(ez){c ez.15},1N:7(9E){c 6[9E.2n=="1N-g7"?"eB":"eA"](9E)},eB:7(93){f 8R=93.g2;c 8R>=0?6.86(93.D[8R]):N},eA:7(85){f 6h,84=85.E;if(!84){c N}O(f i=0,6h=[];i<84;i++){f 3l=85.D[i];if(3l.fX){6h.v(6.86(3l))}}c 6h},86:7(3l){c h.k(3l).6d("15")?3l.15:3l.3H}};1s.5Y=7(){};1s.5Y.m={1S:7(eu,ev,ep){6.3m=ev;6.B=$(eu);6.3J=ep;6.2F=6.1y();6.2Z()},2Z:7(){eo(6.3e.1j(6),6.3m*82)},3e:7(){f 3R=6.1y();f eq=("57"==1h 6.2F&&"57"==1h 3R?6.2F!=3R:1Z(6.2F)!=1Z(3R));if(eq){6.3J(6.B,3R);6.2F=3R}}};G.h.61=1l.1k();G.h.61.m=l.k(I 1s.5Y(),{1y:7(){c G.h.1y(6.B)}});G.61=1l.1k();G.61.m=l.k(I 1s.5Y(),{1y:7(){c G.5q(6.B)}});1s.2S=7(){};1s.2S.m={1S:7(er,et){6.B=$(er);6.3J=et;6.2F=6.1y();if(6.B.1c.1D()=="M"){6.es()}W{6.2Z(6.B)}},81:7(){f 5m=6.1y();if(6.2F!=5m){6.3J(6.B,5m);6.2F=5m}},es:7(){G.3K(6.B).J(6.2Z.1j(6))},2Z:7(54){if(54.2n){5c(54.2n.1D()){1i"e7":1i"e6":1f.3Z(54,"gf",6.81.1j(6));11;5H:1f.3Z(54,"gb",6.81.1j(6));11}}}};G.h.2S=1l.1k();G.h.2S.m=l.k(I 1s.2S(),{1y:7(){c G.h.1y(6.B)}});G.2S=1l.1k();G.2S.m=l.k(I 1s.2S(),{1y:7(){c G.5q(6.B)}});if(!1d.1f){f 1f=I l()}l.k(1f,{ga:8,gc:9,gd:13,ge:27,fW:37,fV:38,fE:39,fD:40,fF:46,fG:36,fC:35,fB:33,fx:34,B:7(7M){c 7M.fz||7M.fA},fI:7(5j){c(((5j.dL)&&(5j.dL==1))||((5j.7J)&&(5j.7J==1)))},fT:7(7G){c 7G.fU||(7G.fQ+(C.5s.4d||C.1C.4d))},fP:7(7I){c 7I.fL||(7I.fK+(C.5s.44||C.1C.44))},7O:7(4c){if(4c.dK){4c.dK();4c.fN()}W{4c.fO=U;4c.gm=Y}},3V:7(dM,dN){f 2U=1f.B(dM);1g(2U.21&&(!2U.1c||(2U.1c.1K()!=dN.1K()))){2U=2U.21}c 2U},26:U,dJ:7(3g,u,51,6E){if(!6.26){6.26=[]}if(3g.dP){6.26.v([3g,u,51,6E]);3g.dP(u,51,6E)}W{if(3g.7U){6.26.v([3g,u,51,6E]);3g.7U("43"+u,51)}}},dE:7(){if(!1f.26){c}O(f i=0,dO=1f.26.E;i<dO;i++){1f.64.2d(6,1f.26[i]);1f.26[i][0]=N}1f.26=U},3Z:7(55,u,dI,6o){55=$(55);6o=6o||U;if(u=="dD"&&(1M.8g.14(/3s|3Q|3I/)||55.7U)){u="dC"}1f.dJ(55,u,dI,6o)},64:7(2E,u,7R,68){2E=$(2E);68=68||U;if(u=="dD"&&(1M.8g.14(/3s|3Q|3I/)||2E.7Q)){u="dC"}if(2E.dB){2E.dB(u,7R,68)}W{if(2E.7Q){1t{2E.7Q("43"+u,7R)}1G(e){}}}}});if(1M.8g.14(/\\h1\\b/)){1f.3Z(1d,"ha",1f.dE,U)}f 2r={dF:U,8r:7(){6.dQ=1d.hc||C.5s.4d||C.1C.4d||0;6.dR=1d.h7||C.5s.44||C.1C.44||0},dG:7(47){f 8E=0,8F=0;do{8E+=47.44||0;8F+=47.4d||0;47=47.21}1g(47);c[8F,8E]},4N:7(3X){f 8C=0,8B=0;do{8C+=3X.3n||0;8B+=3X.3i||0;3X=3X.24}1g(3X);c[8B,8C]},e4:7(2u){f 8I=0,8D=0;do{8I+=2u.3n||0;8D+=2u.3i||0;2u=2u.24;if(2u){if(2u.1c=="e1"){11}f p=h.1o(2u,"1n");if(p=="5u"||p=="3k"){11}}}1g(2u);c[8D,8I]},24:7(28){if(28.24){c 28.24}if(28==C.1C){c 28}1g((28=28.21)&&28!=C.1C){if(h.1o(28,"1n")!="8J"){c 28}}c C.1C},h3:7(4R,x,y){if(6.dF){c 6.dH(4R,x,y)}6.4L=x;6.4U=y;6.1H=6.4N(4R);c(y>=6.1H[1]&&y<6.1H[1]+4R.42&&x>=6.1H[0]&&x<6.1H[0]+4R.4b)},dH:7(4V,x,y){f 8O=6.dG(4V);6.4L=x+8O[0]-6.dQ;6.4U=y+8O[1]-6.dR;6.1H=6.4N(4V);c(6.4U>=6.1H[1]&&6.4U<6.1H[1]+4V.42&&6.4L>=6.1H[0]&&6.4L<6.1H[0]+4V.4b)},gv:7(5V,4C){if(!5V){c 0}if(5V=="gx"){c((6.1H[1]+4C.42)-6.4U)/4C.42}if(5V=="gy"){c((6.1H[0]+4C.4b)-6.4L)/4C.4b}},8A:7(8K){f 5v=0,5t=0;f 1I=8K;do{5v+=1I.3n||0;5t+=1I.3i||0;if(1I.24==C.1C){if(h.1o(1I,"1n")=="3k"){11}}}1g(1I=1I.24);1I=8K;do{if(!1d.2s||1I.1c=="e1"){5v-=1I.44||0;5t-=1I.4d||0}}1g(1I=1I.21);c[5t,5v]},4E:7(3U,2z){f 3a=l.k({e0:Y,e2:Y,e3:Y,e5:Y,3n:0,3i:0},L[2]||{});3U=$(3U);f p=2r.8A(3U);2z=$(2z);f 49=[0,0];f 6f=N;if(h.1o(2z,"1n")=="3k"){6f=2r.24(2z);49=2r.8A(6f)}if(6f==C.1C){49[0]-=C.1C.3i;49[1]-=C.1C.3n}if(3a.e0){2z.o.1B=(p[0]-49[0]+3a.3i)+"1U"}if(3a.e2){2z.o.1F=(p[1]-49[1]+3a.3n)+"1U"}if(3a.e3){2z.o.2P=3U.4b+"1U"}if(3a.e5){2z.o.2O=3U.42+"1U"}},gA:7(19){19=$(19);if(19.o.1n=="3k"){c}2r.8r();f 8l=2r.e4(19);f 1F=8l[1];f 1B=8l[0];f dT=19.dZ;f dS=19.dY;19.dV=1B-3r(19.o.1B||0);19.dU=1F-3r(19.o.1F||0);19.dW=19.o.2P;19.dX=19.o.2O;19.o.1n="3k";19.o.1F=1F+"1U";19.o.1B=1B+"1U";19.o.2P=dT+"1U";19.o.2O=dS+"1U"},gH:7(1r){1r=$(1r);if(1r.o.1n=="5u"){c}2r.8r();1r.o.1n="5u";f 1F=3r(1r.o.1F||0)-(1r.dU||0);f 1B=3r(1r.o.1B||0)-(1r.dV||0);1r.o.1F=1F+"1U";1r.o.1B=1B+"1U";1r.o.2O=1r.dX;1r.o.2P=1r.dW}};if(/3s|3Q|3I/.2B(1M.2x)){2r.4N=7(2R){f 8u=0,8t=0;do{8u+=2R.3n||0;8t+=2R.3i||0;if(2R.24==C.1C){if(h.1o(2R,"1n")=="3k"){11}}2R=2R.24}1g(2R);c[8t,8u]}}h.eV();',62,1159,'||||||this|function|||||return|||var||Element|||extend|Object|prototype||style||||||name|push||||||element|document|options|length||Form||new|each||arguments|form|null|for|undefined|Ajax|||div|false|inspect|else||true|||break|html||match|value||Prototype|include|_226|key|transport|tagName|window|Methods|Event|while|typeof|case|bind|create|Class|map|position|getStyle|Insertion|Array|_22c|Abstract|try|concat|_150|node|url|getValue|Selector|_105|left|body|toLowerCase|Enumerable|top|catch|offset|_21f|_152|toUpperCase|method|navigator|select|Hash|_attributeTranslations|values|_14e|initialize|_14f|px|_160|replace|_19a|expr|String|toString|parentNode|_195|gsub|offsetParent|_120|observers||_212|els|stripScripts|_161|inject|apply|_162|_b2|_19b|throw|_112|onComplete|toArray|_156|_19e|type|display|_16d|_each|Position|opera|innerHTML|_20e|childNodes|_15e|userAgent|join|_221|_1da|test|_d7|_bc|_204|lastValue|disabled|_35|success|_1b9|tbody|range|_20|table|height|width|_39|_22f|EventObserver|_155|_1f9|decay|_1a3|_1a2|_193|registerCallback||_11b|_37||||||||_222|classNames|end|split|onTimerEvent|setTimeout|_1fa|_da|offsetLeft|_1d3|absolute|opt|frequency|offsetTop|constructor|emptyFunction|filter|parseFloat|Konqueror|timer|_5|toQueryString|_199|_e7|params|_136|_144|initializeRange|Responders|_97|insertContent|_146|evalScripts|text|KHTML|callback|getElements|_1dc|pair|_14a|slice|pos|Safari|_1ec|_db|_21|_220|findElement|_36|_20b|_106|observe||_10c|offsetHeight|on|scrollTop|_10f||_208|_overflow|_224|_29|offsetWidth|_1f6|scrollLeft|_1ba|_b7|_1f|_|_24|getElementsByTagName|_ed|_28|_1db|Serializers|_c1|_c6|_14c|copy|pluck|alpha|_1d6|_ee|parameters|_7b|post|attributes|first|_19f|_21b|_197|clone|remove|_142|_a0|_140|strip|Request|xcomp|_7c|cumulativeOffset|createElement|_77|_78|_213|_1ab|_a9|ycomp|_216|expression|_aa|_b4|_6d|_125|_1fc|_123|_e1|_1f1|_200|responders|string|auto|_115|nodeValue|start|switch|_f3|_flag|_50|_16b|dispatchException|Template|_1f3|styleFloat|abort|_1f0|_e2|_93|cssFloat|serialize|responseText|documentElement|_21e|relative|_21d|_23|evaluate|_b1|nodeType|_1bc|status|encodeURIComponent|charAt|asynchronous|reverse|obj|default|_102|_10a|depth|recursivelyCollect|_ac|currentlyExecuting|_38|_b3|_1e|hasClassName|_a7|_4c|names|mode|content|firstChild|TimedObserver|_4a|operator|Observer|ScriptFragment|_3f|stopObserving|Base|input|_45|_207|ObjectRange|_c7|_6f|_bf|hasAttribute|_1dd|_225|tag|_1e4|className|_179|nextSibling|ClassNames|_17b|setOptions|_203|none|dispatch|nextSiblings|_b8|tr|_1cf|_6e|overflow|_1c9|_e3|_1c5|_1c3|continue|container|hidden|_1fd|RegExp|_13f|opacity|_d2|_14b|_108|_13d|selectNodeContents|update|_145|_153|_16f|removeChild|insertBefore|appendChild|_reverse|all|encoding|eval|_de|application|MSIE|activeRequestCount|defaultView|_166|_madePositioned|_ba|_complete|_bb|_nativeExtensions|HTMLElement|Simulated|css|Complete|_174|cache|_177|succ|findOrStore|_178|toQueryParams|visible|getHeader|camelize|_cc|_d9|Version|script|_a8|getDimensions|_e5|onStateChange|_getAttr|TBODY|adjacency|_df|TR|_157|_180|respondToReadyState|_ce|visibility|reset|_1f4|_f5|_1f5|button|len|substring|_1f2|_3b|stop|_34|detachEvent|_206|_10e|_110|attachEvent|last|_114|_11a|_3e|_54|_f2|onElementEvent|1000|add|_1e5|_1e3|optionValue|_4d|_4e|_11d|_116|prepareReplacement|Updater|_46|updater|interpret|appVersion|_fa|_fe|_a|_100|_227|_e|_14|_12|_10|_9|prepare|_3|_231|_230|_4|_2|_7|_101|XPath|page|_20d|_20c|_210|_209|_20a|_25|_10d|_20f|static|_21c|BrowserFeatures|_109|_16|_219|_f9|_1c|_1e2|_58|_1a9|_139|_80|_fd|_84|_88|_89|_1a4|_7f|_1ac|_1e1|shift|request|flatten|args|_81|getElementsByClassName|Function|getTransport|_98|_13e|z0|_190|without|_18f|set|9_|_92|_e6|_1a0|_8c|readAttribute|criteria|_196|rest|data|findChildElements|_65|previousSiblings|focus|_1d8|_1d4|_6c|_66|_60|_5c|_5d|_1e0|textarea|_61|_1de|_1d2|_6a|_75|_1c0|failure|_1c7|_1d1|_1cb|_1c1|lastText|_e0|updateContent|onreadystatechange|updateComplete|_fc|_ef|_f7|_f1|_104|onException|javascript|_ec|_ea|_e9|insertion|_e4|evalJSON|_f8|_f6|PeriodicalUpdater|_getElementsByXPath|_eb|Events|Content|evalResponse|_83|_51|_4f|_4b|_52|_53|_56|_55|_48|_49|Pattern|_43|_42|template|pattern|_47|_44|_57|_59|_69|_6b|_67|eachSlice|_70|_72|_71|_64|_63|_5b|_5a|_5e|_5f|_68|_62|_41|_40|_19|_18|_15|PeriodicalExecuter|_1a|_1d|_1b|_13|_11|_8|_6|_b|_c|_f|_d|index|_22|_31|stripTags|_2f|_32|_33|_3d|decodeURIComponent|_2d|extractScripts|_27|_26|img|_2a|_2b|_2c|_73|_74|ActiveXObject|these|Try|XMLHTTP|_cb|_cf|_cd|_ca|_c8|_c0|_be|_b9|_c2|_c4|exclusive|_c5|_d0|_d1|xml|XMLHttpRequest|setRequestHeaders|contentType|overrideMimeType|requestHeaders|2005|readyState|_d8|_d3|register|_d5|get|onCreate|indexOf|keys|_b5|_8d|_8b|_8a|_8e|_8f|_96|_94|_87|_85|_79|_76|_7a|_7d|_82|_7e|collect|detect|_a6|_a3|_a5|size|_ae|reduce|compact|_a2|_a1|_9a|findAll|_9d|_9b|_9f|_9e|_dd|bottom|_18e|_18c|_18a|_191|parseExpression|empty|_192|_189|After|_186|_185|Bottom|collapse|_188|_187|wildcard|_19d|_1aa|matchElements|_1ae|_1af|_1b3|_1b0|_1a7|_1a8|selector|_1a1|compileMatcher|buildMatchExpression|_1a6|childOf|Top|_184|THEAD|specified|getAttributeNode|TD|td|_175|times|_16a|readonly|_164|getAttribute|_165|_167|title|_168|_176|_17a|createRange|ownerDocument|createContextualFragment|contentFromAnonymousTable||_183|Before|_181|insertAdjacentHTML|_17d|_17c|Toggle|toggle|_17f|_17e|_1b2|findElements|removeEventListener|keydown|keypress|unloadCache|includeScrollOffsets|realOffset|withinIncludingScrolloffsets|_202|_observeAndCache|preventDefault|which|_1f7|_1f8|_1ff|addEventListener|deltaX|deltaY|_22b|_22a|_originalTop|_originalLeft|_originalWidth|_originalHeight|clientHeight|clientWidth|setLeft|BODY|setTop|setWidth|positionedOffset|setHeight|radio|checkbox|findFirstElement|find|_1d7|clear|activate|_1d9|_1cd|_1c8|_1ad|_1b4|_1b6|_1b7|_1be|serializeElements|disable|enable|setInterval|_1eb|_1ed|_1ee|registerFormCallbacks|_1ef|_1e9|_1ea|inputSelector|blur|checked|_1df|selectMany|selectOne|_163|_18b|_143|_141|_148|_149|scrollTo|_13c|_13b|_131|_130|_133|_134|_13a|getComputedStyle|currentStyle|_15c|_159|_15d|addMethods|right|_15a|_15b|capitalize|Gecko|100|float|_12f|_12e|_119|_118|_11c|_11e|_11f|class|outerHTML|_extended|_107|_10b|hide|show|_121|_122|_12a|descendants|_12b|_12c|_12d|_129|_128|_124|_126|ancestors|_127|descendantOf|_135|dasherize|KEY_PAGEDOWN|underscore|target|srcElement|KEY_PAGEUP|KEY_END|KEY_DOWN|KEY_RIGHT|KEY_DELETE|KEY_HOME|parseQuery|isLeftClick|up|clientY|pageY|open|stopPropagation|returnValue|pointerY|clientX|charCodeAt|fromCharCode|pointerX|pageX|KEY_UP|KEY_LEFT|selected|previous|send|multiple|unregister|selectedIndex|Microsoft|next|Msxml2|tabIndex|one|down|clearTimeout|KEY_BACKSPACE|change|KEY_TAB|KEY_RETURN|KEY_ESC|click|postBody|enctype||charset|any|href|cancelBubble|unescapeHTML|Number|toColorPart|event|Uninitialized|snapshotItem|_method|snapshotLength|overlap|XPathResult|vertical|horizontal|ORDERED_NODE_SNAPSHOT_TYPE|absolutize|bindAsEventListener|TEXTAREA|SELECT|RangeError|instanceof|INPUT|relativize|contains|Loading|Loaded|Interactive|longDesc|clearInterval|finally|maxlength|immediateDescendants|maxLength|www|urlencoded|encType|previousSibling|siblings|createTextNode|escapeHTML|cssText|truncate|bMSIE|UTF|within|readOnly|callee|replaceChild|pageYOffset|sub|scan|unload|getElementById|pageXOffset|grep|src|vAlign|number|_86|getResponseHeader|valign|reject|member|setStyle|HTMLFormElement|With|setRequestHeader|undoPositioned|partition|afterBegin|colSpan|entries|Requested|__proto__|makePositioned|Accept|HTMLInputElement|sortBy|200|rowspan|_95|uniq|300|afterEnd|delete|rowSpan|setStartAfter|Failure|pop|sort|beforeEnd|ecma|999999|Unknown|java|merge|zip|00001|from|colspan|Input|focusFirstElement|getHeight|datetime|getWidth|HTMLSelectElement|getInputs|invoke|block|longdesc|FORM|accesskey|accessKey|tabindex|Field|submit||getElementsBySelector||inGroupsOf|present|dateTime|TextArea|addClassName|beforeBegin|||min|close|cleanWhitespace|setStartBefore|object|error|call|JSON|Connection|toggleClassName|max|HTMLTextAreaElement|Select|undoClipping|makeClipping|removeClassName|Parse|HTML|Success'.split('|'),0,{}))/**
* @author Kaiser Shahid
* @copyright 2007-2010
* @site www.qaiser.net
*/

// compatibility since this was built for mootools
function $type( obj ) { return typeof obj; }

// for some reason, getTimezoneOffset wasn't returning the negative.
// TODO: verify that getUTCHours() is correct
// TODO: adjust for daylight savings
Date.prototype.getTimezoneOffset = function()
{
	return 330;
	var ltime = this.getHours() * 60 + this.getMinutes();
	var gtime = this.getUTCHours() * 60 + this.getUTCMinutes();
	var delta = ltime - gtime;
	return delta;
}

Date.prototype.getTimezoneGMT= function()
{
	var val = this.getTimezoneOffset() / 60;
	var _s = '-', _p = '';
	
	if ( val >= 0 ) _s = '+';
	else val = 0 - val; // adjust to make it positive now
	if ( val < 10 ) _p = '0'; // leading 0 padding
	
	var _t = val.toString().split( '.' );
	if ( _t.length == 2 )
		val = _s + _p + _t[0] + ( parseFloat( '.' + _t[1] ) * 60 );
	else
		val = _s + _p + _t[0] + '00';
	
	return val;
}

/**
* @param format String Should be similar to strftime() function
* @param timestamp Date [Optional] If not given, use current time.
*/

Date.__format = '%Y-%m-%d %H:%i:%s';
Date.format = function()
{
	var format = '';
	var d = null;
	
	if ( arguments.length > 0 )
		format = arguments[0];
	else
		format = Date.__format;
	
	if ( arguments.length > 1 )
	{
		d = arguments[1];
		if ( $type( d ) == 'number' )
			d = new Date( d );
	}
	else
		d = new Date();
	
	/*if ( !Date.qkopts['format_cache'][format] )
		Date.qkopts['format_cache'][format] = Date.format_compile( format );
	
	var _format = Date.qkopts['format_cache'][format];*/
	
	var _format = format.split( '' );
	var cache = {}, tmp = null, reg = null, val = null;
	var buffer = '';
	
	for ( var i = 0; i < _format.length; i++ )
	{
		token = _format[i];
		
		if ( token == '%' )
		{
			// read-ahead
			token = _format[i+1];
			if ( token == '%' )
			{
				buffer += '%';
				i++;
				continue;
			}
			i++;
		}
		else
		{
			buffer += token;
			continue;
		}
		
		if ( !cache[token] )
		{
			var t = null;
			// omitted placeholders: G, g, E*, O*, Z
			switch ( token )
			{
				case 'A': val = Date.__locale['days'][d.getDay()]; break; // replaced by national representation of the full weekday name
				case 'a': val = Date.__locale['days_abbr'][d.getDay()]; break; // replaced by national representation of the abbreviated weekday name
				case 'B': val = Date.__locale['months'][d.getMonth()]; break; // is replaced by national representation of the full month name
				case 'b': val = Date.__locale['months_abbr'][d.getMonth()]; break; // is replaced by national representation of the abbreviated month name
				case 'C': val = Math.round( d.getFullYear() / 100 ); break; // is replaced by (year / 100) as decimal number; single digits are preceeded by 0
				case 'c': val = Date.format( Date.__locale['datetime'], d ); break; // replaced by national representation of time and date
				case 'D': val = Date.format( '%m/%d/%y', d ); break; // is equivalent to: %m/%d/%y
				case 'd': val = Date.__f_0p( d.getDate() ); break;
				case 'E*': break; // not implemented
				case 'O*': break; // not implemented
				case 'e': val = d.getDate(); break; // replaced by the day of month as a decimal number (1-31); single digits are preceded by a blank
				case 'F': val = Date.format( '%Y-%m-%d', d ); break; // is equivalent to: %Y-%m-%d
				case 'G': break; // is replaced by a year as a decimal number with century.  This year is the one that contains the greater part of the week (Monday as the first day of the week).
				case 'g': break; // is replaced by the same year as in ``%G'', but as a decimal number  without century (00-99).
				case 'H': val = Date.__f_0p( d.getHours() ); break; // is replaced by the hour (24-hour clock) as a decimal number (00-23).
				case 'h': val = Date.__locale['months_abbr'][d.getMonth()]; break; // the same as %b.
				case 'I': // is replaced by the hour (12-hour clock) as a decimal number (01-12).
					val = d.getHours();
					if ( val > 12 ) val = val % 12;
					else if ( val == 0 ) val = 12;
					val = Date.__format_0p( val );
				break;
				//case 'i': val = Date.__f_0p( d.getMinutes() ); break;
				case 'j': val = Date.__f_daysinyear( d ); break; // is replaced by the day of the year as a decimal number (001-366).
				case 'k': val = d.getHours(); break; // is replaced by the hour (24-hour clock) as a decimal number (0-23); single digits are preceded by a blank.
				case 'l': // is replaced by the hour (12-hour clock) as a decimal number (1-12); single digits are preceded by a blank.
					val = d.getHours();
					if ( val > 12 ) val = val % 12;
					else if ( val == 0 ) val = 12;
				break;
				case 'M': val = Date.__f_0p( d.getMinutes() ); break; // is replaced by the minute as a decimal number (00-59).
				case 'm': val = Date.__locale['months_num'][d.getMonth()]; break; // is replaced by the month as a decimal number (01-12).
				case 'n': val = "\n"; break; // is replaced by a newline.
				case 'p': // is replaced by national representation of either "ante meridiem" or "post meridiem" as appropriate.
					var _m = d.getHours();
					if ( _m < 12 ) val = Date.__locale['ampm'][0];
					else val = Date.__locale['ampm'][1];
				break;
				case 'R': val = Date.format( '%H:%M', d ); break; // is equivalent to: %H:%M.
				case 'r': val = Date.format( '%I:%M:%S %p' ); break; // is equivalent to: %I:%M:%S %p.
				case 'S': val = Date.__f_0p( d.getSeconds() ); break; // is replaced by the second as a decimal number (00-60).
				case 's': val = d.getTime(); break; // is replaced by the number of seconds since the Epoch, UTC (see mktime(3)).
				case 'T': val = Date.format( '%H:%M:%S', d ); break; // is equivalent to: %H:%M:%S.
				case 't': val = "	"; break; // is replaced by a tab.
				case 'U': val = Date.__f_weeksinyear( d, 'U' ); break; // is replaced by the week number of the year (Sunday as the first day of the week) as a decimal number (00-53).
				case 'u': val = d.getDay() + 1; break; // is replaced by the weekday (Monday as the first day of the week) as a decimal number (1-7).
				case 'V': val = Date.__f_weeksinyear( d, 'V' ); break; // is replaced by the week number of the year (Monday as the first day of the week) as a decimal number (01-53).  If the week containing January 1 has four or more days in the new year, then it is week 1; otherwise it is the last week of the previous year, and the next week is week 1.
				case 'v': val = Date.format( '%e-%b-%Y', d ); break; // is equivalent to: %e-%b-%Y.
				case 'W': val = Date.__f_weeksinyear( d, 'W' ); break; // is replaced by the week number of the year (Monday as the first day of the week) as a decimal number (00-53).
				case 'w': val = d.getDay(); break; // is replaced by the weekday (Sunday as the first day of the week) as a decimal number (0-6).
				case 'X': val = Date.format( Date.__locale['time'], d ); break; // is replaced by national representation of the time.
				case 'x': val = Date.format( Date.__locale['date'], d ); break; // is replaced by national representation of the date.
				case 'Y': val = d.getFullYear(); break; // is replaced by the year with century as a decimal number.
				case 'y': val = d.getFullYear().toString().substring( 2, 4 ); break; // is replaced by the year without century as a decimal number (00-99).
				case 'Z': val = d.getTimezoneGMT(); break; // is replaced by the time zone name.
				case 'z': val = d.getTimezoneOffset() / 60; break; // is replaced by the time zone offset from UTC; a leading plus sign stands for east of UTC, a minus sign for west of UTC, hours and minutes follow with two digits each and no delimiter between them (common form for RFC 822 date headers).
			}
			
			cache[token] = val;
		}
		
		val = cache[token];
		buffer += val;
	}
	
	return buffer;
};

// TODO: research more locale stuff and have a function to set locale info?
// TODO: be able to load locale dynamically [via ajax or remote scripting]
Date.__locale = {
 	'days': ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
 	, 'days_abbr': ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
 	, 'daysinmonth': [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
 	, 'months': ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
	, 'months_abbr': ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
	, 'months_num': ['01','02','03','04','05','06','07','08','09','10','11','12'] // month as a 2-char decimal number
	, 'ampm': ['am', 'pm']
	, 'date': '%Y-%m-%d'
	, 'time': '%H:%M:%S'
	, 'datetime': '%Y-%m-%d %H:%M:%S'
};

// 0-pad single digits
Date.__f_0p = function( num ) { num = num.toString(); if ( num.length == 1 ) num = '0' + num; return num; }

// calculate days in the year [000-366]
Date.__f_daysinyear = function( d )
{
	var _m = d.getMonth();
	var _y = d.getFullYear();
	var _d = d.getDate();
	var tot = 0;
	
	for ( var j = 0; j < _m; j++ )
		tot += Date.__locale['daysinmonth'][j];
	if ( _y % 4 == 0 && _m > 1 ) // leap year
		tot++;
	
	// TODO: pad with 0s if needed (%03d)
	return tot;
}

// TODO: fill in timezone names
// TODO: determine DST
Date.__tzs = {
	'0000': 'GMT'
	, '-0500': 'Eastern'
};

/**
* type is:
* 'U' - week starting on a Sunday, 00-53
* 'V' - week starting on a Monday, 01-53; if four or more days in week starting Jan 1, week is 01, else, 53
* 'W' - week starting on a Monday, 00-53
*/
// TODO: finish this (or at least W)!
Date.__f_weeksinyear = function( d, type )
{
	var n = new Date( d.getTime() );
	// set jan 1.
	return '';
}

// accessible to instances
Date.prototype.format = function()
{
	if ( arguments.length == 0 )
		return Date.format();
	else if ( arguments.length == 1 )
		return Date.format( arguments[0] );
	else
		return Date.format( arguments[0], arguments[1] );
}

//var k = new Date();
//alert( Date.format( '%%A %A %a %B %b | %D | %F | %U %z %Z', k ) );
/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;
//v1.0
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}
var clear="http://assets.aarp.org/aarp.org_/images/global/clear.gif"; //path to clear.gif

pngfix=function(){var els=document.getElementsByTagName('*');var ip=/\.png/i;var i=els.length;while(i-- >0){var el=els[i];var es=el.style;if(el.src&&el.src.match(ip)&&!es.filter){es.height=el.height;es.width=el.width;es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+el.src+"',sizingMethod='crop')";el.src=clear;}else{var elb=el.currentStyle.backgroundImage;if(elb.match(ip)){var path=elb.split('"');var rep=(el.currentStyle.backgroundRepeat=='no-repeat')?'crop':'scale';es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path[1]+"',sizingMethod='"+rep+"')";es.height=el.clientHeight+'px';es.backgroundImage='none';var elkids=el.getElementsByTagName('*');if (elkids){var j=elkids.length;if(el.currentStyle.position!="absolute")es.position='static';while (j-- >0)if(!elkids[j].style.position)elkids[j].style.position="relative";}}}}}
try { window.attachEvent('onload',pngfix); }
catch ( err ) { }// script.aculo.us scriptaculous.js v1.7.0, Fri Jan 19 19:16:36 CET 2007

// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// 
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
// 
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// For details, see the script.aculo.us web site: http://script.aculo.us/

var Scriptaculous = {
  Version: '1.7.0',
  require: function(libraryName) {
    // inserting via DOM fails in Safari 2.0, so brute force approach
    document.write('<script type="text/javascript" src="'+libraryName+'"></script>');
  },
  load: function() {
    if((typeof Prototype=='undefined') || 
       (typeof Element == 'undefined') || 
       (typeof Element.Methods=='undefined') ||
       parseFloat(Prototype.Version.split(".")[0] + "." +
                  Prototype.Version.split(".")[1]) < 1.5)
       throw("script.aculo.us requires the Prototype JavaScript framework >= 1.5.0");
    
    $A(document.getElementsByTagName("script")).findAll( function(s) {
      return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
    }).each( function(s) {
      var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
      var includes = s.src.match(/\?.*load=([a-z,]*)/);
      (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider').split(',').each(
       function(include) { Scriptaculous.require(path+include+'.js') });
    });
  }
}

Scriptaculous.load();eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('4O.G.1I=8(){g 2m="#";c(6.2p(0,4)=="7S("){g 6X=6.2p(4,6.1u-1).7T(",");g i=0;7Q{2m+=3b(6X[i]).4F()}7O(++i<3)}1H{c(6.2p(0,1)=="#"){c(6.1u==4){37(g i=1;i<4;i++){2m+=(6.4q(i)+6.4q(i)).3M()}}c(6.1u==7){2m=6.3M()}}}j(2m.1u==7?2m:(u[0]||6))};J.4A=8(6S){j $A($(6S).3f).7a(8(30){j(30.3T==3?30.3X:(30.7c()?J.4A(30):""))}).3w().7e("")};J.4B=8(7b,3Q){j $A($(7b).3f).7a(8(2a){j(2a.3T==3?2a.3X:((2a.7c()&&!J.7K(2a,3Q))?J.4B(2a,3Q):""))}).3w().7e("")};J.5Y=8(2V,79){2V=$(2V);2V.r({1W:(79/1p)+"4w"});c(2T.7B.3e("7C")>0){Q.7Z(0,0)}j 2V};J.2K=8(6M){j $(6M).M("O")};J.3j=8(6v,6x){j $(6v).r({O:6x})};J.1x=8(6s){j $(6s).q.O||""};J.4r=8(2X){8C{2X=$(2X);g n=1Z.8B(" ");2X.8z(n);2X.8n(n)}89(e){}};8m.G.8j=8(){g 7z=u;6.U(8(f){f.8i(6,7z)})};g a={2e:{8o:"8A",8E:"8v 7H 7W b 7L 7R 7P, 7M 7N 7U 37 6 4Q 18 81"},4X:8(2U){c(1z 5v=="82"){1L("a.4X 80 7X 7Y.7F.7J\' 8u.8s 8p")}g 3W="1M:69";c(/3p/.2j(2T.3k)&&!Q.1e){3W+=";4x:1"}2U=$(2U);$A(2U.3f).U(8(2Z){c(2Z.3T==3){2Z.3X.8D().U(8(3V){2U.8y(5v.8b("8c",{q:3W},3V==" "?4O.86(8f):3V),2Z)});J.46(2Z)}})},8g:8(2k,4W){g 3i;c(((1z 2k=="8h")||(1z 2k=="8"))&&(2k.1u)){3i=2k}1H{3i=$(2k).3f}g 3n=o.l({50:0.1,2M:0},u[2]||{});g 53=3n.2M;$A(3i).U(8(5a,57){p 4W(5a,o.l(3n,{2M:57*3n.50+53}))})},3L:{"8e":["6C","6L"],"88":["7s","7h"],"5m":["3N","5h"]},87:8(2h,2L){2h=$(2h);2L=(2L||"5m").3M();g 5Z=o.l({17:{1M:"5A",41:(2h.8a||"3c"),4n:1}},u[2]||{});a[2h.8d()?a.3L[2L][1]:a.3L[2L][0]](2h,5Z)}};g 8x=a;a.1b={85:6f.K,24:8(t){j(-L.3K(t*L.3I)/2)+0.5},4H:8(t){j 1-t},7y:8(t){j((-L.3K(t*L.3I)/4)+0.75)+L.8q()/4},8t:8(t){j(-L.3K(t*L.3I*(9*t))/2)+0.5},6V:8(t,1A){1A=1A||5;j(L.1D((t%(1/1A))*1A)==0?((t*1A*2)-L.5F(t*1A*2)):1-((t*1A*2)-L.5F(t*1A*2)))},2B:8(t){j 0},6n:8(t){j 1}};a.4i=1q.1m();o.l(o.l(a.4i.G,7D),{1n:8(){6.E=[];6.2I=1P},5G:8(5H){6.E.5G(5H)},5U:8(1c){g 23=p 5L().5M();g 5E=(1z 1c.h.17=="2E")?1c.h.17:1c.h.17.1M;49(5E){Y"7I":6.E.7G(8(e){j e.2o=="44"}).U(8(e){e.1N+=1c.1K;e.1K+=1c.1K});T;Y"7E-84":23=6.E.5B("1N").2J()||23;T;Y"5A":23=6.E.5B("1K").2J()||23;T}1c.1N+=23;1c.1K+=23;c(!1c.h.17.4n||(6.E.1u<1c.h.17.4n)){6.E.6F(1c)}c(!6.2I){6.2I=83(6.3d.1F(6),15)}},46:8(5T){6.E=6.E.6u(8(e){j e==5T});c(6.E.1u==0){7V(6.2I);6.2I=1P}},3d:8(){g 58=p 5L().5M();37(g i=0,5N=6.E.1u;i<5N;i++){c(6.E[i]){6.E[i].3d(58)}}}});a.31={3m:$H(),33:8(2t){c(1z 2t!="2E"){j 2t}c(!6.3m[2t]){6.3m[2t]=p a.4i()}j 6.3m[2t]}};a.a3=a.31.33("3c");a.5P={11:a.1b.24,P:1,5S:60,V:N,13:0,18:1,2M:0,17:"a8"};a.1h=8(){};a.1h.G={1M:1P,1s:8(5Q){6.h=o.l(o.l({},a.5P),5Q||{});6.4j=0;6.2o="44";6.1N=6.h.2M*3B;6.1K=6.1N+(6.h.P*3B);6.1i("9U");c(!6.h.V){a.31.33(1z 6.h.17=="2E"?"3c":6.h.17.41).5U(6)}},3d:8(3a){c(3a>=6.1N){c(3a>=6.1K){6.2P(1);6.3v();6.1i("6d");c(6.1S){6.1S()}6.1i("6b");j}g t=(3a-6.1N)/(6.1K-6.1N);g 4b=L.1D(t*6.h.5S*6.h.P);c(4b>6.4j){6.2P(t);6.4j=4b}}},2P:8(t){c(6.2o=="44"){6.2o="5C";6.1i("27");c(6.1Y){6.1Y()}6.1i("3P")}c(6.2o=="5C"){c(6.h.11){t=6.h.11(t)}t*=(6.h.18-6.h.13);t+=6.h.13;6.1M=t;6.1i("9L");c(6.1r){6.1r(t)}6.1i("9M")}},3v:8(){c(!6.h.V){a.31.33(1z 6.h.17=="2E"?"3c":6.h.17.41).46(6)}6.2o="9S"},1i:8(2Q){c(6.h[2Q+"5I"]){6.h[2Q+"5I"](6)}c(6.h[2Q]){6.h[2Q](6)}},48:8(){g 47=$H();37(3q 5z 6){c(1z 6[3q]!="8"){47[3q]=6[3q]}}j"#<a:"+47.48()+",h:"+$H(6.h).48()+">"}};a.1Q=1q.1m();o.l(o.l(a.1Q.G,a.1h.G),{1n:8(5V){6.E=5V||[];6.1s(u[1])},1r:8(5W){6.E.9y("2P",5W)},1S:8(6c){6.E.U(8(29){29.2P(1);29.3v();29.1i("6d");c(29.1S){29.1S(6c)}29.1i("6b")})}});a.6a=1q.1m();o.l(o.l(a.6a.G,a.1h.G),{1n:8(){g 6e=o.l({P:0},u[0]||{});6.1s(6e)},1r:6f.9E});a.1E=1q.1m();o.l(o.l(a.1E.G,a.1h.G),{1n:8(6j){6.b=$(6j);c(!6.b){1L(a.2e)}c(/3p/.2j(2T.3k)&&!Q.1e&&(!6.b.76.77)){6.b.r({4x:1})}g 6i=o.l({13:6.b.2K()||0,18:1},u[1]||{});6.1s(6i)},1r:8(6h){6.b.3j(6h)}});a.W=1q.1m();o.l(o.l(a.W.G,a.1h.G),{1n:8(6g){6.b=$(6g);c(!6.b){1L(a.2e)}g 68=o.l({x:0,y:0,61:"69"},u[1]||{});6.1s(68)},1Y:8(){6.b.1v();6.2N=2d(6.b.M("I")||"0");6.2R=2d(6.b.M("D")||"0");c(6.h.61=="4T"){6.h.x=6.h.x-6.2N;6.h.y=6.h.y-6.2R}},1r:8(4a){6.b.r({I:L.1D(6.h.x*4a+6.2N)+"12",D:L.1D(6.h.y*4a+6.2R)+"12"})}});a.9W=8(5y,63,62){j p a.W(5y,o.l({x:62,y:63},u[3]||{}))};a.X=1q.1m();o.l(o.l(a.X.G,a.1h.G),{1n:8(67,66){6.b=$(67);c(!6.b){1L(a.2e)}g 65=o.l({1l:B,2u:B,1f:B,3D:N,1t:"4o",28:1p,54:66},u[2]||{});6.1s(65)},1Y:8(){6.10=6.h.10||N;6.4Z=6.b.M("1M");6.43={};["D","I","F","z","1W"].U(8(k){6.43[k]=6.b.q[k]}.1F(6));6.2R=6.b.a7;6.2N=6.b.a9;g 45=6.b.M("aa-8G")||"1p%";["4w","12","%","5K"].U(8(42){c(45.3e(42)>0){6.1W=2d(45);6.59=42}}.1F(6));6.55=(6.h.54-6.h.28)/1p;6.1d=1P;c(6.h.1t=="4o"){6.1d=[6.b.a5,6.b.a4]}c(/^9Y/.2j(6.h.1t)){6.1d=[6.b.5g,6.b.9Z]}c(!6.1d){6.1d=[6.h.1t.3x,6.h.1t.3y]}},1r:8(56){g 3z=(6.h.28/1p)+(6.55*56);c(6.h.1f&&6.1W){6.b.r({1W:6.1W*3z+6.59})}6.4V(6.1d[0]*3z,6.1d[1]*3z)},1S:8(a2){c(6.10){6.b.r(6.43)}},4V:8(4c,4k){g d={};c(6.h.1l){d.F=L.1D(4k)+"12"}c(6.h.2u){d.z=L.1D(4c)+"12"}c(6.h.3D){g 4l=(4c-6.1d[0])/2;g 4m=(4k-6.1d[1])/2;c(6.4Z=="4T"){c(6.h.2u){d.D=6.2R-4l+"12"}c(6.h.1l){d.I=6.2N-4m+"12"}}1H{c(6.h.2u){d.D=-4l+"12"}c(6.h.1l){d.I=-4m+"12"}}}6.b.r(d)}});a.4S=1q.1m();o.l(o.l(a.4S.G,a.1h.G),{1n:8(5x){6.b=$(5x);c(!6.b){1L(a.2e)}g 5r=o.l({5s:"#8Z"},u[1]||{});6.1s(5r)},1Y:8(){c(6.b.M("5b")=="2B"){6.3v();j}6.4f={};c(!6.h.8X){6.4f.5p=6.b.M("4h-8V");6.b.r({5p:"2B"})}c(!6.h.4d){6.h.4d=6.b.M("4h-1J").1I("#78")}c(!6.h.4g){6.h.4g=6.b.M("4h-1J")}6.3Z=$R(0,2).2g(8(i){j 3b(6.h.5s.2p(i*2+1,i*2+3),16)}.1F(6));6.5t=$R(0,2).2g(8(i){j 3b(6.h.4d.2p(i*2+1,i*2+3),16)-6.3Z[i]}.1F(6))},1r:8(5w){6.b.r({4M:$R(0,2).6w("#",8(m,v,i){j m+(L.1D(6.3Z[i]+(6.5t[i]*5w)).4F())}.1F(6))})},1S:8(){6.b.r(o.l(6.4f,{4M:6.h.4g}))}});a.5f=1q.1m();o.l(o.l(a.5f.G,a.1h.G),{1n:8(5e){6.b=$(5e);6.1s(u[1]||{})},1Y:8(){2c.5i();g 3C=2c.93(6.b);c(6.h.5d){3C[1]+=6.h.5d}g 2J=Q.5c?Q.z-Q.5c:1Z.5j.5g-(1Z.5k.2G?1Z.5k.2G:1Z.5j.2G);6.3U=2c.92;6.5l=(3C[1]>2J?2J:3C[1])-6.3U},1r:8(5q){2c.5i();Q.8L(2c.8K,6.3U+(5q*6.5l))}});a.5h=8(2s){2s=$(2s);g 5n=2s.1x();g 5u=o.l({13:2s.2K()||1,18:0,C:8(3H){c(3H.h.18!=0){j}3H.b.1g().r({O:5n})}},u[1]||{});j p a.1E(2s,5u)};a.3N=8(2l){2l=$(2l);g 51=o.l({13:(2l.M("5b")=="2B"?0:2l.2K()||0),18:1,C:8(6l){6l.b.4r()},27:8(3J){3J.b.3j(3J.h.13).2A()}},u[1]||{});j p a.1E(2l,51)};a.8S=8(14){14=$(14);g 6J={O:14.1x(),1M:14.M("1M"),D:14.q.D,I:14.q.I,F:14.q.F,z:14.q.z};j p a.1Q([p a.X(14,8Q,{V:B,3D:B,1f:B,10:B}),p a.1E(14,{V:B,18:0})],o.l({P:1,8P:8(52){2c.97(52.E[0].b)},C:8(5X){5X.E[0].b.1g().r(6J)}},u[1]||{}))};a.7h=8(2H){2H=$(2H);2H.1C();j p a.X(2H,0,o.l({1f:N,1l:N,10:B,C:8(7i){7i.b.1g().1B()}},u[1]||{}))};a.7s=8(2S){2S=$(2S);g 3Y=2S.36();j p a.X(2S,1p,o.l({1f:N,1l:N,28:0,1t:{3x:3Y.z,3y:3Y.F},10:B,3P:8(7o){7o.b.1C().r({z:"4e"}).2A()},C:8(7t){7t.b.1B()}},u[1]||{}))};a.9p=8(2W){2W=$(2W);g 7n=2W.1x();j p a.3N(2W,o.l({P:0.4,13:0,11:a.1b.7y,C:8(7v){p a.X(7v.b,1,{P:0.3,3D:B,1l:N,1f:N,10:B,27:8(7u){7u.b.1v().1C()},C:8(7l){7l.b.1g().1B().1y().r({O:7n})}})}},u[1]||{}))};a.9o=8(1G){1G=$(1G);g 7q={D:1G.M("D"),I:1G.M("I"),O:1G.1x()};j p a.1Q([p a.W(1G,{x:0,y:1p,V:B}),p a.1E(1G,{V:B,18:0})],o.l({P:0.5,27:8(7r){7r.E[0].b.1v()},C:8(7p){7p.E[0].b.1g().1y().r(7q)}},u[1]||{}))};a.9n=8(2r){2r=$(2r);g 6D={D:2r.M("D"),I:2r.M("I")};j p a.W(2r,{x:20,y:0,P:0.7f,C:8(7m){p a.W(7m.b,{x:-40,y:0,P:0.1,C:8(7j){p a.W(7j.b,{x:40,y:0,P:0.1,C:8(7k){p a.W(7k.b,{x:-40,y:0,P:0.1,C:8(7w){p a.W(7w.b,{x:40,y:0,P:0.1,C:8(7x){p a.W(7x.b,{x:-20,y:0,P:0.7f,C:8(6E){6E.b.1y().r(6D)}})}})}})}})}})}})};a.6C=8(2n){2n=$(2n).6K();g 6G=2n.1w().M("19");g 3O=2n.36();j p a.X(2n,1p,o.l({1f:N,1l:N,28:Q.1e?0:1,1t:{3x:3O.z,3y:3O.F},10:B,3P:8(2z){2z.b.1v();2z.b.1w().1v();c(Q.1e){2z.b.r({D:""})}2z.b.1C().r({z:"4e"}).2A()},6I:8(39){39.b.1w().r({19:(39.1d[0]-39.b.2G)+"12"})},C:8(3R){3R.b.1B().1y();3R.b.1w().1y().r({19:6G})}},u[1]||{}))};a.6L=8(2v){2v=$(2v).6K();g 6q=2v.1w().M("19");j p a.X(2v,Q.1e?0:1,o.l({1f:N,1l:N,1t:"4o",28:1p,10:B,6R:8(2w){2w.b.1v();2w.b.1w().1v();c(Q.1e){2w.b.r({D:""})}2w.b.1C().2A()},6I:8(3u){3u.b.1w().r({19:(3u.1d[0]-3u.b.2G)+"12"})},C:8(3G){3G.b.1g().1B().1y().r({19:6q});3G.b.1w().1y()}},u[1]||{}))};a.9v=8(6p){j p a.X(6p,Q.1e?1:0,{10:B,27:8(6o){6o.b.1C()},C:8(6m){6m.b.1g().1B()}})};a.9u=8(1j){1j=$(1j);g 2b=o.l({3s:"35",3l:a.1b.24,32:a.1b.24,34:a.1b.6n},u[1]||{});g 72={D:1j.q.D,I:1j.q.I,z:1j.q.z,F:1j.q.F,O:1j.1x()};g S=1j.36();g 1R,1V;g 1U,1T;49(2b.3s){Y"D-I":1R=1V=1U=1T=0;T;Y"D-2O":1R=S.F;1V=1T=0;1U=-S.F;T;Y"19-I":1R=1U=0;1V=S.z;1T=-S.z;T;Y"19-2O":1R=S.F;1V=S.z;1U=-S.F;1T=-S.z;T;Y"35":1R=S.F/2;1V=S.z/2;1U=-S.F/2;1T=-S.z/2;T}j p a.W(1j,{x:1R,y:1V,P:0.9t,27:8(6r){6r.b.1g().1C().1v()},C:8(3t){p a.1Q([p a.1E(3t.b,{V:B,18:1,13:0,11:2b.34}),p a.W(3t.b,{x:1U,y:1T,V:B,11:2b.3l}),p a.X(3t.b,1p,{1t:{3x:S.z,3y:S.F},V:B,28:Q.1e?1:0,11:2b.32,10:B})],o.l({27:8(6N){6N.E[0].b.r({z:"4e"}).2A()},C:8(74){74.E[0].b.1B().1y().r(72)}},2b))}})};a.9s=8(Z){Z=$(Z);g 2i=o.l({3s:"35",3l:a.1b.24,32:a.1b.24,34:a.1b.2B},u[1]||{});g 6U={D:Z.q.D,I:Z.q.I,z:Z.q.z,F:Z.q.F,O:Z.1x()};g 21=Z.36();g 22,26;49(2i.3s){Y"D-I":22=26=0;T;Y"D-2O":22=21.F;26=0;T;Y"19-I":22=0;26=21.z;T;Y"19-2O":22=21.F;26=21.z;T;Y"35":22=21.F/2;26=21.z/2;T}j p a.1Q([p a.1E(Z,{V:B,18:0,13:1,11:2i.34}),p a.X(Z,Q.1e?1:0,{V:B,11:2i.32,10:B}),p a.W(Z,{x:22,y:26,V:B,11:2i.3l})],o.l({6R:8(6Q){6Q.E[0].b.1v().1C()},C:8(6P){6P.E[0].b.1g().1B().1y().r(6U)}},2i))};a.9i=8(2x){2x=$(2x);g 38=u[1]||{};g 6W=2x.1x();g 3S=38.11||a.1b.24;g 4R=8(t){j 3S(1-a.1b.6V(t,38.9g))};4R.1F(3S);j p a.1E(2x,o.l(o.l({P:2,13:0,C:8(64){64.b.r({O:6W})}},38),{11:4R}))};a.9f=8(1k){1k=$(1k);g 6Z={D:1k.q.D,I:1k.q.I,F:1k.q.F,z:1k.q.z};1k.1C();j p a.X(1k,5,o.l({1f:N,1l:N,C:8(9h){p a.X(1k,1,{1f:N,2u:N,C:8(6Y){6Y.b.1g().1B().r(6Z)}})}},u[1]||{}))};a.3h=1q.1m();o.l(o.l(a.3h.G,a.1h.G),{1n:8(6T){6.b=$(6T);c(!6.b){1L(a.2e)}g 1O=o.l({q:{}},u[1]||{});c(1z 1O.q=="2E"){c(1O.q.3e(":")==-1){g 3r="",71="."+1O.q;$A(1Z.9e).4H().U(8(2F){c(2F.2y){2y=2F.2y}1H{c(2F.6O){2y=2F.6O}}$A(2y).4H().U(8(4u){c(71==4u.9d){3r=4u.q.99;1L $T}});c(3r){1L $T}});6.q=3r.4J();1O.C=8(2C){2C.b.98(2C.h.q);2C.4E.U(8(4t){c(4t.q!="O"){2C.b.q[4t.q.5o()]=""}})}}1H{6.q=1O.q.4J()}}1H{6.q=$H(1O.q)}6.1s(1O)},1Y:8(){8 1I(25){c(!25||["9a(0, 0, 0, 0)","9b"].9c(25)){25="#78"}25=25.1I();j $R(0,2).2g(8(i){j 3b(25.2p(i*2+1,i*2+3),16)})}6.4E=6.q.2g(8(4I){g 3A=4I[0].9j().9k(),1a=4I[1],2f=1P;c(1a.1I("#73")!="#73"){1a=1a.1I();2f="1J"}1H{c(3A=="O"){1a=2d(1a);c(/3p/.2j(2T.3k)&&!Q.1e&&(!6.b.76.77)){6.b.r({4x:1})}}1H{c(J.5D.2j(1a)){g 3E=1a.5R(/^([\\+\\-]?[0-9\\.]+)(.*)$/),1a=2d(3E[1]),2f=(3E.1u==3)?3E[2]:1P}}}g 4y=6.b.M(3A);j $H({q:3A,1X:2f=="1J"?1I(4y):2d(4y||0),2D:2f=="1J"?1I(1a):1a,3F:2f})}.1F(6)).6u(8(2q){j((2q.1X==2q.2D)||(2q.3F!="1J"&&(6t(2q.1X)||6t(2q.2D))))})},1r:8(4G){g 4z=$H(),4C=1P;6.4E.U(8(1o){4C=1o.3F=="1J"?$R(0,2).6w("#",8(m,v,i){j m+(L.1D(1o.1X[i]+(1o.2D[i]-1o.1X[i])*4G)).4F()}):1o.1X+L.1D(((1o.2D-1o.1X)*4G)*3B)/3B+1o.3F;4z[1o.q]=4C});6.b.r(4z)}});a.6y=1q.1m();o.l(a.6y.G,{1n:8(6z){6.4s=[];6.h=u[1]||{};6.6H(6z)},6H:8(7g){7g.U(8(4D){g 6A=$H(4D).9q().6B();6.4s.6F($H({4v:$H(4D).9m().6B(),4Q:a.3h,h:{q:6A}}))}.1F(6));j 6},9l:8(){j p a.1Q(6.4s.2g(8(2Y){g 7A=[$(2Y.4v)||$$(2Y.4v)].3w();j 7A.2g(8(e){j p 2Y.4Q(e,o.l({V:B},2Y.h))})}).3w(),6.h)}});J.5O=$w("4M 96 8O 8R "+"8N 8M 8I 8H "+"8J 8T 8U 9x "+"94 95 91 19 90 1J "+"1W 8W z I 8Y 9w "+"9B a6 ac 9X 9V a1 "+"a0 ab ad O 9T 9F "+"9H 9D 9z 9A 9I "+"2O 9J D F 9Q 9O");J.5D=/^(([\\+\\-]?[0-9\\.]+)(4w|9N|12|5z|9G|9K|5K|9P|\\%))|0$/;4O.G.4J=8(){g 4K=J.l(1Z.9R("4P"));4K.9C="<4P q=\\""+6+"\\"></4P>";g 4N=4K.1w().q,3g=$H();J.5O.U(8(3o){c(4N[3o]){3g[3o]=4N[3o]}});c(/3p/.2j(2T.3k)&&!Q.1e&&6.3e("O")>-1){3g.O=6.5R(/O:\\s*((?:0|1)?(?:\\.\\d*)?)/)[1]}j 3g};J.6k=8(4p,5J){p a.3h(4p,o.l({q:5J},u[2]||{}));j 4p};["3j","2K","1x","4r","5Y","4A","4B","6k"].U(8(f){J.4Y[f]=J[f]});J.4Y.8r=8(4L,4U,70){s=4U.8k(/8l/,"-").5o();7d=s.4q(0).8w()+s.8F(1);p a[7d](4L,70);j $(4L)};J.9r();',62,634,'||||||this||function||Effect|element|if||||var|options||return||extend|||Object|new|style|setStyle||pos|arguments|||||height||true|afterFinishInternal|top|effects|width|prototype||left|Element||Math|getStyle|false|opacity|duration|window||_98|break|each|sync|Move|Scale|case|_a1|restoreAfterFinish|transition|px|from|_6c|||queue|to|bottom|_c0|Transitions|_2a|dims|opera|scaleContent|hide|Base|event|_95|_b0|scaleX|create|initialize|_c8|100|Class|update|start|scaleMode|length|makePositioned|down|getInlineOpacity|undoPositioned|typeof|_26|undoClipping|makeClipping|round|Opacity|bind|_7b|else|parseColor|color|finishOn|throw|position|startOn|_b5|null|Parallel|_99|finish|_9c|_9b|_9a|fontSize|originalValue|setup|document||_a4|_a5|_2b|sinoidal|_bc|_a6|beforeSetup|scaleFrom|_3f|_8|_96|Position|parseFloat|_elementDoesNotExistError|_c1|map|_1e|_a2|test|_17|_68|_1|_87|state|slice|_c4|_7f|_64|_34|scaleY|_8d|_8f|_a9|cssRules|_8a|show|none|_ba|targetValue|string|_b8|clientHeight|_70|interval|max|getOpacity|_1f|delay|originalLeft|right|render|_3a|originalTop|_72|navigator|_13|_9|_76|_f|_d0|_15|_5|Queues|scaleTransition|get|opacityTransition|center|getDimensions|for|_aa|_8b|_36|parseInt|global|loop|indexOf|childNodes|_d5|Morph|_19|setOpacity|userAgent|moveTransition|instances|_1a|_d6|MSIE|property|_b6|direction|_9e|_90|cancel|flatten|originalHeight|originalWidth|_51|_bf|1000|_61|scaleFromCenter|_c2|unit|_91|_67|PI|_6b|cos|PAIRS|toLowerCase|Appear|_89|afterSetup|_7|_8c|_ac|nodeType|scrollStart|_16|_14|nodeValue|_73|_base||scope|_4f|originalStyle|idle|_4e|remove|_3b|inspect|switch|_46|_38|_53|endcolor|0px|oldStyle|restorecolor|background|ScopedQueue|currentFrame|_54|_56|_57|limit|box|_d7|charAt|forceRerendering|tracks|_bb|_b9|ids|em|zoom|_c3|_c6|collectTextNodes|collectTextNodesIgnoreClass|_c7|_ce|transforms|toColorPart|_c5|reverse|_be|parseStyle|_d3|_da|backgroundColor|_d4|String|div|effect|_ad|Highlight|absolute|_db|setDimensions|_18|tagifyText|Methods|elementPositioning|speed|_69|_6e|_1b|scaleTo|factor|_50|_1d|_31|fontSizeType|_1c|display|innerHeight|offset|_60|ScrollTo|scrollHeight|Fade|prepare|body|documentElement|delta|appear|_65|camelize|backgroundImage|_63|_59|startcolor|_delta|_66|Builder|_5c|_58|_47|in|end|pluck|running|CSS_LENGTH|_2c|floor|_each|_29|Internal|_d8|pt|Date|getTime|len|CSS_PROPERTIES|DefaultOptions|_35|match|fps|_2f|add|_3c|_3d|_6f|setContentZoom|_20||mode|_49|_48|_af|_4c|_4b|_4a|_45|relative|Event|afterFinish|_3e|beforeFinish|_40|Prototype|_44|_43|_42|_41|morph|_6a|_94|full|_93|_92|_8e|_9d|_e|isNaN|reject|_c|inject|_d|Transform|_cc|_cf|first|SlideDown|_80|_86|push|_88|addTracks|afterUpdateInternal|_6d|cleanWhitespace|SlideUp|_b|_9f|rules|_a8|_a7|beforeStartInternal|_4|_b4|_a3|pulse|_ab|_2|_b3|_b1|_dc|_b7|_97|zzzzzz|_a0||currentStyle|hasLayout|ffffff|_a|collect|_6|hasChildNodes|effect_class|join|05|_cd|BlindUp|_71|_82|_83|_7a|_81|_77|_74|_7e|_7c|_7d|BlindDown|_75|_79|_78|_84|_85|flicker|_11|_d1|appVersion|AppleWebKit|Enumerable|with|aculo|findAll|specified|front|us|hasClassName|does|but|is|while|exist|do|not|rgb|split|required|clearInterval|DOM|including|script|scrollBy|requires|operate|undefined|setInterval|last|linear|fromCharCode|toggle|blind|catch|id|node|span|visible|slide|160|multiple|object|apply|call|gsub|_|Array|removeChild|name|library|random|visualEffect|js|wobble|builder|The|toUpperCase|Effect2|insertBefore|appendChild|ElementDoesNotExistError|createTextNode|try|toArray|message|substring|size|borderLeftWidth|borderLeftStyle|borderRightColor|deltaX|scrollTo|borderLeftColor|borderBottomWidth|borderBottomColor|beforeSetupInternal|200|borderBottomStyle|Puff|borderRightStyle|borderRightWidth|image|fontWeight|keepBackgroundImage|letterSpacing|ffff99|clip|borderTopWidth|deltaY|cumulativeOffset|borderTopColor|borderTopStyle|backgroundPosition|absolutize|addClassName|cssText|rgba|transparent|include|selectorText|styleSheets|Fold|pulses|_b2|Pulsate|underscore|dasherize|play|keys|Shake|DropOut|SwitchOff|values|addMethods|Shrink|01|Grow|Squish|lineHeight|borderSpacing|invoke|paddingLeft|paddingRight|marginBottom|innerHTML|paddingBottom|emptyFunction|outlineOffset|cm|outlineWidth|paddingTop|textIndent|mm|beforeUpdate|afterUpdate|ex|zIndex|pc|wordSpacing|createElement|finished|outlineColor|beforeStart|markerOffset|MoveBy|marginTop|content|scrollWidth|maxWidth|maxHeight|_52|Queue|offsetWidth|offsetHeight|marginLeft|offsetTop|parallel|offsetLeft|font|minHeight|marginRight|minWidth'.split('|'),0,{}))
/**
* Core AARP library. Initializes AARP namespace and defines some key methods within it.
*
* @author Kaiser Shahid [2007 to infinity]
*/

var AARP = {
	__version__: '2009-05-14'
	
	, domain: 'www.aarp.org'
	, proxyDomain: 'www.aarp.org'
	
	/*
	store & set user's login & member state
	*/
	, User: { 
		name: '', 
		firstName: '', 
		mail: 0, 
		isLoggedIn: false, 
		accountStatus: '', 
		expirationDate: '', 
		isMember: false, 
		isExpiredMember: false, 
		isExpiringMember: false
	}
	, setUser: function()
	{
		var inf = Cookies.get( 'header' );
		if ( inf == null ) return;
		var inf = inf.split( '|' );
		
		AARP.User.isLoggedIn = true;
		
		AARP.User.name = inf[2];
		AARP.User.firstName = inf[0];
		AARP.User.messages = inf[1];
		
		try { AARP.User.accountStatus = inf[3]; } catch ( e ) { }
		try { AARP.User.expirationDate = inf[4]; } catch ( e ) { }
		
		if ( AARP.User.accountStatus == '0' ) {
			AARP.User.isMember = true ;
			if ( AARP.User.expirationDate != '' ) {
				try {
					var expirationDate = new Date( AARP.User.expirationDate.split('/')[2], AARP.User.expirationDate.split('/')[0] - 1, AARP.User.expirationDate.split('/')[1] ) ;
					var sixtyDaysOutDate = new Date(); sixtyDaysOutDate.setDate( sixtyDaysOutDate.getDate() + 60 ) ;
					if ( sixtyDaysOutDate > expirationDate ) {
						AARP.User.isExpiringMember = true ;
					}
				}
				catch ( e ) {
				}
			}
		}
		
		if ( AARP.User.accountStatus == '5' ) {
			AARP.User.isExpiredMember = true ;
		}
	}
	/*
	Helper Objects/Functions
	*/
	
	/**
	* Hopefully a useful function to open new windows. Usage:
	* 
	* AARP.newWindow( 'http://...', '_new', 500, 500 );
	* AARP.newWindow( 'http://...', '_new', 500, 600, { titlebar: true, menubar: true, addressbar: true } );
	*
	* @param href string Where the window should point to
	* @param name string The name of the window (equivalent to target attribute)
	* @param w int (Optional) Width of window
	* @param h int (Optional) Height of window
	* @param opts int (Optional) Additional options, defined below, are either true or false.
	*        - centered (window centered on screen), scrollbars, titlebar, addressbar, menubar, statusbar, toolbar, resizable, left, top
	*        By default, everything is false, except for resizable and centered.
	* @return object The reference to the new window
	*/
	
	, newWindow: function( href, name )
	{
		var w = '', h = '', opts = {};
		if ( arguments.length > 2 )
			w = arguments[2];
		if ( arguments.length > 3 )
			h = arguments[3];
		if ( arguments.length > 4 )
			opts = arguments[4];
		
		w = parseInt( w );
		if ( !w ) w = 100;
		h = parseInt( h );
		if ( !h ) h = 100;
		
		// merge default values on absense of these items. otherwise, presence denotes true
		for ( var x in AARP.__newWindow_default_opts )
		{
			if ( opts[x] ) opts[x] = 1;
			else opts[x] = AARP.__newWindow_default_opts[x];
		}
		
		var xpos = 0, ypos = 0;
		if ( ( parseInt( navigator.appVersion ) >= 4 ) && (opts.centered) )
		{
			xpos = (screen.width - w) / 2;
			ypos = (screen.height - h) / 2;
		}
		
		var args = "width=" + w + "," 
			+ "height=" + h + "," 
			+ "location=" + opts.addressbar + "," 
			+ "menubar=" + opts.menubar + ","
			+ "resizable=" + opts.resizable + ","
			+ "scrollbars=" + opts.scrollbars + ","
			+ "status=" + opts.statusbar + "," 
			+ "titlebar=" + opts.titlebar + ","
			+ "toolbar=" + opts.toolbar + ","
			+ "hotkeys=" + opts.hotkeys + ","
			+ "screenx=" + xpos + "," // netscape
			+ "screeny=" + ypos + "," // netscape
			+ "left=" + xpos + ","
			+ "top=" + ypos
		;
		
		return window.open( href, name, args );
	}
	, __newWindow_default_opts: { 
		addressbar: 0
		, menubar: 0
		, resizable: 1
		, scrollbars: 0
		, statusbar: 0
		, titlebar: 0
		, toolbar: 0
		, left: 0
		, top: 0
		, hotkeys: 0
		, centered: 1
	}
	
	/*
	The 'page' variable contains convenient components of the URL for all sorts of use.
	setPage() parsers the URL into these components.
	*/
	
	// NEW [2008-02-12 | kaiser] added some new properties:
	// is_authoring; site {dotorg,bulletin}; path_effective; pathc_effective
	, page: { url: '', protocol: 'http', host: '', port: '80', path: '', pathc: [], file: '', querystring: '', parameters: {}, anchor: ''
		, is_authoring: false, site: 'dotorg', path_effective: '', pathc_effective: []
	}
	, setPage: function()
	{
		AARP.page.url = document.location.toString();
		
		// separate path from querystring. [0] is full path, [1] is querystring
		var __path_qs = AARP.page.url.split( '?', 2 );
		
		// if url is 'http://www.aarp.org/health/', tmp would be [http:, , www.aarp.org, health, ]
		// if url is 'http://www.aarp.org/health/page.html', tmp would be [http:, , www.aarp.org, health, page.html]
		var tmp = __path_qs[0].split( '/' );
		
		// protocol
		var tmp2 = tmp.shift(); tmp.shift();
		AARP.page.protocol = tmp2.substring( 0, tmp2.length - 1 );
		
		// domain & port
		tmp2 = tmp.shift().split( ':' );
		AARP.page.host = tmp2[0];
		if ( tmp2.length > 1 )
			AARP.page.port = tmp2[1];
		
		// remove page from end (page could be an empty string)
		tmp2 = '';
		if ( tmp.length > 0 )
			tmp2 = tmp.pop();
		
		// remove & save anchor
		var anchor = [];
		if ( __path_qs[1] ) anchor = __path_qs[1].split( '#', 2 );
		else
		{
			// no querystring, so anchor would be immediately after page
			anchor = tmp2.split( '#', 2 );
			tmp2 = anchor[0];
		}
		
		if ( anchor[1] ) AARP.page.anchor = anchor[1];
		
		// set path & filename	
		AARP.page.file = tmp2.substring( 0, tmp2.length );
		AARP.page.path = '/' + tmp.join( '/' );
		if ( AARP.page.path == '/' )
			AARP.page.path = '';
		else
			AARP.page.pathc = AARP.page.path.substring( 1, AARP.page.path.length ).split( '/' );
		//AARP.page.pathc = tmp;
		
		// parse querystring into dictionary
		if ( __path_qs.length > 1 && __path_qs[1] != '' )
		{
			AARP.page.querystring = __path_qs[1];
			tmp = __path_qs[1].split( '&' ); //AARP.page.querystring.split( '&' );
			var ptr = AARP.page.parameters;
			for ( var p = 0; p < tmp.length; p++ )
			{
				var tmp3 = tmp[p].split( '=', 2 );
				if ( tmp3.length == 1 ) tmp2[1] = '';

				// check if the parameter already exists. if so, either convert to
				// an array, or append
				if ( ptr[tmp3[0]] )
				{
					// array
					if ( ptr[tmp3[0]].push )
						ptr[tmp3[0]].push( unescape( tmp3[1] ) );
					else
						ptr[tmp3[0]] = [ ptr[tmp3[0]], unescape( tmp3[1] ) ];
				}
				else
					ptr[tmp3[0]] = unescape( tmp3[1] );
			}
		}

		// TODO: add ?querystring to end?
		var portStr = '';
		if ( AARP.page.port != '80' )
			portStr = ':' + AARP.page.port;

		AARP.page.url = AARP.page.protocol + '://' + AARP.page.host + portStr + AARP.page.path + '/' + AARP.page.file;

		// NEW [2008-02-12 | kaiser]: set site and whether or not in authoring mode,
		// and also set what the real path(s) would be.

		if ( AARP.page.url.match( /bulletin[^.]*\.aarp/ ) ) AARP.page.site = 'bulletin';
		if ( AARP.page.url.match( /products[^.]*\.aarp/ ) ) AARP.page.site = 'products';
		if ( AARP.page.host.match( /w-d|w-s|author/ ) || AARP.page.port == '4402' || AARP.page.port == '4502' )
		{
			AARP.page.is_authoring = true;
			
			// set what would be the published path. if we're on /content/bulletin.html 
			// or /content/home.html, set the root values
			if ( AARP.page.pathc.length > 4 )
			{
				//alert(AARP.page.pathc);
				last_dir = '';
				for ( var i = 4; i < AARP.page.pathc.length; i++ )
				{
					AARP.page.pathc_effective.push( AARP.page.pathc[i] );
					last_dir = AARP.page.pathc[i];
				}
				// if last_dir IS articles, the filename is an article, otherwise, it should be a valid channel.
				if ( last_dir != 'articles' )
				{
					var tf = AARP.page.file.split( '.' );
					if ( tf.length > 0 ) AARP.page.pathc_effective.push( tf[0] );
				}
				AARP.page.path_effective = '/' + AARP.page.pathc_effective.join( '/' );
			}
			else
			{
				AARP.page.path_effective = '';
				AARP.page.pathc_effective = [];
			}
		}
		else
		{
			AARP.page.path_effective = AARP.page.path;
			AARP.page.pathc_effective = AARP.page.pathc;
		}
		
		if ( AARP.page.is_authoring || AARP.page.port == '4503' )
		{
			Ajax.proxyHandler = function( ajax )
			{
				if ( ajax.url.match( /^\/(content|etc|bin|system|crx)/ ) )
					return ajax.url;
				
				var url = "/etc/aarp/proxy.html?p-url=" + escape( ajax.url ) + "&p-domain=" + AARP.proxyDomain;
				if ( ajax.method == 'POST' )
				{
					ajax.method = 'GET';
					delete ajax.headers['Content-Type'];
					url += '&p-method=post&p-body=' + escape( ajax.params );
					ajax.params = '';
				}
				
				return url;
			}
		}
	}
	
	// the legendary encryption/decryption library, defined below
	, daw: null
	
	/*
	Objects/Functions definition deferred for other scripts.
	*/
	, Login: null // header.js
	, Comment: null // community/comments.js
	, Flag: null // community/content.js
	, Favorite: null // community/content.js
	, Email: null // community/content.js
	, Form: null // global.forms.js
	, Validator: null // global.forms.js
	, Persistence: null
	, Personalization: null
}

AARP.setUser();
AARP.setPage();
//startup.add( function() {} );


/**
* Ported David's daw_encrypt.py to Javascript. Biggest missing pieces was ord() and chr(), which I implemented on String:
* the caveat is that they can only handle asci characters 33-127. Which is fine, since these functions would be
* used for non-special character encodings (i.e. email, urls, timestamps, plaintext).
* 
* @author Kaiser Shahid, 2007-10-09
*/

// TODO: obfuscate this! (or at least the key.)
AARP.daw = {
	aKey: [ 26, 238, 80, 83, 225, 13, 123, 145, 78, 248, 63, 65, 54, 208, 199, 45, 152, 229, 168, 109, 82, 189, 183, 208, 132, 192, 141, 139, 42, 239, 20, 166, 66, 54, 43, 40, 62, 114, 14, 34, 39, 30, 66, 220, 237, 82, 218, 82, 194, 66, 245, 200, 102, 240, 232, 97, 165, 42, 93, 236, 19, 109, 160, 14, 163, 15, 127, 222, 219, 18, 213, 90, 220, 234, 59, 125, 243, 14, 237, 104, 85, 200, 140, 200, 49, 52, 124, 83, 36, 241, 162, 237, 18, 222, 150, 73, 84, 130, 114, 92, 123, 3, 205, 176, 100, 232, 244, 244, 244, 47, 187, 128, 82, 177, 33, 135, 152, 249, 49, 157, 88, 70, 69, 45, 138, 94, 5, 116, 74, 231, 76, 243, 55, 39, 136, 158, 138, 214, 109, 173, 16, 170, 163, 182, 166, 111, 141, 168, 243, 150, 112, 64, 141, 130, 71, 199, 77, 187, 151, 174, 103, 216, 127, 153, 147, 43, 70, 164, 17, 192, 181, 141, 184, 68, 174, 50, 48, 187, 219, 90, 3, 19, 83, 61, 244, 93, 216, 118, 140, 157, 181, 34, 118, 57, 167, 180, 132, 127, 232, 77, 146, 248, 29, 9, 225, 121, 145, 23, 163, 162, 65, 79, 219, 67, 143, 160, 169, 202, 90, 105, 227, 107, 98, 243, 44, 44, 135, 67, 96, 99, 13, 40, 163, 34, 8, 21, 220, 153, 162, 154, 172, 111, 11, 193, 24, 199, 142, 133, 166, 17, 69, 97, 96, 86, 74, 106, 31, 39, 12, 190, 224, 212, 216, 201, 181, 22, 13, 56, 98, 185, 226, 248, 214, 180, 182, 124, 157, 14, 89, 7, 212, 173, 67, 161, 101, 85, 191, 183, 205, 222, 65, 56, 56, 163, 60, 219, 41, 6, 228, 123, 142, 182, 4, 123, 156, 87, 240, 196, 206, 59, 160, 70, 10, 122, 39, 0, 202, 42, 197, 45, 171, 96, 100, 57, 230, 96, 178, 9, 57, 97, 126, 114, 236, 56, 76, 100, 88, 118, 137, 116, 113, 74, 195, 115, 240, 137, 226, 198, 208, 93, 4, 19, 9, 232, 216, 216, 238, 100, 116, 244, 24, 231, 220, 57, 116, 162, 184, 13, 79, 131, 114, 225, 168, 246, 198, 194, 59, 62, 161, 222, 29, 65, 187, 190, 24, 24, 46, 191, 174, 208, 84, 105, 211, 160, 61, 108, 117, 53, 237, 200, 175, 52, 200, 246, 16, 207, 84, 118, 98, 60, 165, 171, 179, 233, 237, 151, 2, 184, 16, 19, 230, 150, 207, 31, 114, 208, 239, 60, 179, 225, 56, 8, 146, 130, 216, 35, 152, 34, 188, 205, 218, 116, 97, 29, 23, 66, 56, 4, 200, 244, 88, 124, 204, 101, 24, 218, 207, 20, 134, 87, 92, 120, 127, 42, 241, 183, 17, 79, 173, 248, 3, 28, 4, 35, 107, 160, 25, 230, 214, 106, 107, 59, 15, 61, 242, 180, 237, 122, 187, 61, 165, 245, 248, 126, 101, 164, 184, 99, 3, 2, 26, 68, 190, 173, 19, 191, 132, 64, 4, 83, 192, 75, 184, 51, 90, 16, 95, 203, 213, 203, 231, 115, 38, 225, 139, 76, 41, 245, 177, 88, 108, 55, 12, 156, 72, 230, 53, 29, 150, 122, 129, 183, 136, 35, 121, 215, 141, 62, 112, 181, 233, 182, 242, 38, 1, 98, 111, 247, 176, 164, 147, 178, 58, 128, 32, 121, 138, 48, 120, 65, 176, 97, 169, 29, 106, 117, 85, 115, 40, 151, 245, 68, 242, 37, 98, 5, 89, 71, 110, 114, 147, 55, 249, 219, 117, 239, 89, 16, 39, 234, 213, 134, 17, 136, 247, 68, 77, 213, 217, 136, 194, 119, 49, 17, 98, 4, 156, 13, 127, 231, 183, 95, 11, 63, 114, 130, 88, 41, 38, 89, 91, 152, 52, 143, 15, 19, 88, 191, 186, 219, 138, 233, 52, 186, 179, 123, 76, 76, 246, 127, 230, 49, 231, 54, 238, 90, 99, 152, 64, 70, 85, 36, 25, 174, 80, 68, 56, 159, 15, 235, 236, 41, 193, 180, 101, 203, 142, 179, 111, 4, 178, 234, 49, 130, 4, 50, 213, 46, 38, 95, 176, 244, 37, 245, 234, 182, 221, 206, 61, 100, 206, 232, 194, 93, 204, 73, 116, 156, 45, 172, 55, 47, 236, 40, 26, 210, 105, 88, 233, 96, 242, 89, 94, 114, 54, 52, 26, 62, 123, 173, 241, 20, 190, 159, 190, 46, 220, 78, 162, 161, 100, 34, 173, 223, 184, 74, 144, 159, 238, 119, 12, 168, 248, 87, 29, 114, 147, 236, 124, 212, 160, 157, 97, 231, 96, 189, 17, 79, 16, 182, 94, 219, 118, 144, 145, 56, 8, 183, 171, 228, 209, 37, 175, 193, 70, 108, 228, 61, 177, 23, 165, 33, 185, 166, 169, 176, 155, 190, 136, 128, 96, 190, 55, 214, 11, 73, 63, 78, 175, 33, 167, 52, 175, 184, 14, 112, 198, 244, 230, 153, 110, 83, 197, 188, 25, 27, 36, 182, 201, 225, 168, 138, 186, 230, 226, 160, 46, 90, 186, 80, 125, 114, 230, 150, 144, 94, 233, 123, 99, 158, 111, 224, 9, 33, 187, 97, 236, 139, 65, 207, 169, 53, 150, 62, 242, 248, 80, 207, 87, 160, 184, 111, 26, 234, 248, 173, 229, 0, 200, 184, 216, 82, 236, 239, 43, 184, 12, 185, 98, 221, 162, 95, 95, 128, 33, 111, 197, 12, 125, 136, 103, 190, 143, 225, 23, 21, 146, 153, 139, 78, 199, 9, 220, 68, 12, 46, 230, 42, 215, 138, 120, 61, 25, 69, 115, 99, 182, 1, 208, 110, 163, 112, 163, 36, 63, 237, 238, 175, 141, 8, 189, 200, 177, 68, 6, 239, 131, 125, 190, 60, 2, 149, 36, 18, 137, 238, 221, 60, 125, 209, 160, 200, 31, 181, 188, 247, 107, 219, 17, 215, 236, 35, 45, 182, 244, 93, 198, 38, 76, 89, 145, 134, 244, 168, 57, 22, 23, 92, 2, 52, 56, 219, 165, 9, 107, 25, 200, 68, 103, 0, 185, 230, 226, 168, 221, 39, 175, 70, 146, 229, 120, 187, 169, 108, 226, 154, 120, 73, 246, 4, 151, 59, 81, 22 ]
	, encrypt: function( s, start, backwards )
	{
		L = [];
		if ( backwards )
			key = 1023 - start;
		else
			key = start;
		
		for ( var i = 0; i < s.length; i++ )
		{
			next = String.ord( s.charAt( i ) ) ^ AARP.daw.aKey[key];
			L.push( AARP.daw._hex( next ) ); // strip of the 0x added by hex
			if ( backwards )
			{
				key -= 1;
				if ( key < 0 )
					key = 1023;
			}
			else
			{
				key += 1;
				if ( key > 1023 )
					key = 0;
			}
		}
		
		L.push( AARP.daw._hex( start ) );
		return L.join( "" );
	}
	, decrypt: function( s )
	{
		start = parseInt( s.substring( s.length - 2 ), 16 ) // last two chars are encoded start value
		backwards = start % 2;
		s = s.substring( 0, s.length - 2 );
		L = [];
		
		if ( backwards )
			key = 1023 - start;
		else
			key = start;
		
		var max = Math.floor( s.length / 2 ) - 1;
		
		for ( var i = 0; i <= max; i++ )
		{
			var lo = i * 2;
			var hi = (i + 1) * 2;
			next = parseInt( s.substring( lo, hi ), 16 ) ^ AARP.daw.aKey[key];
			
			L.push( String.chr( next ) );
			
			if ( backwards )
			{
				key -= 1;
				if ( key < 0 )
					key = 1023;
			}
			else
			{
				key += 1;
				if ( key > 1023 )
					key = 0;
			}
		}
		
		return L.join( "" );	
	}
	, _hex: function( n )
	{
		s = n.toString( 16 );
		if ( s.length == 1 )
	        return "0" + s;
	    else
	        return s;
	}
	, crypt_text: function( plain )
	{
		var start = plain.length % 250;
		var backwards = start % 2;
		return AARP.daw.encrypt( plain, start, backwards );
	}
	, decrypt_text: function( enc )
	{
		return AARP.daw.decrypt( enc );
	}
	, create_timestamp: function()
	{
		var s = null;
		if ( arguments.length > 0 )
		{
			s = arguments[0];
		}
		else
		{
			s = new Date();
			s = s.getTime();
		}
		var start = s % 250;
		var backwards = start % 2;

		return AARP.daw.encrypt( s + "", start, backwards );
	}
	, show_timestamp: function( ts )
	{
		var s = parseInt( AARP.daw.decrypt( ts + "" ) );
		return new Date( s );
	}
}

/**
* A post-pageload link fixer that applies target=_top to non-CQ pages
* and sticks an extension onto all CQ links.
*
* @author Kaiser Shahid
*/

AARP.CQ5LinkFix = function( element )
{
	var domain = AARP.page.protocol + '://' + AARP.page.host;
	if ( AARP.page.port != '80' )
		domain += ':' + AARP.page.port;
	
	if ( document.location.href.match( /cq5linkfix=no/ ) ) return;
	
	try
	{
		dbg( "AARP.CQ5LinkFix: " + element + " ; id=" + element.id );
		var links = element.getElementsByTagName( "a" );
		for ( var i = 0 ; i < links.length; i++ )
		{
			var link = links[i];
			var href = link.href;
			
			/* don't want to fix internal anchors and javascript calls */
			if ( !href || href.match( /^(javascript|#)/ ) ) continue;
			
			var href0 = href + "";
			
			if ( AARP.page.is_authoring )
				href = href.replace( domain, '' );
			
			if ( href.charAt( 0 ) == '/' && !href.match( /^\/(community|system|lib|apps|var|bin)/ ) )
			{
				if ( href.charAt( href.length - 1 ) == '/' ) continue;
				
				var b4 = href + "";
				/* no extension at all, so add .html */
				if ( !href.match( /\.[^.]+$/ ) )
					href += '.html';
				
				link.href = href;
				//dbg( ">> " + href );
			}
			else if ( AARP.page.is_authoring )
				link.target = '_top';
			
			/* bust out of symlink iframe */
			if ( document.location.href.match( /\.sym\./ ) )
				link.target = '_top';
			
			if ( href != href0 )
				dbg( href0 + " => " + href + " (target=" + link.target + ")" );
			else
				dbg( href0 + " ! unchanged" );
		}
		
		dbg( "AARP.CQ5LinkFix: processed links=" + links.length );
	}
	catch ( e ) { dbg( "AARP.CQ5LinkFix: " + e.toString(), dbg.ERROR ); }
}


startup.add( function() { 
	AARP.CQ5LinkFix( $( 'contentArea' ) );
	AARP.CQ5LinkFix( $( 'footer' ) );
} );

// Catch firebug console debug
if( typeof console === "undefined" ) {
	console = {
		log: function() {},
		info: function() {},
		trace: function() {},
		debug: function() {},
		warn: function() {},
		error: function() {},
		profile: function() {},
		profileEnd: function () {}
	} ;
} ;


/*
* Header functions
* @todo bring all the junk up into the namespace
*/

AARP.Header = {
	__version__: '3.0d', 
	WAMable: { 
		'beta-d.aarp.org': 'login-d', 
		'www-i.aarp.org': 'login-d', 
		'www-d.aarp.org': 'login-d', 
		'bulletin-d.aarp.org': 'login-d', 
		'products-d.aarp.org': 'login-d', 
		'beta-s.aarp.org': 'login-s', 
		'www-qa.aarp.org': 'login-s', 
		'www-qa-p.aarp.org': 'login-s', 
		'www-s.aarp.org': 'login-s', 
		'bulletin-s.aarp.org': 'login-s', 
		'products-s.aarp.org': 'login-s', 
		'beta.aarp.org': 'login', 
		'www.aarp.org': 'login', 
		'bulletin.aarp.org': 'login', 
		'products.aarp.org': 'login'
	}, 
	login: function() {
		var WAMserver = AARP.Header.WAMable[ AARP.page.host ] ;
		if ( WAMserver )
		{
			document.location = 'https://' + WAMserver + '.aarp.org/community/auth/wamloginhandler.bt?referrer=' + window.location.href ;
			return;
		}
		else {
			document.location = 'https://login.aarp.org/community/auth/wamloginhandler.bt?referrer=' + window.location.href ;
			return;
		}
	},
	register: function() {
		var WAMserver = AARP.Header.WAMable[ AARP.page.host ] ;
		if ( WAMserver ) {
			document.location = 'https://' + WAMserver + '.aarp.org/community/register/index.bt' ;
			return;
		}
		else {
			document.location = 'https://login.aarp.org/community/register/index.bt' ;
			return;
		}
	},
	join: function() {
		document.location = 'http://www.aarp.org/memtools1' ;
		return;
	},
	searchTermsFocus: function() {
		var defaultText = 'Enter Search Terms' ;
		var searchInput = $( 'searchTerms' ) ;
		if ( searchInput.getValue() == defaultText ) {
			searchInput.value = '' ;
		}
		searchInput.setStyle( { borderColor: '#000', color: '#000' } ) ;
	},
	searchTermsBlur: function() {
		var defaultText = 'Enter Search Terms' ;
		var searchInput = $( 'searchTerms' ) ;
		searchInput.setStyle( { borderColor: '#999', color: '#949189' } ) ;
		if ( searchInput.getValue() == '' ) {
			searchInput.value = defaultText ;
		} ;
	},
	startupSearch: function() {
		var searchInput = $( 'searchTerms' ) ;
		if ( searchInput.getValue() == '' ) {
			searchInput.blur() ;
			searchInput.setStyle( { borderColor: '#999', color: '#949189' } ) ;
			searchInput.value = 'Enter Search Terms' ;
		} ;
		Event.observe( 'searchTerms', 'focus', AARP.Header.searchTermsFocus ) ;
		Event.observe( 'searchTerms', 'blur', AARP.Header.searchTermsBlur ) ;
	},
	startup: function() {
		if ( AARP.User.isLoggedIn ) {
			var firstName = AARP.User.firstName ;
			if (firstName.length > 13) {
				firstName = firstName.substring(0, 14) + '&#8230;' ;
			}
			var newMessageCount = AARP.User.messages ;
			var membername = AARP.User.name ;
			
			$( 'welcomeAnon' ).hide() ;
			$( 'welcomeLoggedIn' ).show() ;
			$( 'firstName' ).update(firstName) ;
			if (newMessageCount > 0) {
				$( 'newMessageCount' ).update( ' (' + newMessageCount + ' New)' ) ;
			}
		}
		
		var currentPagePath = AARP.page.pathc_effective ;
		
		if ( AARP.User.isMember ) {
			if ( AARP.User.isExpiringMember ) {
				$( 'loggedInExpiredMemberRenew' ).show() ;
			}
		}
		else if ( AARP.User.isExpiredMember ) {
			$( 'loggedInExpiredMemberRenew' ).show() ;
		}
		else {
			$( 'loggedInNonMemberJoin' ).show() ;
		}
	}
} ;

startup.add( function() { AARP.Header.startupSearch(); } ) ;

//backward compatibility for Bulletin header
AARP.Login = { open: function() { AARP.Header.login(); } } ;

// backward compatibility for article 'Comments'
// :: verify 'Log In' link above comment box in 'Anonymous / Not-Logged-In' view before removing
function openLogin() { AARP.Header.login(); } ;


// ---------------------------------------------------
function showSelectBoxes() {
	var selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "visible";
	}
}

// ---------------------------------------------------
function hideSelectBoxes() {
	var selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "hidden";
	}
}

// ---------------------------------------------------
function showFlash() {
	var flashObjects = document.getElementsByTagName("object");
	for (i = 0; i < flashObjects.length; i++) {
		flashObjects[i].style.visibility = "visible";
	}

	var flashEmbeds = document.getElementsByTagName("embed");
	for (i = 0; i < flashEmbeds.length; i++) {
		flashEmbeds[i].style.visibility = "visible";
	}
}

// ---------------------------------------------------
function hideFlash() {
	var flashObjects = document.getElementsByTagName("object");
	for (i = 0; i < flashObjects.length; i++) {
		flashObjects[i].style.visibility = "hidden";
	}

	var flashEmbeds = document.getElementsByTagName("embed");
	for (i = 0; i < flashEmbeds.length; i++) {
		flashEmbeds[i].style.visibility = "hidden";
	}
}

// ---------------------------------------------------
function showCalcs() {
	var calcs = document.getElementsByName("calculator");
	for (var i=0; i<calcs.length; i++) {
			calcs[i].style.visibility = "visible";
	}
}

// ---------------------------------------------------
function hideCalcs() {
	var calcs = document.getElementsByName("calculator");
	for (var i=0; i<calcs.length; i++) {
			calcs[i].style.visibility = "hidden";
	}
}

// ---------------------------------------------------
function getPageScroll() {
	var xScroll, yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
		xScroll = self.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
		xScroll = document.documentElement.scrollLeft;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
		xScroll = document.body.scrollLeft;	
	}

	arrayPageScroll = new Array(xScroll,yScroll);
	return arrayPageScroll;
}

// ---------------------------------------------------
function getPageSize() {
	var xScroll, yScroll;

	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}

	var windowWidth, windowHeight;

	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	

	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
	return arrayPageSize;
}

// ---------------------------------------------------
function overlayConfirmation(dialogBoxContentsDivID) {
	hideCalcs();
	hideSelectBoxes();
	hideFlash();

	var objBody = document.getElementsByTagName("body").item(0);
	
	var objOverlay = document.createElement("div");
	objOverlay.setAttribute('id','overlay');
	objOverlay.style.display = 'none';
	objBody.appendChild(objOverlay);

	var objDialogBox = document.createElement("div");
	objDialogBox.setAttribute('id','dialog');
	objDialogBox.style.display = 'none';
	objBody.appendChild(objDialogBox);

	var arrayPageSize = getPageSize();
	$('overlay').style.width = arrayPageSize[0] +"px";
	$('overlay').style.height = arrayPageSize[1] +"px";

	var overlayDuration = 0.2;	// shadow fade in/out duration
	var overlayOpacity = 0.6;	// controls transparency of shadow overlay
	new Effect.Appear('overlay', { duration: overlayDuration, from: 0.0, to: overlayOpacity });
	
	var arrayPageScroll = getPageScroll();
	var dialogBoxTop = arrayPageScroll[1] + (arrayPageSize[3] / 3);
	var dialogBoxWidth = 350;
	var dialogBoxLeft = ((arrayPageSize[2] / 2) - (dialogBoxWidth / 2)) + arrayPageScroll[0];
	
	$('dialog').style.top = dialogBoxTop +"px"; 
	$('dialog').style.left = dialogBoxLeft +"px"; 
	$('dialog').update($(dialogBoxContentsDivID).innerHTML);
	
	$('dialog').show();
}

// ---------------------------------------------------
function closeOverlayConfirmation() {
	$('dialog').hide();
	var overlayDuration = 0.2;	// shadow fade in/out duration
	new Effect.Fade('overlay', { duration: overlayDuration});
	showCalcs();
	showSelectBoxes();
	showFlash();
}

// ---------------------------------------------------
function overlayUI() {
	//hideSelectBoxes();
	hideCalcs();
	hideFlash();

	var objOverlay = document.createElement("div");
	objOverlay.setAttribute('id','overlay');
	objOverlay.style.display = 'none';
	$$('body')[0].appendChild(objOverlay);

	var arrayPageSize = getPageSize();
	$('overlay').style.width = arrayPageSize[0] +"px";
	$('overlay').style.height = arrayPageSize[1] +"px";

	var overlayDuration = 1.2;	// shadow fade in/out duration
	var overlayOpacity = 0.6;	// controls transparency of shadow overlay
	new Effect.Appear('overlay', { duration: overlayDuration, from: 0.0, to: overlayOpacity });
}

// ---------------------------------------------------
function closeOverlayUI() {
	var overlayDuration = 0.2;	// shadow fade in/out duration
	new Effect.Fade('overlay', { duration: overlayDuration});
	showCalcs();
	showSelectBoxes();
	showFlash();
}

/**
* Ad Code
*/

AARP.Ads = {
	__version__: ''
	, sitename: 'aarporgv2.dart'
	, sitename_map: { 'bulletin':'bulletin.dart','products':'aarppnsv2.dart' }
	, zonename: ''
	, kw: ''
	, house: ''
	, taxa: ''
	, taxb: ''
	, iachn: ''
	, iasub: ''
	, dindx: ''
	, jsrpt: ''
	, sorce: ''
	, pgid: ''
	, ord: 0
	, tile: 0
	, pgtyp: ''
	, tpl: null
	
	, tpl_str: '<' + "script type=\"text/javascript\" src=\"http://ad.doubleclick.net/N1175/adj/#{sitename}/#{zonename};abr=!webtv;kw=#{kw};sz=#{width}x#{height};tile=#{tile};jsrpt=yes;grab=all;house=#{house};taxa=#{taxa};taxb=#{taxb};iachn=#{iachn};iasub=#{iasub};dindx=#{dindx};sorce=#{sorce};pgid=#{pgid};ord=#{ord}?\">"
		+ '<' + "/script><!-- ad_doc_write -->"
		+ '<' + "script type='text/javascript'>"
		+ "if ((!document.images && navigator.userAgent.indexOf(\"Mozilla/2.\") >= 0) || (navigator.userAgent.indexOf(\"WebTV\") >= 0)) {"
		+ "document.write('<a href=\"http://ad.doubleclick.net/N1175/jump/#{sitename}/#{zonename};kw=#{kw};sz=#{width}x#{height};tile=#{tile};jsrpt=no;grab=all;house=#{house};taxa=#{taxa};taxb=#{taxb};iachn=#{iachn};iasub=#{iasub};dindx=#{dindx};sorce=#{sorce};pgid=#{pgid};ord=#{ord}?\">');"
		+ "document.write('<img src=\"http://ad.doubleclick.net/N1175/ad/#{sitename}/#{zonename};kw=#{kw};sz=#{width}x#{height};tile=#{tile};jsrpt=no;grab=all;house=#{house};taxa=#{taxa};taxb=#{taxb};iachn=#{iachn};iasub=#{iasub};dindx=#{dindx};sorce=#{sorce};pgid=#{pgid};ord=#{ord}?\" width=\"#{width}\" height=\"#{height}\" border=\"0\"></a>');"
		+ "}"
		+ '<' + "/script>"
	, width: 0
	, height: 0
	, buffer: ''
	
	// TODO: figure out definitions how to get definitions for these
	, dem1: ''
	, dem2: ''
	, dem3: ''
	, debugInline: false
	, pageLoaded: false
	, _pri: ''
	, _sec: ''
	, _ter: ''
	, _qua: ''
	
	/*
	AARPAds will set the taxonomy, page id, etc., based on any set vars and also where
	the user currently is (since /community will need to auto-generate all AARPAds).
	
	AARPAds SHOULD ONLY BE CALLED BEFORE <head> CLOSES! (AARPAds will allow the CMS to set
	some parameters manually through the custom head file).
	*/
	
	, init: function()
	{
		AARPAds.ord = Math.floor( Math.random() * 1298948098294839 );
		AARPAds.tpl = new Template( AARPAds.tpl_str );
		
		// NEW [2009-11-17 | kaiser]: first line of defense in obtaining zone/taxonomy is
		// to check the Subject1 metafield if stuff is empty.
		
		try
		{
			// note that we only want to apply the data from here IF AND ONLY IF
			// a Subject field is present.
			// @todo should we do checks to make sure that this only applies to articles?
			var groupings = [ 'null', 'null', 'null', 'null' ];
			var subjects = {};
			var found = false;
			var metas = document.getElementsByTagName( 'meta' );
			for ( var i = 0; i < metas.length; i++ )
			{
				var meta = metas[i];
				if ( meta.name.match( /^Subject/ ) )
				{
					subjects[meta.name] = meta.getAttribute( 'content' );
					continue;
				}
			}
			
			for ( var i = 1; i <= 5; i++ )
			{
				if ( subjects['Subject'+i] )
				{
				  found = true;
					groupings = subjects['Subject'+i]
						.replace( / and /, ' & ' )
						.replace( /_and_/, ' & ' )
						.split( /[:\/]/ )
					;
					for ( var j = 0; j < 4; j++ )
					{
						if ( !groupings[j] ) groupings[j] = 'null';
					}
					break;
				}
			}
			
			if ( found )
			{
				if ( AARP.Ads.zonename == '' )
					AARP.Ads.zonename = AARP.Ads.normalize( groupings[0] + '__' + groupings[1], true );
				if ( AARP.Ads.taxa == '' )
					AARP.Ads.taxa = AARP.Ads.normalize( groupings[2], true );
				if ( AARP.Ads.taxb == '' )
					AARP.Ads.taxb = AARP.Ads.normalize( groupings[3], true );
			}
		}
		catch ( e )
		{
			dbg( 'AARP.Ads.init(): ' + e.toString(), dbg.ERROR );
		}
		
		//if ( AARPAds.sitename_map[AARP.page.host] )
		//	AARPAds.sitename = AARPAds.sitename_map[AARP.page.host];
		if( AARPAds.sitename_map[AARP.page.site] )
			AARPAds.sitename = AARPAds.sitename_map[AARP.page.site];
		
		var tmp = null;
		// woo! with setPage(), don't need to worry about AARPAds nonsense that used to be here.
		//var comp = document.location.toString().split( '/' );
		//var comp = "http://beta.aarp.org/health/index.html".split( '/' );
		
		var protocol = AARP.page.protocol;
		var domain = AARP.page.host;
		var page = AARP.page.file;
		var querystring = AARP.page.querystring;
		var comp = AARP.page.path.split( '/' );
		comp.shift();
		if ( comp.length == 0 ) comp.push( '' ); // to make sure code doesn't throw errors, just put in a dummy value
		
		// /pri/articles/article.html -> 3
		// /pri/sec/articles/articles.html -> 4
		
		//Modified by Yonas Hassen on 02 July 2008:
		//Added third and fourth level subdirectories.
		//These will fill the values for 'taxa' and 'taxb' respectively, 
		//only if 'iachn' and 'iasub' are not null.
		var _pri = comp[0];
		var _sec = comp[1];
		var _ter = comp[2];
		var _qua = comp[3];
		AARPAds._pri = _pri;
		AARPAds._sec = _sec;
		AARPAds._ter = _ter;
		AARPAds._qua = _qua;
		
		/* dbg( "Ad Init:\n"
			+ 'url: ' + AARP.page.url + "\n"
			+ "querystring: " + querystring + "\n"
			+ 'domain: ' + domain + "\n"
			+ 'page: ' + page + "\n"
			+ 'pathc: ' + comp + "\n"
			+ 'primary: ' + _pri + "\n"
			+ 'secondary: ' + _sec + "\n"
		); */
		
		//TODO: check for subdomain properties (bulletin, magazine, etc.)--
		//taxonomy/zonename/etc. conventions should be the same throughout
		//(at least for the time being), so only sitename ever needs to change.
		
		var isArticle = false;
		
		// CMS processing
		if ( _pri != 'community' )
		{
			// normalize pgid to set for zonename, taxa, and taxb
			// NEW (2008-02-05): add != 'null' test
			var pgid = null;
			if ( AARPAds.pgid != '' && AARPAds.pgid != 'null' )
			{
				if ( AARPAds.pgid.match( /\/content\/articlerepository/ ) )
				{
					isArticle = true;
					
					// remove '/content/articlerepository' from beginning, and article label from end
					pgid = AARPAds.pgid.split( '/' );
					if ( pgid[0] == '' ) pgid.shift();
					pgid.shift(); pgid.shift();
					pgid.pop();
					
					/*
					// NEW [2008-07-10 | kaiser]: special processing for articles only (used to
					// be anytime pgid was pre-set). the article template was changed way back per
					// scott's request to include dcsubject1 as a zonename, but apparently he now 
					// wants the repository path to be the zonename and dcsubject1 to be taxa/taxb.
					// this code change is specific to how the data is outputted on the proxy, so
					// any changes to the ad code in the proxy (regarding zonename) will affect this.
					
					var taxonomy = AARPAds.zonename.split( /__/ );
					var l1 = pgid[0];
					var l2 = 'null';
					if ( pgid[1] ) l2 = pgid[1];
					
					AARPAds.zonename = l1 + '__' + l2;
					AARPAds.taxa = taxonomy[0];
					AARPAds.taxb = taxonomy[1];
					if ( !AARPAds.taxa || AARPAds.taxa == '' ) AARPAds.taxa = 'null';
					if ( !AARPAds.taxb || AARPAds.taxb == '' ) AARPAds.taxb = 'null';
					*/
					
					// NEW [2007-12-14 | kaiser]: don't override taxa, taxb, and zonename if they're set
					//if ( AARPAds.taxa == '' || AARPAds.taxa == 'null' ) AARPAds.taxa = pgid[0];
					//if ( (AARPAds.taxb == '' || AARPAds.taxb == 'null') && pgid.length > 1 ) AARPAds.taxb = pgid[1];
					if ( AARPAds.zonename == '' )
					{
						AARPAds.zonename = pgid[0];
						for ( var i = 1; i < pgid.length; i++ )
							AARPAds.zonename += '_' + pgid[i];
					}
				}
			}
			else
			{
				// NEW [2008-07-09]: assign a page id
				AARPAds.pgid = '/' + AARP.page.path;
				AARPAds.taxa = _ter;
				AARPAds.taxb = _qua;
			}
			
			// for now, AARPAds only includes states pages. but it could grow.
			var notPrimaryChannels = /^states$/;
			if ( !comp[0].match( notPrimaryChannels ) )
			{
				// no matter what, index.html in the CMS will be an index/landing page of some sort.
				// however, if dindx is manually set at startup, its current value will be respected.
				// TODO: match for /^index/ instead?
				
				if ( page != 'index.html' && AARPAds.dindx == '' )
					AARPAds.dindx = 'no';
				else if ( page == 'index.html' )
					AARPAds.dindx = 'yes';
			
				if ( comp[1] == 'articles' )
					_sec = 'articles';
				else if ( comp[2] == 'articles' )
				{
					_sec = comp[1];
					_ter = 'articles';
				}
			}
			else
			{
				// main state landing & individual state pages
				if ( _pri == 'states' && comp.length <= 2 )
					AARPAds.dindx = 'yes';
			}
			
			AARPAds.iachn = _pri;
			AARPAds.iasub = _sec;
		}
		else
		{
			var comObjMatch = /^(people|photos|video|journals|groups|tags)$/;
			if ( page.match( /^showCommunityHome/ ) )
				AARPAds.dindx = 'yes';
			else
			{
				// /community/%object%
				var m = null;
				if ( comp[1] ) m = comp[1].match( comObjMatch );
				
				if ( AARP.page.file == 'search.bt' )
				{
					AARPAds.zonename = 'search_results';
					AARPAds.dindx = 'yes';
				}
				else if ( m )
				{
					_sec = comp[1];
					AARPAds.dindx = 'yes';
				}
				// user's profile index
				else if ( comp.length == 2 )
				{
					AARPAds.dindx = 'yes';
				}
				// /community/portfolio/%object%/index.jsp?membername=%user%&pageNum=%page%
				else if ( comp[1] == 'portfolio' )
				{
					_sec = comp[2];
					AARPAds.dindx = 'yes';
					m = querystring.match( /membername=([\w_]+)/ );
					if ( m[1] )
					{
						AARPAds.pgid = m[1] + '__' + _sec;
						m = querystring.match( /pageNum=([\d]+)/ );
						if ( m[1] )
							AARPAds.pgid += '__page_' + m[1];
						else
							AARPAds.pgid += '__page_1';
					}
				}
				// /community/%user%/%object%[/%label%/%id%]
				else if ( comp[1] != 'misc' && comp[1] != 'profile' )
				{
					// TODO: should i set page [id] to be %user%__%object%__%id%?
					_sec = comp[2];
					AARPAds.pgid = comp[1] + '__' + _sec;
					
					// if the url decomp is 
					if ( comp.length == 5 )
					 	AARPAds.pgid += '__id_' + comp[4]; // + '__' + comp[3]
					else if ( comp.length == 3 )
					{
						AARPAds.pgid += '__page_1';
						AARPAds.dindx = 'yes';
					}
					
					page = AARPAds.pgid;
				}
				else
				{
					// TODO: what would go here?
				}
			}
		}
		
		// NEW [2008-07-10 | kaiser]: moved stuff under this branch since it interferes with article behavior.
		if ( !isArticle )
		{
			if ( AARPAds.zonename == '' )
			{
				// NEW [2008-07-09 | kaiser]: if in a subchannel, make sure to set the zone to subchannel. may need to revisit
				// code regarding 2008-02-16 later (once scott gives test cases)
				if ( _sec && _sec != '' && _sec != 'null' )
					AARPAds.zonename = 'subchannel_' + _sec;
				else
					AARPAds.zonename = 'channel__' + _pri;
			}
			
			if ( AARPAds.taxa == 'topic' ) AARPAds.taxa = 'null';
			if ( AARPAds.taxb == 'subtopic' ) AARPAds.taxb = 'null';
			
			if ( AARPAds.taxb == '' ) AARPAds.taxb = _ter;		
			AARPAds.iachn = _pri;
			AARPAds.iasub = _sec;
			
			//Added by Yonas Hassen on 02 July 2008
			if (AARPAds.iachn != '' && AARPAds.iasub != '')
			{
				if ( AARPAds.taxa == '' || AARPAds.taxa == 'null' ) AARPAds.taxa = _ter;
				if ( AARPAds.taxb == '' || AARPAds.taxb == 'null' ) AARPAds.taxb = _qua;
			}
		}
		
		var kw = Cookies.get( 'search-kw' );
		var queryPatterns = /(query|tags|groupQuery|keywords|terms)=([^&]+)/;
		
		// look for & set query for duration of session
		var m = document.location.toString().match( queryPatterns );
		if ( m )
		{
			AARPAds.kw = AARPAds.kw_normalize( m[2] );
			Cookies.set( 'search-kw', AARPAds.kw );
		}
		else if ( kw )
			AARPAds.kw = kw;
		
		// NEW (2008-01-22): per Scott's fixes
		// set 'null' if these are empty still
		// # Modified by Yonas Hassen (30 June 2008)
		var tmp = ['kw', 'taxa', 'taxb', 'iachn', 'iasub', 'sorce', 'pgid'];
		for ( var y in tmp )
		{
			y = tmp[y];
			if ( AARPAds[y] == '' || AARPAds[y] == undefined ) AARPAds[y] = 'null';
		}
		
		// NEW [2008-07-31 | kaiser]: post-fixing things
		AARPAds['sorce'] = AARPAds.normalize( AARPAds['sorce'].toLowerCase() );
		
		// for easier debugging: just show output inline with the ad so that
		// viewing community code is easier
		if ( AARP.page.parameters['debugAds'] != undefined )
			AARPAds.debugInline = true;
		
		// there's a 49 character limit on zonenames
		try
		{
			if ( AARPAds.zonename.length > 49 )
				AARPAds.zonename = AARPAds.zonename.substring( 0, 49 );
		}
		catch ( e ) { }
	}
	
	// output ad code
	// optional 3rd parameter, if given, should be an id string of an object whose innerHTML will be set 
	//    to the ad code.
	//    NEW [2009-02-20 | kaiser]: typecheck on 3rd parameter. if object, will do innerHTML, otherwise, will return the ad string
	
	, serve: function( width, height )
	{
		AARPAds.fix_before_serve();
		AARPAds.width = width;
		AARPAds.height = height;
		
		var obj = null;
		var ret_str = false;
		if ( arguments.length > 2 )
		{
			if ( typeof( arguments[2] ) == 'object' )
			{
				obj = arguments[2];
				obj = $( obj );
			}
			else
			{
				ret_str = true;
			}
		}
		
		//alert("ADS >> inline=" + AARPAds.debugInline + "; obj=" + obj + "; ret_str=" + ret_str);
		startup.add( function() {
			dbg( "ADS >> inline=" + AARPAds.debugInline + "; obj=" + obj + "; ret_str=" + ret_str );
		} );
		
		// we're sending 'AARPAds' as the dictionary because, well, AARPAds is a 
		// dictionary. with super powers.
		
		AARPAds.tile++;
		var buffer = AARPAds.tpl.evaluate( AARPAds );
		
		if ( obj == null )
		{
			if ( !ret_str )
			{
				if ( AARPAds.debugInline )
					buffer += "<textarea rows='10' cols='25'>Tile #" + AARPAds.tile + "\n" + buffer.replace( "<" + "&gt;" ).replace( ">", "&lt;" ) + "</textarea>\n\n";
				document.write( buffer );
			}
		}
		else
			obj.innerHTML = buffer;
		
		if ( !AARPAds.debugInline )
			AARPAds.buffer += "Tile #" + AARPAds.tile + "\n" + buffer + "\n\n";
		
		if ( ret_str ) return buffer;
	}
	
	// NEW [2008-02-16 | kaiser]: catch any runtime errors post-initialize
	, fix_before_serve: function()
	{
		if ( AARP.page.file == 'search.bt' )
		{
			AARPAds.zonename = 'search_results';
		}
		// TODO: individual checks on overwriting taxa/taxb?
		else if ( AARPAds.taxa == 'topic' || AARPAds.taxa == '' ) //  || AARPAds.taxb == 'subtopic' || AARPAds.taxb == ''
		{
			AARPAds.zonename = 'channel_community';
			AARPAds.taxa = 'null';
			AARPAds.taxb = 'null';
		}
	}
	
	, debug: function()
	{
		dbg( AARPAds.buffer );
		//document.write( "<textarea rows='20' cols='60'>" + AARPAds.buffer + "</textarea>" );
	}
	
	// convert 'fancy' characters into alphanumeric and underscore
	, normalize: function( str )
	{
		/*
		str = str.replace( /[^\w\s-]/g, '' );
		str = str.replace( /-/g, ' ' );
		*/
		
		// Round 1: remove non-word characters from beginning & end of string
		// Round 2: all non-word, non-dash characters get converted to _
		// Round 3: replace any remaining spaces with _
		str = str.trim().replace( /^[^\w]+/, '' ).replace( /[^\w]+$/, '' );
		str = str.replace( /[^\w-]+/g, '_' );
		str = str.replace( /\s+/g, '_' );
		
		if ( arguments.length > 1 )
			str = str.toLowerCase();
		
		return str;
	}
	
	// simlar to normalize(), except convert all non-words to spaces, then convert 
	// groups of spaces to +
	, kw_normalize: function( str )
	{
		// trim & replace non-words at beginning and end with empty strings
		str = str.trim().replace( /^[^\w]+/, '' ).replace( /[^\w]+$/, '' );
		// replace any run of non-words and dashes with a single space
		str = str.replace( /[^\w-]+/g, ' ' );
		// convert one or more spaces to a single plus
		str = str.replace( /\s+/g, '+' );
		
		return str.toLowerCase();
	}
	
	, removeAds: function()
	{
		var adArr = $$('div.ad');

		for (var i = 0; i<adArr.length; i++) {
			adArr[i].style.display = "none";	
		}
	}
}

// for backwards compatibility...
var AARPAds = AARP.Ads;



/**
* Helper functions to fix dynamic right column for (what else) IE.
* @author Kaiser Shahid (2009-02-20; 2009-02-23)
*/

AARP.externalRight = {
	found_ads: 0
	/**
	* This function will turn the calls to AARPAds.serve() into actual HTML, in order to reduce
	* the number of document.write() calls and also do a little modifying of html (mainly
	* wrapping the ad code with a div and giving it a unique id).
	*/
	, adFix: function( str )
	{
		// NEW [2009-05-11 | kaiser]: it looks like the end head and opening body tag are included as part of output, so strip
		// those off.split on that.
		
		var head_body_remover = new RegExp( "</head><body[^>]+>" );
		var div_container_remover = new RegExp( "<div id='AARPRightColumn'>" );
		var script_matcher_init = new RegExp(
			'<' + 'script[^>]*>\\s*AARPAds\.init[^;]+;</' + 'script>'
		);
		var script_matcher_serve = new RegExp(
			'<' + 'script[^>]*>AARPAds\\.serve([^;]+);</' + 'script>', 'g'
		);
		
		str = str.replace( head_body_remover, '' );
		// replace the start & end of the big container and then the script init call
		str = str.replace( div_container_remover, '' ).replace( /\s*<\/div>\s*$/, '' ).replace( script_matcher_init, '' );
		str += "<div id='aarp.ad.___separator___' style='display: none;'> </div>";
		AARPAds.init();
		
		var serves = str.match( script_matcher_serve );
		for ( var i = 0; i < serves.length; i++ )
		{
			// break up '...serve( x, y )...' into '..serve( ' and 'x,y )...'
			var tmp = serves[i].split( /serve\(\s*/ );
			// break up 'x, y )...' into 'x, y' and ' )...'
			tmp = tmp[1].split( /\s*\)/ );
			
			// parse out the dimensions and retrieve the corresponding ad code.
			// also, wrap the ad code with a unique container and id
			var dim = tmp[0].split( /,\s*/ );
			var w = parseInt( dim[0] ), h = parseInt( dim[1] );
			var ad_buff = "<div id='aarp.ad." + i + "'>" + AARPAds.serve( w, h, true ) + "</div>";
			AARP.externalRight.found_ads++;
			
			// replace the script call with the actual ad output
			str = str.replace( serves[i], ad_buff );
		}
		
		return str;
	}
	
	/**
	* Once the page finishes loading, re-examine the right column and move each of the ads inserted at the bottom to
	* the appropriate slots above. The typical way to check if the current node is an ad element is if:
	* 1) the separator has been found
	* 2) the current element is not: SCRIPT, NOSCRIPT, non-HTML element (whitespace, html comments)
	*/
	
	, postFix: function()
	{
		if ( !navigator.userAgent.toString().match( /MSIE/ ) ) return;
		
		var right = $( 'rightColumn' );
		var dbg = $( 'rightColumnText' );
		
		var found_separator = false;
		var last_ele_was_script = false;
		var ad_counter = 0;
		var ad_containers = [];
		
		for ( var i = 0; i < right.childNodes.length; i++ )
		{
			var node = right.childNodes[i];
			var tagname = ''; if ( node.tagName ) tagname = node.tagName.toUpperCase();
			//dbg.value += node.tagName + ' -> ' + node.id  + ' ? ' + node.src + "\n";
			
			if ( node.id == 'aarp.ad.___separator___' )
			{
				found_separator = true;
				continue;
			}
			else if ( tagname == 'DIV' && node.getAttribute( 'table' ) == 'y' )
			{
				ad_containers = AARP.externalRight.extractAdContainers( node );
			}
			
			if ( !found_separator ) continue;
			
			// a legitimate ad node; remove and insert into container pointed to by ad_counter,
			// then increment ad_counter by 1.
			if ( tagname != 'SCRIPT' && tagname != 'NOSCRIPT' && tagname.match( /[\w]+/ ) )
			{
				//dbg.value += ad_counter + ' - ' + tagname + ' : ' + node.innerHTML + "\n\n";
				right.removeChild( node );
				if ( ad_containers[ad_counter] )
				{
					ad_containers[ad_counter].appendChild( node );
					ad_counter++;
				}
				last_ele_was_script = false;
			}
		}
	}
	
	/**
	* Grabs the first child of each node under parent that has 'ad' in the class name.
	*/
	
	, extractAdContainers: function( parent )
	{
		var ad_containers = [];
		for ( var i = 0; i < parent.childNodes.length; i++ )
		{
			var node = parent.childNodes[i];
			if ( node.className.match( /^ad/ ) )
				ad_containers.push( node.firstChild );
		}
		
		return ad_containers;
	}
}


//startup.add( function() { AARPAds.init(); } );

/**
* Miscellaneous code
*/

/**
* compatibility with popup option in article authoring.
*/

function CFC_popup(/*String*/ url, /*String*/ name, /*String*/ features)
{
	var defaultWidth = 500;
	var defaultHeight = 400;
	if (url.indexOf("/content/") == 0) url = url.substr(8);
	var w = window.open(url, name, features);
	w.focus();
}

AARP.Misc = {};

AARP.Misc.mostPopularFixer = function( div_id )
{
	startup.add( function() {
		if ( !$( div_id ) ) return;
		var li = $( div_id ).getElementsByTagName( 'a' );
		for ( var i = 0; i < li.length; i++ )
		{
			var a = li[i];
			try { a.innerHTML = unescape( a.innerHTML ); }
			catch ( e ) {}
		}
	} );
}

/**
*
* @author kaiser shahid [2007-11-05]
*/

AARP.Misc.defaultText = {
	__version__: ''
	, set: function( obj, txt )
	{
		if ( obj.value.trim() == '' )
			obj.value = txt;
	}
	, unset: function( obj, txt )
	{
		if ( obj.value.trim() == txt )
			obj.value = '';
	}
}

/**
* Dynamic character counter for <textarea> and <input> tags
* Copied by Jon Lechliter from bulletin/js/global.js (2008-7-30)
* @todo Find old instances (non-namespaced)
*/

AARP.Misc.dynamicCharacterCounter = {
	getObject: function(obj)
	{
		var theObj;
		if(document.all) 
		{
	    	if(typeof obj=="string") 
			{
	      		return document.all(obj);
	    	} 
			else 
			{
	      		return obj.style;
	    	}
	  	}
  
		if(document.getElementById) 
		{
	    	if(typeof obj=="string") 
			{
	      		return document.getElementById(obj);
	    	} 
			else 
			{
	      		return obj.style;
	    	}
	  	}
		return null;
	}
	
	, toCount: function( entrance, exit, text, characters )
	{
		var entranceObj = this.getObject(entrance);
		var exitObj = this.getObject(exit);
		var length = characters - entranceObj.value.length;
  	
		if(length <= 0) 
		{
	    	length=0;
	   	 	text='<span class="disable">You have reached your character limit.</span>';
	    	entranceObj.value=entranceObj.value.substr(0,characters);
	  	}
  	
		exitObj.innerHTML = text.replace("{CHAR}",length);
	}
}

AARP.Misc.getMetaValue = function( metaName )
{
	var metaTags=document.getElementsByTagName("META");
	for (var i=0; i<metaTags.length; i++) {
		if (metaTags[i].name.toLowerCase() == metaName.toLowerCase()) {
			return metaTags[i].content;
		}
	}
	return "NA";
}

// some backwards compatibility
AARP.misc = AARP.Misc;


/**
* @author kaiser shahid [2008-02-05]
*/

AARP.hitTracker = {
	server: 'www.aarp.org'
	, name: ''
	, url: ''
	, repoUrl: ''
	, authorName: ''
	, category: ''
	, debugURL: ''
	, hit: function()
	{
		// do not track author instance hits
		if ( AARP.page.is_authoring ) return;
		
		// NEW [2008-03-24]: remove 'debug=y'
		// NEW [2009-08-13]: stripping 'aarp/en/' from the url if available, to keep things normalized (kshahid)
		AARP.hitTracker.url = AARP.hitTracker.url.replace( /debug=[^&]+/, '' ).replace( /aarp\/en\//, '' );
		
		// remove empty querystring
		if ( AARP.hitTracker.url[AARP.hitTracker.url.length-1] == '?' )
			AARP.hitTracker.url = AARP.hitTracker.url.substring( 0, AARP.hitTracker.url.length-1 );
		
		// NEW [2008-03-05 | kaiser]: add site to top of category if not dotorg
		var category = AARP.hitTracker.category;
		if ( AARP.page.site != 'dotorg' ) category = '/' + AARP.page.site + category;
		
		url = 'http://' + AARP.hitTracker.server + '/community/hitTracker/track.action'
			+ '?name=' + escape( AARP.hitTracker.name ) + '&url=' + escape( AARP.hitTracker.url )
			+ '&repoUrl=' + escape( AARP.hitTracker.repoUrl ) + '&authorName=' + escape( AARP.hitTracker.authorName )
			+ '&category=' + escape( category )
		;
		
		var img = new Image();
		img.src = url;
		
		AARP.hitTracker.debugURL = url;
		if ( AARP.page.parameters['debug'] ) document.write( "this: " + AARP.hitTracker.url + "<br />target: " + url + "<br />path, effective: " + AARP.page.pathc_effective + "<br />path: " + AARP.page.pathc + "<br />category: " + category + "<br />site: " + AARP.page.site );
		//document.location = url;
	}
}


/**
* Moved from js/cms/ctg.js to here. Could be useful for other things.
*/

AARP.XMLParser = {
   parse: function( xml )
   {
       var xmlDoc = null;
       var docType = "text/xml";

       var opts = {}; if ( arguments[1] ) opts = arguments[1];
       if ( opts.docType ) docType = opts.docType;

       try //Internet Explorer
       {
           xmlDoc = new ActiveXObject( "Microsoft.XMLDOM" );
           xmlDoc.async = false;
           // IE parser does not like DOCTYPE =/
           xmlDoc.loadXML( xml.replace( /^\s*<!DOCTYPE[^>]+>/, '' ) );
       }
       catch( e )
       {
           try //Firefox, Mozilla, Opera, etc.
           {
               var parser = new DOMParser();
               xmlDoc = parser.parseFromString( xml, docType );
           }
           catch( f ) { dbg(f.description) }
       }

       return xmlDoc;
   }

   , getSpanText: function( span )
   {
       if ( span.childNodes.length > 0 )
           return span.childNodes[0].nodeValue;
       else
           return '';
   }
} ;


AARP.Print = {
	popUpWindowOptions: 'width=720,scrollbars=yes,menubar=no,titlebar=no,toolbar=no,location=no,directories=no', 
	open: function( handleNode ) {
		window.open( handleNode + '.print.html', 'print_article', this.popUpWindowOptions ) ; 
	}
} ;

// CHANGED [2008-03-05 | kaiser]: only condition needed now is that staging & dev point to www-s
// *updated* [18.Aug.2009 | yhassen]: a fix for ads not showing up in w-s.
if ( !AARP.page.host.match( /^www\.aarp/ ) ) AARP.hitTracker.server = 'beta-s.aarp.org';
/**
* Article searching and indexing.
*/

if ( !AARP.Search ) AARP.Search = {}

/**
* Wrapper functions for components/modular/content/indexing. We no longer need
* to control rendering here (hopefully).
*/

AARP.Search.Indexing = {
	CONTAINER_PREFIX: 'content.index.'
	, instances: {}
	, cache: {}
	
	, newInstance: function( id, style )
	{
		this.instances[id] = style;
	}
	
	, fetch: function( id, url )
	{
		// ambassador code can sometimes omit one of the selectors, resulting
		// in '..', which cq doesn't totally like.
		url = url.replace( /\.{2,}/, '.' );
		
		// removes domain stuff from beginning
		if ( url.indexOf( 'http' ) == 0 )
			url = url.replace( /^http[^:]*:\/\/[^\/]+/, '' );
		
		if ( !AARP.page.is_authoring )
			url = url.replace( /^\/(content\/)?aarp\/en\/home/, '' );
		
		if ( this.cache[url] )
		{
			dbg( 'AARP.Search.Indexing.fetch(): from cache: ' + url );
			var obj = { responseText: this.cache[url] };
			this.fetchComplete( id, url, obj );
			return;
		}
		
		dbg( 'AARP.Search.Indexing.fetch()=' + url );
		var opts = {
			method: 'get'
			, noProxy: true
			, onComplete: function( trans ) { AARP.Search.Indexing.fetchComplete( id, url, trans ); }
		}
		new Ajax.Request( url, opts );
		AARP.Search.Indexing.wait( id );
	}
	
	/**
	* Wait screen
	*/
	
	, wait: function( id )
	{
		var type = this.instances[id];
		var divs = $( this.CONTAINER_PREFIX + id ).getElementsByTagName( 'div' );
		for ( var i = 0; i < divs.length; i++ )
		{
			if ( divs[i].className && divs[i].className == 'progress-meter' )
				divs[i].style.display = 'block';
		}
	}
	
	, fetchComplete: function( id, url, transport )
	{
		dbg( 'AARP.Search.Indexing.fetchComplete( ' + id + ' )' );
		var response = transport.responseText;
		var tmp = response.split( /<!-- content\.index:search-[a-z]+ -->/ );
		
		try
		{
			//dbg( '^-- response: '  + response );
			var container = $( this.CONTAINER_PREFIX + id );
			container.innerHTML = tmp[1];
			if ( url ) this.cache[url] = response;
			AARP.CQ5LinkFix( container );
		}
		catch ( e )
		{
			dbg( '^-- ' + e.toString(), dbg.ERROR );
		}
	}
}


/**
* Email tool
*/

AARP.Email = {
	__version__: ''
	, email_validation: /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/
	, mail_template: ''
	, generalStatus: ''
	, currentOverlay: ''
	, overlayToPrefix: {}
	, formToPrefix: {}
	, overlayCreated: false
	, nodeCache: {}
	
	, open: function( event )
	{
		hideCalcs();
		var overlay = 'emailOverlay';
		var form = 'emailContentForm';
		var prefix = 'email';
		
		if ( arguments.length > 1 && arguments[1] )
			overlay = arguments[1];
		if ( arguments.length > 2 && arguments[2] )
			form = arguments[2];
		if ( arguments.length > 3 && arguments[3] )
			prefix = arguments[3];
		
		AARP.Email.currentOverlay = overlay;
		AARP.Email.currentForm = form;
		
		AARP.Email.overlayToPrefix[overlay] = prefix;
		AARP.Email.formToPrefix[form] = prefix;
		
	var objBody = document.getElementsByTagName("body").item(0);
	
	var objOverlay = null;
	if ( !AARP.Email.overlayCreated )
	{
		objOverlay = document.createElement("div");
		objOverlay.setAttribute('id','overlay');
		objOverlay.style.display = 'none';
		objBody.appendChild(objOverlay);
		AARP.Email.overlayCreated = objOverlay;
	}
	else
	{
		objOverlay = AARP.Email.overlayCreated;
	}
	
	var overlayDel = null;
	if ( !AARP.Email.nodeCache[overlay] )
	{
		overlayDel = $("tools").removeChild($(overlay));
		objBody.appendChild(overlayDel);
		AARP.Email.nodeCache[overlay] = overlayDel;
	}
	else
	{
		overlayDel = AARP.Email.nodeCache[overlay];
	}
	
	var arrayPageSize = getPageSize();
	$('overlay').setStyle({position: 'absolute', top: '0', left: '0'});
	$('overlay').style.width = arrayPageSize[0] +"px";
	$('overlay').style.height = arrayPageSize[1] +"px";

	var overlayDuration = 0.2;	// shadow fade in/out duration
	var overlayOpacity = 0.6;	// controls transparency of shadow overlay
	new Effect.Appear('overlay', { duration: overlayDuration, from: 0.0, to: overlayOpacity });
	
	var arrayPageScroll = getPageScroll();
	var dialogBoxTop = arrayPageScroll[1] + (arrayPageSize[3] / 3);
	var dialogBoxWidth = 350;
	var dialogBoxLeft = ((arrayPageSize[0] - dialogBoxWidth) / 2) + arrayPageScroll[0];
	overlayDel.style.top = dialogBoxTop +"px"; 
	overlayDel.style.left = dialogBoxLeft +"px"; 
	overlayDel.setStyle({position: 'absolute', zIndex: 1000000});

	$(overlay).show();

	}
	, send: function()
	{
		showCalcs();
		var prefix = 'email';
		
		if ( arguments.length > 0 && arguments[0] )
		{
			AARP.Email.currentForm = arguments[0];
			prefix = AARP.Email.formToPrefix[arguments[0]];
		}
		
		// this first check indicates that this is on a non-community page (presumably an article).
		// fill in fields if true.
		
		var ctypename = $( prefix + '.contentTypeName' );
		if ( ctypename && ctypename.value == "article" )
		{
			var em = $( prefix + '.from' ).value;
			var emc = AARP.daw.crypt_text( em );
			var url = AARP.page.protocol + '://' + AARP.page.host + ':' + AARP.page.port + AARP.page.path + '/' + AARP.page.file;
			$( prefix + '.status' ).style.display = 'none';
			var req = $( prefix + '.required' );
			
			// repository id gives unique value
			//$( prefix + '.contentId' ).value = AARPAds.pgid;
			$( prefix + '.contentTitle' ).value = document.title;
			$( prefix + '.permalinkUrl' ).value = url;
			$( prefix + '.redirect' ).value = url + '?generalStatus=' + AARP.Email.generalStatus;
			
			// TODO: when form validation is built, use that instead of this
			var msgs = [];
			if ( !em.match( AARP.Email.email_validation ) )
				msgs.push( "Your E-mail address is invalid" );
			
			// split up recipients list and validate each email;
			// show the addresses that aren't valid.

			var tmpRE = /,\s*/;
			var tmp = $( prefix + '.to' ).value.trim().split( tmpRE );
			var recipients = [];
			var rinvalid = [];
			for ( var i = 0; i < tmp.length; i++ )
			{
				if ( tmp[i].match( AARP.Email.email_validation ) )
					recipients.push( AARP.daw.crypt_text( tmp[i].trim() ) );
				else
					rinvalid.push( tmp[i] );
			}
			if ( rinvalid.length > 0 )
				msgs.push( 'These recipients are invalid: ' + rinvalid.join( ", " ) );
			else
			{
				// limit # of recipients after processing copyme
				if ( $( prefix + '.copyme' ).checked ) recipients.push( emc );
				if ( recipients.length > 5 )
					msgs.push( "You can send emails up to 5 people at a time (including yourself). You currently have " + recipients.length ) + " people on your list";
			}
			
			if ( req && req.value.match( /emailContentMessage/ ) )
			{
				var _m = $( prefix + '.message' );
				if ( _m.value.trim() == '' )
					msgs.push( "Message must not be empty." );
			}
			
			if ( msgs.length > 0 )
			{
				$( prefix + '.status' ).innerHTML = "The following errors occurred:<br />&ndash; " + msgs.join( '<br />&ndash; ' );
				$( prefix + '.status' ).style.display = 'block';
			}
			else
			{
				var realname = $( prefix + '.fromName' ).value.trim();
				if ( realname == '' ) realname = em;
				
				//$( prefix + '.email' ).disabled = true;
				$( prefix + '.email' ).value = em;
				$( prefix + '.realname' ).value = $( prefix + '.fromName' ).value = realname;
				$( prefix + '.recipients' ).value = recipients.join( ',' );
				$( prefix + '.mail_template' ).value = AARP.Email.mail_template;
				$( prefix + '.subject' ).value = 'AARP.org Article from ' + em;
				$( AARP.Email.currentForm ).submit();
			}
		}
	}
	
	, close: function()
	{
		showCalcs();
		if ( arguments.length > 0 )
			AARP.Email.currentOverlay = arguments[0];
		
		// hide error messages
		var prefix = AARP.Email.overlayToPrefix[AARP.Email.currentOverlay];
		$( prefix + '.status' ).style.display = 'none';
		
	$(AARP.Email.currentOverlay).hide();
	var overlayDuration = 0.2;	// shadow fade in/out duration
	new Effect.Fade('overlay', { duration: overlayDuration});
	}
	
	, clearIt: function()
	{
		
	}
}

AARP.Email.mail_template = AARP.daw.crypt_text( 'http://assets.aarp.org/aarp.org_/misc/formmail_email-tpl_article.html' );
AARP.Email.generalStatus = escape( 'Thanks! Your email has been sent.' );

startup.add( function() { AARP.Email.startup(); } );

/**
* Comments. Adapted from a monstrosity.
* @todo Prototype deprecation: Form.serialize, $element.update, Effect.*
*/

AARP.Comments = {
	pageId: ''
	, method: 'get'
	, errorFlag: 0
	
	, defaultText: ""
	, textUnset: function( obj )
	{
		AARP.Misc.defaultText.unset( obj, AARP.Comments.defaultText );
	}
	, textSet: function( obj )
	{
		AARP.Misc.defaultText.set( obj, AARP.Comments.defaultText );
	}
	
	, startup: function(opts)
	{
		
		AARP.Comments.generateSubmitArea();
		
		if ( !opts ) 
        {
			AARP.Comments.pull();
		  }
		else if ( opts.short ) 
		{
			AARP.Comments.pull({ short: true } );
		}
		
	}
	
	, error: function( transport )
	{
		if ( transport.status >= 400 && transport.status < 600 )
			dbg( transport.status + " => " + transport.responseText, dbg.ERROR );
	}
	
	/**
	*
	*/
	
	, generateSubmitArea: function()
	{
		var buffer = '';
		
		if ( AARP.User.isLoggedIn )
		{
			buffer += "<div class='commentTitle'>Add Your Comments:</div>";
			buffer += "<form action='#' id='articleCommentForm' method='post' onSubmit='return false;'>";
			buffer += "<input type='hidden' name='membername' value='" + AARP.User.name +"'>";
			buffer += "<input type='hidden' name='articleUrl' value='" + AARP.page.url +"'>"; // checkArticleUrl()
			buffer += "<input type='hidden' name='method' value='submitNewArticleComment'>";
			buffer += "<textarea name='comment' id='comment' class='articleCommentFormInput' rows='4' onfocus='AARP.Comments.textUnset(this); this.style.backgroundColor = \"#ffffcc\";' onblur='AARP.Comments.textSet(this); this.style.backgroundColor = \"#ffffff\";' onkeyup='AARP.Comments.charsLeft(\"comment\", \"remainChars\")';></textarea>";
			buffer += "<div class='commentChars'>You can enter <span id='remainChars'>2000</span> more characters.</div>";
			
			//USING SPRITE (not working for some reason)
			buffer += "<a href='#' onclick='AARP.Comments.submit(); return false;' class='btn24Blue'>";
			buffer += "<span class='left'>&nbsp;</span>";
			buffer += "<span class='middle'>Submit</span>";
			buffer += "<span class='right'>&nbsp;</span>";
			buffer += "</a>";
			buffer += "<div class='clearer'></div>";
		}
		else
		{
			buffer += "<p>Please log in to leave a comment. <a href='#' onclick='jumpToLogin();'>Log In</a> | <a href='https://login.aarp.org/community/register/index.bt'>Sign Up</a></p>";

			// return the notloggedin form.
			buffer += "<textarea name='comment' id='comment' class='articleCommentFormInput' rows=4 disabled></textarea><br />";	

			//USING SPRITE (not working for some reason)
			buffer += "<a href='#' onclick='return false;' class='btn24Inactive'>";
			buffer += "<span class='left'>&nbsp;</span>";
			buffer += "<span class='middle'>Submit</span>";
			buffer += "<span class='right'>&nbsp;</span>";
			buffer += "</a>";
			buffer += "<div class='clearer'></div>";
		}
		
		$( 'commentarySlot' ).update( buffer );
	}
	
	, charsLeft: function (textArea, numLeft)
	{
		var maxChrs = 2000;
		var openChrs = maxChrs - $( textArea ).value.length;
		
		if ( openChrs <= 0 )
		{
			openChrs = 0;
			$( textArea ).value = $( textArea ).value.substr( 0, maxChrs );
		}
		
		$( numLeft ).update( openChrs );
	}

	
	/**
	* Retrieves comments
	* @param object Dictionary of options:
	* <code>
	* short: if true, pulls short comments
	* sortOrder: if provided, appends sort order
	* </code>
	*/
	
	, pull: function( opts )
	{
		if ( !opts ) opts = {};
		if ( opts.short ) AARPAds.version = 'less';
		
		var params = 'method=viewArticleComments&articleID=' + AARPAds.pgid;
		var url = '/community/articleComments/' + (opts.short ? 'shortComments.bt' : 'comments.bt');
		if ( opts.sortOrder ) params += '&sOr' + opts.sortOrder;
		
		var ajax = new Ajax.Request( url, {
			method: AARP.Comments.method
			, params: params
			, onSuccess: function( trans ) { AARP.Comments.show( trans ); }
			, onComplete: function( trans ) { AARP.Comments.error( trans ); }
		} );
		
		$('recentCommentsSlot').update( '<p>Loading...</p>' );
	}
	
	/**
	* Renders comments from Ajax response
	*/
	
	, show: function( transport )
	{
		var gotBack = transport.responseText;
		$('recentCommentsSlot').update( gotBack );
		var commentCount = Cookies.get( 'articleCommentCount' );
		if ( commentCount == null )
			commentCount = 0;
		
		if ( AARPAds.version == 'less' && ( parseInt( commentCount ) ) > 3 )
			$( 'moreCommentsDiv' ).style.display = 'block';
	}
	
	/**
	*
	*/
	
	, preview: function()
	{
		var previewComment = $( 'comment' ).value.replace( /\n/g, "<br />" );
		$('previewArea').style.display = "block";
		$('previewComment').update( previewComment );
	}
	
	/**
	*
	*/
	
	, submit: function()
	{
		// NEW (2007-12-13): issues with serialize() on Safari 2.x and other WebKit browsers
		//var formValues = $('articleCommentForm').serialize() + '&articleID=' + AARPAds.pgid;
		var formValues = Form.serialize( 'articleCommentForm', null ) 
			+ '&articleID=' + AARPAds.pgid + '&version=' + AARPAds.version 
			+ '&articleTitle=' + escape( document.title.substring(0, 30) )
		;
		var url = '/community/articleComments/comment/submit.bt';
		var debug_url = url + '?' + formValues;

		var ajax = new Ajax.Request( 
			url
			, {
				method: AARP.Comments.method
				, params: formValues
				, onSuccess: AARP.Comments.show
				, onComplete: AARP.Comments.error
			}
		);

		$('previewArea').style.display = 'none';
	}
	
	, submitContent: function()
	{
		var commentValue = $( 'postCommentForm' ).comment.value;
		if( commentValue == '' )
		{
			alert("You cannot post a blank comment.  Please try again!");
			return false;
		}
		else
		{
			var formValues = $('postCommentForm').serialize();
			var url = '/community/content/comment/submit.bt';
			var submitNewContentComment = new Ajax.Request(
				url
				, {
					method: AARP.Comments.method
					, params: formValues
					, onSuccess: AARP.Comments.showCommentResponse
				}
			);
		}
	}
	
	, showCommentResponse: function( transport )
	{
		var gotBack = transport.responseText;
		if ( gotBack.match( /ERROR/ ) )
			return false;
		else
			$( 'commentDiv' ).update( gotBack );
	}
	
	, flagComment: function( commentId )
	{
		if ( AARP.Comments.errorFlag == 0 )
		{
			var formValues = $( 'flagFormComment' + commentId ).serialize() + "&itemTypeId=2";
			// since we can have more than one page here, we need to find out what page number we are on and pass it on.
			var pageNum = getPageNumber();
			if (pageNum != null)
				formValues = formValues + "&pageNum=" + pageNum;
			
			var loginRequest = new Ajax.Request(
				'/community/content/comment/flag.bt'
				, {
					method: AARP.Comments.method
					, params: formValues
					, onSuccess: AARP.Comments.showCommentResponse
				}
			);
		}
	}
	
	, flagAll: function( commentId )
	{
		if ( AARP.Comments.errorFlag == 0 )
		{
			var formValues = $( 'flagFormTestimonial' + commentId ).serialize() + "&itemTypeId=3";
			// since we can have more than one page here, we need to find out what page number we are on and pass it on. 
			var pageNum = AARP.Comments.getPageNumber();
			if ( pageNum != null )
				formValues = formValues + "&pageNum=" + pageNum;
			
			var loginRequest = new Ajax.Request(
				'/community/profile/flagFromAllTestimonial.bt'
				, {
					method: AARP.Comments.method
					, params: formValues
					, onSuccess: AARP.Comments.showTestimonialResponse
				}
			);
		}
	}
	
	/**
	*
	*/
	
	, deleteComment: function( commentId )
	{
		var params = "method=deleteArticleComment&commentId=" + commentId + "&articleID=" + AARPAds.pgid + '&version=' + AARPAds.version;
		var loginRequest = new Ajax.Request( 
			'/community/articleComments/comment/delete.bt'
			, {
				method: 'post'
				, params: params
				, onSuccess: AARP.Comments.deleteCommentSuccess
			}
		);
	}
	
	, deleteCommentSuccess: function( transport )
	{
		var pageVersion = AARPAds.version;
		if ( pageVersion != null && pageVersion == 'less' )
		{
			location.reload( true );
		}
		else
		{
			AARP.Comments.show( transport );
		}
	}
	
	, deleteAll: function( commentId )
	{
		if ( AARP.Comments.errorFlag == 0 )
		{
			var formValues = $( 'deleteFormTestimonial' + commentId ).serialize();
			// since we can have more than one page here, we need to find out what page number we are on and pass it on. 
			var pageNum = AARP.Comments.getPageNumber();
			if ( pageNum != null )
				formValues = formValues + "&pageNum=" + pageNum;
			
			var loginRequest = new Ajax.Request( 
				'/community/profile/deleteFromAllTestimonial.bt'
				, {
					method: AARP.Comments.method
					, params: formValues
					, onSuccess: AARP.Comments.showTestimonialResponse
				}
			);
		}
	}
	
	, showTestimonialResponse: function( transport )
	{
		var gotBack = transport.responseText;
		//this line fails locally and doesn't refresh the page properly

		if ( gotBack.match( /ERROR/ ) )
			return false;
		else
			$( 'memberTestimonials' ).update( gotBack );
	}
	
	, flagProfile: function( commentId )
	{
		if ( AARP.Comments.errorFlag == 0 )
		{
			var formValues = $( 'flagFormTestimonial' + commentId ).serialize() + "&itemTypeId=3";
			var loginRequest = new Ajax.Request(
				'/community/profile/flagProfileTestimonial.bt'
				, {
					method: AARP.Comments.method
					, params: formValues
					, onSuccess: AARP.Comments.showTestimonialResponse
				}
			);
		}
	}
	
	/**
	* Generates the URL to fetch comments from
	*/
	
	, getUrl: function( page )
	{
		var tmpArticleUrl = location.href.match( new RegExp( '(.*\.html)(.*)' ) );
		var articleUrl = tmpArticleUrl[1];
		return articleUrl.replace( ':4502/content/home', '' );
	}
	
	, getPageNumber: function() { return AARP.page.parameters.pageNum; }
}

/**
* Compatibility with old code
*/

var checkNumberOfCharacters = function( textArea, numLeft ) { AARP.Comments.charsLeft( textArea, numLeft ); };
var grabRecentComments = AARP.Comments.pull;
var grabRecentCommentsShort = function() { AARP.Comments.pull( { short: true } ); };
var grabPagedCommentsForArticle = function( url, sortOrder ) { AARP.Comments.pull( { sortOrder: sortOrder } ); };
var showArticleComments = AARP.Comments.show;
var submitDeleteArticleComment = AARP.Comments.deleteComment;
var successfulCommentAddition = AARP.Comments.deleteCommentSuccess;
var showTestimonialResponse = AARP.Comments.showTestimonialResponse;
var submitFlagProfile = AARP.Comments.flagProfile;
var showCommentResponse = AARP.Comments.showCommentResponse
var submitFlagAll = AARP.Comments.flagAll;
var submitFlagComment = AARP.Comments.flagComment;

/**
* Bookmarking
*/

AARP.Favorite = {
	__version__: ''

	, errorHandler: function(transport)
	{
		if (AARP.page.querystring["debug"])
		{
				alert(transport.responseText);
		}
	}
	
	// need two parameters: stringURL and articleTitle
	, Article: {
		submitURL: '/community/articleFavorite/submit.bt'
		, checkURL: '/community/articleFavorite/validate.bt'
		, open: function()
		{
			$( 'favorite.title' ).innerHTML = document.title;
			overlayConfirmation('favoriteContentOverlay');
		}
		, save: function()
		{
			if ( !AARP.User.isLoggedIn )
			{
				// TODO: make a nicer way of showing error/status message
				alert( "You must be logged in." );
				return;
			}
			
			// TODO: does one save the proxy path or the repository path?
			// TODO: is it right to be using document.title going forward?
			var params = 'articleURL=http://' + AARP.page.host + AARP.page.path + '/' + AARP.page.file
				+ '&articleTitle=' + escape( document.title )
				;
			
			new Ajax.Request(
				AARP.Favorite.Article.submitURL
				, { method: 'get', parameters: params, onSuccess: AARP.Favorite.Article.save__onSuccess, onError: AARP.Favorite.errorHandler }
			);
		}
		, save__onSuccess: function( response )
		{
			// TODO: check response for status code
			// alert(response.responseText.trim());
			// AARP.generalStatus( 'This has been saved to your Bookmarks on your Profile Page.' );
			console.info( "Bookmarking Ajax Request was Successful" ) ;
			AARP.Favorite.Article.createConfirmationMessage() ;
			new Effect.Opacity( 'dialog', { from: 1.0, to: 0.1, duration: 1.0, delay: 1.0, afterFinish: AARP.Favorite.Article.destroyConfirmationMessage } ) ;
		}
		, createConfirmationMessage: function() 
		{
			$( 'dialog' ).update( '<div class="dialogBody"><div class="dialogHeader">Article Bookmarked</div><div class="dialogContent">A link to this article has been created in your user profile.</div></div>' ) ;
		}
		, destroyConfirmationMessage: function() 
		{
			closeOverlayConfirmation() ;
			$( 'dialog' ).setStyle( { opacity: 1.0 } ) ;
		}
		, unsave: function()
		{
			
		}
		/*
		check that the current article is already saved? use Cookies to
		cache this info (maybe do it per session).
		*/
		// TODO: parameter check to see if an external method is explicitly forcing an action
		, check: function()
		{
			var page = AARP.page.path + '/' + AARP.page.file;
			var params = 'articleID=' + page + '&memberID=' + AARP.User.name;
			
			new Ajax.Request(
				AARP.Favorite.Article.checkURL
				, { method: 'get', data: params, onSuccess: AARP.Favorite.Article.check__onSuccess }
			);
			
			/* var article = Cookies.get( 'favorite.article.' + page;
			
			// not saved for this session
			if ( article == null )
			{
				
			} */
			
		}
		, check__onSuccess: function( response )
		{
			var val = response.responseText.trim().toLowerCase();
			if ( val == "true" )
			{
				// TODO: disable bookmark link and indicate that this is already saved
			}
		}
	}
}

/**
* Share tools.
* @todo do we still use this?
* @todo 
*/

/* Old Functions for Social Bookmarking tool */



/* Functions for Social Bookmarking tool */
AARP.Share = {
	__version__: ''
	, errorHandler: function(transport)
	{
		if (AARP.page.querystring["debug"])
		{
			alert(transport.responseText);
		}
	}
	, open: function()
	{
		overlayConfirmation('shareContentOverlay');
		yahooBuzzArticleHeadline = document.title;
		yahooBuzzArticleSummary = AARP.Misc.getMetaValue('description');
		yahooBuzzArticleId = window.location.href;
	}
	
	, toggleShare: function()
	{
		$('shareBG').style.visibility = "visible";
		$('socialBookmarks').style.display= "block";
	}

	, toggleShareOff: function()
	{
		$('shareBG').style.visibility = "hidden";
		$('socialBookmarks').style.display= "none";
	}

	, toggleShare2: function()
	{
		$('socialBookmarks2').style.display = "block";
		$('socialBookmarks2').style.visibility = "visible";
		$('shareBG2').style.visibility = "visible";
	}

	, toggleShareOff2: function()
	{
		$('socialBookmarks2').style.display = "none";
		$('socialBookmarks2').style.visibility = "hidden";
		$('shareBG2').style.visibility = "hidden";
	}
	
	, openShareWindow: function( url )
	{
		var flowURL = null;
		if( url == "DIGG" ) {
			flowURL = "http://digg.com/remote-submit?url=" + window.location.href + "&title=" + document.title + "&bodytext=" + AARP.Misc.getMetaValue('description');
		} else if( url == "DELICIOUS" ) {
			flowURL = "http://del.icio.us/post?url=" + window.location.href + "&title=" + document.title;
		} else if(url =="LINKEDIN") {
			flowURL = "http://www.linkedin.com/shareArticle?mini=true&url=" + window.location.href + "&title=" + document.title + "&summary=" + AARP.Misc.getMetaValue('description');
		} else if (url == "YAHOOBUZZ") {
			flowURL = "http://buzz.yahoo.com/submit/?submitUrl=" + window.location.href + "&submitHeadline=" + document.title + "&submitSummary=" + AARP.Misc.getMetaValue('description');
		} else if(url == "FACEBOOK") {
			flowURL = "http://www.facebook.com/sharer.php?u=" + window.location.href + "&t=" + document.title;
		}
		var shareWindowRef = window.open(''+flowURL,"SHARE",'left=20,top=20,width=650,height=450,toolbar=0,resizable=0,scrollbars=1');
	}
}
AARP.Personalization = {
	// User not logged in
	notLoginImage: ''
	, notLoginImageLink: ''
	// Not an active member
	, notMemberImage: ''
	, notMemberImageLink: ''
	// Active Member
	, activeMemberImage: ''
	, actibeMemberImageLink: ''
	//Expiring member
	, expiringMemberImage: ''
	, expiringMemberImageLink: ''
	//Expired member
	, expiredmemberimage: ''
	, expiredmemberimageLink: ''
	, unhideByStatus: function() {
		// temp Work-around for document write
		if ( AARP.User.isLoggedIn ) {
			if ( AARP.User.isMember ) {
				if ( AARP.User.isExpiringMember ) {
					$( 'joinExpiringMember' ).show() ;
				}
				else {
					$( 'joinActiveMember' ).show() ;
				}
			}
			else if ( AARP.User.isExpiredMember ) {
				$( 'joinExpiredMember' ).show() ;
			}
			else {
				$( 'joinNonMember' ).show() ;
			}
		}
		else {
			$( 'joinNotLoggedIn' ).show() ;
		}
	}
	, toggleThingyAuthorTabToggle: function( tab ) {
	}
	, toggleThingyPresentation: function( unique ) {
		if ( AARP.User.isLoggedIn ) {
			if ( AARP.User.isMember ) {
				if ( AARP.User.isExpiringMember ) {
					$( 'tabContentExpiring' + unique ).show() ;
				}
				else {
					$( 'tabContentCurrent' + unique ).show() ;
				}
			}
			else if ( AARP.User.isExpiredMember ) {
				$( 'tabContentLapsed' + unique ).show() ;
			}
			else {
				$( 'tabContentNon-Member' + unique ).show() ;
			}
		}
		else {
			$( 'tabContentAnon' + unique ).show() ;
		}
	}
	, checkStatus: function()
	{
		//var loginStatus 	= checkLoginStatus("header");
		var loginStatus = AARP.User.isLoggedIn;
						
		// Defining the variable
		var userName		="";
		var accountStatus	="";
		var expirationDate	="";
		
		if (loginStatus) // != null
		{
			userName = AARP.User.name;
			accountStatus = AARP.User.accountStatus;
			expirationDate = AARP.User.expirationDate;
			//if ( AARP.page.is_authoring ) { alert( "accountStatus=" + accountStatus ); }
			// checking for account status
			if (accountStatus == "0") 
			{
				if (expirationDate != undefined || expirationDate != '') 
				{
					// checking for non user member
					var toDay 	= new Date();
					
					// parsing the expire date
					var exactDate		=  expirationDate.split(' ')[0];
					var expireMonth		=  exactDate.split('/')[0];
					var expireDay		=  exactDate.split('/')[1];
					var expireYear		=  exactDate.split('/')[2];
					
					var expireDay		= new Date(expireYear,expireMonth-1,expireDay);
					
					var milli_toDay 	= toDay.getTime();
					var milli_expireDay 	= expireDay.getTime();
					var diff 		= milli_expireDay - milli_toDay;
					var noDay		= Math.round(diff/(1000*60*60*24));					
										
					if (noDay>180) 
					{
						// active member
						if (AARP.Personalization.activeMemberImage!="")
						{
							//checking the image reference is there or not
							if (AARP.Personalization.actibeMemberImageLink!="")
							{
								document.write("<a href='"+AARP.Personalization.actibeMemberImageLink+"'>"+AARP.Personalization.activeMemberImage+"</a>");
							}
							 else 
							{
								document.write("<a href='#' onclick='return false;'>"+AARP.Personalization.activeMemberImage+"</a>");
							}	
						}
					}
					else if (noDay<=180) 
					{
						//expering member
						if (AARP.Personalization.expiringMemberImage!="")
						{
							//checking the image reference is there or not
							if (AARP.Personalization.expiringMemberImageLink!="")
							{
								document.write("<a href='"+AARP.Personalization.expiringMemberImageLink+"'>"+AARP.Personalization.expiringMemberImage+"</a>");
							}
							 else 
							{
								document.write("<a href='#' onclick='return false;'>"+AARP.Personalization.expiringMemberImage+"</a>");
							}	
						}
					}
				}				
			}
			else if (accountStatus == "5") 
			{
				//expired member
				if (AARP.Personalization.expiredmemberimage!="")
				{
					//checking the image reference is there or not
					if (AARP.Personalization.expiredmemberimageLink!="")
					{
						document.write("<a href='"+AARP.Personalization.expiredmemberimageLink+"'>"+AARP.Personalization.expiredmemberimage+"</a>");
					}
					 else 
					{
						document.write("<a href='#' onclick='return false;'>"+AARP.Personalization.expiredmemberimage+"</a>");
					}	
				}
				
			}
			else
			{
				if (AARP.Personalization.notMemberImage!="")
				{
					//checking the image reference is there or not
					if (AARP.Personalization.notMemberImageLink!="")
					{
						document.write("<a href='"+AARP.Personalization.notMemberImageLink+"'>"+AARP.Personalization.notMemberImage+"</a>");
					}
					 else 
					{
						document.write("<a href='#' onclick='return false;'>"+AARP.Personalization.notMemberImage+"</a>");
					}	
				}						
			}
		}
		else
		{
			// should display the default Image
			if (AARP.Personalization.notLoginImage!="")
			{
				//checking the image reference is there or not
				if (AARP.Personalization.notLoginImageLink!="")
				{
					document.write("<a href='"+AARP.Personalization.notLoginImageLink+"'>"+AARP.Personalization.notLoginImage+"</a>");
				}
				 else 
				{
					document.write("<a href='#' onclick='return false;'>"+AARP.Personalization.notLoginImage+"</a>");
				}	
			}
		}
	}
} ;


function ctgPromo() {
	if ( AARP.User.isLoggedIn ) {
		var ctgCookie = Cookies.get( 'MAPPS' ) ;
		if ( ctgCookie == null ) {
			$( 'promoImageNotJoined' ).show() ;
		}
		else {
			$( 'promoImageJoined' ).show() ;
		}
	}
	else {
		$( 'promoImageNotLoggedInLink' ).href = $( 'promoImageNotLoggedInLink' ).href + document.location.toString() ;
		$( 'promoImageNotLoggedIn' ).show() ;
	}
} ;


function ctgJoin() {
	overlayConfirmation( 'progressDialog' ) ;
	var ctgJoinURL = "/community/member/joinapp.bt?promo=CTG" ;
	new Ajax.Request( ctgJoinURL, {
		method: 'get',
		onComplete: function( transport ) {
			if ( 200 == transport.status ) {
				closeOverlayConfirmation() ;
				$( 'promoImageNotLoggedIn' ).hide() ;
				$( 'promoImageNotJoined' ).hide() ;
				$( 'promoImageJoined' ).show() ;
			}
			else {
				document.location.href = "http://www.aarp.org/makeadifference/volunteer/articles/create_the_good_error.html" ;
			}
		},
		onFailure: function() {
			document.location.href = "http://www.aarp.org/makeadifference/volunteer/articles/create_the_good_error.html" ;
		}
	} );
} ;


function statePromo() {
	var stateCookie = Cookies.get( 'MEMBER_STATE' ) ;
	if ( stateCookie == null ) {
		$( 'statePromoAnon' ).show() ;
	}
	else {
		$( 'statePromoReg' ).show() ;
		
		// get reference to form
		var states = document.statePromoForm.statePromoSelect.options;

		for ( var i = 0; i < states.length; i++ ) {
			if( states[ i ].text.indexOf( removeDoubleQoutes( stateCookie ) ) != -1 ) {
				// check if element is contained within form
				var statAnchorTag = document.createElement( 'a' ) ;
				statAnchorTag.href = states[ i ].value ;
				var stateText = document.createTextNode( states[ i ].text ) ;
				statAnchorTag.appendChild( stateText );
				$( 'state' ).appendChild( statAnchorTag );
				break ;
			}
		}
	}
} ;

function statePromoJumpToStatePage() {
	var statePromoJumpToTarget = $( 'statePromoSelect' ).getValue() ;
	if ( statePromoJumpToTarget != "See another state" ) {
		window.location.href = statePromoJumpToTarget ;
	}
} ;


function newsletterRankedJoin( defaultToJoin, rankedToJoinRecordNameString, rankedToJoinContractIdString, customTitle ) {
	var rankedToJoinContractId = $w( rankedToJoinContractIdString ) ;
	var rankedToJoinRecordName = $w( rankedToJoinRecordNameString ) ;
	var selectedNewsletter = defaultToJoin ;
	
	if ( Cookies.get( 'NEWSLETTER' ) ) {
		var newsletterCookie = Cookies.get( 'NEWSLETTER' ) ;
		newsletterCookie = newsletterCookie.sub( '"', '', 3 ) ;
		var newslettersHave = newsletterCookie.gsub( ',', ' ' ) ;
		newslettersHave = $w( newslettersHave ) ;
		var nextRankingByName = "";
		var nextRankingById = "";
		if ( rankedToJoinContractId.length == rankedToJoinRecordName.length ) {
			while ( rankedToJoinContractId.length > 0 ) {
				nextRankingById = rankedToJoinContractId.shift();
				nextRankingByName = rankedToJoinRecordName.shift();
				if ( newslettersHave.indexOf( nextRankingById ) == -1 ) {
					selectedNewsletter = nextRankingByName; 
					break;
				}
			}
		}
	}

	var ajaxURL = "/content/aarp/en/home.newsletterByRecordName" ;
	var grabNewsletterURL = ajaxURL + '.' + selectedNewsletter + '.html' ;
	var ajax = new Ajax.Request( 
		grabNewsletterURL, 
		{
			onSuccess: function( transport ) {
				var gotBack = transport.responseText ;
				if ( customTitle != "" ) {
					gotBack = gotBack.replace( "<h2>Newsletters</h2>", "<h2>" + customTitle + "</h2>" ) ;
				}
				var newsletterPlaceholder = $( 'newsletterInject' ) ;
				newsletterPlaceholder.update( gotBack ) ;
			},
			noProxy: true,
			method: 'get'
		}
	) ;
} ;

function Ribbon( numberCells ) {
	this.setContainerWidth = numberCells * 179 ;

	if ( this.setContainerWidth <= 895 ) {
		$( 'prevRibbonArrow' ).hide() ;
		$( 'nextRibbonArrow' ).hide() ;
	}

	this.setContainerWidth = this.setContainerWidth + 'px' ;
	$( 'ribbonCellsContainer' ).setStyle( { width: this.setContainerWidth } ) ;
	$( 'nextRibbonArrowLink' ).show() ;
}

function onNextRibbonArrow() {
	$( 'nextRibbonArrowLink' ).hide() ;
	$( 'prevRibbonArrowLink' ).show() ;
	// work-around for bug in getStyle for IE
	var leftPos = $( 'ribbonCellsContainer' ).style.left ;
	if ( leftPos == "" ) {
		leftPos = 0 ;
	}
	else {
		leftPos = parseInt( leftPos.replace( 'px','' ) ) ;
	}
	var getContainerWidth = parseInt ( ( $( 'ribbonCellsContainer' ).getStyle( 'width' ) ).replace( 'px', '' ) ) ;
	var containerWidthHiddenRight = ( getContainerWidth - Math.abs( leftPos ) ) - ( 179 * 5 ) ;
	if ( containerWidthHiddenRight > 716 ) {
		new Effect.Move( 'ribbonCellsContainer', { x: -716, duration: 2.3, afterFinish: function () { $( 'nextRibbonArrowLink' ).show() ; } } ) ;
	}
	else {
		new Effect.Move( 'ribbonCellsContainer', { x: ( 0 - containerWidthHiddenRight ), duration: 2.3 } );
	}
}

function onPrevRibbonArrow() {
	$( 'prevRibbonArrowLink' ).hide() ;
	$( 'nextRibbonArrowLink' ).show() ;
	var leftPos = parseInt ( ( $( 'ribbonCellsContainer' ).style.left ).replace( 'px', '' ) ) ;
	if ( ( ( leftPos / 179 ) % 4 ) == 0 ) {
		if ( Math.abs( leftPos ) == 716 ) {
			new Effect.Move( 'ribbonCellsContainer', { x: 716, duration: 2.3 } );
		}
		else {
			new Effect.Move( 'ribbonCellsContainer', { x: 716, duration: 2.3, afterFinish: function () { $( 'prevRibbonArrowLink' ).show() ; } } );
		}
	}
	else {
		if ( Math.abs( leftPos ) < 716 ) {
			new Effect.Move( 'ribbonCellsContainer', { x: ( 179 * ( Math.abs( ( leftPos / 179 ) % 4 ) ) ), duration: 2.3 } ) ;
		}
		else {
			new Effect.Move( 'ribbonCellsContainer', { x: ( 179 * ( Math.abs( ( leftPos / 179 ) % 4 ) ) ), duration: 2.3, afterFinish: function () { $( 'prevRibbonArrowLink' ).show() ; } } );
		}
	}
}

/**
* AARP.communityJournals
*/
AARP.communityJournals = {
		max: 5
		, loadFeed: function( url, callbackFunction ) {
			if (window.XMLHttpRequest) {
				var request = new XMLHttpRequest();
			} else {
				var request = new ActiveXObject("Microsoft.XMLHTTP");
			}
			request.open("GET", url, true);
			request.onreadystatechange = function() {
				if (request.readyState == 4 && request.status == 200) {
					if (request.responseText) {
						AARP.communityJournals.receiveAjax(request.responseText, callbackFunction);
					}
				}
			}
			request.send(null);

		} 

		, receiveAjax: function( response, callbackFunction ) {
			if (window.ActiveXObject) {
				var doc = new ActiveXObject("Microsoft.XMLDOM");
				doc.async = "false";
				doc.loadXML(response);
			} else {
				var parser = new DOMParser();
				var doc = parser.parseFromString(response,"text/xml");
			}
			callbackFunction(doc.documentElement);
		}

		, parseData: function( data ) {
			var items = data.getElementsByTagName('item');
			var output = '<ul>';
			for (var i = 0; i < items.length; ++i) {
				if (i<AARP.communityJournals.max) {
					var title = AARP.communityJournals.valueFromTagName(items[i], 'title');
					var link = AARP.communityJournals.valueFromTagName(items[i], 'link');
					output += '<li><a href ="' + link + '">' + title + '</li>';
				}
			}
			output += '</ul>';
			var RSSOutput = document.getElementById('journalrss');
			RSSOutput.innerHTML = output;
		}
		
		, valueFromTagName: function( item, tagname ) {
			var val = item.getElementsByTagName(tagname);
			return val[0].firstChild.nodeValue;
		}
} ;
/**
*
* @todo Be careful with using 'this', especially when passing AARP.CTG functions
* as callbacks. If doing so, wrap the function reference within another function
* reference. For instance, 'function() { AARP.CTG.someFunction(); }' instead of
* 'AARP.CTG.someFunction'.
*/
if ( !AARP ) var AARP = {};

AARP.CTG = {
	debug: false
	, cache: {} // holds abstract opportunities for a set of parameters
	, cache_penguination: {} // holds the penguination elements for a set of parameters (excluding pageSize and startIndex)
	, cache_html: {} // holds rendered elements for a set of parameters
	, time_start: 0
	, time_start_parse: 0
	, time_end_parse: 0
	, time_start_render: 0
	, time_end_render: 0
	, time_start_ajax: 0
	, time_end_ajax: 0
	
	/**
	* Shallow copy of a source object to a new object.
	*/
	
	, clone: function( obj, exclude )
	{
		var nobj = {};
		for ( var x in obj )
		{
			if ( exclude[x] ) continue;
			nobj[x] = obj[x];
		}
		return nobj;
	}
	
	/**
	* To make sure we're doing things deterministically, we need to always be sure
	* that a given set of parameters can be unredundantly saved. There's no guarantee
	* that an object's property order is preserved, so { id: 0, prop1: 1, prop2: 2 },
	* when iterated over with 'for', might be {id, prop1, prop2}, or {prop1, prop2, id},
	* etc. The way around this is to make an array with each element being a key=value
	* pair that then gets sorted alphabetically. That final order is then turned into a
	* string.
	*/
	
	, makeCacheKey: function( params )
	{
		var arr = [];
		for ( var x in params )
			arr.push( x + '=' + params[x] );
		arr.sort();
		return arr.join( "\t" );
	}
	
	// REST-specific thingers
	, REST: {
		svcUrl: 'proxy.php'
		, svcCQUrl: '/apps/CreateTheGood/search/opps.action'
		, svcCQUrl_auth: '/etc/custom/ctg.'
		, is_local: false
		, is_auth: true
		, actions: { opps: 'opps', ref: 'ref' }
		
		// a list of possible REST parameters for a given action
		, params: {
			opps: [ 'dur', 'issue', 'loc', 'keyword', 'src', 'type', 'city', 'state', 'cntry', 'pageSize', 'startIndex' ]
			, ref: [ 'list' ]
		}
	
		// the prefix for the form fields' id that get prepended to the REST parameters.
		, paramPrefix: 'ctg.'
		, pageSize: 8
		
		/**
		* Iterates through list of possible query parameter values to find a form object that
		* corresponds to it. If it exists, stick it in the parameter dictionary.
		*/

		, getParams: function( action )
		{
			if ( !this.params[action] ) return {};

			var list = this.params[action];
			var params = {};

			for ( var i = 0; i < list.length; i++ )
			{
				var obj = $( this.paramPrefix + list[i] );
				if ( obj && obj.value != '' )
					params[list[i]] = obj.value;
			}
			
			if ( !params.pageSize ) params.pageSize = this.pageSize;
			
			return params;
		}
	}
	
	/**
	* Uses AARP.CTG.REST.svcUrl and the given dictionary to construct the final url to
	* hit. This allows for an easy way to switch what server to hit without affecting
	* all other parts of the process.
	*/
	, SEP_AMP: '&'
	, SEP_CQ: '.'
	, constructUrl: function( action, params )
	{
		var root = '/content';
		
		var query = '';
		var sep = '';
		
		dbg( 'local=' + AARP.CTG.REST.is_local + '; is_auth=' + AARP.CTG.REST.is_auth );
		var url = '';
		
		for ( var k in params )
		{
			if ( k == 'loc' && !params[k].match( /ALL|VR/i ) )
			{
				query += sep + 'loc=IP' + this.SEP_AMP + 'state=' + params[k];
				sep = this.SEP_AMP;
				continue;
			}
			
			query += sep + k + '=' + params[k];
			sep = this.SEP_AMP;
		}
		
		if ( !params.pageSize ) query += '&pageSize=15';
		url = this.REST.svcCQUrl + '?action=' + action + '&' + query;
		
		dbg( "url=" + url );
		return url;
	}
	
	/**
	* Will be needed for click events to parse the querystring of penguination links.
	*/
	
	, parseQueryString: function( query )
	{
		var params = {};
		var items = query.split( /&/ );
		dbg( 'parseQueryString: ' + items );
		for ( var i = 0; i < items.length; i++ )
		{
			var item = items[i].split( /=/, 2 );
			params[item[0]] = item[1];
		}
		
		return params;
	}
	
	, makeQueryString: function( params )
	{
		var query = '';
		var sep = '';
		for ( var x in params )
		{
			query += sep + x + '=' + params[x];
			sep = '&';
		}
		
		return query;
	}
	
	// handles penguination clicks
	, onclick: function( anchor )
	{
		// IE does not return empty strings from a split. it's really stupid. no other regex lib does this.
		var tmp = anchor.href.toString().split( /#/, 2 );
		var params = this.parseQueryString( (tmp.length < 2 ? tmp[0] : tmp[1]) );
		this.get( 'opps', params );
	}
	
	// handles form submit
	, submit: function( action )
	{
		var params = AARP.CTG.REST.getParams( action );	
		this.get( action, params );
	}
	
	, test: function( action )
	{
		var params = AARP.CTG.REST.getParams( action );
		this.get( action, params );
	}
	
	, detect: function()
	{
		var loc = document.location.href.toString();
		
		if ( loc.match( /4502\// ) )
			AARP.CTG.REST.is_auth = true;
		else
			AARP.CTG.REST.is_auth = false;
		
		if ( loc.match( /http:\/\/work/ ) )
			AARP.CTG.REST.is_local = true;
		
		//if ( AARP.CTG.debug )
		//	alert( loc + " -> local=" + AARP.CTG.REST.is_local + "; author=" + AARP.CTG.REST.is_auth );
		
		if ( !loc.match( /#/ ) ) loc = "x#loc=ALL&dur=ALL&issue=ALL";
		var comps = loc.split( /#/, 2 );
		
		var params = AARP.CTG.parseQueryString( comps[1] );
		
		// toggle values on
		for ( var k in params )
		{
			dbg(k + ' = ' + params[k]);
			try { $( 'ctg.' + k ).value = params[k]; }
			catch ( e ) {}
		}
		
		AARP.CTG.submit( 'opps' );
		dbg(params);
		//AARP.CTG.get( 'opps', params );
	}
	
	, get: function( action, params )
	{
		if ( $( 'dumpout' ) ) {
			$( 'dumpout' ).value = "resetting\n" ;
		}
		if ( params.startIndex && params.startIndex < 1 ) delete params.startIndex;
		
		var url = this.constructUrl( action, params );
		var cache_key = this.makeCacheKey( params );
		
		// TODO: toggle loading layer
		dbg('loading... ' + url);
		
		AARP.CTG.time_start = (new Date()).getTime();
		AARP.CTG.time_start_parse = 0;
		AARP.CTG.time_start_render = 0;
		AARP.CTG.time_start_ajax = 0;
		
		if ( this.cache[cache_key] )
		{
			this.output.opps( params, cache_key, this.cache[cache_key] );
			AARP.CTG.time_end_render = (new Date()).getTime();
			AARP.CTG.time_end_parse = AARP.CTG.time_end_render;
			AARP.CTG.time_report();
			return;
		}
		
		if ( $( 'ctg-loader' ) ) {
			$( 'ctg-loader' ).style.display = 'block' ;
		}
		//$( 'ctg-no-results' ).style.display = 'none';
		AARP.CTG.time_start_ajax = (new Date()).getTime();
		new Ajax.Request( url, {
			onComplete: function( trans ) { AARP.CTG.complete( action, params, cache_key, trans ); }
			, method: 'get'
		} );
	}
	
	, complete: function( action, params, cache_key, transport )
	{
		AARP.CTG.time_end_ajax = (new Date()).getTime();
		$( 'ctg-loader' ).style.display = 'none';
		
		/*
		AARP.CTG.time_start_parse = (new Date()).getTime();
		var xml = XMLParser.parse( transport.responseText );
		AARP.CTG.time_end_parse = (new Date()).getTime();
		*/
		
		if ( document.location.href.toString().match( /ctgNoParse/ ) )
		{
			dbg( 'stopping parsing' );
			AARP.CTG.time_report();
			return;
		}
		
		//if ( !xml ) return;
		
		try
		{
			if ( action == 'opps' )
			{
				//var opps = this.objectifyXML.opps( xml );d
				eval( "var opps = " + transport.responseText.trim().replace( /(\rn|[\r\n])/g, '<br/>' ) + ';' );
				try { opps.maxResults = parseInt( opps['total-count'] ); }
				catch ( e ) { dbg(e.description); opps.maxResults = -1; }
				this.output.opps( params, cache_key, opps );
				this.cache[cache_key] = opps;
				AARP.CTG.time_end_render = (new Date()).getTime();
			}
		}
		catch ( e )
		{
			dbg( action + " -- " + e.description + "\n" + transport.responseText );
		}
		
		AARP.CTG.time_report();
	}
	
	, time_report: function()
	{
		try
		{
			var now = (new Date()).getTime();
			var delta_total = now - AARP.CTG.time_start;
			var delta_ajax = AARP.CTG.time_end_ajax - AARP.CTG.time_start_ajax;
			var delta_render = AARP.CTG.time_end_render - AARP.CTG.time_start_render;
			var delta_parse = AARP.CTG.time_end_parse - AARP.CTG.time_start_parse;
			if ( AARP.CTG.time_start_parse == 0 ) delta_parse = 0;
			
			dbg( "total time: " + delta_total.toString() + "ms" );
			dbg( "parse time: " + delta_parse.toString() + "ms" );
			dbg( "render time: " + delta_render.toString() + "ms" );
			dbg( "web svc time: " + delta_ajax.toString() + "ms" );
		}
		catch ( e ) { dbg( "time_report() error: " + e.description ); }
	}
	
	, split_words: function( str, words )
	{
		var w = str.trim().split( /\s+/ );
		var begin = "";
		var end = "";
		if ( w.length > words )
		{
			begin = w.slice( 0, words ).join( ' ' );
			end = w.slice( words ).join( ' ' );
		}
		else
			begin = str;
		
		return [ begin, end ];
	}
	
	, omniture: function( anchor, type )
	{
		var s = s_gi('aarpglobal');
		s.linkTrackVars = 'eVar3';
		s.eVar3 = 'ctg_' + type;
		s.tl( anchor, 'o', 'ctg_' + type );
	}
	
	, output: {
		containers: { nav: 'ctg-navbar', body: 'ctg-display-results' }
		, template_body: "<div class='#{oddeven}' type='ctg-list-item' id='#{id}.body'> "
			+ "<p class='where'><span class='location'>#{location}</span> <span class='postal'>#{opportunity-postal}</span></p>"
			//+ ( "#{source-type}" == "external" ? "<h3>#{opportunity-name}</h3>" : "<h3><a href='#{opportunity-url}' onclick='AARP.CTG.omniture( this, \"#{source-type}\" );'>#{opportunity-name}</a></h3>" )
			+ "<h3>#{opportunity-name}</h3>"
			+ "#{extended-body}"
		 	//+ "<p>#{opportunity-desc}</p>"
//			+ '<div class="toolTipBalloonSide" id="#{id}.badge_location"><div class="toolTipLeft"></div><div class="toolTipBody"><div class="toolTipHeader">#{badge-location}</div><div class="toolTipContent">#{content-location}</div></div></div>'
//			+ '<div class="toolTipBalloonSide" id="#{id}.badge_issue"><div class="toolTipLeft"></div><div class="toolTipBody"><div class="toolTipHeader">#{badge-issue}</div><div class="toolTipContent">#{content-issue}</div></div></div>'
//			+ '<div class="toolTipBalloonSide" id="#{id}.badge_source"><div class="toolTipLeft"></div><div class="toolTipBody"><div class="toolTipHeader">#{badge-source}</div><div class="toolTipContent">#{content-source}</div></div></div>'
//			+ '<div class="toolTipBalloonSide" id="#{id}.badge_type"><div class="toolTipLeft"></div><div class="toolTipBody"><div class="toolTipHeader">#{badge-type}</div><div class="toolTipContent">#{content-type}</div></div></div>'
//			+ '<div class="toolTipBalloonSide" id="#{id}.badge_duration"><div class="toolTipLeft"></div><div class="toolTipBody"><div class="toolTipHeader">#{badge-duration}</div><div class="toolTipContent">#{content-duration}</div></div></div>'
			+ " #{print_r}<div class='clearer'> </div></div>"
		, template_body_obj: null
		, nav_pages_to_show: 5 // should always be odd!
		, last_navbar: null
		, last_navbar_bot: null
		, last_body: null
		, nav_track: { }
		
		// used for the previous & next buttons. it locates the link that
		// corresponds to the page and triggers a click.
		, handler_prevnext: function()
		{
			var cache_key = this.getAttribute( 'cache_key' );
			var type = this.getAttribute( 'iam' );
			var navbar_info = AARP.CTG.cache_penguination[cache_key];
			
			var pg = 0;
			if ( type == 'prev' )
			{
				pg = navbar_info.lastPage - 1;
				if ( pg < 1 ) return;
			}
			else
			{
				pg = navbar_info.lastPage + 1;
				if ( pg > navbar_info.maxPages ) return;
			}
			
			var a = $( cache_key + '-' + pg );
			a.onclick();
			return false;
		}
		, opps: function( params, cache_key, data )
		{
			AARP.CTG.time_start_render = (new Date()).getTime();
			if ( data.maxResults == null ) data.maxResults = 0;
			
			data.pageSize = params.pageSize;
			data.startIndex = params.startIndex ? params.startIndex : 0;
			data.startIndex = parseInt( data.startIndex );
			
			var nav_params = AARP.CTG.clone( params, { startIndex: 1 } );
			var nav_cache_key = AARP.CTG.makeCacheKey( nav_params );
			var navbar_info = this.makeNavBar( AARP.CTG.makeQueryString( nav_params ), nav_cache_key, data );
			
			// hide the last navbar if user is using a different set of filters than before
			if ( this.last_navbar && navbar_info.dom != this.last_navbar )
			{
				this.last_navbar.style.display = 'none';
				this.last_navbar_bot.style.display = 'none';
			}
			
			this.last_navbar = navbar_info.dom;
			this.last_navbar_bot = navbar_info.dom_bot;
			this.last_navbar.style.display = 'block';
			this.last_navbar_bot.style.display = 'block';
			
			this.navToggle( nav_cache_key, data.startIndex, data.pageSize, data.maxResults );
			
			//if ( data.maxResults == 0 ) $( 'ctg-no-results' ).style.display = 'block';
			
			// hide the last results page if user is viewing a different page of results or using a new set of filters
			
			var body = this.makeBody( cache_key, data );
			if ( this.last_body && body != this.last_body )
				this.last_body.style.display = 'none';
			this.last_body = body;
			this.last_body.style.display = 'block';
		}
		
		/*
		Basic structure of these elements
		container < 1, ..., 2, 3, etc., ..., last_page >
		
		Dedicated to the gay penguins who got their egg.
		*/
		
		, makeNavBar: function( baseQuery, cache_key, data )
		{
			if ( AARP.CTG.cache_penguination[cache_key] )
				return AARP.CTG.cache_penguination[cache_key];
			dbg( 'makeNavBar=' + cache_key );
			
			var penguination = { maxResults: 0, lastPage: 0, maxPages: 0, pageSize: 0, dom: null, dom_bot: null };
			penguination.maxResults = parseInt( data.maxResults );
			penguination.pageSize = parseInt( data.pageSize );
			
			var pages = Math.ceil( data.maxResults / data.pageSize );
			penguination.maxPages = pages;
			
			var container = document.createElement( 'div' );
			var container_bot = document.createElement( 'div' );
			var ptr = null;
			
			var id_prefix = '';
			for ( var z = 0; z < 2; z++ ) { // first round is top, second is bottom
			
			if ( z == 0 )
			{
				id_prefix = '';
				ptr = container;
			}
			else 
			{
				id_prefix = 'bot-';
				ptr = container_bot;
			}
			
			var ellipse_1 = document.createElement( 'span' );
			ellipse_1.id = id_prefix + cache_key + '-ellipse1';
			ellipse_1.className = 'ellipse';
			ellipse_1.innerHTML = '...';
			ellipse_1.style.display = 'none';
			
			var ellipse_2 = document.createElement( 'span' );
			ellipse_2.id = id_prefix + cache_key + '-ellipse2';
			ellipse_2.className = 'ellipse';
			ellipse_2.innerHTML = '...';
			ellipse_2.style.display = 'none';
			
			// overall container of navigation elements. see article index for structure
			
			var pageSorting = document.createElement( 'span' );
			pageSorting.className = 'left';
			
			var penguinator = document.createElement( 'span' );
			penguinator.className = 'right';
			
			var onclick = function() { AARP.CTG.onclick( this ); return false; };
			
			ptr.appendChild( pageSorting );
			ptr.appendChild( penguinator );
			
			// need to create two of each: one is inactive and the other is active
			var __prev = document.createElement( 'a' );
			__prev.href = baseQuery;
			__prev.setAttribute( 'cache_key', cache_key );
			__prev.setAttribute( 'iam', 'prev' );
			__prev.onclick = this.handler_prevnext;
			__prev.innerHTML = "<img src='http://assets.aarp.org/aarp.org_/images/buttons/btn20x66_previous.gif' alt='Previous Page' />";
			
			var __prev2 = document.createElement( 'span' );
			__prev2.style.display = 'none';
			__prev2.innerHTML = "<img src='http://assets.aarp.org/aarp.org_/images/buttons/btn20x66_previous_off.gif' alt='Previous Page' /> ";
			
			var __next = document.createElement( 'a' );
			__next.href = baseQuery;
			__next.setAttribute( 'cache_key', cache_key );
			__next.setAttribute( 'iam', 'next' );
			__next.onclick = this.handler_prevnext;
			__next.innerHTML = "<img src='http://assets.aarp.org/aarp.org_/images/buttons/btn20x41_next.gif' alt='Next Page' />";
			
			var __next2 = document.createElement( 'span' );
			__next2.style.display = 'none';
			__next2.innerHTML = " <img src='http://assets.aarp.org/aarp.org_/images/buttons/btn20x41_next_off.gif' />";
			
			penguinator.appendChild( __prev );
			penguinator.appendChild( __prev2 );
			
			for ( var i = 1; i <= pages; i++ )
			{
				var offset = (i-1) * data.pageSize + 1;
				
				var a = document.createElement( 'a' );
				a.id = id_prefix + cache_key + '-' + i;
				a.href = '#' + baseQuery + (offset != 0 ? '&startIndex=' + offset : '');
				a.onclick = function() { AARP.CTG.onclick( this ); return false; };
				if ( offset == data.startIndex ) a.style.fontWeight = 'bold';
				a.innerHTML = i + " ";
				
				// insert the ellipsis containers immediately before the last page or immediately after the first page
				if ( i == (pages - 1) ) penguinator.appendChild( ellipse_2 );
				penguinator.appendChild( a );
				if ( i == 1 ) penguinator.appendChild( ellipse_1 );
			}
			
			penguinator.appendChild( __next2 );
			penguinator.appendChild( __next );
			
			var clear = document.createElement( 'div' );
			clear.className = 'clearer';
			ptr.appendChild( clear );
			
			} // for ( var z = 0; z < 2; z++ )
			
			/*
			// rather than double every line of code to generate the bottom nav, just grab
			// the innerHTML, inject some string into the ids to  make them unique, then
			// stick them into the bottom nav container. the only code that needs to be
			// doubled, then, are the things in navToggle(). i really hope this works in IE...
			var clone = container.innerHTML.replace( /id="/g, 'id="bot-' );
			container_bot.innerHTML = clone;
			*/
			
			container.id = cache_key + '-nav-top';
			container.className = 'article-index-nav bottom';
			container_bot.id = cache_key + '-nav-bot';
			container_bot.className = 'article-index-nav bottom';
			
			penguination.dom = $( 'ctg-navbar' ).appendChild( container );
			penguination.dom_bot = $( 'ctg-navbar-bot' ).appendChild( container_bot );
			AARP.CTG.cache_penguination[cache_key] = penguination;
			
			return penguination;
		}
		
		/*
		Toggles ellipsis and shows/hides links depending on what the user is seeing. 
		Also hilites the current page.
		*/
		
		, navToggle: function( cache_key, offset, results_per_page, max )
		{
			offset = parseInt( offset );
			results_per_page = parseInt( results_per_page );
			max = parseInt( max );
			
			var pages = Math.ceil( max / results_per_page );
			var page = Math.floor( (offset + results_per_page)/results_per_page );
			var navbar_info = AARP.CTG.cache_penguination[cache_key];
			dbg('navToggle() ' + offset + ',' + results_per_page + ' => ' + page);
			
			if ( navbar_info.lastPage == page && navbar_info.lastPage != 1 ) return;
			
			var do_toggle = true;
			
			var ellipse_1 = false, ellipse_2 = false;
			var links_in_middle = this.nav_pages_to_show;
			if ( (links_in_middle + 2) >= pages ) do_toggle = false; // don't bother toggle if there aren't too many pages
			
			dbg(' finding lo/hi');
			var lo = 1, hi = links_in_middle, thispage = 0;
			var pivot = Math.floor( links_in_middle / 2 );
			
			// just beyond range of beginning or end, so toggle appropriate ellipses
			if ( page >= links_in_middle ) ellipse_1 = true;
			if ( page <= (pages-links_in_middle) ) ellipse_2 = true;
			
			// we're beyond the range of the first page, so set the current page to be the 
			// middle link and set the links around it to show
			if ( ellipse_1 )
			{
				lo = page - pivot;
				hi = page + pivot;
			}
			
			// we're within range of the last page, so readjust so that the last N links
			// show (N==links_in_middle)
			if ( !ellipse_2 )
			{
				lo = pages - links_in_middle;
				hi = pages;
			}
			
			dbg( ' figured ellipsis' );
			// sanity checks
			if ( lo < 1 ) lo = 1;
			if ( hi > pages ) hi = pages;
			
			for ( var i = 1; i <= pages; i++ )
			{
				var link = $( cache_key + '-' + i );
				var link2 = $( 'bot-' + cache_key + '-' + i );
				if ( (i == 1 || i == pages) || i >= lo && i <= hi )
				{
					link.style.display = '';
					link2.style.display = '';
					
					if ( i == page )
					{
						link.style.fontWeight = 'bold';
						link2.style.fontWeight = 'bold';
						navbar_info.lastPage = i;
						thispage = i;
					}
					else
					{
						link.style.fontWeight = 'normal';
						link2.style.fontWeight = 'normal';
					}
				}
				else
				{
					link.style.display = 'none';
					link2.style.display = 'none';
				}
			}
			
			dbg( 'ellipsis' );
			try
			{
				if ( ellipse_1 )
				{
					$( cache_key + '-ellipse1' ).style.display = '';
					$( 'bot-' + cache_key + '-ellipse1' ).style.display = '';
				}
				else
				{
					$( cache_key + '-ellipse1' ).style.display = 'none';
					$( 'bot-' + cache_key + '-ellipse1' ).style.display = 'none';
				}
			
				if ( ellipse_2 )
				{
					$( cache_key + '-ellipse2' ).style.display = '';
					$( 'bot-' + cache_key + '-ellipse2' ).style.display = '';
				}
				else
				{
					$( cache_key + '-ellipse2' ).style.display = 'none';
					$( 'bot-' + cache_key + '-ellipse2' ).style.display = 'none';
				}
			}
			catch ( e ) { }
			
			dbg( 'toggle prev' );
			// toggle previous/next. order is: prev enabled, prev disabled, ..., next disabled, next enabled
			var penguinator = navbar_info.dom.childNodes[1];
			var penguinator2 = navbar_info.dom_bot.childNodes[1];
			if ( thispage < 2 )
			{
				penguinator.childNodes[0].style.display = 'none';
				penguinator.childNodes[1].style.display = '';
				penguinator2.childNodes[0].style.display = 'none';
				penguinator2.childNodes[1].style.display = '';
			}
			else
			{
				penguinator.childNodes[0].style.display = '';
				penguinator.childNodes[1].style.display = 'none';
				penguinator2.childNodes[0].style.display = '';
				penguinator2.childNodes[1].style.display = 'none';
			}
			
			dbg( 'toggle next' );
			var offset = penguinator.childNodes.length - 2;
			if ( thispage < navbar_info.maxPages )
			{
				penguinator.childNodes[offset].style.display = 'none';
				penguinator.childNodes[offset+1].style.display = '';
				penguinator2.childNodes[offset].style.display = 'none';
				penguinator2.childNodes[offset+1].style.display = '';
			}
			else
			{
				penguinator.childNodes[offset].style.display = '';
				penguinator.childNodes[offset+1].style.display = 'none';
				penguinator2.childNodes[offset].style.display = '';
				penguinator2.childNodes[offset+1].style.display = 'none';
			}
			
			// x to y of z
			var whereat = '';
			var end = thispage * navbar_info.pageSize;
			var start = end - navbar_info.pageSize + 1;
			if ( end > navbar_info.maxResults ) end = navbar_info.maxResults;
			
			if ( start < 0 ) start = 0;
			whereat = start + ' to ' + end + ' of ' + navbar_info.maxResults;
			navbar_info.dom.childNodes[0].innerHTML = whereat;
			navbar_info.dom_bot.childNodes[0].innerHTML = whereat;
		}
		
		, makeBody: function( cache_key, data )
		{
			dbg( 'makeBody() ' + cache_key );
			if ( AARP.CTG.cache_html[cache_key] )
				return AARP.CTG.cache_html[cache_key];
			
			var body = document.createElement( 'div' );
			body.id = cache_key;
			
			if ( data.maxResults < 1 )
			{
				dbg( 'cached: ' + cache_key );
				body.innerHTML = "<p>Sorry, no results matched your search criteria.</p>";
			}
			else
			{
				dbg( '...iterating...' );
				var buff = '';
				for ( var i = 0; i < data.opportunities.length; i++ )
				{
					data.opportunities[i]['id'] += '_' + i;
					var oddeven = 'even'; if ( i % 2 == 1 ) oddeven = 'odd';
					data.opportunities[i].oddeven = oddeven;
					//data.opportunities[i]['issue'] = data.opportunities[i]['opportunity-display-periods'][0]['issue']
					
					if ( data.opportunities[i]['opportunity-url'].trim() != '' )
						data.opportunities[i]['opportunity-name'] = '<a href="' + data.opportunities[i]['opportunity-url'] + '">' + data.opportunities[i]['opportunity-name'] + '</a>';
					
					if ( AARP.CTG.debug )
						data.opportunities[i]['print_r'] = '<pre>' + print_r( data.opportunities[i] ) + '</pre>';
					data.opportunities[i]['location'] = data.opportunities[i]['opportunity-state'].split( / - / )[0];
					data.opportunities[i]['year'] = '2009';
					
					data.opportunities[i]['extended-body'] = AARP.CTG.output.makeDetails( 
						data.opportunities[i]['id']
						, data.opportunities[i]
						, AARP.CTG.split_words( data.opportunities[i]['opportunity-desc'], 50 )
					);
					
					buff += this.template_body_obj.evaluate( data.opportunities[i] );
				}
			
				body.innerHTML = buff;
			}
			
			//dbg( buff );
			$( 'ctg-display-results' ).appendChild( body );
			AARP.CTG.cache_html[cache_key] = body;
			AARP.CTG.output.details.register( body );
			
			return body;
		}
		
		, makeDetails: function( id, data, description )
		{
			var buff = '';
			var ellipsis = '';
			var desc = '';
			var moreLink = '';
			var periods_buff = '';
			
			//dbg( 'source: ' + data['opportunity-source'] );
			//if ( id % 2 == 0 ) data['opportunity-source'] = ' NM - AARP ';
			//else data['opportunity-source'] = ' AA - ';
			
			dbg( 'makedetails() > ' + id );
			//try { 
			if ( data['opportunity-source'].indexOf( 'NM' ) >= 0 )
			{
				if ( data['opportunity-contact-phone-display-online'].trim() == 'false' )
					data['opportunity-contact-phone'] = '';
				
				dbg( 'network member' );
				if ( description[1] != '' )
					ellipsis = ' ... ';
				
				desc = '<p>' + description[0] 
					+ '<span id="' + id + '.ellipsis">' + ellipsis + '</span><span id="' + id + '.desc" style="display: none;">&nbsp;' 
					+ description[1] + '</span></p>'
				;
				
				dbg( 'location' );
				var location = '';
				if ( data['opportunity-location'].indexOf( 'VR -' ) < 0 )
				{
					location = 'State-wide<br />';
					if ( data['opportunity-state'].trim() != '' )
						location = data['opportunity-state'] + '<br />';
				
					if ( data['opportunity-addr'].trim() != '' )
					 	location += data['opportunity-addr'] + '<br />';
					
					var city = "";
					data['opportunity-city'] = data['opportunity-city'].trim();
					if ( data['opportunity-city'] != '' )
						city += data['opportunity-city'] + ', ';
					
					location += city + data['opportunity-state'] + ' ' + data['opportunity-postal'];
				}
				else
				{
					location = 'Virtual';
				}
			
				var startend = '';
				
				dbg( 'opp dates' );
				if ( data['opportunity-start'].trim() != '' )
					startend = 'Start-date: ' + AARP.CTG.output.parseDate( data['opportunity-start'] ) + ' ';
				if ( data['opportunity-end'].trim() != '' )
					startend += 'End-date: ' + AARP.CTG.output.parseDate( data['opportunity-end'] ) + ' ';
				if ( startend != '' ) startend += '<br />';
				if ( data['opportunity-start-time'].trim() != '' )
					startend += 'Start-time: ' + AARP.CTG.output.parseTime( data['opportunity-start-time'] ) + ' ';
				if ( data['opportunity-end-time'].trim() != '' )
					startend += 'End-time: ' + AARP.CTG.output.parseTime( data['opportunity-end-time'] ) + ' ';
				if ( startend != '' ) startend = '<p class="noindent">' + startend + '</p>';
				
				dbg( 'periods' );
				var periods = data['opportunity-display-periods'];
				periods_buff = '<div id="' + id + '.periods" style="display: none;" class="period">'
					+ '<p>Location: ' + location + '</p>'
					+ startend
					+ '<p>Contact Person: <a href="mailto:' + data['opportunity-contact-email'] + '">' + data['opportunity-contact-name'] + '</a></p>'
					+ ( data['opportunity-contact-phone'].trim() != '' ? '<p>Phone: ' + data['opportunity-contact-phone'] + '</p>' : '' )
					+ '</div>'
				;

				moreLink = '<a class="moreLess" href="#" onclick="AARP.CTG.output.details.toggle( this, \'' + id + '\' ); return false;"><span class="left"></span><span class="middle"><img src="' + AARP.CTG.output.details.imageMore + '" /></span><span class="right"></span></a> '
				;
			}
			else
			{
				desc = '<p>' + description[0] + ' ' + description[1] + '</p>';
			}
			//} catch ( e ) { dbg( e ); }
			
			dbg( 'makeCodeIcon()...' );
			buff += desc + periods_buff
				+ '<div class="toolbar">' + moreLink
				+ AARP.CTG.output.makeCodeIcon( id, 'duration', data, data['opportunity-duration'] )
				+ AARP.CTG.output.makeCodeIcon( id, 'location', data, data['opportunity-location'], data['opportunity-state'] )
				+ AARP.CTG.output.makeCodeIcon( id, 'issue', data, data['opportunity-display-periods'][0]['issue'] )
				+ AARP.CTG.output.makeCodeIcon( id, 'type', data, data['opportunity-type'] )
				+ AARP.CTG.output.makeCodeIcon( id, 'source', data, data['opportunity-source'] )
				+ '</div>'
			;
			
			dbg( '...done!' );
			return buff;
		}
		
		, month_letter_to_num: { Dec: 12, Nov: 11, Oct: 10, Sep: '09', Aug: '08', Jul: '07', Jun: '06', May: '05', Apr: '04', Mar: '03', Feb: '02', Jan: '01' }
		, parseDate: function( date )
		{
			var tmp = date.split( /-/ );
			return AARP.CTG.output.month_letter_to_num[tmp[1]] + '/' + tmp[0] + '/' + tmp[2];
		}
		
		, parseTime: function( time )
		{
			var tmp = time.split( /[^\d]+/ );
			var ampm = 'am';
			if ( tmp[0] > 12 )
			{
				tmp[0] = tmp[0] - 12;
				ampm = 'pm';
			}
			
			return tmp[0] + ':' + tmp[1] + ' ' + ampm ;
		}
		
		, code_types: {
			location: ''
			, duration: ''
			, type: ''
			, source: ''
			, issue: ''
		}
		, codes: {
			H: { label: 'Takes a Few Hours', text: 'You would have to devote a couple of hours to complete this volunteer activity.', icon: '20x16icon_takes_a_few_hours.gif' }
			, L5: { label: '5 Minutes or Less', text: 'You can complete this activity in five minutes or less.', icon: '20x16icon_5_minutes.gif' }
			, O: { label: 'Ongoing', text: 'You can participate in this activity as long as you would like; you would fulfill a continuing need.', icon: '20x16icon_ongoing.gif' }
			, FS: { label: 'Financial', text: '', icon: '' }
			, HL: { label: 'Health', text: '', icon: '' }
			, HM: { label: 'Home and Community', text: '', icon: '' }
			, W: { label: 'Work', text: '', icon: '' }
			, IP: { label: 'In Person', text: '', icon: '' }
			, VR: { label: 'Online/Via Phone', text: 'You can perform this activity by going online or by making a phone call.', icon: '20x16icon_virtual.gif' }
			, SW: { label: 'State Wide', text: '', icon: '' }
			, AA: { label: 'AARP', text: '', icon: '' }
			, AP: { label: 'Partner', text: '', icon: '' }
			, NM: { label: 'User Generated', text: '', icon: '' }
			, A_type: { label: 'Activity', text: '', icon: '' }
			, E_type: { label: 'Event', text: '', icon: '' }
			, O_type: { label: 'Offering', text: '', icon: '' }
		}
		
		, makeCodeIcon: function( id, type, data, p1, p2 )
		{
			//dbg( id + ' -> ' + type + ' : ' + p1 + ',' + p2 );
			//try {
			// TODO: if type == IP, check p1 (state); if it's empty, leave as IP, otherwise, convert to SW (state wide)
			var tmp = p1.trim().split( /\s+-\s+/ );
			var code = tmp[0];
			if ( type == 'type' )
				code += '_type';
			
			//dbg( 'code=' + code );
			
			// NEW [2009-04-08 | kaiser] new codes added, causing problems. so take the text
			// given by output if not found in codes.
			
			if ( AARP.CTG.output.codes[code] )
			{
				data['badge-'+type] = AARP.CTG.output.codes[code].label;
				data['content-'+type] = AARP.CTG.output.codes[code].text;
			}
			else
			{
				data['badge-'+type] = tmp[1];
				data['content-'+type] = '';
				return '';
			}
			
			if ( type == 'source' )
			{
				if ( code == 'NM' ) {
				data['source-type'] = 'external';
				} else {
				data['source-type'] = AARP.CTG.output.codes[code].label.toLowerCase();
				}
			}
			
			if ( AARP.CTG.output.codes[code].icon == '' ) return '';
			
			return '<a style="position: relative; text-decoration: none;" href="#" onmouseover="AARP.CTG.output.details.showBadge( this, \'' + id + '\', \'' + type + '\', true );" '
				+ 'onmouseout="AARP.CTG.output.details.showBadge( this, \'' + id + '\', \'' + type + '\', false );">'
				+ '<img src="http://assets.aarp.org/aarp.org_/images/icons/ctg/' + AARP.CTG.output.codes[code].icon + '" />'
				+ '<!--[if lt IE 7]><style type="text/css">.searchContainer.ctg .toolTipBalloonSide { top: -5px; }</style><![endif]-->'
				+ '<div class="toolTipBalloonSide" id="' + id + '.badge_' + type + '"><div class="toolTipLeft"></div><div class="toolTipBody"><div class="toolTipHeader">' + AARP.CTG.output.codes[code].label + '</div><div class="toolTipContent">' + AARP.CTG.output.codes[code].text + '</div></div></div>'
				+ '</a> '
			;
			//} catch ( e ) { dbg( e ); return ''; }
		}
		
		, details: {
			elements: {}
			, imageMore: 'http://assets.aarp.org/aarp.org_/images/icons/12icon_expand.gif'
			, imageLess: 'http://assets.aarp.org/aarp.org_/images/icons/12icon_collapse.gif'
			, register: function( body )
			{
				var items = body.getElementsByTagName( 'div' );
				for ( var i = 0; i < items.length; i++ )
				{
					if ( items[i].getAttribute( 'type' ) != 'ctg-list-item' ) continue;
					
					var item = items[i];
					var id = item.id.split( /\./ ); id = id[0];
					var elements = { container: item };
					
					var spans = item.getElementsByTagName( 'span' );
					for ( var j = 0; j < spans.length; j++ )
					{
						if ( !spans[j].id || spans[j].id.trim() == '' ) continue;
						var idcomps = spans[j].id.split( /\./ );
						elements[idcomps[1]] = spans[j];
					}
					
					var divs = item.getElementsByTagName( 'div' );
					for ( var j = 0; j < divs.length; j++ )
					{
						if ( !divs[j].id || divs[j].id.trim() == '' ) continue;
						var idcomps = divs[j].id.split( /\./ );
						elements[idcomps[1]] = divs[j];
					}
					
					elements.show = false;
					AARP.CTG.output.details.elements[id] = elements;
				}
			}
			, toggle: function( anchor, id )
			{
				var elements = AARP.CTG.output.details.elements[id];
				if ( elements.show )
				{
					anchor.childNodes[1].childNodes[0].src = this.imageMore;
					elements.ellipsis.style.display = '';
					elements.desc.style.display = 'none';
					elements.periods.style.display = 'none';
					elements.show = false;
				}
				else
				{
					anchor.childNodes[1].childNodes[0].src = this.imageLess;
					elements.ellipsis.style.display = 'none';
					elements.desc.style.display = '';
					elements.periods.style.display = 'block';
					elements.show = true;
				}
			}
			, showBadge: function( anchor, id, type, show )
			{
				var elements = AARP.CTG.output.details.elements[id];
				var badge = elements['badge_'+type];
				if ( show )
				{
					badge.style.display = 'block';
					var coords = Position.cumulativeOffset( elements.container );
					var acoords = Position.cumulativeOffset( anchor );
//					badge.style.left = (acoords[0] - coords[0] + anchor.offsetWidth).toString() + 'px';
//					badge.style.top = (elements.container.offsetHeight - 40).toString() + 'px';
				}
				else
					badge.style.display = 'none';
			}
		}
	}
}

AARP.CTG.output.template_body_obj = new Template( AARP.CTG.output.template_body );
try
{
	/*
	Event.observe( window, 'load', function() {	
		var nores = document.createElement( 'div' );
		nores.id = 'ctg-no-results';
		nores.innerHTML = '<p>Sorry, no results matched your search criteria.</p>';
		nores.style.display = 'none';
		if ( $( 'ctg-display-results' ) ) {
			$( 'ctg-display-results' ).appendChild( nores ) ;
		}
		
		if ( document.location.href.toString().match( /debugCtg/ ) )
		{
			AARP.CTG.debug = true;
			$( 'dumpout' ).style.display = '';
		}
		
		AARP.CTG.detect();
	} );
	*/
}
catch ( e ) { }


function print_r( obj )
{
	indent = '';
	if ( arguments.length > 1 ) indent = arguments[1];
	
	if ( obj == null ) return '';
	
	var nindent = indent + "\t";
	var buff = '';
	
	for ( var k in obj )
	{
		var v = obj[k];
		if ( typeof( v ) == 'object' )
			buff += indent + k + " => Object\n" + print_r( v, nindent );
		else
		{
			if ( typeof( v ) != 'function' ) buff += indent + k + " => " + v + "\n";
			//else buff += indent + k + " => #function\n";
		}
	}
	
	return buff;
}

AARP.SubSiteSearch = {
	inputFocus: function() {
		if ( $( 'searchTermsSubSite' ).value == "Enter Search Terms" ) {
			$( 'searchTermsSubSite' ).value = "" ;
			$( 'searchTermsSubSite' ).setStyle( { color: "#333333" } );
		}
	} ,
	inputBlur: function() {
		if ( $( 'searchTermsSubSite' ).value == "" ) {
			$( 'searchTermsSubSite' ).value = "Enter Search Terms" ; 
			$( 'searchTermsSubSite' ).setStyle( { color: "#A0A0A0" } );
		}
	} ,
	processPromoForm: function() {
		var queryString = $( 'searchTermsSubSite' ).value ;
		queryString = queryString.strip() ;
		if ( queryString == "" || queryString == "Enter Search Terms" ) {
			$( 'searchTermsSubSite' ).value = "Enter Search Terms" ; 
			$( 'searchTermsSubSite' ).setStyle( { color: "#B50301" } );
		}
		else {
			var resultsLocation = $( 'resultsLocation' ).value ;
			var queryString = $( 'searchTermsSubSite' ).value ;
			queryString = queryString.replace( /["']/, "" );
			//console.info( "goto: %s", ( resultsLocation + "#" + encodeURIComponent( queryString ) ) ) ;
			document.location.href = resultsLocation + "#" + encodeURIComponent( queryString ) ;
		}
	}
} ;

function gutCenterColumnPrepListing() {
	var htmlString = '<h1 id="queryTerm" style="font-weight: normal; font-size: 1.85em; color: #333333;"></h1><div class="article-index-nav top" style="display: none;"></div><!-- /article-index-nav --><div id="inProgress"><p class="progressImage" style="text-align: center;"><img width="220" height="19" src="http://assets.aarp.org/aarp.org_/images/global/progressBar.gif" alt=""/></p></div><div class="new-article-index"><div style="display: none;" id="hitsPagingTopContainer" class="article-index-nav bottom"><div id="hitsPagingTop"></div><!-- /hitsPagingTop --><div class="clearMe" /></div></div><!-- /hitsPagingTopContainer --><div id="hitListing"></div><!-- /hitListing --><div style="display: none;" id="hitsPagingBottomContainer" class="article-index-nav bottom"><div id="hitsPagingBottom"></div><!-- /hitsPagingBottom --><div class="clearMe" /></div><!-- /hitsPagingBottomContainer --></div><!-- /new-article-index -->' ;
	$( 'gridcolumnmain' ).update( htmlString ) ;
} ;

function processListingOnLoad( collection, options ) {
	var queryString = ( window.location.hash ).replace( "#", "" ) ;
	if ( queryString != "" ) {
		$( 'queryTerm' ).update( '<strong>Search Results</strong> for &#8220;' + decodeURIComponent( queryString ) + '&#8221;' ) ;
		queryGSA( queryString, collection, options ) ;
	}
	else {
		$( 'queryTerm' ).update( '<strong>Search Results</strong>' ) ;
	}
} ;

function queryGSA( queryString, collection, options ) {
	var url = '/search?q=' + queryString + '&site=' + collection + '&output=xml_no_dtd&oe=UTF-8&ie=UTF-8&client=default_frontend&num=100&filter=0&getfields=estimated_publish_date' ;
	new Ajax.Request( url, {
		method: 'get',
		onSuccess: function( transport ) {
			var xml = transport.responseXML ;
			if ( xml ) {
				SubSiteReturnSetAsArray = xml.getElementsByTagName( 'R' );
				SubSiteLength = SubSiteReturnSetAsArray.length ;
				if ( SubSiteLength > 0 ) {
					if ( ( SubSiteLength / 10 ) <= 1 ) {
						SubSiteNumberPages = 1 ;
					}
					else {
						SubSiteNumberPages = Math.ceil( SubSiteLength / 10 ) ;
					}
				}
				else {
					$( 'inProgress' ).update( '<strong>&nbsp;&#8212;No results found.</strong>' );
				}
				doSubSiteListing() ;
			}
			else {
				$( 'inProgress' ).update( '<strong>&nbsp;&#8212;No results found.</strong>' );
			}
		},
		onFailure: function() {
			$( 'inProgress' ).update( '<strong>&nbsp;&#8212;No results found.</strong>' );
		}
	} );
} ;

function buildSubSitePagerLink( page ) {
	return '<a href="#" onclick="doSubSiteListing(' + page + '); return false;">' + page + '</a>' ;
} ;

function doSubSiteListing( page, options ) {
	if ( !page ) {
		page = 1 ;
	}

	var elip = "&#8230;" ;
	var pipe = ' | ' ;

	var end = 0 ;
	var start = 0 ;
	var showNext = false ;
	var showPrev = false ;

	start = ( ( page - 1 ) * 10 ) + 1 ;

	if ( ( page * 10 ) < SubSiteLength ) {
		end = ( page * 10 );
	} else {
		end = SubSiteLength ;
	}
	if ( page > 1 ) {
		showPrev = true ;
	}
	else {
		showPrev = false ;
	}
	if ( end != SubSiteLength ) {
		showNext = true ;
	} else {
		showNext = false ;
	}

	var strHTML = "" ;

	strHTML +=  '<span class="left">' + start + ' to ' + end + ' of ' + SubSiteLength + '</span>' ;
	if ( SubSiteNumberPages > 1) {
		strHTML += '<span class="right">' ;
		if ( showPrev ) {
			var prevPageNumber = ( page - 1 );
			strHTML += '<a href="#" onclick="doSubSiteListing(' + prevPageNumber + '); return false;"><img alt="Previous Page" src="http://assets.aarp.org/aarp.org_/images/buttons/btn20x66_previous.gif" width="66" height="20" /></a> ' ;
		} else {
			strHTML += '<img alt="" src="http://assets.aarp.org/aarp.org_/images/buttons/btn20x66_previous_off.gif" width="66" height="20" /> ' ;
		}

		if ( SubSiteNumberPages < 5 ) {
			var pager = 0;
			for (var i=0; i < SubSiteNumberPages; i++) {
				pager = ( i + 1 );
				if ( pager == page ) {
					strHTML += pager ;
				} else {
					strHTML += ' ' + buildSubSitePagerLink( pager ) ;
				}
				if ( pager < SubSiteNumberPages ) {
					strHTML += pipe ;
				}
			}
		} else {
			if ( page < 4) {
				if ( page == 1 ) {
					strHTML += '1' + pipe + buildSubSitePagerLink( 2 ) + pipe + buildSubSitePagerLink( 3 ) + elip + buildSubSitePagerLink( SubSiteNumberPages ) ;
				}
				else if ( page == 2 ) {
					strHTML += buildSubSitePagerLink( 1 ) + pipe + '2' + pipe + buildSubSitePagerLink( 3 ) + elip + buildSubSitePagerLink( SubSiteNumberPages ) ;
				}
				else {
					strHTML += buildSubSitePagerLink( 1 ) + pipe + buildSubSitePagerLink( '2' ) + pipe + '3' + elip + buildSubSitePagerLink( SubSiteNumberPages ) ;
				}
			} else if ( page > ( SubSiteNumberPages - 3 ) ) {
				if ( page == SubSiteNumberPages ) {
					strHTML += buildSubSitePagerLink( 1 ) + elip + buildSubSitePagerLink( SubSiteNumberPages - 2 ) + pipe + buildSubSitePagerLink( SubSiteNumberPages -1 ) + pipe + SubSiteNumberPages ;
				} else if ( page == ( SubSiteNumberPages - 1 ) ) {
					strHTML += buildSubSitePagerLink( 1 ) + elip + buildSubSitePagerLink( SubSiteNumberPages - 2 ) + pipe + ( SubSiteNumberPages - 1 ) + pipe + buildSubSitePagerLink( SubSiteNumberPages ) ;
				} else {
					strHTML += buildSubSitePagerLink( 1 ) + elip + ( SubSiteNumberPages - 2 ) + pipe + buildSubSitePagerLink( SubSiteNumberPages - 1 ) + pipe + buildSubSitePagerLink( SubSiteNumberPages ) ;
				}
			} else {
				strHTML += buildSubSitePagerLink( 1 ) + elip + buildSubSitePagerLink( page - 1) + pipe + page + pipe + buildSubSitePagerLink( page + 1 ) + elip + buildSubSitePagerLink( SubSiteNumberPages ) ;
			}
		}

		if ( showNext ) {
			var nextPageNumber = ( page + 1 );
			strHTML += ' <a href="#" onclick="doSubSiteListing(' + nextPageNumber + '); return false;"><img alt="Next Page" src="http://assets.aarp.org/aarp.org_/images/buttons/btn20x41_next.gif" width="41" height="20" /></a>' ;
		} else {
			strHTML += ' <img alt="" src="http://assets.aarp.org/aarp.org_/images/buttons/btn20x41_next_off.gif" width="41" height="20" />' ;
		}
		strHTML += '</span>' ;
	}	

	$( 'hitsPagingTop' ).update( strHTML );
	$( 'hitsPagingBottom' ).update( strHTML );
	$( 'hitsPagingTopContainer' ).show() ;
	$( 'inProgress' ).hide() ;

	strHTML = '' ;
	var dateString = '' ;
	var fixedDate = '' ;
	var description = '' ;
	var fixedDate_prettyMonth = $w( "January February March April May June July August September October November December" );
	for (var i= (start - 1); i < end; i++) {
		if ( SubSiteReturnSetAsArray[i].getElementsByTagName('T').length > 0 ) {
			strHTML += '<h3><a href="' + SubSiteReturnSetAsArray[i].getElementsByTagName('U')[0].firstChild.nodeValue + '">' + SubSiteReturnSetAsArray[i].getElementsByTagName('T')[0].firstChild.nodeValue + '</a></h3>' ;
			if ( SubSiteReturnSetAsArray[i].getElementsByTagName('MT').length > 0 ) {
				fixedDate = SubSiteReturnSetAsArray[i].getElementsByTagName('MT')[0].getAttribute('V') ;
				/*
				[2009-10-30 | kaiser] 4 cases:
				1. blank
				2a. YYYY-MM-DD
				2b. DD.MM.YYYY
				3. pretty date
				*/
				if ( fixedDate != '' )
				{
					if ( fixedDate.match( /^\d{4,4}-\d{2,2}-\d{2,2}/ ) )
					{
						fixedDate = fixedDate.split( " " )[0].split( "-" );
						fixedDate_month = fixedDate[1] - 1 ;
						dateString = fixedDate_prettyMonth[ fixedDate_month ] + ' ' + fixedDate[2] + ', ' + fixedDate[0] + '&#8212';
					}
					else if ( fixedDate.match( /^\d{2,2}\.\d{2,2}\.\d{4,4}/ ) )
					{
						fixedDate = fixedDate.split( " " )[0].split( "." );
						fixedDate_month = fixedDate[1] - 1;
						dateString = fixedDate_prettyMonth[ fixedDate_month ] + ' ' + fixedDate[0] + ', ' + fixedDate[2] + '&#8212';
					}
					else
						dateString = fixedDate + '&#8212;';
				}
			}
			if ( SubSiteReturnSetAsArray[i].getElementsByTagName('S').length > 0 ) {
				if ( SubSiteReturnSetAsArray[i].getElementsByTagName('S')[0].firstChild != null ) {
					description = SubSiteReturnSetAsArray[i].getElementsByTagName('S')[0].firstChild.nodeValue ;
				}
			}
			strHTML += '<p class="description">' + dateString + description + '</p>' ;
		}
	}

	$( 'hitListing' ).update( strHTML );

	if ( ( end - start ) > 4 ) {
		$( 'hitsPagingBottomContainer' ).show() ;
	}
} ;

try { Event.observe( window, 'load', function() {

	for (var i=0; i< document.forms.length; i++) {
    var thisForm = document.forms[i];

    if (thisForm.className == "aarpForm") {
      for (var k=0; k< thisForm.elements.length; k++) {
        var thisFormInputs = thisForm.elements[k];
        thisFormInputs.onclick = function() {
          if (this.value == "First Name") {
            this.value = "";
          } else if (this.value == "Last Name") {
            this.value = "";
          } else if (this.value == "City") {
            this.value = "";
          } else if (this.value == "Postal Code") {
            this.value = "";
          }
        }

        if (thisFormInputs.tagName != "SELECT") {
          thisFormInputs.onfocus = function() {
            this.style.backgroundColor = '#ffc';
            this.select();
          }
        }

        thisFormInputs.onblur = function() {
          this.style.backgroundColor = '#fff';
          if ((this.id.indexOf("firstname") > -1) && (this.value == "")) {
            this.value = "First Name";
          } else if ((this.id.indexOf("lastname") > -1) && (this.value == "")) {
            this.value = "Last Name";
          } else if ((this.id.indexOf("city") > -1) && (this.value == "")) {
            this.value = "City";
          } else if ((this.id.indexOf("zipcode") > -1) && (this.value == "")) {
            this.value = "Postal Code";
          }

        }
      }

    }

  }

} ); }
catch ( e ) { }



function SubmitForm( aForm ) {
	if(validForm(aForm) == true) {
		aForm.submit();
	}
	return false;
} ;



function validForm(aForm) {
	var allGood = true;
	var allTags = aForm.getElementsByTagName("*");

	for (var i=0; i<allTags.length; i++) {
		if (!validTag(allTags[i])) {
			allGood = false;
		}
	}
	return allGood;

	function validTag(thisTag) {
		var outClass = "";
		var allClasses = thisTag.className.split(" ");
	
		for (var j=0; j<allClasses.length; j++) {
			outClass += validBasedOnClass(allClasses[j]) + " ";
		}
	
		thisTag.className = outClass;
	
		if (outClass.indexOf("invalid") > -1) {
			invalidLabel(thisTag);
			thisTag.focus();
			if (thisTag.nodeName == "INPUT") {
				thisTag.select();
			}
			return false;
		}
		return true;
		
		function validBasedOnClass(thisClass) {
			var classBack = "";
		
			switch(thisClass) {
				case "":
				case "invalid":
					break;
				case "reqd":
					if (allGood && thisTag.value == "" ||thisTag.value =="First Name"  || thisTag.value =="Last Name" || thisTag.value =="City" || thisTag.value =="Postal Code") classBack = "invalid ";
					classBack += thisClass;
					break;
				case "reqdSelect":
					if ( allGood && ( thisTag.value == "" && thisTag.visible() ) ) classBack = "invalid ";
					classBack += thisClass;
					break;
				case "isRadio":
					if (allGood && !radioPicked(thisTag.name)) classBack = "invalid ";
					classBack += thisClass;
					break;
				case "isNum":
					if (allGood && !isNum(thisTag.value)) classBack = "invalid ";
					classBack += thisClass;
					break;
				case "isZip":
					if (allGood && !isZip(thisTag.value)) classBack = "invalid ";
					classBack += thisClass;
					break;
				case "isEmail":
					if (allGood && !validEmail(thisTag.value)) classBack = "invalid ";
					classBack += thisClass;
					break;
				default:
					classBack += thisClass;
			}
			return classBack;
		}
		
		function radioPicked(radioName) {
			var radioSet = "";

			for (var k=0; k<document.forms.length; k++) {
				if (!radioSet) {
					radioSet = document.forms[k][radioName];
				}
			}
			if (!radioSet) return false;
			for (k=0; k<radioSet.length; k++) {
				if (radioSet[k].checked) {
					return true;
				}
			}
			return false;
		}
		
		function isNum(passedVal) {
			if (passedVal == "") {
				return false;
			}
			for (var k=0; k<passedVal.length; k++) {
				if (passedVal.charAt(k) < "0") {
					return false;
				}
				if (passedVal.charAt(k) > "9") {
					return false;
				}
			}
			return true;
		}
		
		function isZip(inZip) {
			if (inZip == "") {
				return true;
			}
			return (isNum(inZip));
		}
		
		function validEmail(email) {
			var invalidChars = " /:,;";
		
			if (email == "") {
				return false;
			}
			for (var k=0; k<invalidChars.length; k++) {
				var badChar = invalidChars.charAt(k);
				if (email.indexOf(badChar) > -1) {
					return false;
				}
			}
			var atPos = email.indexOf("@",1);
			if (atPos == -1) {
				return false;
			}
			if (email.indexOf("@",atPos+1) != -1) {
				return false;
			}
			var periodPos = email.indexOf(".",atPos);
			if (periodPos == -1) {	
				return false;
			}
			if (periodPos+3 > email.length)	{
				return false;
			}
			return true;
		}
		
    function invalidLabel(child) {
      var parent = child.parentNode;
      if(parent.className.indexOf("formRow") > -1) {
        parent.className += " invalid";
      } else {
        invalidLabel(parent);
      }
    }
	}
}/*
Expandable Categories.
  Example can be seen at http://www.aarp.org/aarp/About_AARP/contact_aarp/
*/

AARP.expandCats = {
    enabled: false
    , categories: function()
    {
        if ( !AARP.expandCats.enabled ) return;

        var groupArray = $$('.categoryGroup');
        var groupTitleArray = $$('.categoryGroup h3 a');
        var subGroupsArray = $$('.subGroups');
        var categoryArray = $$('.category');
        var categoryTitleArray = $$('.category h4 a');
        var contentArray = $$('.categoryContent');

        for (var i = 0; i < groupArray.length; ++i) {
          var subCat = groupArray[i].getElementsByTagName("div");
          var groupId = groupArray[i].id;
          for (var j = 0; j < subCat.length; ++j) {
            if (subCat[j].id.indexOf(groupId + "_") != 0) {
              if (subCat[j].className == "category") {
                subCat[j].id = groupId + "_" + subCat[j].id;
              }
              if (subCat[j].className == "categoryContent") {
                subCat[j].id = subCat[j].parentNode.id + "_content";
              }
            }
          }
        }

        for (var i = 0; i < groupTitleArray.length; ++i) {
          var groupTitle = groupTitleArray[i];
          groupTitle.onclick = switcherManual;
        }

        for (var i = 0; i < categoryTitleArray.length; ++i) {
          var subCatTitle = categoryTitleArray[i];
          subCatTitle.onclick = switcherManual2;
        }

        function switcherManual()
    		{
    				var thisGroup = "";
    				var parent = this.parentNode;
    				while ( parent != null ) {
    					if ( parent.className && parent.className == "categoryGroup" ) {
    						thisGroup = parent;
    					}
    					parent = parent.parentNode;
    				}
    				var subGroup = document.getElementById(thisGroup.id + "_subGroup");
    				if (subGroup == null) {
    					subGroup = document.getElementById(thisGroup.id + "_" + "categorySolo");
    				}
    				if (subGroup.style.display == "block") {
    					subGroup.style.display = "none";
    					thisGroup.getElementsByTagName("a")[0].className = "";
    				} else {
    					for (var i = 0; i < groupTitleArray.length; ++i) {
    						groupTitleArray[i].className = "";
    					}
    					for (var i = 0; i < subGroupsArray.length; ++i) {
    						subGroupsArray[i].style.display = "none";
    					}
    					for (var i = 0; i < categoryArray.length; ++i) {
    						if (categoryArray[i].id.indexOf("categorySolo") > -1) {
    							categoryArray[i].style.display = "none";
    						}
    					}
    					subGroup.style.display = "block";
    					thisGroup.getElementsByTagName("a")[0].className = "on";
    					for (var i = 0; i < contentArray.length; ++i) {
    						if (contentArray[i].id.indexOf("categorySolo") < 0) {
    							contentArray[i].style.display = "none"
    							if (categoryTitleArray[i]) {
    								categoryTitleArray[i].className = "";
    							}
    							if (contentArray[i].id.split("_content")[0] == this.href.split("#")[1]) {
    								contentArray[i].style.display = "block";
    								categoryTitleArray[i].className = "on";
    							}
    						}
    		
    					}
    					if (!subGroup) {
    						soloCat.style.display = "block"
    					}
    				}
    				return false;
    		} //switcherManual
    
        function switcherManual2()
    		{
    				var thisGroup = "";
    				var parent = this.parentNode;
    				while ( parent != null ) {
    					if ( parent.className && parent.className == "category" ) {
    						thisGroup = parent;
    					}
    					parent = parent.parentNode;
    				}
    				var catContent = document.getElementById(thisGroup.id + "_content");
    		
    				if (catContent == null) {
    					catContent = document.getElementById(thisGroup.id + "_" + thisGroup.id + "Solo");
    				}
    				if (catContent.style.display == "block") {
    					catContent.style.display = "none";
    					thisGroup.getElementsByTagName("a")[0].className = "";
    				} else {
    					for (var i = 0; i < contentArray.length; ++i) {
    						if (contentArray[i].id.indexOf("categorySolo") < 0) {
    							contentArray[i].style.display = "none";
    							if (categoryTitleArray[i]) {
    								categoryTitleArray[i].className = "";
    							}
    						}
    					}
    					for (var i = 0; i < contentArray.length; ++i) {
    						if (contentArray[i].id.indexOf("categorySolo") > -1) {
    							categoryArray[i].style.display = "none";
    						}
    					}
    					catContent.style.display = "block";
    					thisGroup.getElementsByTagName("a")[0].className = "on";
    				}
    				return false;
    		} //switcherManual2
    }
}
Event.observe( window, 'load', function() { AARP.expandCats.categories(); } );