function request(a,c,b,d,f){if(d==null)d="result";if(/.htm?/.test(b)==true){b=b.split(".htm?");for(var g="",h=0;h<b.length;h++)g=g+b[h]+"&";b=g}document.getElementById(d).innerHTML='<img src="/js/img/loader.gif" width="16" height="16" style="vertical-align:middle" />';var e=new JsHttpRequest;e.onreadystatechange=function(){if(e.readyState==4)if(e.responseJS){document.getElementById(d).innerHTML=e.responseText;runScripts(document.getElementById(d).getElementsByTagName("SCRIPT"))}};e.caching=false; e.loader=a;e.open(c,"/loader.php"+b,true);b={q:b,data2:f};f==null&&delete b.data2;e.send(b)} function getdata(a,c,b,d,f){if(d==null)d="result";if(/.htm?/.test(b)==true){b=b.split(".htm?");for(var g="",h=0;h<b.length;h++)g=g+b[h]+"&";b="?p="+g}document.getElementById(d).innerHTML='<img src="/js/img/loader.gif" width="16" height="16" style="vertical-align:middle" />';var e=new JsHttpRequest;e.onreadystatechange=function(){if(e.readyState==4)if(e.responseJS){document.getElementById(d).innerHTML=e.responseText;runScripts(document.getElementById(d).getElementsByTagName("SCRIPT"))}};e.caching= false;e.loader=a;e.open(c,"/loader.php"+b,true);b={q:b,data2:f};f==null&&delete b.data2;e.send(b)} function doLoad(a,c){document.getElementById(c).innerHTML='<img src="/js/img/loader.gif" width="16" height="16" style="vertical-align:middle;" />';var b=new JsHttpRequest;b.onreadystatechange=function(){if(b.readyState==4){document.getElementById(c).innerHTML=b.responseText;runScripts(document.getElementById(c).getElementsByTagName("SCRIPT"))}};b.open(null,"/loader.php",true);b.send({form:document.getElementById(a)})} function checkLen1(a,c,b){var d=document.getElementById(a).value,f=d.length,g=c-f;if(c<f)document.getElementById(a).value=d.substring(0,c);if(f<c-1)document.getElementById(b).innerHTML="\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c: "+g;else document.getElementById(b).innerHTML="<br>\u0422\u0435\u043a\u0441\u0442 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043b\u0438\u043d\u043d\u0435\u0435, \u0447\u0435\u043c "+c+" \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432!"} function calcStrLen(a,c){var b=document.getElementById(a).value.length;document.getElementById(c).innerHTML=b+" \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432"}function trhover(a,c){a.className=c?"hover "+a.className:a.className.replace("hover","")} function menu_toggle(a){if(document.getElementById("d_"+a).style.display=="none"){document.getElementById("d_"+a).style.display="block";document.getElementById("i_"+a).src="/tmpl/black/adm_img/brown_uf.gif"}else{document.getElementById("d_"+a).style.display="none";document.getElementById("i_"+a).src="/tmpl/black/adm_img/brown_f.gif"}} function runScripts(a){if(!a)return false;for(var c=0;c<a.length;c++){var b=a[c];if(b.src){var d=document.createElement("script");d.type=b.type;d.language=b.language;d.src=b.src;document.body.appendChild(d)}else if(b=b.text||b.innerHTML){b=(""+b).replace(/^\s*<!\-\-/,"").replace(/\-\->\s*$/,"");eval(b)}}}function HideObject(a){document.getElementById(a).style.display="none"}function ShowObject(a){document.getElementById(a).style.display="block"} function getElementsByClass(a,c,b){var d=[];if(c==null)c=document;if(b==null)b="*";c=c.getElementsByTagName(b);b=c.length;a=RegExp("(^|\\s)"+a+"(\\s|$)");for(j=i=0;i<b;i++)if(a.test(c[i].className)){d[j]=c[i];j++}return d}function setall(a){a=getElementsByClass(a,null,"input");for(i=0;i<a.length;i++)a[i].checked=a[i].checked==true?false:true} function SwitchShow(a){if(document.getElementById(a).style.display=="none")document.getElementById(a).style.display="block";else document.getElementById(a).style.display="none"} function checkSMSLen(a,c){var b=document.getElementById(a).value;maxlen=document.getElementById("rus").value==0?160:70;var d=b.length,f=maxlen-d;if(maxlen<d)document.getElementById(a).value=b.substring(0,maxlen);if(d<maxlen-1)document.getElementById(c).innerHTML="\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c: "+f;else document.getElementById(c).innerHTML="<br>\u0422\u0435\u043a\u0441\u0442 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043b\u0438\u043d\u043d\u0435\u0435, \u0447\u0435\u043c "+ maxlen+" \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432!"}function addfield(a){var c=document.createElement("div");c.innerHTML='<input name="'+a+'[]" type="text" size="80" /><br />';document.getElementById("questArea").appendChild(c)}function delelem(a){a=document.getElementById(a);a.parentNode.removeChild(a)} function sendReAdd(a,c){JsHttpRequest.query("loader.php?p=for_check&act=saveWrCom&id_work="+c,{form:document.getElementById(a)},function(b){if(b){if(b.state!="ERROR"){rwin.close("reAddbox");delelem("TR_"+c)}alert(b.msg)}},true)}function parseLinks(){var a=getElementsByClass("slink",null,"span");for(i=0;i<a.length;i++)a[i].innerHTML='<a href="'+a[i].title+'" target="_blank" rel="nofollow">'+a[i].innerHTML+"</a>"};function doLoadData(formid, formareaid){JsHttpRequest.query('loader.php?p=question&act=add_quest',{'form': document.getElementById(formid)},function(result, errors){if(result){if(result['state'] == "ERROR"){alert(result['msg']);}else{document.getElementById(formareaid).innerHTML='';if(result['free']) qwin.close();alert(result['msg']);}}},true);}
var dhtmlwindow={imagefiles:["js/img/min.gif","js/img/close.gif","js/img/restore.gif","js/img/resize.gif"],ajaxbustcache:true,ajaxloadinghtml:"<b>Loading Page. Please wait...</b>",minimizeorder:0,zIndexvalue:100,tobjects:[],lastactivet:{},init:function(B){var E=document.createElement("div");E.id=B;E.className="dhtmlwindow";var D="";D='<div class="drag-handle">';D+='DHTML Window <div class="drag-controls"><img src="'+this.imagefiles[0]+'" title="Minimize" /><img src="'+this.imagefiles[1]+'" title="Close" /></div>';D+="</div>";D+='<div id="'+B+'_inner" class="drag-contentarea"></div>';D+='<div class="drag-statusarea"><div class="drag-resizearea" style="background: transparent url('+this.imagefiles[3]+') top right no-repeat;">&nbsp;</div></div>';D+="</div>";E.innerHTML=D;document.getElementById("dhtmlwindowholder").appendChild(E);var B=document.getElementById(B);var C=B.getElementsByTagName("div");for(var A=0;A<C.length;A++){if(/drag-/.test(C[A].className)){B[C[A].className.replace(/drag-/,"")]=C[A]}}B.handle._parent=B;B.resizearea._parent=B;B.controls._parent=B;B.onclose=function(){return true};B.onmousedown=function(){dhtmlwindow.setfocus(this)};B.handle.onmousedown=dhtmlwindow.setupdrag;B.resizearea.onmousedown=dhtmlwindow.setupdrag;B.controls.onclick=dhtmlwindow.enablecontrols;B.show=function(){dhtmlwindow.show(this)};B.hide=function(){dhtmlwindow.hide(this)};B.close=function(){dhtmlwindow.close(this)};B.setSize=function(F,G){dhtmlwindow.setSize(this,F,G)};B.moveTo=function(F,G){dhtmlwindow.moveTo(this,F,G)};B.isResize=function(F){dhtmlwindow.isResize(this,F)};B.isScrolling=function(F){dhtmlwindow.isScrolling(this,F)};B.load=function(F,G,H){dhtmlwindow.load(this,F,G,H)};this.tobjects[this.tobjects.length]=B;return B},open:function(J,D,I,G,E,H){var F=dhtmlwindow;function B(K){var L=new RegExp(K+"=([^,]+)","i");return(L.test(E))?parseInt(RegExp.$1):0}if(document.getElementById(J)==null){J=this.init(J)}else{J=document.getElementById(J)}this.setfocus(J);J.setSize(B(("width")),(B("height")));var C=B("center")?"middle":B("left");var A=B("center")?"middle":B("top");if(typeof H!="undefined"&&H=="recal"&&this.scroll_top==0){if(window.attachEvent&&!window.opera){this.addEvent(window,function(){setTimeout(function(){J.moveTo(C,A)},400)},"load")}else{this.addEvent(window,function(){J.moveTo(C,A)},"load")}}J.isResize(B("resize"));J.isScrolling(B("scrolling"));J.style.visibility="visible";J.style.display="block";J.contentarea.style.display="block";J.moveTo(C,A);J.load(D,I,G);if(J.state=="minimized"&&J.controls.firstChild.title=="Restore"){J.controls.firstChild.setAttribute("src",dhtmlwindow.imagefiles[0]);J.controls.firstChild.setAttribute("title","Minimize");J.state="fullview"}return J},setSize:function(B,A,C){B.style.width=Math.max(parseInt(A),150)+"px";B.contentarea.style.height=Math.max(parseInt(C),100)+"px"},moveTo:function(B,A,C){this.getviewpoint();B.style.left=(A=="middle")?this.scroll_left+(this.docwidth-B.offsetWidth)/2+"px":this.scroll_left+parseInt(A)+"px";B.style.top=(C=="middle")?this.scroll_top+(this.docheight-B.offsetHeight)/2+"px":this.scroll_top+parseInt(C)+"px"},isResize:function(A,B){A.statusarea.style.display=(B)?"block":"none";A.resizeBool=(B)?1:0},isScrolling:function(A,B){A.contentarea.style.overflow=(B)?"auto":"hidden"},load:function(C,B,D,E){if(C.isClosed){alert("DHTML Window has been closed, so no window to load contents into. Open/Create the window again.");return }var B=B.toLowerCase();if(typeof E!="undefined"){C.handle.firstChild.nodeValue=E}if(B=="inline"){C.contentarea.innerHTML=D}else{if(B=="div"){var A=document.getElementById(D);C.contentarea.innerHTML=(A.defaultHTML||A.innerHTML);if(!A.defaultHTML){A.defaultHTML=A.innerHTML}A.innerHTML="";A.style.display="none"}else{if(B=="iframe"){C.contentarea.style.overflow="hidden";if(!C.contentarea.firstChild||C.contentarea.firstChild.tagName!="IFRAME"){C.contentarea.innerHTML='<iframe src="" style="margin:0; padding:0; width:100%; height: 100%" name="_iframe-'+C.id+'"></iframe>'}window.frames["_iframe-"+C.id].location.replace(D)}else{if(B=="ajax"){this.ajax_connect(D,C)}}}}C.contentarea.datatype=B},setupdrag:function(B){var C=dhtmlwindow;var A=this._parent;C.etarget=this;var B=window.event||B;C.initmousex=B.clientX;C.initmousey=B.clientY;C.initx=parseInt(A.offsetLeft);C.inity=parseInt(A.offsetTop);C.width=parseInt(A.offsetWidth);C.contentheight=parseInt(A.contentarea.offsetHeight);if(A.contentarea.datatype=="iframe"){A.style.backgroundColor="#F8F8F8";A.contentarea.style.visibility="hidden"}document.onmousemove=C.getdistance;document.onmouseup=function(){if(A.contentarea.datatype=="iframe"){A.contentarea.style.backgroundColor="white";A.contentarea.style.visibility="visible"}C.stop()};return false},getdistance:function(B){var C=dhtmlwindow;var A=C.etarget;var B=window.event||B;C.distancex=B.clientX-C.initmousex;C.distancey=B.clientY-C.initmousey;if(A.className=="drag-handle"){C.move(A._parent,B)}else{if(A.className=="drag-resizearea"){C.resize(A._parent,B)}}return false},getviewpoint:function(){var B=document.all&&!window.opera;var A=document.documentElement&&parseInt(document.documentElement.clientWidth)||100000;this.standardbody=(document.compatMode=="CSS1Compat")?document.documentElement:document.body;this.scroll_top=(B)?this.standardbody.scrollTop:window.pageYOffset;this.scroll_left=(B)?this.standardbody.scrollLeft:window.pageXOffset;this.docwidth=(B)?this.standardbody.clientWidth:(/Safari/i.test(navigator.userAgent))?window.innerWidth:Math.min(A,window.innerWidth-16);this.docheight=(B)?this.standardbody.clientHeight:window.innerHeight},rememberattrs:function(A){this.getviewpoint();A.lastx=parseInt((A.style.left||A.offsetLeft))-dhtmlwindow.scroll_left;A.lasty=parseInt((A.style.top||A.offsetTop))-dhtmlwindow.scroll_top;A.lastwidth=parseInt(A.style.width)},move:function(A,B){A.style.left=dhtmlwindow.distancex+dhtmlwindow.initx+"px";A.style.top=dhtmlwindow.distancey+dhtmlwindow.inity+"px"},resize:function(A,B){A.style.width=Math.max(dhtmlwindow.width+dhtmlwindow.distancex,150)+"px";A.contentarea.style.height=Math.max(dhtmlwindow.contentheight+dhtmlwindow.distancey,100)+"px"},enablecontrols:function(B){var C=dhtmlwindow;var A=window.event?window.event.srcElement:B.target;if(/Minimize/i.test(A.getAttribute("title"))){C.minimize(A,this._parent)}else{if(/Restore/i.test(A.getAttribute("title"))){C.restore(A,this._parent)}else{if(/Close/i.test(A.getAttribute("title"))){C.close(this._parent)}}}return false},minimize:function(B,A){dhtmlwindow.rememberattrs(A);B.setAttribute("src",dhtmlwindow.imagefiles[2]);B.setAttribute("title","Restore");A.state="minimized";A.contentarea.style.display="none";A.statusarea.style.display="none";if(typeof A.minimizeorder=="undefined"){dhtmlwindow.minimizeorder++;A.minimizeorder=dhtmlwindow.minimizeorder}A.style.left="10px";A.style.width="200px";var C=A.minimizeorder*10;A.style.top=dhtmlwindow.scroll_top+dhtmlwindow.docheight-(A.handle.offsetHeight*A.minimizeorder)-C+"px"},restore:function(B,A){dhtmlwindow.getviewpoint();B.setAttribute("src",dhtmlwindow.imagefiles[0]);B.setAttribute("title","Minimize");A.state="fullview";A.style.display="block";A.contentarea.style.display="block";if(A.resizeBool){A.statusarea.style.display="block"}A.style.left=parseInt(A.lastx)+dhtmlwindow.scroll_left+"px";A.style.top=parseInt(A.lasty)+dhtmlwindow.scroll_top+"px";A.style.width=parseInt(A.lastwidth)+"px"},close:function(B){try{var A=B.onclose()}catch(C){var A=true}finally{if(typeof A=="undefined"){alert('An error has occured somwhere inside your "onclose" event handler');var A=true}}if(A){if(B.state!="minimized"){dhtmlwindow.rememberattrs(B)}if(window.frames["_iframe-"+B.id]){window.frames["_iframe-"+B.id].location.replace("about:blank")}else{B.contentarea.innerHTML=""}B.style.display="none";B.isClosed=true}return A},setopacity:function(A,B){if(!A){return }if(A.filters&&A.filters[0]){if(typeof A.filters[0].opacity=="number"){A.filters[0].opacity=B*100}else{A.style.filter="alpha(opacity="+B*100+")"}}else{if(typeof A.style.MozOpacity!="undefined"){A.style.MozOpacity=B}else{if(typeof A.style.opacity!="undefined"){A.style.opacity=B}}}},setfocus:function(A){this.zIndexvalue++;A.style.zIndex=this.zIndexvalue;A.isClosed=false;this.setopacity(this.lastactivet.handle,0.5);this.setopacity(A.handle,1);this.lastactivet=A},show:function(A){if(A.isClosed){alert("DHTML Window has been closed, so nothing to show. Open/Create the window again.");return }if(A.lastx){dhtmlwindow.restore(A.controls.firstChild,A)}else{A.style.display="block"}this.setfocus(A);A.state="fullview"},hide:function(A){A.style.display="none"},ajax_connect:function(A,B){var E=false;var D="";if(window.XMLHttpRequest){E=new XMLHttpRequest()}else{if(window.ActiveXObject){try{E=new ActiveXObject("Msxml2.XMLHTTP")}catch(C){try{E=new ActiveXObject("Microsoft.XMLHTTP")}catch(C){}}}else{return false}}B.contentarea.innerHTML=this.ajaxloadinghtml;E.onreadystatechange=function(){dhtmlwindow.ajax_loadpage(E,B)};if(this.ajaxbustcache){D=(A.indexOf("?")!=-1)?"&"+new Date().getTime():"?"+new Date().getTime()}E.open("GET",A+D,true);E.send(null)},ajax_loadpage:function(B,A){if(B.readyState==4&&(B.status==200||window.location.href.indexOf("http")==-1)){A.contentarea.innerHTML=B.responseText}},stop:function(){dhtmlwindow.etarget=null;document.onmousemove=null;document.onmouseup=null},addEvent:function(B,C,A){var A=(window.addEventListener)?A:"on"+A;if(B.addEventListener){B.addEventListener(A,C,false)}else{if(B.attachEvent){B.attachEvent(A,C)}}},cleanup:function(){for(var A=0;A<dhtmlwindow.tobjects.length;A++){dhtmlwindow.tobjects[A].handle._parent=dhtmlwindow.tobjects[A].resizearea._parent=dhtmlwindow.tobjects[A].controls._parent=null}window.onload=null}};document.write('<div id="dhtmlwindowholder"><span style="display:none">.</span></div>');window.onunload=dhtmlwindow.cleanup;
function JsHttpRequest(){this._construct()}(function(){var COUNT=0;var PENDING={};var CACHE={};JsHttpRequest.dataReady=function(id,text,js){var undef;var th=PENDING[id];delete PENDING[id];if(th){delete th._xmlReq;if(th.caching&&th.hash){CACHE[th.hash]=[text,js]}th._dataReady(text,js)}else{if(th!==false){throw"JsHttpRequest.dataReady(): unknown pending id: "+id}}};JsHttpRequest.query=function(url,content,onready,nocache){var req=new JsHttpRequest();req.caching=!nocache;req.onreadystatechange=function(){if(req.readyState==4){onready(req.responseJS,req.responseText)}};req.open(null,url,true);req.send(content)},JsHttpRequest.prototype={onreadystatechange:null,readyState:0,responseText:null,responseXML:null,status:200,statusText:"OK",responseJS:null,session_name:"PHPSESSID",caching:false,loader:null,_span:null,_id:null,_xmlReq:null,_openArg:null,_reqHeaders:null,_maxUrlLen:2000,dummy:function(){},abort:function(){if(this._xmlReq){this._xmlReq.abort();this._xmlReq=null}this._cleanupScript();this._changeReadyState(4,true)},open:function(method,url,asyncFlag,username,password){var sid=this._getSid();if(sid){url+=(url.indexOf("?")>=0?"&":"?")+this.session_name+"="+this.escape(sid)}this._openArg={method:(method||"").toUpperCase(),url:url,asyncFlag:asyncFlag,username:username!=null?username:"",password:password!=null?password:""};this._id=null;this._xmlReq=null;this._reqHeaders=[];this._changeReadyState(1,true);return true},send:function(content){this._changeReadyState(1,true);var id=(new Date().getTime())+""+COUNT++;var url=this._openArg.url;var queryText=[];var queryElem=[];if(!this._hash2query(content,null,queryText,queryElem)){return }var loader=(this.loader||"").toLowerCase();var method=this._openArg.method;var xmlReq=null;if(queryElem.length&&!loader){loader="form"}else{xmlReq=this._obtainXmlReq(id,url)}var fullGetUrl=url+(url.indexOf("?")>=0?"&":"?")+queryText.join("&");this.hash=null;if(this.caching&&!queryElem.length){this.hash=fullGetUrl;if(CACHE[this.hash]){var c=CACHE[this.hash];this._dataReady(c[0],c[1]);return false}}var canSetHeaders=xmlReq&&(window.ActiveXObject||xmlReq.setRequestHeader);if(!loader){if(xmlReq){loader="xml";switch(method){case"POST":if(!canSetHeaders){loader="form"}break;case"GET":break;default:if(canSetHeaders){method="POST"}else{if(fullGetUrl.length>this._maxUrlLen){method="POST";loader="form"}else{method="GET"}}}}else{loader="script";switch(method){case"POST":loader="form";break;case"GET":break;default:if(fullGetUrl.length>this._maxUrlLen){method="POST";loader="form"}else{method="GET"}}}}else{if(!method){switch(loader){case"form":method="POST";break;case"script":method="GET";break;default:if(canSetHeaders){method="POST"}else{method="GET"}}}}var requestBody=null;if(method=="GET"){url=fullGetUrl;if(url.length>this._maxUrlLen){return this._error("Cannot use so long query (URL is "+url.length+" byte(s) length) with GET request.")}}else{if(method=="POST"){requestBody=queryText.join("&")}else{return this._error("Unknown method: "+method+". Only GET and POST are supported.")}}url=url+(url.indexOf("?")>=0?"&":"?")+"JsHttpRequest="+id+"-"+loader;PENDING[id]=this;switch(loader){case"xml":if(!xmlReq){return this._error("Cannot use XMLHttpRequest or ActiveX loader: not supported")}if(method=="POST"&&!canSetHeaders){return this._error("Cannot use XMLHttpRequest loader or ActiveX loader, POST method: headers setting is not supported")}if(queryElem.length){return this._error("Cannot use XMLHttpRequest loader: direct form elements using and uploading are not implemented")}this._xmlReq=xmlReq;var a=this._openArg;this._xmlReq.open(method,url,a.asyncFlag,a.username,a.password);if(canSetHeaders){for(var i=0;i<this._reqHeaders.length;i++){this._xmlReq.setRequestHeader(this._reqHeaders[i][0],this._reqHeaders[i][1])}this._xmlReq.setRequestHeader("Content-Type","application/octet-stream")}return this._xmlReq.send(requestBody);case"script":if(method!="GET"){return this._error("Cannot use SCRIPT loader: it supports only GET method")}if(queryElem.length){return this._error("Cannot use SCRIPT loader: direct form elements using and uploading are not implemented")}this._obtainScript(id,url);return true;case"form":if(!this._obtainForm(id,url,method,queryText,queryElem)){return null}return true;default:return this._error("Unknown loader: "+loader)}},getAllResponseHeaders:function(){if(this._xmlReq){return this._xmlReq.getAllResponseHeaders()}return""},getResponseHeader:function(label){if(this._xmlReq){return this._xmlReq.getResponseHeader(label)}return""},setRequestHeader:function(label,value){this._reqHeaders[this._reqHeaders.length]=[label,value]},_construct:function(){},_dataReady:function(text,js){with(this){if(text!==null||js!==null){status=4;responseText=responseXML=text;responseJS=js}else{status=500;responseText=responseXML=responseJS=null}_changeReadyState(2);_changeReadyState(3);_changeReadyState(4);_cleanupScript()}},_error:function(msg){throw (window.Error?new Error(msg):msg)},_obtainXmlReq:function(id,url){var p=url.match(new RegExp("^([a-z]+)://([^/]+)(.*)","i"));if(p){if(p[2].toLowerCase()==document.location.hostname.toLowerCase()){url=p[3]}else{return null}}var req=null;if(window.XMLHttpRequest){try{req=new XMLHttpRequest()}catch(e){}}else{if(window.ActiveXObject){try{req=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}if(!req){try{req=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){}}}}if(req){var th=this;req.onreadystatechange=function(){if(req.readyState==4){req.onreadystatechange=th.dummy;th.status=null;try{th.status=req.status;th.responseText=req.responseText}catch(e){}if(!th.status){return }var funcRequestBody=null;try{eval("funcRequestBody = function() {\n"+th.responseText+"\n}")}catch(e){return th._error("JavaScript code generated by backend is invalid!\n"+th.responseText)}funcRequestBody()}};this._id=id}return req},_obtainScript:function(id,href){with(document){var span=createElement("SPAN");span.style.display="none";body.insertBefore(span,body.lastChild);span.innerHTML="Text for stupid IE.<script><\/script>";setTimeout(function(){var s=span.getElementsByTagName("script")[0];s.language="JavaScript";if(s.setAttribute){s.setAttribute("src",href)}else{s.src=href}},10);this._id=id;this._span=span}},_obtainForm:function(id,url,method,queryText,queryElem){if(method=="GET"){queryText=url.split("?",2)[1].split("&");url=url.split("?",2)[0]}var div=document.createElement("DIV");div.id="jshr_d_"+id;div.style.position="absolute";div.style.visibility="hidden";div.innerHTML='<form enctype="multipart/form-data"></form><iframe src="javascript:\'\'" name="jshr_i_'+id+'" style="width:0px; height:0px; overflow:hidden; border:none"></iframe>';var form=div.getElementsByTagName("FORM")[0];var iframe=div.getElementsByTagName("IFRAME")[0];if(queryElem.length){form=queryElem[0][1].form;var foundFile=false;for(var i=0;i<queryElem.length;i++){var e=queryElem[i][1];if(!e.form){return this._error('Element "'+e.name+'" do not belongs to any form!')}if(e.form!=form){return this._error('Element "'+e.name+'" belongs to different form. All elements must belong to the same form!')}foundFile=foundFile||(e.tagName.toLowerCase()=="input"&&(e.type||"").toLowerCase()=="file")}var et="multipart/form-data";if(form.enctype!=et&&foundFile){return this._error('Attribute "enctype" of elements\' form must be "'+et+'" (for IE), "'+form.enctype+'" given.')}}for(var i=0;i<form.elements.length;i++){var e=form.elements[i];if(e.name!=null){e.jshrSaveName=e.name;e.name=""}}var tmpE=[];for(var i=0;i<queryText.length;i++){var pair=queryText[i].split("=",2);var e=document.createElement("INPUT");e.type="hidden";e.name=unescape(pair[0]);e.value=pair[1]!=null?unescape(pair[1]):"";form.appendChild(e);tmpE[tmpE.length]=e}for(var i=0;i<queryElem.length;i++){queryElem[i][1].name=queryElem[i][0]}document.body.insertBefore(div,document.body.lastChild);this._span=div;var sv={};sv.enctype=form.enctype;form.enctype="multipart/form-data";sv.action=form.action;form.action=url;sv.method=form.method;form.method=method;sv.target=form.target;form.target=iframe.name;sv.onsubmit=form.onsubmit;form.onsubmit=null;form.submit();for(var i in sv){form[i]=sv[i]}for(var i=0;i<tmpE.length;i++){tmpE[i].parentNode.removeChild(tmpE[i])}for(var i=0;i<form.elements.length;i++){var e=form.elements[i];if(e.jshrSaveName!=null){e.name=e.jshrSaveName;e.jshrSaveName=null}}},_cleanupScript:function(){var span=this._span;if(span){this._span=null;setTimeout(function(){span.parentNode.removeChild(span)},50)}if(this._id){PENDING[this._id]=false}return false},_hash2query:function(content,prefix,queryText,queryElem){if(prefix==null){prefix=""}if(content instanceof Object){for(var k in content){var v=content[k];if(v instanceof Function){continue}var curPrefix=prefix?prefix+"["+this.escape(k)+"]":this.escape(k);if(this._isFormElement(v)){var tn=v.tagName.toLowerCase();if(tn=="form"){for(var i=0;i<v.elements.length;i++){var e=v.elements[i];if(e.name){queryElem[queryElem.length]=[e.name,e]}}}else{if(tn=="input"||tn=="textarea"||tn=="select"){queryElem[queryElem.length]=[curPrefix,v]}else{return this._error("Invalid FORM element detected: name="+(e.name||"")+", tag="+e.tagName)}}}else{if(v instanceof Object){this._hash2query(v,curPrefix,queryText,queryElem)}else{if(v===null){continue}queryText[queryText.length]=curPrefix+"="+this.escape(""+v)}}}}else{queryText[queryText.length]=content}return true},_isFormElement:function(e){return e&&e.ownerDocument&&e.parentNode&&e.parentNode.appendChild&&e.tagName},_getSid:function(){var m=document.location.search.match(new RegExp("[&?]"+this.session_name+"=([^&?]*)"));var sid=null;if(m){sid=m[1]}else{var m=document.cookie.match(new RegExp("(;|^)\\s*"+this.session_name+"=([^;]*)"));if(m){sid=m[2]}}return sid},_changeReadyState:function(s,reset){with(this){if(reset){status=statusText=responseJS=null;responseText=""}readyState=s;if(onreadystatechange){onreadystatechange()}}},escape:function(s){return escape(s).replace(new RegExp("\\+","g"),"%2B")}}})();
