/*
 * for inline thickbox implementation
 */
function change_tb_href()
{
  var qString = $("a.thickbox").attr('rel');
  $("a.thickbox").attr('href', '#TB_inline?' + qString);
}

/*
 * auto submit form that has class of "auto" when any select is changed
 */
function form_auto_submit()
{
  $('form.auto select').change(function(){
    // added this to null second select if first is changed
    if (this.id == 'f1') {
      $('select#f2').attr('selectedIndex',0);
    }
    var $form = $(this).parents('form');
    $form.submit();
  });
}

function drop_nav()
{
  $('#nav ul ul').attr('style','display:none');
  $('#nav ul ul').parent().hoverIntent({
    over:function(){
      $(this).children('ul').slideToggle(100);
    },
    timeout: 500,
    out:function(){
      $(this).children('ul').slideToggle(100);
    }
  });
}

/* onDocumentReady Call */
$(function(){
  if ($('a.thickbox').hasClass('inline')) {
      change_tb_href();
  }

  form_auto_submit();
  drop_nav();
});

