// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
var hdr_banner_count;
var hdr_banner_index = 1;
var anim_speed = 750;
var pause_duration = 6000;
var timer;

$(document).ready(function(){
	setupOutboundLinks();
	$(".header_banner").show();
	hdr_banner_count = $(".header_banner").length;
	timer = setTimeout("animateBanners()", pause_duration);
});

function animateBanners()
{
	$(".header_banner").eq(hdr_banner_count - hdr_banner_index).fadeOut(anim_speed, function(){
		hdr_banner_index++;
		if(hdr_banner_index == hdr_banner_count)
		{
			hdr_banner_index = 1;
			$(".header_banner").show();
		}
		timer = setTimeout("animateBanners()", pause_duration);
	});	
}//end function animateBanners


function setupOutboundLinks(){
	
	$("a").each(function(i,e){
		
		if($(this).attr("href") != undefined){
		
			if($(this).attr("href").match("http")){
				if(!$(this).attr("href").match("crawfordcountyindiana.com")){
					$(this).attr("target", "_blank");
				}
			}//end if http
			
		}//end if href
		
	});//end each
	
}//end setupOutboundLinks

