/*
	imagegallery.js for mootools v1.2
	by Devin Ross (http://www.tutorialdog.com) - MIT-style license
	modded by Charles Morgan
*/
window.addEvent('domready', function()
{
	var drop = $('large');
	var dropFx = drop.effect('background-color', {wait: false}); // wait is needed so that to toggle the effect,
	$$('.item').each(function(item)
	{
		item.addEvent('click', function(e)
		{
			var clcked;
			if (e.target)
			{
				clcked=e.target;
			}
			else if (e.srcElement)
			{
				clcked=e.srcElement;
			}
			if (clcked.nodeType==3) // defeat Safari bug
			{
				clcked = targ.parentNode;
			}
			if(clcked.alt == undefined)
				return;
			if(fancolor==clcked.alt) //don't update if the user clicked on the same color
				return;
			fancolor=clcked.alt;
			submitaction();
			var drop = $('large');
			var dropFx = drop.effect('background-color', {wait: false}); // wait is needed so that to toggle the effect,
			drop.empty();
			UpdateMainImage(fancolor);
			//dropFx.start('7389AE').chain(dropFx.start.pass('ffffff', dropFx));
		});
	});
});

function UpdateMainImage(fc) {
	var lc = lightcount;
	if( lc == 0 ){
		lc="";
	}
	
	fancolorlc=fc.toLowerCase();
	var container = document.getElementById("large");
	container.innerHTML = "<div class=\'info\'><img src=\'assets/images/diskfan/colors/diskfan" + lc + "_m_" + fancolorlc + ".jpg\' alt=\'Your Ceiling Fan Replacement:  " + fancolor + "-Colored " + lc + "-Light DISKFAN: Your Ceiling Fan Replacement\' title=\'Your Ceiling Fan Replacement:  " + fancolor + "-Colored " + lc + "-Light DISKFAN: The Ceiling Fan Replacement\' width=\'200\' height=\'165\'></div>";
	UpdateZoomTarget(fancolor);
}//	C	h	a	r	l	e	s		M	o	r	g	a	n		I	I	I
