(function($) {
	$.fn.subMenu = function(settings) {
		settings = jQuery.extend({
			
		},settings);
		var obj = this;

        $(this).find('ul').hide();
        
        $(this).find('li:has(ul)').each(function(index){
            var num = index;
            if ($(this).hasClass('open')) {
                 $(this).children('ul').show();   
            }
            $(this).children('a').click(function(){
                $(this).parent('li').children('ul').show();
                if ($(this).parent('li').attr('class') == 'open') {
                    $(this).parent('li').children('ul').hide();   
                    $(this).parent('li').removeAttr('class');
                } else {
                    hideAll();
                    $(this).parent('li').children('ul').slideDown('fast');   
                    $(this).parent('li').attr('class', 'open');
                }
                return false;
            });
        });
        
        function hideAll() {
            obj.find('li:has(ul)').removeAttr('class');
            obj.find('ul').hide();
        }
	};
})(jQuery); 


(function($) {
	$.fn.subMenu2 = function(settings) {
		settings = jQuery.extend({
			
		},settings);
		var obj = this;

        $(this).find('ul').hide();
        
        $(this).find('li:has(ul)').each(function(index){
            var num = index;
            if ($(this).hasClass('open')) {
                 $(this).children('ul').show();   
            }
            $(this).children('a').click(function(){
                /*$(this).parent('li').children('ul').show();
                if ($(this).parent('li').attr('class') == 'open') {
                    $(this).parent('li').children('ul').hide();   
                    $(this).parent('li').removeAttr('class');
                } else {
                    hideAll();
                    $(this).parent('li').children('ul').slideDown('fast');   
                    $(this).parent('li').attr('class', 'open');
                }*/
                var exp = this.href.split("/");
                if( exp[ exp.length - 1 ] == "production" ) {
                    var links = this.parentNode.getElementsByTagName( "a" );
                    location.href = links[1].href;
                    return false;
                }
            });
        });
        
        function hideAll() {
            obj.find('li:has(ul)').removeAttr('class');
            obj.find('ul').hide();
        }
	};
})(jQuery); 
