var $j=jQuery.noConflict();
var message = "Please be advised that you are leaving First Southern National Banks's website. This link is provided as a courtesy. First Southern does not endorse or control the content of third party websites.";
$j(document).ready(function(){
// jQuery replacement for warn
	if( $j('.warn').length > 0 ){
		$j('.warn').click( function(){
			alert( message );
		});
	}
	
	if( $j('.confirm').length > 0 ){
		$j('.confirm').click( function( event ){
			event = new Event(event);
			if( confirm(message) ) {
				return true;
			} else {
				event.stop();
				return false;
			}
		});
	}
	
// write body id and class
$j(function(){
	var primary = $j('#primaryNav li a.inPath').text().replace(/ /g,'');
	$j('body').attr("class",primary);
	});


$j(function() {
    $j("input#logIn")
        .mouseover(function() { 
            $j(this).attr("src", "/custom/firstsouthern/image/btn-login-ro.png");
        })
        .mouseout(function() {
            $j(this).attr("src", "/custom/firstsouthern/image/btn-login.png");
        })
})

// hide noflash link if javascript is enabled
var flashLink = $j("body#homepage #flashBanner > a"); 
flashLink.children().insertBefore(flashLink);  
flashLink.remove(); 

// toggle product details
  $j('.productTitle').css('cursor','pointer')
  $j('.productTitle')
  .toggle(function(){
		$j(this).closest("li").animate({height : "45em"}, function(){
			$j(this).closest("li").css('height','100%');
		});
		$j(this).closest("li").addClass("selected")
		$j("div.showDetails",this).hide()
		$j("div.hideDetails",this).show();
	}, function(){
		$j(this).closest("li").animate({height:"10.5em"}, {duration:500})
		$j(this).closest("li").removeClass("selected")
		$j("div.showDetails",this).show()
		$j("div.hideDetails",this).hide();
		}
	);
  

    // cycle photos
    $j('#sideImageBox')
	.after('<div id="slideShowNav">')
	.cycle({
		fx: 'scrollLeft',
		speed:  1000, 
		timeout: 4000, 
		delay: 1000,
		pager:  '#slideShowNav'
	});
	
// map - find empty table
	$j("#locList li:nth-child(2) th:contains('Drive Thru Hours')").empty();
	$j("#locList li:nth-child(2) th:contains('Lobby Hours')").replaceWith("<th scope='col'>Hours</th>");

}); // END doc ready