$(document).ready(function(){

  // add first and last classes to all lists, table rows, table heads and table cells in the DOM
  $('ul li:first-child,table tr:first-child,tr td:first-child, tr th:first-child').addClass("first");
  $('ul li:last-child,table tr:last-child,tr td:last-child, tr th:last-child').addClass("last");


  // equalise the heights of the two feature boxes on the home page
  $(".hometoolbox").equalHeights();
  
  $("#home #services").height(function() {
    return $('#home-top').height() - 40;
  });


  // cycle the images show for pricing for wills call-to-actions
  $('#willsepa .toolprice').cycle({ 
      delay:  350, 
      speed:  400
  }); 
  $('#wills-calltoaction .toolprice').cycle({ 
      delay:  350, 
      speed:  400
  }); 


  // initialise drop down menus
  $('#nav ul.sf-menu').superfish({ 
      delay:       500,                            // one second delay on mouseout 
      animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
      speed:       'fast',                          // faster animation speed 
      autoArrows:  false,                           // disable generation of arrow mark-up 
      dropShadows: false                            // disable drop shadows 
  }); 

  $("#freeform,.standard-form form").validate();
  $("#create_client").validate();

  $('.input-example').example(function() {
      return $(this).attr('title');
  });

	$(".toggle-next").click(function() {
		$(this).next().slideToggle('fast');
		$(this).toggleClass('item-open');
		return false;
	}).next().hide();

});
