// ALLOW GOOGLE ANALYTICS TO PASS COOKIES BETWEEN DOMAINS
// This allows GA to track the Fahlgren family of sites as a single unit so that visitors can be followed from site to site
// Added 9/15/10 GML
function gaPassCookie() {
	var strHref;
	$("a[href*=www.fahlgren.com],a[href*=www.fahlgrenmortine.com],a[href*=www.fahlgrengrip.com],a[href*=www.fahlgrenadvertising.com]").click(function() {
		strHref = $(this).attr("href");
		if (location.hash == "#test") {
			alert(strHref);
		}
		else {
			_gaq.push(['_link', strHref]); 			
		}	
		return false;		
	});
}

// CHECK IE DOCUMENT MODE
function checkDocumentMode() {
	if (location.hash == "#mode") {
		alert(document.documentMode);
	}
}

$.fn.equalHeights = function(minHeight, maxHeight) {
	tallest = (minHeight) ? minHeight : 0;
	this.each(function() {
		if($(this).height() > tallest) {
			tallest = $(this).height();
		}
	});
	if((maxHeight) && tallest > maxHeight) tallest = maxHeight;
	return this.each(function() {
		//$(this).height(tallest).css("overflow","hidden");
		$(this).height(tallest);
	});
}

$(document).ready(function(){	
	$.easy.navigation();
	$.easy.tooltip();
	$.easy.popup('.thumbnails a');
	// $.easy.external();
	$.easy.rotate();
	$.easy.forms();
	$.easy.showhide();
	$.easy.jump();
           /* gaPassCookie(); */
           checkDocumentMode();
	
// Homepage columns equal height
	$('#homepage-bottom .col:not(:last)').equalHeights(); 

// Hompage Column Rollovers
	$('#homepage-bottom .col:not(:last)').hover(
		function(){$(this).siblings('.hover').fadeTo(0, 0.33);},
		function(){$(this).siblings('.hover').fadeTo(0, 1);}
	);
	
});

// Work Samples Hover Effects
	function sampleHover(){
		$(this).children('.background').fadeIn('500');
		$(this).children('.inner').animate({paddingTop:"10px"},400);
		$(this).children('.inner').children('.question').animate({backgroundPosition: "(0 -89px)","color": "#333"},400);
	}
	function sampleHoverOut(){
		$(this).children('.background').fadeOut('200');
		$(this).children('.inner').animate({paddingTop: "0"},200);
		$(this).children('.inner').children('.question').animate({"color": "#999",backgroundPosition: "(0 2px)"},200);
	}
	var config1 = {    
		sensitivity: 99, // sensitivity threshold (must be 1 or higher)
		interval: 50, // milliseconds for onMouseOver polling interval
		timeout: 100, // milliseconds delay before onMouseOut
		over: sampleHover, 
     	out: sampleHoverOut
	};
	$("#work-samples .sample").hoverIntent( config1 );

