$(document).ready(function(){

		// second simple accordion with special markup
		jQuery('#practice_links').accordion({
			active: false,
			header: '.head',
			practice_links: true,
			event: 'mouseover',
			fillSpace: false,
			alwaysOpen: false,
			autoheight:false,
			clearStyle: false,
			animated: "easeslide"
		});

	$('#practice_links li:first ul').show();

	$('#hdr_contact_icon').hover(function(){
		        $('.home_contact_block').css("display", "block");
		      },
		      function () {
		        $('.home_contact_block').css("display", "none");
		});

$('div.showarea').css({display: 'none'});
$('div.showarea:first').fadeIn(500);

$('.mainattorneys a').click( function (ev) {
    //prevent browser jumping to top
    ev.preventDefault();

    //get current visible item
    var $visibleItem = $('div.showarea:visible');

    //get total item count
    var total =  $('div.showarea').length;

    //get index of current visible item
    var index = $visibleItem.prevAll().length - 1;

    //if we click next increment current index, else decrease index
    $(this).attr('href') === '#carouselNext' ? index++ : index--;

    //if we are now past the beginning or end show the last or first item
    if (index === -1){
       //index = total-1;
       return;
    }
    if (index === total){
       //index = 0
       return;
    }

    //hide current show item
    $visibleItem.hide();

    //fade in the relevant item
    $('div.showarea:eq(' + index + ')').fadeIn(500);

});

});
