function loadWidgets()
{
    if (typeof (EasySite) === "undefined")
        Type.registerNamespace("EasySite.UI.WebControls");

    if (typeof (EasySite.UI.WebControls.Utility) === "undefined")
        jQuery.getScript($ess.baseResourcesUrl + "Shared/scripts/EasySiteAjaxShared.js",
                    function() { jQuery.getScript($ess.baseResourcesUrl + "Shared/scripts/widgets.js"); });
    else
        jQuery.getScript($ess.baseResourcesUrl + "Shared/scripts/widgets.js");
}

if (typeof ($ess) === "undefined") {
    $ess = new Object();
    $ess.pageScripts = document.getElementsByTagName("script");
    $ess.scriptUrl = $ess.pageScripts[$ess.pageScripts.length - 1].src;
    $ess.hostUrl = (typeof ($ess.hostUrl) == "undefined" ? $ess.scriptUrl.toLowerCase().replace("resources/shared/scripts/initwidgets.js", "") : $ess.hostUrl);
    if (!$ess.hostUrl.endsWith("/")) $ess.hostUrl += "/";
    $ess.baseEssScriptUrl = $ess.hostUrl + "Resources/Shared/scripts/";
    $ess.baseResourcesUrl = $ess.hostUrl + "Resources/";
}

// jQuery dependency
if (typeof (Sys) === "undefined")
    jQuery.getScript($ess.baseEssScriptUrl + "MSAJAX/MicrosoftAjax.js", loadWidgets());
else 
    loadWidgets();

if ( Sys && Sys.Application ){   
	Sys.Application.notifyScriptLoaded();
}
