jQuery().ready( function() {
	var l = jQuery( '#nav ul > li' );
	l.hover( function () {
		jQuery( this ).addClass( 'sfhover' );
	}, function () {
		jQuery( this ).removeClass( 'sfhover' );
	} );
		
	l.each( function() {
		jQuery( 'ul > li:last > a', jQuery( this ) ).addClass( 'last' );
	} );
	jQuery( 'a:last', l.last() ).addClass( 'last' );
	
	highlightMenu();
} );

function highlightMenu()
{
	var d = window.location.protocol + '//' + window.location.host;
	var uriparts = window.location.pathname;
	var nav = jQuery( '#nav > ul' );
	jQuery( 'a', nav ).each( function() {
		var h = jQuery( this ).attr( 'href' );
		var h = h.replace( d, "" )
		if( uriparts.match( h ) )
		{
			jQuery( this ).addClass( 'current' );
			if( $( this ).hasClass( 'level_1' ) )
			{
				var p = jQuery( this ).parent().parent().parent();
				jQuery( 'a:first', p ).addClass( 'current' );
			}
			return true;
		}
	} );
	
	var nav = jQuery( '#left_nav' );
	jQuery( 'a', nav ).each( function() {
		var h = jQuery( this ).attr( 'href' );
		var h = h.replace( d, "" )
		if( uriparts.match( h ) )
		{
			jQuery( this ).addClass( 'current' );
			return true;
		}
	} );
}

function switchBanners()
{
	var obj_banner = jQuery( '#coin-slider' );
   var active = jQuery( 'a.active', obj_banner );
 
    if ( active.length == 0 ) active = jQuery( 'a:last', obj_banner );
 
    // use this to pull the images in the order they appear in the markup
    var next =  active.next().length ? active.next() : jQuery( 'a:first', obj_banner );
    
 	active.animate({opacity: 0.0}, 1000 );
    next.addClass('active').animate({opacity: 1.0}, 1000, function() {
		active.removeClass('active');
     });
if( jQuery( 'a', obj_banner  ).length > 1 )
{
    setTimeout( "switchBanners()", 8000 );
	}
}

