function urlencode(a){return encodeURIComponent(a)}function checkAll(a,b){if(typeof a=="string")a=document.getElementById(a);for(var c=0;c<a.elements.length;c++){var e=a.elements[c];if(e.type=="checkbox"&&e.name.substr(0,6)!="allbox"&&(!b||b&&e.name.substr(0,b.length)==b))e.checked=!e.checked}} function getPath(){var a=document.body;if(!a)(a=document.getElementsByTagName("head")[0])||(a=document);var b="";if(a=a.lastChild.getAttribute("src")){a=a.split("/");a=a.slice(0,-1);if(a.length)b=a.join("/")+"/"}return b}var isLoadedJS=[];function include(a,b){if(!(!b&&isLoadedJS[a])){document.write('<script type="text/javascript" src="'+a+'"><\/script>');isLoadedJS[a]=true}} function includeJS(a){var b=document.body;if(!b)(b=document.getElementsByTagName("head")[0])||(b=document);var c=document.createElement("script");c.type="text/javascript";c.src=a;b.appendChild(c);isLoadedJS[a]=true}function includeCSS(a){var b=document.getElementsByTagName("head")[0];if(b){var c=document.createElement("link");c.setAttribute("rel","stylesheet");c.setAttribute("type","text/css");c.setAttribute("href",a);b.appendChild(c)}} function refreshWin(a){if(typeof a=="undefined")a=window;var b=a.location.href,c=b.indexOf("#");if(c>0)b=b.substring(0,c);a.location.href=b}function redirect(a){document.location.href=a}var popUpWin=0; function openWin(a,b,c){if(popUpWin)popUpWin.closed||popUpWin.close();b=typeof b=="undefined"?400:b;c=typeof c=="undefined"?300:c;x=Math.round((screen.width-b)/2);y=Math.round((screen.height-c)/2);popUpWin=window.open(a,"popUpWin","toolbar=no,status=no,menubar=no,scrollbars=no,copyhistory=yes,width="+b+",height="+c+",left="+x+",top="+y);popUpWin.focus();return popUpWin}var popUpImageWin=0; function openImageWin(a){if(popUpImageWin)popUpImageWin.closed||popUpImageWin.close();x=Math.round((screen.width-400)/2);y=Math.round((screen.height-300)/2);w=popUpImageWin=window.open("","popUpImageWin","toolbar=no,status=no,menubar=no,scrollbars=no,copyhistory=yes,width=400,height=300,left="+x+",top="+y);w.document.writeln('<html><body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">');w.document.writeln("<script>");w.document.writeln("function resizeWin(w, h) {");w.document.writeln(" w += 80; h +=60;"); w.document.writeln(" window.resizeTo(w,h);");w.document.writeln(" x = Math.round((screen.width - w)/2);");w.document.writeln(" y = Math.round((screen.height - h)/2);");w.document.writeln(" window.moveTo(x>0 ? x : 0, y > 0 ? y : 0);");w.document.writeln("}");w.document.writeln("<\/script>");w.document.writeln('<center><img src="'+a+'" onclick="window.close();" onload="resizeWin(this.width,this.height)" alt="Click to close"/></center>');w.document.writeln("</body></html>");w.document.close();w.focus()} var popUpPromptWin=0; function openPromptWin(a,b,c){if(popUpPromptWin)popUpPromptWin.closed||popUpPromptWin.close();x=Math.round((screen.width-300)/2);y=Math.round((screen.height-150)/2);var e=popUpPromptWin=window.open("about:blank","popUpPromptWin","toolbar=no,status=no,menubar=no,scrollbars=no,copyhistory=yes,width=300,height=150,left="+x+",top="+y),d=e.document;d.writeln("<html>");d.writeln("<meta><title>"+a+"</title></meta>");d.writeln('<body bgcolor="#DFDCD2" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="javascript: focusTextBox();">');d.writeln('<div style="margin-top: 30px; text-align: center">'); d.writeln('<form name="frmPrompt" onsubmit="returnPromptText()">');d.writeln(a+"<br/>");d.writeln('<input type="text" name="promptText" value="'+b+'" style="width: 250px; margin-bottom: 6px" tabindex="0"/><br/>');d.writeln('<input type="button" value=" OK " onclick="returnPromptText();" />');d.writeln('<input type="button" value=" Cancel " onclick="window.opener.'+c+'(null); window.close();" />');d.writeln("</form>");d.writeln('<script language="javascript" type="text/javascript">');d.writeln("<!--"); d.writeln("function focusTextBox() {");d.writeln(" document.forms['frmPrompt'].elements['promptText'].focus();");d.writeln("}");d.writeln("function returnPromptText() {");d.writeln(" window.opener."+c+"(document.forms['frmPrompt'].elements['promptText'].value);");d.writeln(" window.opener.focus();");d.writeln(" window.close();");d.writeln("}");d.writeln("--\>");d.writeln("<\/script>");d.writeln("</div>");d.writeln("</body></html>");d.close();e.focus()} function writeCookie(a,b,c){var e="";if(c!=null){e=new Date((new Date).getTime()+c*36E5);e="; expires="+e.toGMTString()}document.cookie=a+"="+escape(b)+e}function readCookie(a){var b="";a=a+"=";if(document.cookie.length>0){offset=document.cookie.indexOf(a);if(offset!=-1){offset+=a.length;end=document.cookie.indexOf(";",offset);if(end==-1)end=document.cookie.length;b=unescape(document.cookie.substring(offset,end))}}return b} function getSizePos(a){a=document.getElementById(a);var b=getAbsolutePos(a);return{x:b.x,y:b.y,w:a.offsetWidth,h:a.offsetHeight}}function getAbsolutePos(a,b){if(typeof a=="string")a=document.getElementById(a);var c=0,e=0;if(!b){var d=/^div$/i.test(a.tagName);if(d&&a.scrollLeft)c=a.scrollLeft;if(d&&a.scrollTop)e=a.scrollTop}c={x:a.offsetLeft-c,y:a.offsetTop-e};if(a.offsetParent){e=getAbsolutePos(a.offsetParent);c.x+=e.x;c.y+=e.y}return c} function moveToCenter(a){if(typeof a=="string")a=document.getElementById(a);var b=a.style.display;a.style.display="";var c=getWindowSize(),e=getPageScroll(),d=Math.round((c.width-a.offsetWidth)/2)+e.x;c=Math.round((c.height-a.offsetHeight)/2)+e.y;if(d<0)d=0;if(c<0)c=0;a.style.position="absolute";a.style.left=d+"px";a.style.top=c+"px";a.style.display=b;b=a.cloneNode(true);a.parentNode.removeChild(a);document.body.appendChild(b)} function getWindowSize(){var a=0,b=0;if(document.compatMode&&document.compatMode=="CSS1Compat")if(window.opera){a=document.body.clientWidth||0;b=document.body.clientHeight||0}else{a=document.documentElement.clientWidth||0;b=document.documentElement.clientHeight||0}else{a=window.innerWidth||document.body.clientWidth||document.documentElement.clientWidth||0;b=window.innerHeight||document.body.clientHeight||document.documentElement.clientHeight||0}return{width:a,height:b}} function getPageScroll(){var a={};a.y=window.pageYOffset||document.documentElement.scrollTop||(document.body?document.body.scrollTop:0)||0;a.x=window.pageXOffset||document.documentElement.scrollLeft||(document.body?document.body.scrollLeft:0)||0;return a} function preloadImages(a){if(document.images){if(!document.imageArray)document.imageArray=[];var b=document.imageArray.length,c=typeof a=="string"?[a]:a;for(a=0;a<c.length;a++)if(c[a].indexOf("#")!=0){document.imageArray[b]=new Image;document.imageArray[b++].src=c[a]}}}function gotoNext(a,b){if(window.Event)var c=a.which;else if(a.type=="keypress")c=a.keyCode;if(c==13){if(typeof b!="undefined"){if(typeof b=="string")b=document.getElementById(b);b.enabled&&b.focus()}return false}} function handleEnter(a,b){if((b.keyCode?b.keyCode:b.which?b.which:b.charCode)==13){var c;for(c=0;c<a.form.elements.length;c++)if(a==a.form.elements[c])break;c=(c+1)%a.form.elements.length;a.form.elements[c].focus();return false}else return true} function insertText(a,b,c){if(c)b=" "+b+" ";if(typeof TinyMCE!="undefined"&&tinyMCE.getInstanceById(a))tinyMCE.execInstanceCommand(a,"mceInsertContent",false,b);else{el=document.getElementById(a);if(el.createTextRange){el.focus();document.selection.createRange().duplicate().text=b}else{if(typeof el.selectionStart!="undefined"){c=el.selectionEnd;var e=el.value.length;a=el.value.substring(0,c);c=el.value.substring(c,e);e=el.scrollTop;el.value=a+b+c;el.selectionStart=a.length+b.length;el.selectionEnd= a.length+b.length;el.scrollTop=e}else el.value+=b;el.focus()}}} function wrapText(a,b,c){el=document.getElementById(a);if(typeof c=="undefined")c=b;el.focus();if(document.selection){a=document.selection.createRange();a.text=b+a.text+c;return false}else{if(el.setSelectionRange){a=el.selectionStart;var e=el.selectionEnd,d=element.scrollTop;el.value=el.value.substring(0,a)+b+el.value.substring(a,e)+c+el.value.substring(e);el.setSelectionRange(a+b.length,e+c.length)}else{d=el.scrollTop;el.value+=b+c}el.scrollTop=d;el.focus()}} function autoslug(a,b){var c=document.getElementById(a);if(!c)return alert("slug(): #"+a+" not found!");var e=document.getElementById(b);if(!e)return alert("slug(): #"+b+" not found!");if(e.value==""){c=c.value.toLowerCase();c=c.replace(RegExp("^[s]+","g"),"");c=c.replace(RegExp("[s]+$","g"),"");for(var d=[" ","\u0430","\u0431","\u0432","\u0433","\u0434","\u0435","\u0451","\u0436","\u0437","\u0438","\u0439","\u043a","\u043b","\u043c","\u043d","\u043e","\u043f","\u0440","\u0441","\u0442","\u0443", "\u0444","\u0445","\u0446","\u0447","\u0448","\u0449","\u044a","\u044b","\u044c","\u044d","\u044e","\u044f"],j=["-","a","b","v","g","d","e","e","j","z","i","j","k","l","m","n","o","p","r","s","t","u","f","h","z","ch","sh","sh","","y","","e","yu","ya"],f="",g=0;g<c.length;g++){for(var i="",h=0;h<d.length;h++)if(c.charAt(g)==d[h])i=j[h];f+=i!=""?i:c.charAt(g)}f=f.replace(/[^a-zA-Z0-9\-\_\,\.\/\~]+/g,"");e.value=f}};
