title: ScriptManager globalization issue
body: <p>I'm having a problem with the asp:ScriptManager not working correctly under SharePoint. I have set EnableScriptGlobalization="true" to be able to use the Sys.CultureInfo object of ASP.NET AJAX, but because of the script is being output in the wrong order, it's not working. The same code works correctly under a plain ASP.NET site, so the issue seems related to SharePoint somehow. Though it did work correctly under SharePoint 2007.</p>
  
  <p>To reproduce the issue, I created this simple usercontrol CultureControl.ascx.</p>
  
  <pre><code>&lt;%@ Control Language="C#" %&gt;
  Server side culture: &lt;%= System.Threading.Thread.CurrentThread.CurrentCulture.Name %&gt;&lt;br /&gt;
  Client side culture: &lt;script type="text/javascript"&gt;document.write(Sys.CultureInfo.CurrentCulture.name);&lt;/script&gt;&lt;br /&gt;
  </code></pre>
  
  <p>When I include this control on a regular ASP.NET web site .aspx page, and set the culture to sv-SE on the server side, the output is as expected.</p>
  
  <p>Server side culture: sv-SE</p>
  
  <p>Client side culture: sv-SE</p>
  
  <p>But when I put the same usercontrol on a page in a SharePoint 2010 site, set the site locale to Swedish and set EnableScriptGlobalization="true" in the master page, I still get the output</p>
  
  <p>Server side culture: sv-SE</p>
  
  <p>Client side culture: en-US</p>
  
  <p>When I started digging in to this problem, I noticed that the reason was that the script blocks that the ScriptManager outputs are in the wrong order. When EnableScriptGlobalization is set to true, the ScriptManager outputs a script block that defines a __cultureInfo variable, which is then used to initialize the Sys.CultureInfo. This variable has to be defined before MicrosoftAjax.js is loaded, otherwise it will default to en-US culture.</p>
  
  <p>In the ASP.NET site, this works correctly. The __cultureInfo variable is defined first, then MicrosoftAjax.js is loaded from WebResource.axd. But under SharePoint, MicrosoftAjax.js is loaded a lot earlier and the __cultureInfo variable is defined too late.</p>
  
  <p>Does anyone know of a solution or workaround for this issue?</p>