/* Declare a namespace for the site */
var Site = window.Site || {};

/* Create a closure to maintain scope of the '$'
   and remain compatible with other frameworks.  */
(function($) {
	
	//same as $(document).ready();
	$(function() {
		
		// determine if the browser supports transition
		var thisStyle = document.body.style,
		supportsTransition = thisStyle.WebkitTransition !== undefined ||
			thisStyle.MozTransition !== undefined ||
			thisStyle.OTransition !== undefined ||
			thisStyle.transition !== undefined;
	
		// assign jQuery transition if the browser doesn't support
		if ( ! supportsTransition ) {
			var defaultCSS = {
				opacity: '0'
			},
			hoverCSS = {
				opacity: '0.9'
			},
			naviCSS = {
				left:'0'
			},
			naviHover = {
				left:'-255px'
			},
			naviCurrent = {
				left:'-510px'
			};
	
			// loop through each button
			$('.details').each(function() {
				var $subtle = $(this);
	
				// bind an event listener for mouseover and focus
				$subtle.bind('mouseenter focus', function() {
					$subtle.animate(hoverCSS, 500, 'swing' );
				});
	
				// bind the reverse for mouseout and blur
				$subtle.bind('mouseleave blur', function(ev) {
					if ( ev.type == 'mouseleave' && ev.target == document.activeElement ) return false;
	
					$subtle.animate(defaultCSS, 500, 'swing' );
				});
			});
			
			
				
			$('body nav ul li a').each(function() {
				var $subtle = $(this);
				
				if( $(this).attr("class") == $("body").attr("class") ) {
					$subtle.css(naviCurrent);
				} else {

	
					// bind an event listener for mouseover and focus
					$subtle.bind('mouseenter focus', function() {
							$subtle.animate(naviHover, 500, 'swing' );
					});
		
					// bind the reverse for mouseout and blur
					$subtle.bind('mouseleave blur', function(ev) {
						if ( ev.type == 'mouseleave' && ev.target == document.activeElement ) return false;
							$subtle.animate(naviCSS, 300, 'swing' );
					});
					
				}
			});
			
		}

	});


	$(window).bind("load", function() {
		
		

	});
	
})(jQuery);

