var $j = jQuery.noConflict();

/**
 * The EA global namespace object.  If EA is already defined, the
 * existing EA object will not be overwritten so that defined
 * namespaces are preserved.
 */
if (typeof EA == 'undefined' || !EA) {
    var EA = {};
}

/**
 * Returns the namespace specified and creates it if it doesn't exist
 * <pre>
 * EA.namespace("property.package");
 * EA.namespace("EA.property.package");
 * </pre>
 * Either of the above would create EA.property, then
 * EA.property.package
 */
EA.namespace = function() {
    var a = arguments, o = null, i, j, d;
    for (i = 0; i < a.length; i = i + 1) {
        d = ('' + a[i]).split('.');
        o = EA;

        for (j = (d[0] == 'EA') ? 1 : 0; j < d.length; j = j + 1) {
            o[d[j]] = o[d[j]] || {};
            o = o[d[j]];
        }
    }

    return o;
};

/**
 * The Core object for common EA methods. Only methods that need to be accessed from
 * all pages should go in here.
 */
EA.namespace('Core');

EA.Core = {
    init: function() {
        EA.Core.bindEvents();
        EA.Core.initIEBackgroundImageCache();
    },

    bindEvents: function() {
        $j('.starter').click(function() {
            $j(this).next().slideToggle('fast', function() {
                omniLinkCall(this, 'global_gus_main_ea');
            });
            return false;
        });
    },

    initIEBackgroundImageCache: function() {
        /**
         * Fix IE background image flicker
         * Thanks for the dirty hack Microsoft
         */
        if ($j.browser.msie && $j.browser.version === '6.0') {
            try {
                document.execCommand('BackgroundImageCache', false, true);
            } catch(e) {}
        }
    }
};

$j(EA.Core.init);
