// ---- ready manager for jquery 

$.readyRegistry = [];

$.readyRegister = function(f) {
	$.readyRegistry.push(f);
}

// --- start

var subMenuActive = false;

var step2visible = false;
var step3visible = false;

$.readyRegister(function(){
    $("#nav li").hover(
        function(){ 
			subMenuActive = true;
			$("ul", this).show(); 
			$(this).addClass('active');
		}, 
        function() { 
			subMenuActive = false;
			$(this).removeClass('active');	
		} 
    );
    if (document.all) {
        $("#nav li").hoverClass("sfhover");
    }
});

$.fn.hoverClass = function(c) {
   return this.each(function(){
       $(this).hover( 
           function() { 
				$(this).addClass(c); 
			},
           function() { 
				$(this).removeClass(c); 
			}
       );
   });
};

window.onload = function() {
	var w= document.body.clientWidth;
	 if (w<905)
	 	$('#main-nav').css('margin-left', '0px');
};

window.onresize = function() {
	var w= document.body.clientWidth;
	 if (w<905)
	 	$('#main-nav').css('margin-left', '0px');
	else
		$('#main-nav').css('margin-left', '0px');
};


$(document).ready(function(){
	for(i=0; i<$.readyRegistry.length; i++) {
		$.readyRegistry[i]();
	}
});