
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 Cut Above The Rest<br/>Landscaping'
, 'A.&nbsp;Charpentier Power Systems, Inc'
, 'A+ Tailors'
, 'AngoffGoldman.com'
, 'Answer is Fitness'
, 'Attleboro Falls<br/>Family Dentistry'
, 'Attleboro-Cumberland<br/>Oral Surgeons'
, 'Atwill-Conroy<br/>Dental Associates'
, 'Bay State<br/>Physical Therapy'
, 'Big Red Pizza'
, 'Brennan\'s Auto Service, LLC'
, 'Briggs Mechanical'
, 'Briggs Nursery'
, 'Brugliera Real Estate'
, 'Budgetcard Inc'
, 'Caf&eacute; Porto Bello'
, 'Collins, Smith<br/>&amp; O\'Connor, LLP'
, 'Compton Doors'
, 'Constitution Trust Mortgage'
, 'Cornetta Appliance Service'
, 'Distron Corp'
, 'Dyer-Lake<br/>Charitable<br/>Foundation'
, 'Eco Services'
, 'Ed &amp; Bills<br/>Auto Sales &amp; Service'
, 'Ercolini &amp; Company, LLP'
, 'Extra Space Storage'
, 'Foley and Son<br/>Landscaping Inc'
, 'Fresh Catch Seafood'
, 'FunFlicks Outdoor Movies'
, 'Furey Roofing'
, 'G. Systems<br/>(Garage Storage Solutions)'
, 'Gaumonds Auto Body'
, 'General Dynamics'
, 'Gentle Dental'
, 'Great Arrivals.com<br/>Gift Baskets'
, 'Health Enterprises, Inc'
, 'Honey Dew Donuts'
, 'Iron Workers Union<br/>Local 7'
, 'Jason\'s Auto Repair'
, 'Jay Brian Transport'
, 'JCK Concrete Cutting'
, 'Jette Silversmiths'
, 'JRF Corporation'
, 'Kelli Barker<br/>Photography'
, 'Kids Day'
, 'KLR'
, 'Labonte\'s Auto School'
, 'Marcou Cleaning Service'
, 'Maritime Home Improvements'
, 'Massud &amp; Son\'s<br/>Floor Covering, Inc'
, 'McClanan &amp; Sons'
, 'N.A. Police Dept.'
, 'N.A. Firefighters<br/>Local 1992'
, 'National Amusements<br/>(Showcase Cinemas)'
, 'New England Packaging'
, 'New England Tank Services'
, 'North&nbsp;Attleboro<br/>Dunkin Donuts'
, 'North&nbsp;Attleboro<br/>Medical Center'
, 'North Bowl'
, 'North Easton<br/>Savings Bank'
, 'Original Chimney Sweep'
, 'Palagi Brothers<br/>Ice Cream'
, 'Piccadilly Pub'
, 'PJ Shannon Remodeling'
, 'Plaster Plus'
, 'R.J.&nbsp;Smith<br/>Insurance Agency'
, 'RBI Academy'
, 'Riel Auto Body'
, 'Royal Bank of Canada'
, 'Rycon Modular Homes'
, 'Safeplay.com'
, 'Schofield Plumbing'
, 'Shannon Insurance'
, 'Sirois Bicycle Shop'
, 'Snap-On Tools'
, 'SoupWorks'
, 'Stay Green<br/>Irrigation'
, 'Sterling<br/>Martial Arts'
, 'Stop &amp; Shop'
, 'The Tavern<br/>from<br/>Tower Square'
, 'Time Savers<br/>Services Corp'
, '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
