var $j=jQuery.noConflict();
var message = "Please be advised that you are leaving Ouachita Independent Bank's website. This link is provided as a courtesy.  Ouachita Independent Bank does not endorse or control the content of third party websites.";

$j(document).ready(function(){
	// jQuery replacement for warn
	if( $j('a.warn').length > 0 ){
		$j('a.warn').click( function(){
			alert( message );
		});
	}
	if( $j('a.confirm').length > 0 ){
		$j('a.confirm').click( function( event ){
			event = new Event(event);
			if( confirm(message) ) {
				return true;
			} else {
				event.stop();
				return false;
			}
		});
	}
	var windowHeight = $j(window).height() - 71;
	var docHeight = $j("#shadowLeft").height();
	if(docHeight < windowHeight) {
		$j("#shadowLeft").css('height',windowHeight+'px');
	}

	var IE6 = (navigator.userAgent.indexOf("MSIE 6")>=0) ? true : false;
	if(!IE6){
		jQuery(document).ready(function(){
			$j("#printShare li").hover(
				function(){
					$j(this).find("span").attr({"style": 'display:block'});
					$j(this).find("span").animate({opacity: 1}, {queue:false, duration:400});
				},
				function(){
					$j(this).find("span").animate({opacity: 0}, {queue:false, duration:400}, "linear",
					function(){
						$j(this).find("span").attr({"style": 'display:none'});
					}
				);
			});
		});
	}
	$j('#financialCalculators li a').addClass('iframe');
	$j('#financialCalculators li a:contains("Stock Quotes")').removeClass('iframe').addClass('stockQuotes');
	$j('#financialCalculators li a:contains("Currency Converter")').removeClass('iframe').addClass('currency');
	$j('#financialCalculators li a:contains("FDIC Insurance Estimator: EDIE")').removeClass('iframe').addClass('fdicInsurance');
	$j("#financialCalculators li a.iframe").fancybox({
		'hideOnContentClick': false,
		'frameWidth': 650,
		'frameHeight': 400,
		'overlayOpacity': 0.8
	});
	
	if( $j('#imgSlides').length ){
	    $j('#imgSlides .imgSlide:not(:first)').hide();
	    var imgSlideAuto = setInterval(imgSlider, 6000);
	}
});

function imgSlider() {
	var holdThis = $j('#imgSlides .imgSlide:visible');
	if( $j(holdThis).next().length > 0 ){
		$j(holdThis).fadeOut(400, function(){
			$j(holdThis).next().fadeIn(400);
		});
	} else {
	    $j(holdThis).fadeOut(400, function(){
			$j('#imgSlides .imgSlide:first').fadeIn(400);
		});
	}
}

