//CESO Global Object
 if (typeof CESO == "undefined" || !CESO) {
    var CESO = {};
}

CESO.mainNavigation = {
    state: null,
    init: function() {
		$("#mainNav li.firstCMSListMenuLI, #mainNav li.firstCMSListMenuLIfirst, #mainNav li.firstCMSListMenuHighlightedLI").mouseenter(function() {
			$(this).children("ul").show();
			$(this).children("a").addClass("selected");
		}).mouseleave(function() {
			$(this).children("ul").hide();
			$(this).children("a").removeClass("selected");
		});
		
		/*
		// Add right-arrow pointers to all second-level menus with child menus
		$.each($("#mainNav ul.secondCMSListMenuUL li"), function() {
			if($(this).children("ul").length > 0) {
				$(this).children("a").addClass('submenu');
			}
		});
		
		// Adjust 'top' positions of third-level menus
		$("#mainNav ul.secondCMSListMenuUL li").mouseenter(function() {
			$(this).children("ul").css('top', $(this).position().top);
		});
		
		// Adjust 'left' positions of third-level menus
		$.each($("#mainNav ul.thirdCMSListMenuUL"), function() {
			$(this).css('left', $(this).parent().parent().width()-10);
		});
		*/
	}
};

CESO.subNavigation = {
	init: function() {
		$("li.secondCMSListMenuHighlightedLI").children("ul.thirdCMSListMenuUL").show();
	}
}

CESO.memberNav = {
	init: function() {
	}
}

CESO.util = {
    hasConsole: false,
    writeLog: true,
    init: function(){
        if (window.console) {
            this.hasConsole = true;
        }
    },
    log: function(msg){
        if(this.writeLog == true){
            if(this.hasConsole == true){
                window.console.log(msg);
            }
            else{
                alert(msg);
            }        
        }
    },
    rand:function(){
        return Math.floor(Math.random()*100000);
    },
    cufon:function() {
    	Cufon.replace('h1');
    	Cufon.replace('h2');
		Cufon.replace('h3');
		Cufon.replace('h4');
    	//Cufon.replace('div#mainNav');
    },
    analytics: function() {
		 var _gaq = _gaq || [];
		 _gaq.push(['_setAccount', 'UA-18468715-1']);
		 _gaq.push(['_setDomainName', 'none']);
		 _gaq.push(['_setAllowLinker', true]);
		 _gaq.push(['_trackPageview']);
		
		 (function() {
		   var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
		   ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
		   var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
		 })();

    }
};

CESO.ie = {
    pngSupport:function(){
        $(document).pngFix();        
    }
};



//jQuery Ready
$(document).ready(function(){
	if ($.browser.msie && $.browser.version == 6){
        CESO.ie.pngSupport();
    }
    
    // CESO Utility Functions
    CESO.util.init();
	CESO.util.cufon();
	CESO.util.analytics();
	
	// CESO Main Navigation
	CESO.mainNavigation.init();
	
	// CESO Sub Navigation
	CESO.subNavigation.init();
	
	// CESO Member Navigation
	CESO.memberNav.init();
    
    // Toggle logging on and off globally here.
    CESO.util.writeLog = false;
      
});







