function switchFontSize(e,d){var b=document.getElementsByTagName("body");if(!b||!b.length){return}b=b[0];var c="fs"+CurrentFontSize;switch(d){case"inc":if(CurrentFontSize+1<7){CurrentFontSize++}break;case"dec":if(CurrentFontSize-1>0){CurrentFontSize--}break;case"reset":default:CurrentFontSize=DefaultFontSize}var a="fs"+CurrentFontSize;b.className=b.className.replace(new RegExp("fs.?","g"),"");b.className=trim(b.className);b.className+=(b.className?" ":"")+a;createCookie(e,CurrentFontSize,365)}function switchTool(b,a){createCookie(b,a,365);window.location.reload()}function cpanel_reset(){var b=document.cookie.match(new RegExp("(?:^|;)\\s*"+tmpl_name.escapeRegExp()+"_([^=]*)=([^;]*)","g"));if(!b){return}for(i=0;i<b.length;i++){var a=b[i].match(new RegExp("(?:^|;)\\s*"+tmpl_name.escapeRegExp()+"_([^=]*)=([^;]*)"));if(a){createCookie(tmpl_name+"_"+a[1],"",-1)}}if(window.location.href.indexOf("?")>-1){window.location.href=window.location.href.substr(0,window.location.href.indexOf("?"))}else{window.location.reload()}}function cpanel_apply(){var b=document.getElementById("ja-cpanel-main").getElementsByTagName("*");var d={};for(i=0;i<b.length;i++){var e=b[i];if(e.name&&(match=e.name.match(/^user_(.*)$/))){var c=match[1];var f="";if(e.tagName.toLowerCase()=="input"&&(e.type.toLowerCase()=="radio"||e.type.toLowerCase()=="checkbox")){if(e.checked){f=e.value}}else{f=e.value}if(d[c]){if(f){d[c]=f+","+d[c]}}else{d[c]=f}}}for(var a in d){c=tmpl_name+"_"+a;f=d[a];createCookie(c,f,365)}if(window.location.href.indexOf("?")>-1){window.location.href=window.location.href.substr(0,window.location.href.indexOf("?"))}else{window.location.reload()}}function createCookie(c,d,e){if(e){var b=new Date();b.setTime(b.getTime()+(e*24*60*60*1000));var a="; expires="+b.toGMTString()}else{a=""}document.cookie=c+"="+d+a+"; path=/"}function trim(b,a){return ltrim(rtrim(b,a),a)}function ltrim(b,a){a=a||"\\s";return b.replace(new RegExp("^["+a+"]+","g"),"")}function rtrim(b,a){a=a||"\\s";return b.replace(new RegExp("["+a+"]+$","g"),"")}function getScreenWidth(){var a=0;if(self.innerHeight){a=self.innerWidth}else{if(document.documentElement&&document.documentElement.clientHeight){a=document.documentElement.clientWidth}else{if(document.body){a=document.body.clientWidth}}}return a}function equalHeight(c){c=$$_(c);if(!c||c.length<2){return}var a=0;var b=[];c.each(function(f,d){if(!f){return}b[d]=f;var e=b[d].getCoordinates().height;a=(a<e)?e:a},this);b.each(function(e,d){if(!e){return}if(e.getStyle("padding-top")!=null&&e.getStyle("padding-bottom")!=null){if(a-e.getStyle("padding-top").toInt()-e.getStyle("padding-bottom").toInt()>0){e.setStyle("min-height",a-e.getStyle("padding-top").toInt()-e.getStyle("padding-bottom").toInt())}}else{if(a>0){e.setStyle("min-height",a)}}},this)}function getDeepestWrapper(a){while(a.getChildren().length==1){a=a.getChildren()[0]}return a}function fixHeight(c,b,d){c=$$_(c);b=$$_(b);d=$$_(d);if(!c||!b){return}var a=0;b.each(function(e){if(!e){return}a+=e.getCoordinates().height});if(d){d.each(function(e){if(!e){return}a-=e.getCoordinates().height})}}function addFirstLastItem(a){a=$(a);if(!a||!a.getChildren()||!a.getChildren().length){return}a.getChildren()[0].addClass("first-item");a.getChildren()[a.getChildren().length-1].addClass("last-item")}function $$_(b){if($type(b)=="string"){return $$(b)}var a=[];b.each(function(c){c=$(c);if(c){a.push(c)}});return a};
