jQuery.noConflict();

function form_labelize(){  jQuery(".labelize input:text").clearingInput(); jQuery(".labelize textarea").clearingInput();}   

function sub_nav(){
  var path = location.pathname.substring(1);
  jQuery('.sub-nav a[href$="' + path + '"]').parent().addClass('nav_active'); // check path as typed exactly
  jQuery('.sub-nav a[href$="' + path + '/"]').parent().addClass('nav_active'); // check path with an extra trailing slash added
}


function pinned(){

  if ( jQuery('#pinned').length ) {

  var top = jQuery('#pinned').offset().top - parseFloat(jQuery('#pinned').css('marginTop').replace(/auto/, 0));
  jQuery(window).scroll(function (event) {
    // what the y position of the scroll is
    var y = jQuery(this).scrollTop();
  
    // whether that's below the form
    if (y >= top) {
      // if so, ad the fixed class
      jQuery('#pinned').addClass('fixed');
    } else {
      // otherwise remove it
      jQuery('#pinned').removeClass('fixed');
    }
  });
  
  }
}

jQuery(function($) {
  form_labelize();
  sub_nav();
  pinned();
});
