$(function () {
	
	// highlight current tab in header
    var tabs = [];
    var tabContainers = [];
    $('#header #top-nav a').each(function () {
        
      currentLink = this.href + "/";
      
      if (currentLink == window.location.href) {
        
      	   $(this).parent().addClass('current');

        }
        
        // @todo rewrite this to work with any subnav
      if (window.location.href.indexOf("equipment-sale/for-sale/") != -1) {
        
      	   $("li.equipment").addClass('current');

        }
        
        
    });
    
  // show subnav for services
/*  if (window.location.href.indexOf("services") !=-1){

    $("#sub-nav #services li").css({display: "inline"});
  
  }*/
  
  // show subnav for services
  if (window.location.href.indexOf("equipment-sale") !=-1){

    $("#sub-nav #equipment-sale").css({display: "block"});
    $("#sub-nav #services").css({display: "none"});
    $("#sub-nav #equipment-sale li").css({display: "inline"});
  
  }
  
  // contact form validation
  
  $("#contact").validate({
    rules: {
      email: {
        required: true,
        email: true
      },
     name: {
        required: true
      },
     phone: {
        required: true
      },
     company: {
        required: true
      }
    }
  });
    
});
