var _mediaObject = {
	'hardhat':		{'sm':'/images/sections/our_work/hard_hat_sm.jpg', 'md':'/images/sections/our_work/hard_hat_md.jpg', 'description':'<p>For Clark\'s 100th anniversary in 2006, we commissioned the creation of a hardhat featuring landmark projects completed during the company\'s first century in business.  This collage represents just a small portion of the  millions of square feet of office buildings, hospitals, research facilities, schools, retail centers, manufacturing facilities, sports complexes and convention facilities that Clark has constructed across the country.  And every day, we hone our experience and broaden our expertise on new projects and building types while  remaining true to our commitment to quality and craftsmanship.  So take our hardhat for a spin, and see for yourself why we are proud of what we build.</p>'}, 
	'la_live':		{'sm':'/images/sections/our_work/la_live_sm.jpg', 'md':'/images/sections/our_work/la_live_md.jpg', 'description':'<p>The 5.6 million square-foot L.A. LIVE complex, a mixed-use development of restaurants, entertainment venues, retail establishments, broadcast studios and residences,  is bringing a new vitality to downtown Los Angeles&rsquo; South Park district.</p><p>The timelapse video above shows the construction of two buildings that serve as L.A. LIVE&rsquo;s primary entertainment areas - the 408,000 square-foot AEG Building and the West Coast headquarters of ESPN, completed in 2008.</p><p>The AEG Building is home to the state-of-the-art GRAMMY&trade; Museum, the Club Nokia music venue, a bowling alley, radio broadcast facilities, several upscale restaurants and office space.  The 105,000 square-foot ESPN Building contains production and broadcast facilities, offices, and an ESPN Zone restaurant. The ESPN Building&rsquo;s structure was designed to accommodate appropriate load and stability requirements to allow the facility to serve as the primary back-up to ESPN&rsquo;s headquarters in Connecticut.</p><p>Clark has also completed the 7,100-seat Nokia Theatre, Nokia Plaza, and a two-story, below-grade parking garage that provides structural support for the Nokia Plaza, AEG, and ESPN Buildings as part of this development.</p>'},
	'alan_meltzer':	{'sm':'/images/sections/our_work/alan_meltzer_sm.jpg', 'md':'/images/sections/our_work/alan_meltzer_md.jpg', 'description':'<p>As remarkable as our long list of completed projects may be, at the heart of our success is a team of people who work tirelessly together, day in and day out, to build what matters most – lasting relationships.  One of our long-term colleagues, Alan Meltzer, CEO of The Meltzer Group, shares his observations about our company in the video clip above.</p>'}, 
	'nationals':	{'sm':'/images/sections/our_work/nationals_sm.jpg', 'md':'/images/sections/our_work/nationals_md.jpg', 'description':'<p>When the Washington Nationals played their first game in <a href="http://www.clarkconstruction.com/projects/feature_project/288/">Nationals Park</a> in March 2008, it was a momentous occasion, not only for Major League Baseball and the District of Columbia, but for our company.</p><p>In just 23 short months, the award-winning project went from groundbreaking to grand opening. This feat would not have been possible without the tremendous hard work and dedication of our team and project partners.</p><p>Nationals Park was also an opportunity to act on one of Clark&rsquo;s founding principles – giving back to the community.  Throughout the course of the project, we helped to foster local, small and disadvantaged business growth through apprenticeship and mentoring programs.  We also supported neighborhood organizations such as the Earth Conservation Corps with the goal of leaving behind not only a ballpark, but a positive impact on its surroundings.</p><p>View the story behind D.C.&rsquo;s record-setting ballpark above.</p>'}
};

var _transDuration = 100;
var _fe3CurrentItem;

function amusementPark()
{
	$('thumb1').store('item','hardhat');
	$('thumb1').store('tip:title','100 year hard hat');
	$('thumb2').store('item','la_live');
	$('thumb2').store('tip:title','L.A. LIVE construction timelapse');
	$('thumb3').store('item','alan_meltzer');
	$('thumb3').store('tip:title','Alan Meltzer testimonial');
	$('thumb4').store('item','nationals');
	$('thumb4').store('tip:title','Nationals Park timeline');
	
	var toolTips = new Tips('.thumb', {className: "toolTip"});
	
	$$('.thumb').each( function(thumb, index) {
		thumb.store('xPos', thumb.getStyle('left').toInt());
		thumb.store('yPos', thumb.getStyle('top').toInt());
		thumb.getFirst('img').set('morph', {duration:_transDuration, link:'cancel', transition:Fx.Transitions.linear});
		thumb.set('morph', {duration:_transDuration, link:'cancel', transition:Fx.Transitions.linear});
		thumb.setStyle('cursor', 'pointer');
		thumb.addEvent('click', function() {
			fe3_swap(this.getProperty('id'), this.retrieve('item'));
		});
		thumb.addEvent('mouseenter', function() {
				this.getFirst('img').setProperty('src',_mediaObject[this.retrieve('item')].md);
				this.getFirst('img').morph({'width':100, 'height':100});
				this.morph({'left': (this.retrieve('xPos') - 7), 'top': (this.retrieve('yPos') - 7), 'opacity': 1});
				this.setStyle('zIndex', 3);
		});
		thumb.addEvent('mouseleave', function() {
			this.getFirst('img').setProperty('src',_mediaObject[this.retrieve('item')].sm);
			this.getFirst('img').morph({'width':86, 'height':86});
			
			this.setStyle('zIndex', 2);
			if (_fe3CurrentItem != this.retrieve('item'))
			{
				this.morph({'left': (this.retrieve('xPos')), 'top': (this.retrieve('yPos')), 'opacity': .6});
			}
			else
			{
				this.morph({'left': (this.retrieve('xPos')), 'top': (this.retrieve('yPos'))});
			}
		});
		thumb.setStyles({'left': (this.retrieve('xPos')), 'top': (this.retrieve('yPos'))});
		thumb.morph({'opacity': .6});
	}, this);
    
    /*//setup the first element
     //fe3_swap('thumb1', $('thumb1').retrieve('item'));*/
	 _fe3CurrentItem = $('thumb1').retrieve('item')
	 $('thumb1').morph({'opacity': 1})
}

function fe3_swap(thumbId, thumbItem) 
{
	_fe3CurrentItem = thumbItem;
	switch (thumbItem)
	{
		case 'alan_meltzer':
            $('main').set('html', '<div id="alan_meltzer"></div>');
            swfobject.embedSWF("/images/sections/our_work/player.swf", "alan_meltzer", "614", "344", "9.0.45", "http://www.clarkconstruction.com/assets/flash/expressInstall.swf" , {the_video: 'alan_meltzer.flv', autoplay: 'true'}, {menu: 'false', base: '.', quality: 'best', scale: 'noscale',salign:'tl',wmode:'transparent'});
			break;
		case 'hardhat':
			$('main').set('html', '<div id="hard_hat_flash"></div>');
            swfobject.embedSWF("/images/sections/our_work/hard_hat.swf", "hard_hat_flash", "614", "344", "9.0.45", "http://www.clarkconstruction.com/assets/flash/expressInstall.swf" , {baseURL: 'http://www.clarkconstruction.com/'}, {menu: 'false', base: '.', quality: 'best', scale: 'noscale',salign:'tl',wmode:'transparent'});
			break;
		case 'la_live':
			 $('main').set('html', '<div id="la_live"></div>');
            swfobject.embedSWF("/images/sections/our_work/player.swf", "la_live", "614", "344", "9.0.45", "http://www.clarkconstruction.com/assets/flash/expressInstall.swf" , {the_video: 'la_live.flv', autoplay: 'true'}, {menu: 'false', base: '.', quality: 'best', scale: 'noscale',salign:'tl',wmode:'transparent'});
			break;
		case 'nationals':
			$('main').set('html', '<div id="nationals"></div>');
			swfobject.embedSWF("/images/sections/our_work/nationals.swf","nationals","614","344","9.0.45","http://www.clarkconstruction.com/assets/flash/expressInstall.swf",{},{menu:'false',base:'.',quality:'best',scale:'noscale',salign:'tl',wmode:'transparent'});
			break;
		default:
			break;
	}
	
	/*$(thumbId).morph({'opacity': 1});*/
	fadeSidePicsOut($(thumbId));
	$(thumbId).fireEvent('mouseleave');
	
	$('fe3_descriptions').set('html', _mediaObject[thumbItem].description);
}

/*fades all of the side pics out except the one past in*/
function fadeSidePicsOut(thisElement)
{
	$$('.thumb').each(function(element)
	{
		if ( _fe3CurrentItem != element.retrieve('item') )
		{
			element.morph({'opacity': .6});
		}
		else
		{
			element.morph({'opacity': 1});
		}
	});
}

/* Preloads the hard hat images */
if ( (! Browser.Engine.trident) && (! Browser.Engine.webkit) )
{
	var hardHatImages = new Array();
	for (var i = 1; i < 36; i++)
	{
	hardHatImages.push('/images/sections/our_work/images/hard_hat_' + i + '.jpg'); 
	}
	var hardHatImageAssets = new Asset.images(hardHatImages);
}

window.addEvent('domready', function() {
	if (swfobject.getFlashPlayerVersion().major > 6)
	{amusementPark();}
	$('leftnav').set('morph', {'duration': 350, 'transition': 'linear'});
	$('primary_content').set('morph', {'duration': 350, 'transition': 'linear'});
	
	/*Click event for the 'more projects'*/
	$('more_projects').addEvent('click', function(e)
	{
		e.stop();
		$('leftnav').setStyle('overflow', 'hidden');
		this.setStyle('display', 'none');
		var leftNavPreSize = $('leftnav').getSize();
		$$('.hidden_project').each(function(element)
		{
			element.setStyle('display', 'block');
		});
		var leftNavPostSize = $('leftnav').getSize();
		$('leftnav').setStyle('height', leftNavPreSize.y);
		/*Set the main content area to be the same height as the left nav*/
		var primaryContentSize = $('primary_content').getSize();
		if (leftNavPostSize.y > primaryContentSize.y)
		{
			
			$('leftnav').morph({'height': leftNavPostSize.y});
			$('primary_content').morph({'height': leftNavPostSize.y});
		}
		
	});
});