
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: 
  [ 
    'A. Charpentier<br/>Power Systems, Inc'
  , { name: 'Answer is Fitness', link: 'http://answerisfitness.com/' }
  , 'Aqua Barriers Inc'
  , 'Arrow<br/>Appraisal Services'
  , { name: 'Ashworth Awards', link: 'http://ashworthawards.com/' }
  , { name: 'AT&amp;T', link: 'http://www.att.com/' }
  , 'Attleboro Farms'
  , 'Attleboro-Cumberland<br/>Oral Surgeons'
  , 'Atwill-Conroy<br/>Dental Associates'
  , 'Automatic Machine'
  , 'Award - Guys'
  , 'Badger Welding'
  , 'Barlow<br/>Real&nbsp;Estate<br/>Appraisal Co'
  , 'Bay State Physical Therapy'
  , 'Big Red Barber Shop'
  , 'Box Seats'
  , 'Brennan\'s Auto Service'
  , 'Caf&eacute; Porto Bello'
  , 'Cinemaworld'
  , 'Compton Doors'
  , 'Constitution<br/>Trust Mortgage'
  , 'Cornetta<br/>Appliance Service'
  , { name: 'Cryan Landscape Contractors', link: 'http://CryanLandscape.com' }
  , 'Dick\'s Sporting Goods'
  , { name: 'Dyer-Lake<br/>Charitable<br/>Foundation', link: 'http://dyer-lakefuneralhome.com/' }
  , { name: 'Distron Corp', link: 'http://distron.com/' }
  , 'Eagle Electric Supply'
  , 'ECO Services'
  , 'Ed &amp; Bill\'s<br/>Auto Sales &amp; Service'
  , 'Environmental Systems Inc<br/>(ESI)'
  , 'Ercolini &amp; Company, LLP'
  , 'Extra Space Storage'
  , { name: 'FreshCatch Seafood', link: 'http://freshcatchinc.com/' }
  , 'Gaumonds Auto Body'
  , 'General Dynamics'
  , { name: 'Gilmore<br/>Insurance Agency Inc', link: 'http://rsgilmore.com/' }
  , { name: 'GreatArrivals.com<br/>Gift Baskets', link: 'http://greatarrivals.com/' }
  , 'Iron Workers Union<br/>Local 7'
  , 'Jay Brian Transport'
  , 'JBR Gutter Services'
  , 'Jette Silversmiths'
  , 'Kelley Boulevard<br/>Wines &amp; Liquors'
  , 'Kelli Barker Photography'
  , { name: 'Labonte\'s Auto School', link: 'http://labontesautoschool.com/' }
  , 'Leona\'s Restaurant'
  , 'Lorell Management Corp'
  , 'Mansfield Bank'
  , 'Marcou Cleaning'
  , 'Maritime Home Improvements'
  , 'Massud &amp; Son\'s<br/>Floor Covering, Inc'
  , 'McClanan &amp; Sons'
  , 'Moore Security Corp'
  , 'North Attleborough<br/>Firefighters<br/>Kids Day'
  , 'National Amusements, Inc<br/>(Showcase Cinemas)'
  , 'Nissan Village'
  , 'North Attleborough<br/>Firefighters<br/>Local 1992'
  , 'North Attleboro Medical Center'
  , { name: 'North Bowl', link: 'http://northbowllanes.com/' }
  , 'North Easton<br/>Savings Bank'
  , { name: 'Northern Lights Electric', link: 'http://northernlightselectric.com/' }
  , 'Original Chimney Sweep'
  , { name: 'Outside Adventures<br/>portablewall.com', link: 'http://portablewall.com/' }
  , 'Palagi Brothers<br/>Ice Cream'
  , 'Park Landscape'
  , 'Peluso Orthodontics'
  , { name: 'Piccadilly Pub', link: 'http://www.piccadillypub.com/NAttleboro.html' }
  , 'Prime Interior Contractors'
  , 'Prime Porsche'
  , 'R.A. Reinbold<br/>Insurance Agency<br/>Inc'
  , { name: 'RBI Academy', link: 'http://rbiacademy.com/' }
  , 'Reflections<br/>Hair &amp; Nail Studio'
  , { name: 'Remax<br/>Lori Seavey', link: 'http://loriseavey.com/' }
  , 'Riel Auto Body'
  , 'RJ Smith Insurance Agency'
  , 'Rockland Federal<br/>Credit Union'
  , 'Rycon Systems Built Homes LLC'
  , 'Schofield<br/>Plumbing &amp; Heating, Inc'
  , 'Signs by Tomorrow'
  , 'Sirois Bicycle Shop'
  , 'Snap-On Tools'
  , { name: 'Stay Green Irrigation', link: 'http://staygreeninc.com/' }
  , 'Studio 31 Yoga'
  , 'Stylz Hair Salon'
  , 'Time Savers<br/>Services Corp'
  , 'Triboro Paint Center'
  , 'UGL Uniccio'
  , 'Uno Chicago Grille'
  , { name: 'Utimaco Safeware Inc', link: 'http://utimaco.com/' }
  , 'Waste Water Services, Ltd'
  , 'Wright Concepts'
  , 'Your Choice Properties'

	]




, 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