/* Element JavaScript */

window.addEvent('domready', function() {
		
	// Smooth Scroll page links
	var mySmoothScroll = new SmoothScroll();
	
	
	// Open External Links in a new window
	externalLinks = function() {
		var allAnchors = $(document.body).getElements('a');
		for (var i=0; i<allAnchors.length; i++) {
			var myCurrentAnchor = allAnchors[i];
			if (myCurrentAnchor.get('href') && myCurrentAnchor.get('rel') == "externalLink") {
				myCurrentAnchor.target = "_blank";
			}
		}
	}
	externalLinks();


	// Fade mainImageThumbs
	if ($('renoTabBar') || $('newConstructionTabBar')) {
		$$('.imgThumb').fade(0.85);
		$$('.imgThumb').addEvent('mouseover', function() {
			this.fade(1.00);
		});
		$$('.imgThumb').addEvent('mouseout', function() {
			this.fade(0.85);
		});
	}
	
	
	// Rotate images on home page
	if ($('rotatorContainer')) {
		var rotater = new Rotater('.rotateThis',{ 	//Class of elements that should rotate.
			slideInterval:7000, 					//Length of showing each element, in milliseconds
			transitionDuration:2000 				//Length crossfading transition, in milliseconds
		});
	}
	
	
	// Fade portfolio page buttons
	if ($('renovationBtn')) {
		
		$('renovationBtn').fade(0.90);
		$('newConstructionBtn').fade(0.90);
		$('renovationBtn').addEvent('mouseover', function() {
			this.fade(1.00);
			$('newConstructionBtn').fade(0.60);
		});
		$('renovationBtn').addEvent('mouseout', function() {
			this.fade(0.90);
			$('newConstructionBtn').fade(0.90);
		});
		$('newConstructionBtn').addEvent('mouseover', function() {
			this.fade(1.00);
			$('renovationBtn').fade(0.60);
		});
		$('newConstructionBtn').addEvent('mouseout', function() {
			this.fade(0.90);
			$('renovationBtn').fade(0.90);
		});
		
	}
	
	
}); // Close DomReady function




	
	





