(function(g){function n(a,b,c){g.ajax({url:a,async:false,contentType:"text/plain;charset=UTF-8",dataType:"text",success:function(h){var m="";h=h.split(/\n/);for(var o=/(\{\d+\})/g,q=/\{(\d+)\}/g,s=/(\\u.{4})/ig,j=0;j<h.length;j++){h[j]=h[j].replace(/^\s\s*/,"").replace(/\s\s*$/,"");if(h[j].length>0&&h[j].match("^#")!="#"){var d=h[j].split("=");if(d.length>0){for(var k=unescape(d[0]).replace(/^\s\s*/,"").replace(/\s\s*$/,""),e=d.length==1?"":d[1],f=2;f<d.length;f++)e+="="+d[f];e=e.replace(/"/g,'\\"');
e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,"");if(c=="map"||c=="both"){if(d=e.match(s))for(f=0;f<d.length;f++)e=e.replace(d[f],t(d[f]));g.i18n.map[k]=e}if(c=="vars"||c=="both"){u(k);if(o.test(e)){d=e.split(o);f=true;for(var p="",r=[],l=0;l<d.length;l++)if(o.test(d[l])&&r.indexOf(d[l])==-1){f||(p+=",");p+=d[l].replace(q,"v$1");r.push(d[l]);f=false}m+=k+"=function("+p+"){";k='"'+e.replace(q,'"+v$1+"')+'"';m+="return "+k+";};"}else m+=k+'="'+e+'";'}}}}eval(m)}})}function u(a){if(/\./.test(a)){var b="";
a=a.split(/\./);for(var c=0;c<a.length;c++){if(c>0)b+=".";b+=a[c];eval("typeof "+b+' == "undefined"')&&eval(b+"={};")}}}function v(a){return a&&a.constructor==Array?a:[a]}function w(a){a=a.toLowerCase();if(a.length>3)a=a.substring(0,3)+a.substring(3).toUpperCase();return a}function t(a){var b=[];a=parseInt(a.substr(2),16);a>=0&&a<Math.pow(2,16)&&b.push(a);a="";for(var c=0;c<b.length;++c)a+=String.fromCharCode(b[c]);return a}g.i18n={};g.i18n.map={};g.i18n.properties=function(a){a=g.extend({name:"Messages",
language:"",path:"",mode:"vars",callback:function(){}},a);if(a.language===null||a.language=="")a.language=g.i18n.browserLang();if(a.language===null)a.language="";var b=v(a.name);for(i=0;i<b.length;i++){n(a.path+b[i]+".properties",a.language,a.mode);a.language.length>=2&&n(a.path+b[i]+"_"+a.language.substring(0,2)+".properties",a.language,a.mode);a.language.length>=5&&n(a.path+b[i]+"_"+a.language.substring(0,5)+".properties",a.language,a.mode)}a.callback&&a.callback()};g.i18n.prop=function(a,b){var c=
g.i18n.map[a];if(c==null)return"["+a+"]";if(b)for(a=0;a<b.length;a++)c=c.replace(new RegExp("\\{("+a+")\\}","g"),b[a]);return c};g.i18n.browserLang=function(){return w(navigator.language||navigator.userLanguage)}})(jQuery);
