jQuery(window).load(function () {
   var currentActive = jQuery('.sf-menu li.active');
   var gotOne = false;
   
   if (currentActive.html() == null) {

     // check to see if this link exists in the main menu
     jQuery('.sf-menu > li').each(function () {
        jQuery(this).find("a").each(function () {
							         if (jQuery(location).attr('href').indexOf(jQuery(this).attr("href")) > 0) {
							            gotOne = true;
							            return false; // return out of each function early
							         } 
							       });
         if (gotOne) {
           jQuery(this).addClass("active");
           return false; // return out of each function early
         }
        
      });

     
     // if it is still not active, then set the default    
      if (jQuery('.sf-menu li.active').html() == null) {
        jQuery('.sf-menu li:first-child').addClass("active");  
      }
   } else {
   }
    var dleft = jQuery('.sf-menu li.active').offset().left - jQuery('.sf-menu').offset().left + 0 ; 
   var dwidth = jQuery('.sf-menu li.active').width() + "px";

    jQuery('.floatr').css({
        "left": (dleft ) +"px",
        "width": dwidth
    });

    jQuery('li').hover(function(){
        var left = jQuery(this).offset().left - (jQuery(this).parents('.sf-menu').offset().left + 0) - dleft;

        var width = jQuery(this).width() + "px";
        var sictranslate = "translate("+left+"px, 0px)";
		
        
        jQuery(this).parent('ul').next('div.floatr').css({
            "width": width,
            "-webkit-transform": sictranslate,
            "-moz-transform": sictranslate
        });

    },

    function(){

         var left = 0;  
        var width = jQuery(this).siblings('li.active').width() + "px";

        var sictranslate = "translate("+left+"px, 0px)";

        jQuery(this).parent('ul').next('div.floatr').css({
            "width": width,
            "-webkit-transform": sictranslate,
            "-moz-transform": sictranslate
            
        });
        
    });

});




