(function($){
	$(document).ready( function(){
		
		$('#FeatureImages').cycle( {
			delay: -1000,
			timeout: 4000,
			speed: 3000
		});
		
		setEqualHeight($("#LandingDepartments article"));
		
	    $('#SearchForm_SearchForm_Search').focus(function() {
	    	$(this).val('');
	    });
	    
		$('#ContentHolder a').each(function() {
			var fileURL = $(this).attr('href');
			if (fileURL) {
				if (fileURL.match("\.doc$")) {
					$(this).addClass('file');
					$(this).css('background','transparent url(mysite/images/icons/icon_doc.gif) no-repeat scroll 0 1px');
				}
				if (fileURL.match("\.pdf$")) {
					$(this).addClass('file');
					$(this).css('background','transparent url(mysite/images/icons/icon_pdf.gif) no-repeat scroll 0 1px');
				}
				if (fileURL.match("\.xls$")) {
					$(this).addClass('file');
					$(this).css('background','transparent url(mysite/images/icons/icon_xls.gif) no-repeat scroll 0 1px');
				}
				if (fileURL.match("\.ppt$")) {
					$(this).addClass('file');
					$(this).css('background','transparent url(mysite/images/icons/icon_ppt.gif) no-repeat scroll 0 1px');
				}
			}
		});
		
		$('.subNav article').hover(function() {
			$(this).addClass('hover');
		}, function() {
			$(this).removeClass('hover');
		});
		
		$('#Collateral a').fancybox({
			titlePosition: 'inside'
		});
		
		if( $('#EventsNavigation.allPages').length ) {
			$('#Menu1events').click(function() {
				$('#EventsNavigation.allPages').slideToggle('fast');
				return false;
			});
		
			$('body').click(function() {
				$('#EventsNavigation.allPages').slideUp('fast');
			});
			
			$('#EventsNavigation.allPages').click(function(e) {
				e.stopPropagation();
			});
		}
	
	});
})(jQuery);

function setEqualHeight(columns) {  
	var tallestcolumn = 0;  
	columns.each(  
		function() {  
			currentHeight = $(this).height();  
			if(currentHeight > tallestcolumn) {  
				tallestcolumn  = currentHeight;  
			}  
		}  
	);  
	columns.height(tallestcolumn);  
}  
