var sPath = window.location.pathname;
var page = sPath.substring(sPath.lastIndexOf('/') + 1);
if (page == '') {
	var page = 'index.php';
}

function slideSwitch() {
	$("#patient-stories:first").addClass('active');
    var $active = $('#patient-stories IMG.active');

    if ( $active.length == 0 ) $active = $('#patient-stories IMG:last');

    var $next =  $active.next().length ? $active.next()
       : $('#patient-stories IMG:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}


$(document).ready(function() {
	$('#nav li a').each(function(){
		if (this.href.indexOf(page) != -1) {
			$(this).parent().addClass('current');
		}
	});
	
	$("ul#footer-nav li:last-child").text('');
	$("div#sidebar div.box").hover(
		 function () {
		 	  $(this).addClass("hover");
		 },
		 function () {
		 	  $(this).removeClass("hover");
		 }
	);
	
	
    setInterval( "slideSwitch()", 4000 );

	
});