$(document).ready(function(){
	
	/* PNGFIX start *******************************************************************/
		$(document).pngFix();
	/* PNGFIX end *********************************************************************/
	
	/* EXTERNAL LINKS start ***********************************************************/
	$('a[@rel$="external"]').click(function(){
		this.target = "_blank";
	});	
	/* EXTERNAL LINKS end *************************************************************/

	/*SEARCH*/
	$('#search input.text').focus(function(){	if(this.value=='Search') {	$(this).val('');} });
	$('#search input.text').blur(function(){ if(this.value =='') {	$(this).val('Search');}	});
	/*SEARCH*/
	
	/* NAVIGATION start ***************************************************************/
	//$('#nav ul ul').prepend('<li class="top"></li>');
	$('#nav ul ul').append('<li class="bottom"></li>');
	$('#nav ul ul').hide();
	//hover show next level
	$('#nav ul > li').hover(function() { $('ul:first', this).show(); },function() {$('ul:first', this).hide();});
	//add class for flyouts
	if ($('#nav ul ul ul').length > 0) { $('#nav ul ul ul ').parent().addClass('flyout'); }
	
	
	/* SLIDESHOW start **************************************************************/
	setInterval( "slideSwitch()", 5000 );
	/* SLIDESHOW end ****************************************************************/	
	
	
	$('#nav li.menu-cat:first').addClass('first');
	$('#nav li.menu-cat:last').addClass('last');
	/* NAVIGATION end ****************************************************************/
	
	/*DISCLAIMER*/
	$('#links-account a').click(function(){ alert('You are leaving the Evans National Bank web site. The hyperlink is provided for your convenience only. Evans National Bank is not responsible for, nor guarantees the accuracy of the information contained in this site.'); });
	/*DISCLAIMER*/
		
}); //close document.ready


/* SLIDESHOW function start *********************************************************/
function slideSwitch() {
	var $active = $('#slideshow img.active');

	if ( $active.length == 0 ) $active = $('#slideshow img:last');

	var $next =  $active.next('img').length ? $active.next()
			: $('#slideshow img:first');

	$active.addClass('last-active');
	
	$next.css({opacity: 0.0})
			.addClass('active')
			.animate({opacity: 1.0}, 500, function() {
			 $active.removeClass('active last-active');
	});
	
}
/* SLIDESHOW function end ***********************************************************/	