var Gmanager={_getKey:function(a){if(a.which==null&&(a.charCode!=null||a.keyCode!=null))a.which=a.charCode!=null?a.charCode:a.keyCode;return a.which},_insAtCaret:function(a,c){var b;a.focus();if(document.selection!==undefined){b=document.selection.createRange();if(b.parentElement()!==a)return;b.text=c;b.select()}else if(a.selectionStart!==undefined){b=a.selectionStart;a.value=a.value.substr(0,b)+c+a.value.substr(a.selectionEnd,a.value.length);b+=c.length;a.setSelectionRange(b,b)}else a.value+=c;a.focus()},_getCaretPosition:function(a){var c,b;if(a.selectionStart!==undefined)return a.selectionStart;else if(document.selection){c=document.selection.createRange();b=c.duplicate();c.collapse(true);b.moveToElementText(a);b.setEndPoint("EndToEnd",c);return b.text.length}return 0},_setCaretPosition:function(a,c){var b;if(document.all===undefined||window.opera!==undefined)window.opera!==undefined?a.setSelectionRange(c+1,c+1):a.setSelectionRange(c,c);else{b=a.createTextRange();b.collapse(true);b.moveStart("character",a.value.substring(0,c).replace(/\n/g,"").length+1);b.moveEnd("character",0);b.select()}},number:function(a){var c=this._getKey(a);if(a.ctrlKey||a.altKey||c<32)return true;return/[\d]/.test(String.fromCharCode(c))},check:function(a,c,b){for(var d=0;d<a[c].length;d++)a[c][d].checked=b},checkForm:function(a,c){if(a[c]===undefined)return false;else if(a[c]instanceof HTMLInputElement){a[c].checked||window.alert(document.getElementById("chF").innerHTML);return a[c].checked}for(var b=0;b<a[c].length;b++)if(a[c][b].checked)return true;window.alert(document.getElementById("chF").innerHTML);return false},delNotify:function(){return window.confirm(document.getElementById("delN").innerHTML)},paste:function(a){var c=document.forms.post.sql;a!==""&&c&&this._insAtCaret(c,decodeURIComponent(a))},files:function(a){var c=document.createElement("input"),b=document.getElementById("fl");c.setAttribute("name","f[]");c.setAttribute("type","file");if(a===1){b.insertBefore(c,null);b.appendChild(document.createElement("br"))}else{a=b.getElementsByTagName("input");b=b.getElementsByTagName("br");if(a.length>0){a=a[a.length-1];a.parentNode.removeChild(a);b=b[b.length-1];b.parentNode.removeChild(b)}}},edit:function(a,c){var b=c.parentNode,d=b.parentNode,e;if(this.id===undefined)this.id=d.lastChild.getAttribute("id").substring(1);this.id++;if(a===1){e=b.cloneNode(true);e.setAttribute("id","i"+this.id);e.getElementsByTagName("input").item(0).setAttribute("value","");e.getElementsByTagName("td").item(0).innerHTML="+";d.insertBefore(e,b.nextSibling)}else d.removeChild(b)},formatCode:function(a,c){var b=this._getCaretPosition(c),d,e="",f=0;if(this._getKey(a)===13&&!/opera mini|opera mobi/.test(window.navigator.userAgent.toLowerCase())){d=c.value.substring(0,b).split("\n");for(d=d[d.length-1].split("");f<d.length;f++)if(d[f]===" ")e+=" ";else break;if(c.value.slice(b-1,b)==="{")e+=" ";c.value=c.value.substring(0,b)+"\n"+e+c.value.substring(b,c.value.length);this._setCaretPosition(c,b+e.length+1);return false}return true}};