var ScriptLoader={request:null,loaded:{},load:function(){for(var i=0,len=arguments.length;i<len;i++){var filename=arguments[i];if(!this.loaded[filename]){if(!this.request){this.request=window.XMLHttpRequest?new XMLHttpRequest:(window.ie?new ActiveXObject("Microsoft.XMLHTTP"):null)}if(!this.request){return false}this.loaded[filename]=true;this.request.open("get",$E("base").getProperty("href")+"scripts/"+filename,false);this.request.send(null);if(this.request.status==200){this.globalEval(this.request.responseText)}}}},globalEval:function(code){if(window.execScript){window.execScript(code,"javascript")}else{window.eval(code)}}};var Dictionary={};Asset.loaded={css:{}};Asset.css=function(source,properties){if(!Asset.loaded.css[source]){Asset.loaded.css[source]=true;return new Element("link",$merge({rel:"stylesheet",media:"screen",type:"text/css",href:"stylesheets/"+source},properties)).inject(document.head)}return false};Object.toQueryString=function(source){var queryString=[];for(var property in source){if($type(source[property])=="array"){for(var i=0;i<source[property].length;i++){queryString.push(encodeURIComponent(property)+"="+encodeURIComponent(source[property][i]))}}else{queryString.push(encodeURIComponent(property)+"="+encodeURIComponent(source[property]))}}return queryString.join("&")};Element.implement({removeProperty:function(property){this.removeAttribute(property);return this}});var Request={request:function(uri,data,onSuccess){new Ajax(uri,{method:"post",postBody:data,onComplete:function(responseText){try{var response=Json.evaluate(responseText)}catch(e){var response={result:false,title:"Ошибка",errors:[{message:"Произошла ошибка. Пожалуйста, обновите страницу."}]}}if(response.result){onSuccess(response)}else{var msg=(typeof response.title!="undefined")?response.title:"Произошла ошибка:\n";response.errors.each(function(error){if(typeof error.field!="undefined"){msg+=error.field+" :\t"}msg+=error.message+"\n"});alert(msg)}}}).request()}};var Label={setLabel:function(result){var id=name="";if(typeof (result)!="undefined"){if(result){id=result.smap_id;name=result.smap_name}$(this.obj.getAttribute("hidden_field")).value=id;$(this.obj.getAttribute("span_field")).innerHTML=name}}};var getPathInfo=function(str){var re=new RegExp("(.*)/([A-Za-z0-9-_. ]+.[A-Za-z0-9-_]+)$","gi");var arr=re.exec(str);return{path:RegExp.$1,filename:RegExp.$2}};