if(typeof HostcmsEscape=='undefined')
{function HostcmsEscape(str)
{return encodeURIComponent(str);}}
document.onkeydown=DoKeyDown;function DoKeyDown(event)
{if(!document.getElementById)
{return;}
if(window.event)
{event=window.event;}
if(event.ctrlKey)
{var Element=null;switch(event.keyCode?event.keyCode:event.which?event.which:null)
{case 0x25:Element=document.getElementById('id_prev');break;case 0x27:Element=document.getElementById('id_next');break;}
if(Element&&Element.href)
{document.location=Element.href;}}}
function DisableTinyMCE()
{if(typeof tinyMCE!='undefined')
{textarea_array=document.getElementsByTagName("textarea");for(var i=0;i<textarea_array.length;i++)
{var elementId=textarea_array[i].id;if(tinyMCE.getInstanceById(elementId)!=null)
{textarea_array[i].disabled=true;tinyMCE.execCommand('mceRemoveControl',false,elementId);}}}}
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('className',"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();}
