// Add theme js customizations here.
jQuery(document).ready(function() {

  // primary menu
  jQuery('.menu-block-2.menu-name-main-menu ul.menu')
    .superfish({
      delay:       0,                 // one second delay on mouseout
      animation:   {opacity:'show'},  // fade-in and slide-down animation
      speed:       0,            // faster animation speed
      autoArrows:  false              // disable generation of arrow mark-up
    });

  // front page slider
  jQuery("#flowpanes")
    .scrollable({
      circular:   true,
      mousewheel: true
    })
    .navigator({
      navi:       "#flowtabs",
      naviItem:   'a',
      activeClass:'current',
      history:    false
    })
    .autoscroll({
      autoplay:   true,
      interval:   7000,
      autopause:  true
    });

  // adds the placeholder capability to all browsers
  jQuery('[placeholder]').focus(function() {
    var input = jQuery(this);
    if (input.val() == input.attr('placeholder')) {
      input.val('');
      input.removeClass('placeholder');
    }
  }).blur(function() {
    var input = jQuery(this);
    if (input.val() == '' || input.val() == input.attr('placeholder')) {
      input.addClass('placeholder');
      input.val(input.attr('placeholder'));
    }
  }).blur().parents('form').submit(function() {
    jQuery(this).find('[placeholder]').each(function() {
      var input = jQuery(this);
      if (input.val() == input.attr('placeholder')) {
        input.val('');
      }
    })
  });

  // http://www.cssnewbie.com/example/equal-heights/
  function equalHeight(group) {
    tallest = 0;
    group.each(function() {
        thisHeight = jQuery(this).height();
        if(thisHeight > tallest) {
	    tallest = thisHeight;
        }
    });
    group.height(tallest);
  }
  equalHeight(jQuery("#front .panel-region:not(.top-teaser)"));

});

