(function($){function toIntegersAtLease(n){return n<10?"0"+n:n}Date.prototype.toJSON=function(date){return this.getUTCFullYear()+"-"+toIntegersAtLease(this.getUTCMonth())+"-"+toIntegersAtLease(this.getUTCDate())};var escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;var meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};$.quoteString=function(string){if(escapeable.test(string)){return'"'+string.replace(escapeable,function(a){var c=meta[a];if(typeof c==="string"){return c}c=a.charCodeAt();return"\\u00"+Math.floor(c/16).toString(16)+(c%16).toString(16)})+'"'}return'"'+string+'"'};$.toJSON=function(o,compact){var type=typeof(o);if(type=="undefined"){return"undefined"}else{if(type=="number"||type=="boolean"){return o+""}else{if(o===null){return"null"}}}if(type=="string"){return $.quoteString(o)}if(type=="object"&&typeof o.toJSON=="function"){return o.toJSON(compact)}if(type!="function"&&typeof(o.length)=="number"){var ret=[];for(var i=0;i<o.length;i++){ret.push($.toJSON(o[i],compact))}if(compact){return"["+ret.join(",")+"]"}else{return"["+ret.join(", ")+"]"}}if(type=="function"){throw new TypeError("Unable to convert object of type 'function' to json.")}var ret=[];for(var k in o){var name;type=typeof(k);if(type=="number"){name='"'+k+'"'}else{if(type=="string"){name=$.quoteString(k)}else{continue}}var val=$.toJSON(o[k],compact);if(typeof(val)!="string"){continue}if(compact){ret.push(name+":"+val)}else{ret.push(name+": "+val)}}return"{"+ret.join(", ")+"}"};$.compactJSON=function(o){return $.toJSON(o,true)};$.evalJSON=function(src){return eval("("+src+")")};$.secureEvalJSON=function(src){var filtered=src;filtered=filtered.replace(/\\["\\\/bfnrtu]/g,"@");filtered=filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]");filtered=filtered.replace(/(?:^|:|,)(?:\s*\[)+/g,"");if(/^[\],:{}\s]*$/.test(filtered)){return eval("("+src+")")}else{throw new SyntaxError("Error parsing JSON, source is not valid.")}}})(jQuery);var Common=new function(){this.imagePath="/Media/Image/";this.blankPngImg=this.imagePath+"blank.gif";this.openedWindowsCount=0;this.b64_keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";this.pageBlocker=null;this.fixPng=function(){var arVersion=navigator.appVersion.split("MSIE");var ieVersion=parseFloat(arVersion[1]);if((ieVersion>=5.5)&&(ieVersion<8)&&(document.body.filters)){var pngs=$$("img.png");pngs.each(function(el,i){var img=el.src;var style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+img+"', sizingMethod='scale');"+el.style.cssText;el.src=Common.blankPngImg;el.style.cssText=style})}};this.getWindowHeight=function(){if(typeof(window.innerHeight)=="number"){browserHeight=window.innerHeight}else{browserHeight=document.documentElement.clientHeight}return browserHeight};this.getWindowWidth=function(){if(typeof(window.innerWidth)=="number"){browserWidth=window.innerWidth}else{browserWidth=document.documentElement.clientWidth}return browserWidth};this.removeChildNodes=function(element){while(element.childNodes[0]){element.removeChild(element.childNodes[0])}};this.requestJsonData=function(module,event,inputData,asyncFunc,blockPage){$.post("/index.php?output=json&mod="+module+"&event="+event,$.toJSON(inputData),function(data){try{if(blockPage){Common.unblockPage()}if(typeof(asyncFunc)=="function"){asyncFunc(data)}else{if(typeof(asyncFunc)=="string"){eval(asyncFunc+"(data)")}}}catch(e){}},"json")};this.loadPage=function(module,event,inputData,updateElement,asyncFunc,noloading){updateElement=$(typeof(updateElement)=="string"?"#"+updateElement:updateElement);if(!noloading){updateElement.empty().addClass("loading")}$.post("/index.php?mod="+module+"&event="+event+'&raw=1',$.toJSON(inputData),function(data){try{if(!noloading){updateElement.removeClass("loading")}updateElement.html(data);if(typeof(asyncFunc)=="function"){asyncFunc(data)}else{if(typeof(asyncFunc)=="string"){eval(asyncFunc+"(data)")}}}catch(e){}})};this.preloadImage=function(url,usedefaultpath){if(usedefaultpath){url=this.imagePath+url}if(document.images){var pic=new Image();pic.src=url}};this.disableForm=function(formId){$("#"+formId+" input").attr("disabled",true);$("#"+formId+" select").attr("disabled",true);$("#"+formId+" button").attr("disabled",true);$("#"+formId+" textarea").attr("disabled",true)};this.enableForm=function(formId){$("#"+formId+" input").attr("disabled",false);$("#"+formId+" select").attr("disabled",false);$("#"+formId+" button").attr("disabled",false);$("#"+formId+" textarea").attr("disabled",false)};this.getSelectValues=function(select){var result=new Array();$.each($("#"+select+" option:selected"),function(i,option){result[i]=$(option).val()});return result};this.toggleVisible=function(element){$("#"+element).toggle()};this.addSelectOption=function(select,val,caption,selected){select=$(select);var opt=$(select.appendChild(document.createElement("OPTION")));opt.setText(caption);opt.value=val;if(selected){opt.selected=true}};this.redirect=function(url){if(!url){return window.location.reload()}location.href=url};this.getRadioValue=function(name){return $("input[@name="+name+"]:checked").val()};this.openPopup=function(url,w,h,name){return window.open(url,name?name:"wnd"+this.openedWindowsCount++,w&&h?"width="+w+",height="+h+",resizable=no,scrollbars=no":"resizable=yes,scrollbars=yes")};this.base64encode=function(input){var output="";var chr1,chr2,chr3,enc1,enc2,enc3,enc4;var i=0;input=this._b64_utf8_encode(input);while(i<input.length){chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=((chr1&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64}else{if(isNaN(chr3)){enc4=64}}output=output+this.b64_keyStr.charAt(enc1)+this.b64_keyStr.charAt(enc2)+this.b64_keyStr.charAt(enc3)+this.b64_keyStr.charAt(enc4)}return output};this.base64decode=function(input){var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(i<input.length){enc1=this.b64_keyStr.indexOf(input.charAt(i++));enc2=this.b64_keyStr.indexOf(input.charAt(i++));enc3=this.b64_keyStr.indexOf(input.charAt(i++));enc4=this.b64_keyStr.indexOf(input.charAt(i++));chr1=(enc1<<2)|(enc2>>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;output=output+String.fromCharCode(chr1);if(enc3!=64){output=output+string.fromCharCode(chr2)}if(enc4!=64){output=output+string.fromCharCode(chr3)}}output=this._b64_utf8_decode(output);return output};this._b64_utf8_encode=function(string){string=string.replace(/\r\n/g,"\n");var utftext="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){utftext+=string.fromCharCode(c)}else{if((c>127)&&(c<2048)){utftext+=string.fromCharCode((c>>6)|192);utftext+=string.fromCharCode((c&63)|128)}else{utftext+=string.fromCharCode((c>>12)|224);utftext+=string.fromCharCode(((c>>6)&63)|128);utftext+=string.fromCharCode((c&63)|128)}}}return utftext};this._b64_utf8_decode=function(utftext){var string="";var i=0;var c=c1=c2=0;while(i<utftext.length){c=utftext.charCodeAt(i);if(c<128){string+=string.fromCharCode(c);i++}else{if((c>191)&&(c<224)){c2=utftext.charCodeAt(i+1);string+=string.fromCharCode(((c&31)<<6)|(c2&63));i+=2}else{c2=utftext.charCodeAt(i+1);c3=utftext.charCodeAt(i+2);string+=string.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3}}}return string};this.blockPage=function(text){if(this.pageBlocker){return false}this.pageBlocker=$(document.body.appendChild(document.createElement("DIV")));this.pageBlocker.attr("id","page_blocker");if(text){this.pageBlocker.text(text)}};this.unblockPage=function(){if(!this.pageBlocker){return false}this.pageBlocker.remove();this.pageBlocker=null};this.sleep=function(milliseconds){var start=new Date().getTime();for(var i=0;i<10000000;i++){if((new Date().getTime()-start)>milliseconds){break}}};this.fixLinksOutline=function(){$("a").focus(function(){this.blur()})}};
