$(document).ready(function(){
	
		$(".homeMidRow .content .col.right").click(function() {
			window.location = "http://www.potterclarkson.com/industry-recognition/";
		});
		
		////// EQUAL HEIGHT ////////////////////////////////////////////////////////////////////
		$('.topRow .box').equalHeight();
		$('.homeMidRow .homeMidHeight').equalHeight();
		$('.homeMidRow .content .col').equalHeight();
		

		$('.lightbox').colorbox({iframe:true,width:'755px',height:'640px',scrolling:false});
		
		$('.ipBox').colorbox({iframe:true,innerWidth:'700px',innerHeight:'750px',scrolling:true});
		
		/////////// SLIDER ON HOMEPAGE ///////////////////////////////////////////		
				
				 $('#slideBanner').advListRotator({
						effect: 'slide',
					effectOptions: {slideBy: 948},
					helper: '#slideBannerHelper',
					helperActiveItemClass: 'slideBannerHelperItemActive',
						helperInteraction: 'click'
				 });
		
		
		var homeTopRowHeight = $(".homeTopRow").height();
		var featureHeight = $(".feature").height();
		
		if (homeTopRowHeight > featureHeight)
			{
				var newHeight = (homeTopRowHeight - 20);
				
				$(".feature").height(newHeight);
			}
		/////////// RESIZE MAIN COL IF NOT BIGGER THAN LEFTCOL ///////////////////////////////////////////	
		
		var column1Height = $("#leftCol").height();
		var column2Height = $(".colbg").height();
		var column3Height = $(".colbg2").height();
	
		if (column1Height > column2Height)
			{
				var newSecondNavHeight = (column1Height + 20);
				
				$(".colbg").height(newSecondNavHeight);
			}
		
		if (column1Height > column3Height)
			{
				var newThirdNavHeight = (column1Height + 20);
				
				$(".colbg2").height(newThirdNavHeight);
			}
	
		
		
		/////////// ROUNDED CORNERS ON TOPNAV ///////////////////////////////////////////		
		
		
		$("#header #nav a").corner("5px");
		
		///////// FOOTER QUOTE TRANSITION /////////////////////////////////////////////	
		
                $('ul#homeslide').innerfade({
                    speed: 1200,
                    timeout: 5000,
                    type: 'sequence'
                });
				
		////////// TABS ////////////////////////////////////////////		 
					
			//When page loads...
			$(".tab_content").hide(); //Hide all content
			$(".tab_content2").hide();
			
			$("#latestActivityTabs ul.tabs a:first").addClass("active").show(); //Activate first tab
			$("#yearTabs ul.tabs2 a:first").addClass("active").show(); //Activate first tab
			
			$(".tab_content:first").show(); //Show first tab content
			$(".tab_content2:first").show(); //Show first tab content
		
			//On Click Event
			$("#latestActivityTabs ul.tabs a").click(function(e) {
				e.preventDefault();
		
				$("#latestActivityTabs ul.tabs a").removeClass("active"); //Remove any "active" class
				$(this).addClass("active"); //Add "active" class to selected tab
		
				$(".tab_content").hide(); //Hide all tab content
		
				var activeTab = $(this).attr("href"); //Find the href attribute value to identify the active tab + content
				
				$(activeTab).fadeIn(); //Fade in the active ID content
				
				return false;
			});
			
			$("#yearTabs ul.tabs2 a").click(function(e) {
				e.preventDefault();
		
				$("#yearTabs ul.tabs2 a").removeClass("active"); //Remove any "active" class
				$(this).addClass("active"); //Add "active" class to selected tab
		
				$(".tab_content2").hide(); //Hide all tab content
		
				var activeTab = $(this).attr("href"); //Find the href attribute value to identify the active tab + content
				
				$(activeTab).fadeIn(); //Fade in the active ID content
				return false;
			});	
});

$.fn.equalHeight = function () {
	var height		= 0;
	var maxHeight	= 0;

	// Store the tallest element's height
	this.each(function () {
		height		= $(this).outerHeight();
		maxHeight	= (height > maxHeight) ? height : maxHeight;
	});

	// Set element's min-height to tallest element's height
	return this.each(function () {
		var t			= $(this);
		var minHeight	= maxHeight - (t.outerHeight() - t.height());
		var property	= $.browser.msie && $.browser.version < 7 ? 'height' : 'min-height';

		t.css(property, minHeight + 'px');
	});
};

