
var sponsors = 
{ COLORS: [ { r: 245, g: 247, b: 247 }	// faded
          , { r: 0, g: 0, b: 0 }  // visible
					]
, DISPLAY: 5000

, REMOVE_BR: /\<br\s*\/\>/g

, ix: -1
, fadeInt: Math.round( 1000 / 10 )
, stepInt: Math.round( 247 / 10 )
, timer: null


, list: 
  [ 
, '4-Ever Photos'
, 'A. Charpentier<br/>Power Systems, Inc.'
, 'Achins Garage Inc.'
, 'AERC Removals'
, 'American Capital Corporation'
, 'American Fence'
, 'Amica Insurance'
, 'Answer Is Fitness'
, 'Armchair Quarterbacks'
, 'Attleboro Falls<br/>Family Dentistry'
, 'Attleboro Farms'
, 'Atwill-Conroy Dentist'
, 'BayState<br/>Physical Therapy'
, 'Big Red Pizza'
, 'Brennan\'s Auto Service'
, 'Brugliera Real Estate'
, 'Chace Building Supply'
, 'Check Point<br/>Software Technology'
, 'Collins, Smith and O\'Connor, LLP'
, 'Comprehensive Therapy Center'
, 'Compu-Call, Inc.'
, 'Constitution<br/>Mortgage Trust<br/>Corp.'
, 'Cornetta<br/>Appliance Service'
, 'Daniel Sterling<br/>Martial Arts &amp; Fitness<br/>(Team Link Jiu Jitsu)'
, 'Distron Corporation'
, 'Dunkin Donuts'
, 'ECO Services'
, 'Ed &amp; Bill\'s Auto'
, 'Equity Office Properties'
, 'Ercolini &amp; Company, LLP'
, 'Everwood Day Camp'
, 'Extra Space Storage'
, 'Fanyards.com'
, 'Franklin Fire Fighters<br/>Local 2637'
, 'Fresh Catch Seafood'
, 'Fun Flicks'
, 'Gallagher Electric'
, 'Gaumond\'s Auto Body'
, 'Gentle Dental'
, 'GreatArrivals.com<br/>Gift Baskets'
, 'Health Enterprises'
, 'Howard Photographers'
, 'IBEW Local 104'
, 'Jason\'s Auto Repair'
, 'JCK Concrete Cutting'
, 'Kahn, Litwin,<br/>Renza &amp; Co. LTD.'
, 'Labonte\'s Auto School'
, 'Mark Schenkman DDS'
, 'Massud &amp; Sons\'<br/>Floor Covering'
, 'McClanan &amp; Sons'
, 'Milton Chiropractic<br/>&amp; Rehab'
, 'Modell\'s Sporting Goods'
, 'Mosquito Shield'
, 'NaturaLawn'
, 'North Attleboro<br/>Medical Center'
, 'North Bowl Lanes'
, 'P J Shannon &amp; Co.'
, 'Palagi Bros. I.C.'
, 'PHM Solutions LLC'
, 'Quan\'s Kitchen'
, 'Riel Auto Body'
, 'RMS and Sons<br/>Car Care Center'
, 'Rockland Federal Credit Union'
, 'Royal Bank of Canada'
, 'Rycon Modular Homes'
, 'Schofield Plumbing'
, 'Showcase Cinemas'
, 'Sirois Bike Shop'
, 'SOS Carpet Cleaning'
, 'StayGreen Irrigation'
, 'Stop &amp; Shop'
, 'The Melting Pot'
, 'The Original Chimney Sweep'
, 'Time Savors Corp.'
, 'Your Choice Properties'
, 'Yurek Electric'



	]




, cycle: function()
		{
		var clickIx = ++this.ix % this.list.length;
		var s = this.list[ clickIx ];

		if ( (typeof s) == 'object' )
			{
			if ( (typeof s.link) != 'undefined' )
				{
				this.div.onclick = function () { sponsors.clickThrough( clickIx ); };
				this.div.style.cursor = 'pointer';
				}
			this.div.innerHTML = s.name;
			}
		else
			{
			if ( (typeof this.div.onclick) != 'undefined' )
				{
				this.div.onclick = null;
				this.div.style.cursor = 'default';
				}
			this.div.innerHTML = s;
			}


		this.fadeIn();
		}	// End method; cycle




, clickThrough: function
(
  clickIx
)
		{
		var s = this.list[ clickIx ];
		if ( (typeof s.link) == 'undefined' )
			{
			window.defaultStatus = 'No link available for ' + s.name;
			}

/*
		try {
				core.asynchJSON( 'http://data.lnal.com/track-click/news/2009/sponsors.js?ix=' + clickIx + '&sponsor=' + escape( s.name.replace( this.REMOVE_BR, ' ' ).replace( '&amp;', '&' ) ) + '&link=' + escape( s.link ) );
				}
		catch ( ex )
				{}
*/
		window.open( s.link, '_blank' );

		return	void 0;
		}	// End method; clickThrough




, fade: function
(
  inOut
)
		{
		var c = this.div.style.color;
		var rgb = { r: 0,  g: 0,  b: 0 };

		if ( c.indexOf( '#' ) == 0 )
			{
			rgb.r = parseInt( c.substr( 1, 2 ), 16 );
			rgb.g = parseInt( c.substr( 3, 2 ), 16 );
			rgb.b = parseInt( c.substr( 5, 2 ), 16 );
			}
		else if ( c.indexOf( 'rgb(' ) == 0 )
			{
			c = c.split( '(' )[1].split( ')' )[0].split( ',' );
			rgb.r = parseInt( c[0] );
			rgb.g = parseInt( c[1] );
			rgb.b = parseInt( c[2] );
			}
		else
			{
			window.defaultStatus = 'sponsors.fade(): Can\'t parse color';
			return;	// should never get here
			}

		var done = 0;
		for ( var chroma in rgb )
			{
			rgb[chroma] = Math.max( Math.min( rgb[chroma] + (inOut * this.stepInt), this.COLORS[0][chroma] ), this.COLORS[1][chroma] );
			done += ( rgb[chroma] == this.COLORS[( inOut > 0  ?  0  :  1 )][chroma]  ?  1  :  0 );
			}

		this.div.style.color = 'rgb(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ')';
		return	done;
		}	// End method; fade




, fadeIn: function()
		{
		if ( this.fade( -1 ) < 2 )
			this.timer = window.setTimeout( 'sponsors.fadeIn();', this.fadeInt );
		else
			this.timer = window.setTimeout( 'sponsors.fadeOut();', this.DISPLAY );
		}	// End method; fadeIn




, fadeOut: function()
		{
		if ( this.fade( 1 ) < 2 )
			this.timer = window.setTimeout( 'sponsors.fadeOut();', this.fadeInt );
		else
			this.cycle();
		}	// End method; fadeIn


};	// End object definition; sponsors
