function runScripts(scripts){if(!scripts){return false;}for(var i=0;i<scripts.length;i++){var thisScript=scripts[i];var text;if(thisScript.src){var newScript=document.createElement("script");newScript.type=thisScript.type;newScript.language=thisScript.language;newScript.src=thisScript.src;document.getElementsByTagName('head')[0].appendChild(newScript);}else if(text=(thisScript.text||thisScript.innerHTML)){var text=(""+text).replace(/^\s*<!\-\-/,'').replace(/\-\->\s*$/,'');var newScript=document.createElement("script");newScript.setAttribute("type","text/javascript");newScript.text=text;var script_node=document.getElementsByTagName('head')[0].appendChild(newScript);}}}function sendRequest(action,method,callback_function){var req=new JsHttpRequest();ShowLoadingScreen();req.onreadystatechange=function(){if(req.readyState==4){HideLoadingScreen();if(typeof callback_function!='undefined'){callback_function(req.responseJS);}return true;}}
req.open(method,action,true);req.send(null);}function AjaxSendForm(callback_function,AAdditionalParams,ButtonObject){var FormNode=ButtonObject.parentNode;while(FormNode.nodeName.toLowerCase()!='form'){var FormNode=FormNode.parentNode;}FormID=FormNode.id;var HiddenInput=document.getElementById(ButtonObject.name);if(null==HiddenInput&&undefined==HiddenInput||HiddenInput.type!='hidden'){var ElementInput=document.createElement("input");ElementInput.setAttribute("type","hidden");ElementInput.setAttribute("id",ButtonObject.name);ElementInput.setAttribute("name",ButtonObject.name);var InputNode=FormNode.appendChild(ElementInput);}if(typeof tinyMCE!='undefined'){tinyMCE.triggerSave();}var JsHttpRequestSendForm=new JsHttpRequest();JsHttpRequestSendForm.onreadystatechange=function(){if(JsHttpRequestSendForm.readyState==4){HideLoadingScreen();if(typeof callback_function!='undefined'){callback_function(JsHttpRequestSendForm.responseJS);}return true;}}
var FormAction=FormNode.attributes['action'].value;var FormMethod=FormNode.getAttribute('method');FormAction+=(FormAction.indexOf('?')>=0?'&':'?')+AAdditionalParams;JsHttpRequestSendForm.open(FormMethod,FormAction,true);JsHttpRequestSendForm.send({query:FormNode});ShowLoadingScreen();return false;}function ShowLoadingScreen(){$("body").css("cursor","wait");var fade_div=$("#id_admin_forms_fade");if(fade_div.length==0){fade_div=$('<div></div>').appendTo(document.body).hide().attr('id',"id_admin_forms_fade").attr('class',"shadowed").applyShadow().css('z-index',"1500").css('position',"absolute").css('left',"50%").css('top',"50%").append('<img src="/hostcmsfiles/images/ajax_loader.gif" id="id_fade_div_img" />').css('width',"32");}fade_div.show().css('top',($(window).height()-fade_div.outerHeight(true))/2+$(window).scrollTop()).css('left',($(window).width()-fade_div.outerWidth(true))/2+$(window).scrollLeft());}function HideLoadingScreen(){$("body").css("cursor","auto");$("#id_admin_forms_fade").css('display','none');}function AddLoadFileField(container_id,inpit_prefix){cbItem=document.getElementById(container_id);if(cbItem){element_array=cbItem.getElementsByTagName("input");count_input=element_array.length;var ElementBr=document.createElement("br");cbItem.appendChild(ElementBr);var ElementInput=document.createElement("input");ElementInput.setAttribute("size","30");ElementInput.setAttribute("name",inpit_prefix+(count_input+1));ElementInput.setAttribute("type","file");ElementInput.setAttribute("title","Прикрепить файл");cbItem.appendChild(ElementInput);}}function sendBackgroundRequest(action,method,callback_function){var req=new JsHttpRequest();req.onreadystatechange=function(){if(req.readyState==4){if(typeof callback_function!='undefined'){callback_function(req.responseJS);}return true;}}
req.open(method,action,true);req.send(null);ShowLoadingScreen();}