var SITE_URL=[(location.protocol||"http:"),"//",location.hostname].join("");function isset(a){return(a!=undefined)}function valueInLimits(c,b,a){return Math.max((a!=undefined?Math.min(c,a):c),b)}var BROWSER=(function(){var ua=navigator.userAgent,webkit=/AppleWebKit/.test(ua),safari=webkit&&/Safari\//.test(ua);return{isIE:
/*@cc_on!@*/
false,isIE6:false
/*@cc_on || @_jscript_version < 5.7 @*/
||/msie 6/i.test(navigator.userAgent.toLowerCase()),isIE7:false
/*@cc_on || @_jscript_version == 5.7 @*/
||/msie 7/i.test(navigator.userAgent.toLowerCase()),isOpera:!!(window.opera&&opera.version),isOpera95:!!((window.opera&&opera.version)&&window.scrollX==undefined),isFirefox:(ua.indexOf("Firefox")!=-1),isFirefox3:(ua.indexOf("Firefox/3")!=-1),isGecko:!!(!document.attachEvent&&document.addEventListener),isWebkit:webkit,isSafari:safari&&/Version\//.test(ua),isChrome:safari&&/Chrome\//.test(ua)}})(),OPERATING_SYSTEM=(function(){var a={isLinux:navigator&&navigator.platform&&navigator.platform.search("Linux")>=0,isBsd:navigator&&navigator.platform&&navigator.platform.search(/Bsd/i)>=0};a.isUnix=(a.isLinux||a.isBsd);return a})(),DEVICE={isIpad:navigator.userAgent.match(/iPad/i)!=null,isTouchDevice:(function(){var a=document.createElement("div");a.setAttribute("ongesturestart","return;");return !!(typeof a.ongesturestart=="function"||"ontouchstart" in document.documentElement)})()};Function.prototype.inheritsFrom=function(a,b){var c=function(){};c.prototype=a.prototype;this.prototype=new c();this.prototype.constructor=this;this.superClass=a;this.prototype._parent=a.prototype;this.prototype._parentMethod=function(f){var e=Array.prototype.slice.call(arguments);if(is_function(this._parent[f])){var d=e.slice(1);return this._parent[f].call(this,d[0],d[1],d[2])}};this.prototype._superMethod=function(d){if(typeof this._parent[d]=="function"){return this._parent[d].apply(this,Array.prototype.slice.call(arguments,1))}};if(is_object(b)){$.extend(this.prototype,b)}return this};function is_function(a){return(a&&typeof(a)=="function")}function is_object(a){return(typeof(a)=="object")}function is_array(a){return(a!=null&&typeof(a)=="object"&&a.unshift!=undefined)}function is_string(a){return(typeof(a)=="string")}function is_numeric(a){return !isNaN(a)}function is_null(a){return a===null}function is_date(a){return(Object.prototype.toString.call(a)==="[object Date]"&&!isNaN(a.getTime()))}function is_valid_date(a){return(is_date(a)&&a.getDay&&!isNaN(a.getDay()))}function method_exists(b,a){return(b&&is_object(b)&&is_function((b)[a]))}if(window.jQuery){jQuery.fn.showBlock=function(){for(var b=0,a=this.length;b<a;b++){this[b].style.display="block"}return this};jQuery.fn.showInline=function(){for(var b=0,a=this.length;b<a;b++){this[b].style.display="inline"}return this};jQuery.fn.showInlineBlock=function(){for(var b=0,a=this.length;b<a;b++){this[b].style.display="inline-block";if(BROWSER.isIE){this[b].style.zoom=1;this[b].style.display="inline"}}return this};jQuery.fn.hideBlock=function(){for(var b=0,a=this.length;b<a;b++){this[b].style.display="none"}return this};jQuery.fn.searchInClass=function(c){if(this.length&&this[0]){var d=(this.attr("class")||"").split(" ");for(var b=0;b<d.length;b++){var a=d[b];if(a.search(c)==0){return a.substr(c.length)}}return""}return""};jQuery.fn.maxlength=function(f){var b=$(this),e,d;for(var c=0,a=this.length;c<a;c++){b=$(this[c]);b.bind("click keyup change",function(){d=f==undefined?parseInt(b.attr("maxlength")):f;e=b.val();if(e.length>d){b.val(e.substr(0,d))}})}return this}}function getRadioValue(e){var c=null,d;e=$name(e);if(!e){return""}for(var b=0,a=e.length;b<a;b++){d=e[b];if(d.checked){c=d.value;break}}return c}function getFileName(b){b=b.replace(/^\s|\s$/g,"");if(/\.\w+$/.test(b)){var a=b.match(/([^\/\\]+)\.(\w+)$/);if(a){return a[1]+"."+a[2]}else{return"(file)"}}else{var a=b.match(/([^\/\\]+)$/);if(a){return a[1]}else{return"(file)"}}}function selfBlur(){return this.blur()}function parseLineXML(f){if(!f){return false}var h=[],b=f.firstChild,k={};if(!b){return{}}if(b.nodeType!=1){b=b.nextSibling}for(var j=0,d=b.attributes.length;j<d;j++){var g=b.attributes[j];if(g.nodeType!=2){continue}k[g.nodeName]=g.nodeValue}for(var e=0,d=b.childNodes.length;e<d;e++){var c=b.childNodes[e];if(c.nodeType!=1){continue}h[e]={value:c.firstChild?c.firstChild.data:"",data:{}};for(var j=0,d=c.attributes.length;j<d;j++){var g=c.attributes[j];if(g.nodeType!=2){continue}h[e].data[g.nodeName]=g.nodeValue}}return{head:k,body:h}}if(typeof DOMParser=="undefined"){DOMParser=function(){return false};DOMParser.prototype.parseFromString=function(c,e){if(typeof ActiveXObject!="undefined"){var b=new ActiveXObject("MSXML.DomDocument");b.loadXML(c);return b}else{if(typeof XMLHttpRequest!="undefined"){var a=new XMLHttpRequest;a.open("GET","data:"+(e||"application/xml")+";charset=utf-8,"+encodeURIComponent(c),false);if(a.overrideMimeType){a.overrideMimeType(e)}a.send(null);return a.responseXML}}return false}}function moveCaretToStart(b){if(b.createTextRange){var a=b.createTextRange();a.collapse(true);a.select()}else{if(b.selectionStart){b.setSelectionRange(0,0);b.focus()}}}function moveCaretToEnd(a){setCaretPosition(a,$value(a).length)}function getCaretPosition(c){c=$id(c);var b=0;if(document.selection){c.focus();var a=document.selection.createRange();a.moveStart("character",-$value(c).length);b=a.text.length}else{if(c.selectionStart||c.selectionStart=="0"){b=c.selectionStart}}return b}function setCaretPosition(c,b){c=$id(c);if(c!=null){if(c.createTextRange){var a=c.createTextRange();a.move("character",b);a.select()}else{if(c.selectionStart){c.setSelectionRange(b,b);c.focus();triggerKeyPress(c,0,32);triggerKeyPress(c,8,0)}else{c.focus()}}}}function setSelection(c,d,a){c=$id(c);if(c!=null){if(c.createTextRange){var b=c.createTextRange();b.moveStart("character",d);b.moveEnd("character",a);b.select()}else{if(c.selectionStart){c.setSelectionRange(d,a);c.focus()}else{c.focus()}}}}function triggerKeyPress(e,c,b){e=$id(e);var a;if(BROWSER.isOpera){a=document.createEvent("Events");a.initEvent("keyup",true,true);try{a.keyCode=c}catch(d){}try{a.which=b}catch(d){}}else{a=document.createEvent("KeyboardEvent");if(typeof a.initKeyboardEvent=="function"){a.initKeyboardEvent("keypress",true,true,null,false,false,false,false,c,b)}else{a.initKeyEvent("keypress",true,true,null,false,false,false,false,c,b)}}e.dispatchEvent(a)}function getCaretPos(a){a=$id(a);a.focus();if(a.selectionStart){return a.selectionStart}else{if(document.selection){return getCaretPosition(a)}}return 0}function selectNode(c){c=$id(c);if(!c){return}var b,a,e,d;if((e=c.ownerDocument)&&(d=e.defaultView)&&typeof d.getSelection!="undefined"&&typeof e.createRange!="undefined"&&(b=window.getSelection())&&typeof b.removeAllRanges!="undefined"){a=e.createRange();a.selectNodeContents(c);b.removeAllRanges();b.addRange(a)}else{if(document.body&&typeof document.body.createTextRange!="undefined"&&(a=document.body.createTextRange())){a.moveToElementText(c);a.select()}}}function $id(b){var a;if(!b){return false}a=null;if(typeof(b)!="object"){if(document.getElementById(b)){a=document.getElementById(b)}}else{if(b.length!=undefined&&b.slideDown!=undefined){a=b[0]}else{a=b}}return a}function $name(b){if(!b){return false}var a=[];if(typeof(b)!="object"){a=document.getElementsByName(b)}if(a.length!=0){return a}else{return null}}function $value(a,b){a=$id(a);if(!a){return""}if(isset(b)){a.value=is_null(b)?"":b}return a.value||""}function $displaying(a){return !!((a=$id(a))&&a.offsetHeight)}function setChild(e,b,f,a,c,g){if(!e&&!b){return false}var d=$id(b);if(e&&!d&&a){e=$id(e);d=document.createElement(a);d=e.appendChild(d);if(b){d.id=b}}if(!d){return false}if(f){d.className=f}if(c){d.innerHTML=c}if(g){d=concatObjects(d,g)}return d}function unsetChild(a){a=$id(a);if(a&&a.parentNode){return a.parentNode.removeChild(a)}return false}function searchInClass(c,d){c=$id(c);if(c&&c.className){var e=c.className.split(" ");for(var b=0;b<e.length;b++){var a=e[b];if(a.search(d)==0){return a.substr(d.length)}}}return undefined}function setChildExt(e){var d={parent:document.body,setType:"append",tag:"DIV",id:"",baseDocument:document};if(is_string(e)){e={className:e}}e=concatObjects(e,d);var c=$id(e.id);if(c){return c}var b=$id(e.parent);if(e.name&&BROWSER.isIE){c=e.baseDocument.createElement("<"+e.tag+' name="'+e.name+'">')}else{c=e.baseDocument.createElement(e.tag);if(e.name){c.name=e.name}}if(!c){return false}if(e.id){c.id=e.id}if(e.type){c.type=e.type}if(isset(e.value)){c.value=e.value}if(e.className){c.className=e.className}if(e.content){c.innerHTML=e.content}if(isset(e.title)){c.title=e.title}if(e.params&&is_object(e.params)){for(var a in e.params){c[a]=e.params[a]}}if(e.style&&is_object(e.style)){setStyle(c,e.style)}if(e.onclick&&is_function(e.onclick)){c.onclick=e.onclick}if(e.onfocus&&is_function(e.onfocus)){c.onfocus=e.onfocus}if(e.onmouseover&&is_function(e.onmouseover)){c.onmouseover=e.onmouseover}if(e.onmouseout&&is_function(e.onmouseout)){c.onmouseout=e.onmouseout}switch(e.setType){case"insertBefore":c=b.parentNode.insertBefore(c,b);break;case"append":c=b.appendChild(c);break}if(e.child&&is_object(e.child)){setChildExt(concatObjects(e.child,{parent:c}))}if(e.children&&is_object(e.children)){for(var a in e.children){var f=e.children[a];if(!is_object(f)){continue}setChildExt(concatObjects(f,{parent:c}))}}if(isset(e.checked)){c.checked=e.checked}if(isset(e.selected)){c.selected=e.selected}if(isset(e.disabled)){c.disabled=e.disabled}if(e.handlerFunction&&is_function(e.handlerFunction)){e.handlerFunction(c)}return c}function setChildren(d,c){d=$id(d);if(!d){d=document.body}if(!is_object(c)){return false}for(var b=0;b<c.length;b++){var a=c[b];if(is_string(a)){a={className:a}}d=setChildExt(rConcatObjects(a,{parent:d}))}return d}function setStyle(b,a){b=$id(b);if(!b||!a||!b.style||typeof a!="object"){return false}var g=["top","left","width","height"];for(var d in a){var c=a[d];try{if(typeof c!="object"&&typeof c!="function"){b.style[d]=c+((in_array(g,d)&&!isNaN(c))?"px":"")}}catch(f){document.writeln("error "+b+": "+d+"="+c)}}return true}function $where(d){var a=$id(d),c=0,b=0;if(!a){return false}while(d){c+=d.offsetLeft;b+=d.offsetTop;d=d.offsetParent}return{left:c,top:b,right:c+a.offsetWidth,bottom:b+a.offsetHeight}}function getWhereIs(a){return $where(a)}function getWhereIsEvent(a){if(a.pageX){return{left:a.pageX,top:a.pageY}}return{left:a.clientX+document.body.parentElement.scrollLeft,top:a.clientY+document.body.parentElement.scrollTop}}function placeUnderCursor(b,a,c){b=$id(b);if(!b){return false}b.style.position="absolute";b.style.left=(a-b.offsetWidth+10)+"px";b.style.top=(c-5)+"px"}function setPosition(a,b){a=$id(a);if(!a){return false}if(b.left!=null){a.style.left=b.left+"px"}if(b.top!=null){a.style.top=b.top+"px"}return false}function putInScreenCenter(a,i,b,c){a=$id(a);if(!a){return false}a.style.position="absolute";var d=(window.opera)?window.innerHeight:document.documentElement.clientHeight,g=(document.all)?document.documentElement.scrollTop:window.pageYOffset,e=Math.max(0,Math.round(g+d/2-a.clientHeight/2)+(b||0)),h=document.documentElement.offsetWidth,f=i?Math.round(h/2-a.offsetWidth/2):null;if(document.all){e-=30}setPosition(a,{left:f,top:e})}function toggleClass(d,e,c){c=c?c:["hidden","showed"];d=$id(d);if(!d){return false}var a="/"+c[0]+"/",f=(e==null)?((d.className.search(c[0])>-1)?1:0):e,b=(f==0)?1:0;if(d.className!=null&&d.className.search(c[b])>-1){d.className=d.className.replace(c[b],c[f])}else{if(d.className!=null&&d.className.search(c[f])<0){d.className+=" "+c[f]}}return f}function getScrollBarWidth(){var c=document.createElement("p"),b,a;c.style.width="100%";c.style.height="200px";var d=document.createElement("div");d.style.position="absolute";d.style.top="0px";d.style.left="0px";d.style.visibility="hidden";d.style.width="200px";d.style.height="150px";d.style.overflow="hidden";d.appendChild(c);document.body.appendChild(d);b=c.offsetWidth;d.style.overflow="scroll";a=c.offsetWidth;if(b==a){a=d.clientWidth}document.body.removeChild(d);return(b-a)}var $drag;(function(){var d={};function b(i,k,f,h){d.This=$id(k);d.Target=$id(f);if(!d.This||!d.Target){throw new Error("error dragging "+d.Target);return false}d.$target=$(d.Target);var j=d.$target.offset();d.StartLeft=parseInt(d.$target.css("left"));d.StartTop=parseInt(d.$target.css("top"));if(isNaN(d.StartLeft)){d.StartLeft=j.left}if(isNaN(d.StartTop)){d.StartTop=j.top}var g={minLeft:1,minTop:1};d.settings=concatObjects(h,g);if(d.settings.onbegin){d.settings.onbegin(d.Target,i,d.settings)}if(!isNaN(d.settings.maxXDelta)){d.settings.minLeft=d.StartLeft-d.settings.maxXDelta;d.settings.maxLeft=d.StartLeft+d.settings.maxXDelta}if(isset(d.settings.maxYDelta)){d.settings.minTop=d.StartTop-d.settings.maxYDelta;d.settings.maxTop=d.StartTop+d.settings.maxYDelta}var e=new Object();if(BROWSER.isIE||BROWSER.isOpera95){e.x=window.event.clientX+document.documentElement.scrollLeft+document.body.scrollLeft;e.y=window.event.clientY+document.documentElement.scrollTop+document.body.scrollTop}else{if(BROWSER.isGecko||BROWSER.isOpera){e.x=i.clientX+window.scrollX;e.y=i.clientY+window.scrollY}}d.cursorStartX=e.x;d.cursorStartY=e.y;d.Target.style.position="absolute";if(BROWSER.isIE){document.attachEvent("onmousemove",a);document.attachEvent("onmouseup",c);window.event.cancelBubble=true;window.event.returnValue=false}else{if(BROWSER.isGecko||BROWSER.isOpera){document.addEventListener("mousemove",a,true);document.addEventListener("mouseup",c,true);i.preventDefault()}}}function a(f){var h,g,e,i;if(BROWSER.isIE||BROWSER.isOpera95){e=window.event.clientX+document.documentElement.scrollLeft+document.body.scrollLeft;i=window.event.clientY+document.documentElement.scrollTop+document.body.scrollTop}else{if(BROWSER.isGecko||BROWSER.isOpera){e=f.clientX+window.scrollX;i=f.clientY+window.scrollY}}h=d.StartLeft+e-d.cursorStartX;h=valueInLimits(h,d.settings.minLeft,d.settings.maxLeft);d.Target.style.left=h+"px";g=d.StartTop+i-d.cursorStartY;g=valueInLimits(g,d.settings.minTop,d.settings.maxTop);d.Target.style.top=g+"px";if(BROWSER.isIE){window.event.cancelBubble=true;window.event.returnValue=false}if(BROWSER.isGecko||BROWSER.isOpera95){f.preventDefault()}if(d.settings.onmove){d.settings.onmove(d.Target,h,g)}}function c(e){if(BROWSER.isIE){document.detachEvent("onmousemove",a);document.detachEvent("onmouseup",c)}if(BROWSER.isGecko||BROWSER.isOpera){document.removeEventListener("mousemove",a,true);document.removeEventListener("mouseup",c,true)}if(d.settings.oncomplete&&is_function(d.settings.oncomplete)){d.settings.oncomplete(d.Target)}}$drag=function(g,h,e,f){b(g,h,e,f)};if(window.jQuery){(function(i){var e="dragging-over",h="_dragTrackingOffset",g=function(j,m,l){var k;j.area&&i.each(j.area,function(){var o=i(this),q=o.data(h)||o.offset(),p={left:0,top:0,leftFactor:0,topFactor:0},n=(m>=q.left&&l>=q.top&&m<=(q.right||(q.right=q.left+o.outerWidth()))&&l<=(q.bottom||(q.bottom=q.top+o.outerHeight())));if(n){p={left:m-q.left,top:l-q.top};p.leftFactor=p.left/(q.right-q.left);p.topFactor=p.top/(q.bottom-q.top)}o.toggleClass(e,n);if(k!==false){k=n}j.handler&&j.handler(o,n,p)});return k},f=function(j){j.area&&i.each(j.area,function(){i(this).data(h,null).removeClass(e)})};i.fn.allowDrag=function(u){var B={useClone:false,trackAreas:[],useMoveCursor:true},m,r,k,z,v,n,q,o,p,s,j,A=[],w,t={setTrackAreas:function(E,C){!C&&(A=[]);for(var F=0,D=E.length;F<D;F++){if(i.isFunction(E[F])){A.push({area:w,handler:E[F]});w=undefined}else{if(!w){w=i(E[F])}else{w=w.add(i(E[F]))}}}if(w){A.push({area:w})}}};u&&i.extend(B,u);if(B.trackAreas.length){t.setTrackAreas(B.trackAreas)}if(typeof(B.dragger)=="object"){k=i(B.dragger)}else{if(typeof(B.dragger)=="string"){z=B.dragger}}i.data(this,"_dragControl",t);for(var y=0,x=this.length;y<x;y++){m=i(this[y]);if(z){k=i(z,m)}else{k=is_object(B.dragger)?i(B.dragger):m}B.useMoveCursor&&k.css({cursor:"move"});if(B.useClone){n=B.oncomplete;v=B.onmove;k.mousedown(function(l){o=m.width();p=m.height();r=m.clone().addClass("dragging-clone").css({position:"absolute",zIndex:10010}).css(m.offset()).width(o).height(p).appendTo(document.body);B.oncomplete=function(){i(document.body).removeClass("dragging-process");q=r.offset();r.remove();n&&n(m,q);if(A.length){for(var D=0,C=A.length;D<C;D++){f(A[D])}}};B.onmove=function(G,F,E){s=F+o;j=E+p;if(A.length){for(var D=0,C=A.length;D<C;D++){g(A[D],(F+s)*0.5,E)}}v&&v.apply(this,arguments)};i(document.body).addClass("dragging-process");b(l,m,r,B)})}else{m.mousedown(function(l){b(l,k||m,m,B)})}}return this}})(jQuery)}})();function in_array(a,c){var b=0;for(var d in a){if(c==a[d]){b++}}return b}function setArray(c){if(is_array(c)){return c}else{var b=[];isset(c)&&b.push(c);return b}}function array_rearrange(b,a,e){var d=b[a];b.splice(a,1);b.splice(e,0,d);return b}function array_rand(a){var b=a.length;var c=(Math.round(Math.random()*(b-1))).between(0,b-1);return a[c]}function storage(c,b,a){if(b!=undefined){if(typeof b=="object"){$.extend(c,b)}else{if(a==undefined){return c[b]}else{c[b]=a}}}return c}function _prop(e,f){if(e&&f&&(f in e)){return e[f]}var d=f.split("."),c;if(!e||!f){return undefined}if(d.length){c=e;for(var b=0,a=d.length;b<a;b++){if(c==undefined){return undefined}c=c[d[b]]}return c}else{return e[f]}}function concatObjects(e,d,c){var b={};for(var a in e){b[a]=e[a]}for(var a in d){if(c&&is_object(d[a])&&is_object(b[a])){b[a]=concatObjects(b[a],d[a])}else{if(!isset(b[a])){b[a]=d[a]}}}return b}function rConcatObjects(b,a){return concatObjects(b,a,"recursive")}function duplicateObject(c){if(is_date(c)){return c}var b=is_array(c)?[]:{};for(var a in c){if(is_object(c[a])){b[a]=duplicateObject(c[a])}else{b[a]=c[a]}}return b}function removeFromObject(c,b){var d={};for(var a in c){if(a!=b){d[a]=c[a]}}return d}function testObject(f,m,a,b){var d="",j=m?"<br/>":"\n";if(!b){b=0}var h="";var l=256;for(var e=0;e<b;e++){h+="  "}if(b>256){return"..too much iterations"}if(is_object(f)){var g=0;for(var c in f){if(++g>l){return"..too much iterations"}var n=f[c];var k=typeof(n);if(n==null){k="Null"}else{if(n.pop){k="Array"}else{if(n.charAt||n==""){k="String"}else{if(!isNaN(Number(n))){k="Number"}}}}if(is_function(n)){continue}d+=j+h+c+"["+k+"]: ";if(is_object(n)){d+=testObject(n,false,true,b+1)}else{d+=n}}}else{d+=h+f}if(m){document.write("<pre>"+d+"</pre>")}else{if(!a){alert(d)}}return d}function dumpObject(f,d,c){var g="",a=d?"<br/>":"\n";for(var e in f){var b=f[e];g+=e+"=>"+b+a}if(d){document.write(g)}else{if(!c){alert(g)}}return g}function getKeyPressed(f){var c=new Array();c[9]="TAB";c[13]="ENTER";c[27]="ESC";c[35]="END";c[36]="HOME";c[37]="ARROWLEFT";c[38]="ARROWUP";c[39]="ARROWRIGHT";c[40]="ARROWDOWN";var a=-1,d;if(window.event){a=event.keyCode;d=event.srcElement}else{a=f.which;d=f.target}var b=(c[a])?c[a]:a;return b}function blockScreen(b){if($id("blockscreen")){return false}var a=setChildExt({id:"blockscreen",className:b||""});resizeBlockScreen()}function unblockScreen(){if(!$id("blockscreen")){return false}unsetChild("blockscreen")}function resizeBlockScreen(){var a=$id("blockscreen");if(!a){return false}var b=$id("body-wrap")?$id("body-wrap").clientHeight:$id("page-body-wrap")?$id("page-body-wrap").clientHeight:0;var c={height:Math.max(document.documentElement.clientHeight,document.body.clientHeight,b),width:Math.max(document.documentElement.clientWidth,document.body.clientWidth)};setStyle(a,c);return true}if(window.jQuery){jQuery(window).resize(resizeBlockScreen)}function paramString(c,d){if(typeof c!="object"){return c}var b=[];for(var a in c){b.push(a+"="+(d?encodeURIComponent(c[a]):c[a]))}return b.join("&amp;")}function parseParamString(e){var d={};var c=e.split("?").pop().split("&");for(var b=0;b<c.length;b++){var a=c[b].split("=");d[a[0]]=a[1]}return d}function buildFlashExt(d){var c={version:7,width:"100%",height:"100%",name:"flashmovie",wmode:"transparent",isWrite:false},a,b;d=concatObjects(d,c);a=d.params?paramString(d.params,true):"";if(!FLASH_CHECKING.DetectFlashVer(d.version)){if(typeof d.noFlash=="function"){d.noFlash()}else{if(d.noFlash!=undefined){b=d.noFlash.toString()}}}else{b=BROWSER.isIE?["<","object ",'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ','width="',d.width,'" ','height="',d.height,'" ','id="',d.name,'">',"<",'param name="movie" value="',d.src,'">',"<",'param name="wmode" value="',d.wmode,'" />',"<",'param name="quality" value="high">',"<",'param name="allowScriptAccess" value="always" />','<param name="menu" value="false" />','<param name="FlashVars" value="',a,'" />',"<","/object>"].join(""):["<","embed ",'src="',d.src,'" ','quality="high" ','wmode="',d.wmode,'" ','width="',d.width,'" ','height="',d.height,'" ','name="',d.name,'"  ','id="',d.name,'" ','menu="false" ','allowscriptaccess="always" ','type="application/x-shockwave-flash" ','flashvars="',a,'"/>'].join("")}d.isWrite&&document.write(b);return b}function $flash(a){return buildFlashExt(a)}function $flashMovie(a){return BROWSER.isIE?window[a]:document.getElementById(a)}var FLASH_CHECKING={isIE:(navigator.appVersion.indexOf("MSIE")!=-1)?true:false,isWin:(navigator.appVersion.toLowerCase().indexOf("win")!=-1)?true:false,isOpera:(navigator.userAgent.indexOf("Opera")!=-1)?true:false,ControlVersion:function(){var a;var b;var c;try{b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");a=b.GetVariable("$version")}catch(c){}if(!a){try{b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");a="WIN 6,0,21,0";b.AllowScriptAccess="always";a=b.GetVariable("$version")}catch(c){}}if(!a){try{b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");a=b.GetVariable("$version")}catch(c){}}if(!a){try{b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");a="WIN 3,0,18,0"}catch(c){}}if(!a){try{b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");a="WIN 2,0,0,11"}catch(c){a=-1}}return a},GetSwfVer:function(){var g=-1;if(navigator.plugins!=null&&navigator.plugins.length>0){if(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]){var f=navigator.plugins["Shockwave Flash 2.0"]?" 2.0":"";var a=navigator.plugins["Shockwave Flash"+f].description;var e=a.split(" ");var c=e[2].split(".");var h=c[0];var b=c[1];var d=e[3];if(d==""){d=e[4]}if(d[0]=="d"){d=d.substring(1)}else{if(d[0]=="r"){d=d.substring(1);if(d.indexOf("d")>0){d=d.substring(0,d.indexOf("d"))}}}var g=h+"."+b+"."+d}}else{if(navigator.userAgent.toLowerCase().indexOf("webtv/2.6")!=-1){g=4}else{if(navigator.userAgent.toLowerCase().indexOf("webtv/2.5")!=-1){g=3}else{if(navigator.userAgent.toLowerCase().indexOf("webtv")!=-1){g=2}else{if(this.isIE&&this.isWin&&!this.isOpera){g=this.ControlVersion()}}}}}return g},DetectFlashVer:function(f,d,c){versionStr=this.GetSwfVer();if(versionStr==-1){return false}else{if(versionStr!=0){if(this.isIE&&this.isWin&&!this.isOpera){tempArray=versionStr.split(" ");tempString=tempArray[1];versionArray=tempString.split(",")}else{versionArray=versionStr.split(".")}var e=versionArray[0];var a=versionArray[1];var b=versionArray[2];if(e>=parseFloat(f)){return true}else{if(e==parseFloat(f)){if(a>parseFloat(d)){return true}else{if(a==parseFloat(d)){if(b>=parseFloat(c)){return true}}}}}return false}}}};function popUp(b){var a={url:"",width:350,height:600,top:200,left:200,menubar:"no",directories:"no",location:"no",resizable:"yes",scrollbars:"no",toolbar:"no"};b=concatObjects(b,a);if(b.width){b.width+=20}if(b.height){b.height+=20}if(b.content){b.url=""}POPUP_WIN=window.open(b.url,"POPUP_WINDOW",(function(){var c=[];for(var d in b){if(d!="url"&&b[d]){c.push(d+"="+b[d])}}return c.join(", ")})());if(b.content){if(!POPUP_WIN.document.body){b.content="<body>"+b.content+"</body>"}POPUP_WIN.document.open();POPUP_WIN.document.write("<head><title>"+(b.title||"")+'</title><style type="text/css">A{cursor:pointer;}</style></head>'+b.content);POPUP_WIN.document.title=(b.title||"");POPUP_WIN.document.close()}return false}function _tmpl(tmpl,ns,actions){if(!tmpl){return""}var fn=function(w,g){g=g.split("|");var cnt=_prop(ns,g[0]);for(var i=1,l=g.length;i<l;i++){cnt=eval(g[i])(cnt)}return isset(cnt)?cnt:""};return tmpl.replace(/\%\(([A-Za-z0-9_|.]+)\)/g,fn)}function trimStr(b,a){a=!a?" \\s\\xA0":a.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g,"$1");return b?b.replace(new RegExp("^["+a+"]+|["+a+"]+$","g"),""):""}function NtoBR(b){var a=new RegExp(/\r?\n/i);while(b.search(a)>=0){b=b.replace(a,"<br>")}return b}function BRtoN(a){a=a.replace(/<br\s*\/?>/i,"\n");return a}function str_quote(a,b){return a?(b||"'")+a+(b||"'"):""}function wrapBreakWord(b,a){if(!a){a=15}if(BROWSER.isIE){return b}b=b.replace(new RegExp("(.{"+a+"})","ig"),'<span class="wrap-quantum">$1</span>');return b}function parseTemplate(c,g){var f=new RegExp(/\{\%\w+\%\}/);var b=0;while(c.search(f)>0&&++b<10){var h=c.search(f)+2;var a=h;var e;var d="";do{d+=c.charAt(a++)}while(c.charAt(a)!="%"&&c.charAt(a+1)!="}"&&a<(c.length-1));c=c.substr(0,h-2)+(g[d]||"")+c.substr(a+2)}return c}function getDomainName(a){if(!a){return""}if(a.search(/http:\/\//i)==0){a=a.slice(7)}else{if(a.search(/https:\/\//i)==0){a=a.slice(8)}}if(a.search(/www\./i)==0){a=a.slice(4)}if(a.substr(-1)=="/"){a=a.slice(0,-1)}return a}function getHost(c){var e,b,a;if(c){e=c.toString().split("://");return e.shift()+"://"+e.join("://").split("/").shift()}}function removeUrlSchema(a){return a?a.replace(/^(?:https?:\/\/)/i,""):""}function isClickableUrl(a){return !!/^https?:\/\/|ftp:\/\//i.test(a)}function makeUrl(a){return(/https?:\/\//i.test(a)?"":"http://")+a}function parseUrl(b,c){if(typeof b=="undefined"){b=location.href}var d="^(([^:/\\?#]+):)?(//(([^:/\\?#]*)(?::([^/\\?#]*))?))?([^\\?#]*)(\\?([^#]*))?(#(.*))?$",f=new RegExp(d),e=f.exec(b),a={href:e[0]||"",protocol:e[1]||"",host:e[4]||"",hostname:e[5]||"",port:e[6]||"",pathname:e[7]||"/",search:e[8]||"",hash:e[10]||""};return c?a[c]:a}function getHostName(a){return parseUrl(a,"host")}function UrlComposer(d,b){var a={parts:[],query:{},hash:undefined},c={parts:function(){var g=arguments.length;if(g==1&&$.isArray(arguments[0])){for(var f=0,e=arguments[0].length;f<e;f++){c.parts(arguments[0][f])}}else{if(g>1){for(var f=0,e=arguments.length;f<e;f++){c.parts(arguments[f])}}else{if(g==1&&typeof arguments[0]!="undefined"){a.parts.push(arguments[0])}}}return this},query:function(){var g=arguments.length;if(g==2&&!$.isPlainObject(arguments[0])&&!$.isPlainObject(arguments[1])){a.query[arguments[0]]=("boolean"==(typeof arguments[1]).toLowerCase())?+arguments[1]:arguments[1]}else{if(g>=2){for(var f=0,e=arguments.length;f<e;f++){c.query(arguments[f])}}else{if(g==1&&$.isPlainObject(arguments[0])){a.query=$.extend({},a.query,arguments[0])}}}return this},hash:function(e){if(typeof e=="undefined"){a.hash=undefined}else{a.hash=e.toString()}return this},parse:function(g){if(typeof g=="undefined"){g=location.href}var j=parseUrl(g),f,k;c.parts(j.pathname.split("/"));if(j.search){f=j.search.substr(1).split("&");for(var h=0,e=f.length;h<e;h++){k=f[h].split("=");c.query(k[0],k[1])}}if(j.hash){a.hash=j.hash}return this},compose:function(){var f="",e=[];$.each(a.query,function(g){e.push(g+"="+this.toString())});return a.parts.join("/")+(e.length?"?"+e.join("&"):"")+(typeof a.hash!="undefined"?"#"+a.hash:"")},toString:function(){return this.compose()},toObject:function(){return $.extend({},a)}};if(d&&d.length){c.parts(d)}if(b){c.query(b)}return c}function isEmail(b){var a=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i;return b?a.test(b):false}function getNumeralEndingType(a){var c=a%10,b=0;if(c>0&&c<=4){b=c}if(a%100>=11&&a%100<=14){b=0}return b}function getPopped(c,a){if(!a){a="_"}var b=c.split(a);b.pop();return b.join(a)}String.prototype.popped=function(a){if(!a){a="_"}var b=this.split(a);b.pop();return b.join(a)};String.prototype.firstCharUpper=function(){return this.substr(0,1).toUpperCase()+this.substr(1)};String.prototype.isNullDate=function(){return(this=="0000-00-00 00:00:00")};String.prototype.html_entity_decode=function(){return this.replace_multiply([[/\&nbsp\;/," "],[/\&mdash\;/,"—"]])};function htmlspecialchars(a){return a?String(a).htmlspecialchars():""}String.prototype.htmlspecialchars=function(){var a=String(this);a=a.replace(/\&(?:.{6})?/g,function(b,d,c){if(/^\&(nbsp|amp|laquo|raquo|quot);/.test(b)){return b}return"&amp;"+b.substr(1)});a=a.replace_multiply([["<","&lt;"],[">","&gt;"],['"',"&quot;"],["«","&laquo;"],["»","&raquo;"]]);return a};function htmlspecialquotes(a){return a?a.replace_multiply([[/\"/,"&quot;"],[/«/,"&laquo;"],[/»/,"&raquo;"]]):""}function strip_tags(c,b){var a="<.*?>";if(b){a="<\\/?s*(?:"+($.isArray(b)?b.join("|"):b.toString())+")(\\s[^>]+)*>"}return c.toString().replace(new RegExp(a,"g"),"")}function typo(a){if(!a){return""}a=a.toString();a=a.replace(/([\s\,\.\;\?\!\:])([а-яА-ЯёЁ]{1,2})\s/g,"$1$2&nbsp;");a=a.replace(/([\s\,\.\;\?\!\:])(\d+)\s/g,"$1$2&nbsp;");a=a.replace(/([\s\,\.\;\?\!\:])\"([а-яА-ЯёЁ0-9\,\!\:\-\s]+)\"([\s\,\.\;\?\!\:])/g,"$1&laquo;$2&raquo;$3");return a}String.prototype.replace_multiply=function(c){var b=this;for(var a in c){var e=c[a];if(!e||!isset(e[0])||!isset(e[1])){continue}if(e[0] instanceof RegExp){while(b.search(e[0])>=0){b=b.replace(e[0],e[1])}}else{b=b.replace(new RegExp(e[0],"g"),e[1])}}return b};String.prototype.nl2br=function(){return NtoBR(this)};String.prototype.truncate=function(a,e,c){if(isNaN(a)){a=30}if(this.length<=a){return this}var d=this.slice(0,a),b;if(d){if(e&&(b=d.match(/^(.+)[\s\,\.]+.+$/))&&b[1]){d=b[1]}d+=typeof c=="undefined"?"...":c}return d};String.prototype.rmnl=function(){var a=new RegExp(/\r?\n/i);return this.replace_multiply([[/\r?\n/i,""],[/\t/,""]])};String.prototype.dateStr=function(){if(this.isNullDate()){return}var a=new Date();return a.getFromDT(this).getReadable()};String.prototype.dateStrFull=function(){if(this.isNullDate()){return}var a=new Date();return a.getFromDT(this).getReadableFull()};String.prototype.dateReadableSimpleStr=function(){if(!this.length||this.isNullDate()){return}var a=new Date();return a.getFromDT(this).getReadableSimple()};String.prototype.dateGetHoursFromDt=function(){if(this.isNullDate()){return}var a=new Date();return String(a.getFromDT(this).getHours()).setDigits()};String.prototype.dateGetMinutesFromDt=function(){if(this.isNullDate()){return}var a=new Date();return String(a.getFromDT(this).getMinutes()).setDigits()};String.prototype.dateFromDt=function(){if(this.isNullDate()){return}return(new Date()).getFromDT(this)};String.prototype.dateFromTs=function(){if(this.isNullDate()){return}return(new Date()).getFromTimeStamp(this)};String.prototype.dateFromTsStr=function(){return(new Date()).getFromTsStr(this)};String.prototype.isTime=function(){return(this.search(/^\d{1,2}\:\d{1,2}(\:\d{1,2})?$/)>=0)};String.prototype.isDate=function(){return this.match(/^\d{4}\-\d{2}\-\d{2}(\s\d{2}:\d{2}:\d{2})?$/)};String.prototype.parseTime=function(){if(!this.isTime()){return{}}var a=this.split(":");return{h:Number(a[0]),m:Number(a[1]),s:Number(a[2])}};String.prototype.setDigits=function(b){if(isNaN(b)){b=2}var d=this,a="",f="",e=0;if(d.charAt(0)=="-"){a="-";d=d.slice(1)}if(d.length<b){e=b-d.length;for(var c=0;c<e;c++){f+="0"}d=f+d}return a+d};String.prototype.twoDigits=function(){if(this.length<2){return"0"+this}return this};Number.prototype.setDigits=function(a){return(String(this)).setDigits(a)};Number.prototype.between=function(d,c){return(Math.min(Math.max(this,Math.min(d,c)),Math.max(d,c)))};Number.prototype.isBetween=function(d,c){return(this>d&&this<c)};Number.prototype.isBetween_s=function(d,c){return(this>=d&&this<=c)};Number.prototype.format=function(){return String(this).numberFormat()};function outputFormat(a){if(is_numeric(a)){a=Number(a).format()}return a}Number.prototype.roundFloat=function(a){a=(a==undefined?2:a);return Math.round(this*Math.pow(10,a))/Math.pow(10,a)};String.prototype.numberFormat=function(c){var g=c!=undefined?String(Number(this).roundFloat(c)):this,b=g.split("."),e=b.shift(),d=b.shift(),a="",f=[];while(e.length>2){f.unshift(e.substr(e.length-3,e.length));e=e.substr(0,e.length-3)}if(e.length){f.unshift(e)}if(c){d=(function(){var j="";d==undefined&&(d="");if(d.length<c){for(var h=0;h<(c-d.length);h++,j+="0"){}}return d+j})()}return['<span class="nmf"><span class="nmf-g">',f.join('</span><span class="nmf-g">'),"</span>",(d?","+d:""),"</span>"].join("")};function ip2long(a){var b=a.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);return b?b[1]*16777216+b[2]*65536+b[3]*256+b[4]*1:false}function long2ip(b){var a=false;if(!isNaN(b)&&(b>=0||b<=4294967295)){a=Math.floor(b/Math.pow(256,3))+"."+Math.floor((b%Math.pow(256,3))/Math.pow(256,2))+"."+Math.floor(((b%Math.pow(256,3))%Math.pow(256,2))/Math.pow(256,1))+"."+Math.floor((((b%Math.pow(256,3))%Math.pow(256,2))%Math.pow(256,1))/Math.pow(256,0))}return a}function bindec(a){a=(a+"").replace(/[^01]/gi,"");return parseInt(a,2)}function decbin(a){if(a<0){a=4294967295+a+1}return parseInt(a,10).toString(2)}var ColorsConverter={hex2rgb:function(b){var a=new Array();a[0]=b>>16;a[1]=b>>8&255;a[2]=b&255;return a},rgb2hex:function(a){var b=a[0]<<16^a[1]<<8^a[2];return b},hsb2rgb:function(d){var c,k,h,e,g,b,a,j;d[0]%=360;if(d[2]==0){return(new Array(0,0,0))}d[1]/=100;d[2]/=100;d[0]/=60;e=Math.floor(d[0]);g=d[0]-e;b=d[2]*(1-d[1]);a=d[2]*(1-(d[1]*g));j=d[2]*(1-(d[1]*(1-g)));if(e==0){c=d[2];k=j;h=b}else{if(e==1){c=a;k=d[2];h=b}else{if(e==2){c=b;k=d[2];h=j}else{if(e==3){c=b;k=a;h=d[2]}else{if(e==4){c=j;k=b;h=d[2]}else{if(e==5){c=d[2];k=b;h=a}}}}}}c=Math.floor(c*255);k=Math.floor(k*255);h=Math.floor(h*255);return(new Array(c,k,h))},rgb2hsb:function(d){var a,g,e,c,b,h;d[0]/=255;d[1]/=255;d[2]/=255;a=Math.min(Math.min(d[0],d[1]),d[2]);h=Math.max(Math.max(d[0],d[1]),d[2]);if(a==h){return(new Array(undefined,0,h*100))}g=(d[0]==a)?d[1]-d[2]:((d[1]==a)?d[2]-d[0]:d[0]-d[1]);e=(d[0]==a)?3:((d[1]==a)?5:1);c=Math.floor((e-g/(h-a))*60)%360;b=Math.floor(((h-a)/h)*100);h=Math.floor(h*100);return(new Array(c,b,h))},hsb2hex:function(a){var b=this.hsb2rgb(a);return(this.rgb2hex(b))},hex2hsb:function(b){var a=this.hex2rgb(b);return(this.rgb2hsb(a))}};var MONTHS=[_("January (gn)"),_("February (gn)"),_("March (gn)"),_("April (gn)"),_("May (gn)"),_("June (gn)"),_("July (gn)"),_("August (gn)"),_("September (gn)"),_("October (gn)"),_("November (gn)"),_("December (gn)")],MONTHS_SHORT=[_("Jan"),_("Feb"),_("Mar"),_("Apr"),_("May (sh)"),_("Jun"),_("Jul"),_("Aug"),_("Sep"),_("Oct"),_("Nov"),_("Dec")],MONTHS_NOMINATIVE=[_("January"),_("February"),_("March"),_("April"),_("May"),_("June"),_("July"),_("August"),_("September"),_("October"),_("November"),_("December")],MONTHS_LENGTHS=[31,((new Date).getFullYear()%4?28:29),31,30,31,30,31,31,30,31,30,31],WEEKDAYS=[_("Mo"),_("Tu"),_("We"),_("Th"),_("Fr"),_("Sa"),_("Su")],WEEKDAYS_FULL=[_("Monday"),_("Tuesday"),_("Wednesday"),_("Thursday"),_("Friday"),_("Saturday"),_("Sunday")];function getMonthLength(a,b){return a==1?isLeapYear(b)?29:28:MONTHS_LENGTHS[a]}function isLeapYear(a){if(!a){a=(new Date()).getFullYear()}return(new Date(a,1,29)).getMonth()==1?true:false}Date.prototype.getReadable=function(){return this.getDate()+"&nbsp;"+MONTHS[this.getMonth()]+"&nbsp;"+this.getFullYear()};Date.prototype.getReadableShort=function(){return this.getDate()+"&nbsp;"+MONTHS_SHORT[this.getMonth()]};Date.prototype.getMonthReadable=function(){return MONTHS_NOMINATIVE[this.getMonth()]+"&nbsp;"+this.getFullYear()};Date.prototype.getWeekReadable=function(){var a=this.duplicate().getWeek(),b=a.begin.getFullYear()==a.end.getFullYear()?"":" "+a.begin.getFullYear();return[a.begin.getReadableShort(),b,"&nbsp;&mdash; ",a.end.getReadableShort()," ",a.end.getFullYear()].join("")};Date.prototype.getWeekReadableShort=function(){var a=this.duplicate().getWeek();return[a.begin.format("d"+(a.begin.getMonth()==a.end.getMonth()?"":" M")),"&nbsp;&mdash; ",a.end.format("d M")].join("")};Date.prototype.getHourReadable=function(){return[this.duplicate().offset({hours:-1}).format("H:i"),"&nbsp;&mdash; ",this.format("H:i")].join("")};Date.prototype.getReadableFull=function(){return _("-dateFullStr",this.getDate(),MONTHS[this.getMonth()],this.getFullYear(),this.getHours().setDigits(),this.getMinutes().setDigits())};Date.prototype.getReadableSimple=function(){var c=this.getDate().toString(),a=(this.getMonth()+1).toString(),e=this.getFullYear().toString();if(c.length<2){c="0"+c}if(a.length<2){a="0"+a}var b=c+"."+a+"."+e;return b};Date.prototype.getPeriodReadable=function(a){var b=a.greater(this)?[this,a]:[a,this];sameYear=b[0].getFullYear()==b[1].getFullYear()?" "+b[0].getFullYear():"",sameMonth=sameYear&&b[0].getMonth()==b[1].getMonth()?" "+b[0].format("F"):"";return sameMonth?[b[0].format("j"),"&nbsp;&mdash; ",b[1].format("j M Y")].join(""):[b[0].format("j F"),(sameYear?"":" "+b[0].getFullYear()),"&nbsp;&ndash; ",b[1].format("j F"),(sameYear?"":" "+b[1].getFullYear()),sameYear].join("")};Date.prototype.toDT=function(){var g=this.getDate().toString(),a=(this.getMonth()+1).toString(),f=this.getFullYear().toString(),c=this.getHours().toString(),b=this.getMinutes().toString(),e=this.getSeconds().toString();return[f.setDigits(4),"-",a.setDigits(2),"-",g.setDigits(2)," ",c.setDigits(2),":",b.setDigits(2),":",e.setDigits(2)].join("")};Date.prototype.getDateStr=function(){return this.format("Y-m-d")};Date.prototype.getTimeStr=function(){return this.toDT().split(" ").pop()};Date.prototype.getTimeStamp=function(){var b=this.getDate(),a=this.getMonth()+1,c=this.getFullYear();if(b<10){b="0"+b}if(a<10){a="0"+a}return["",c,a,b,"000000"].join("")};Date.prototype.getFullTimeStamp=function(){return this.format("YmdHis")};Date.prototype.getTsShort=function(){return[this.getFullYear().toString(),String(this.getMonth()+1).setDigits(),String(this.getDate()).setDigits()].join("")};Date.prototype.getFromTimeStamp=function(e){e=e+"";var i=Number(e.substr(0,4)),a=Number(e.substr(4,2))-1,g=Number(e.substr(6,2))||1,c=Number(e.substr(8,2))||0,f=Number(e.substr(10,2))||0,b=Number(e.substr(12,2))||0;this.setDate(1);this.setFullYear(i);this.setMonth(a);this.setDate(g);this.setHours(c);this.setMinutes(f);this.setSeconds(b);return this};Date.prototype.getFromDT=function(a){a=String(a);this.set({days:a.substr(8,2)||1,months:a.substr(5,2)-1,years:parseInt(a.substr(0,4)),hours:a.substr(11,2)||0,minutes:a.substr(14,2)||0,seconds:a.substr(17,2)||0,milliseconds:0});return this};Date.prototype.getFromTsStr=function(a){var b=a.split(".");this.set({years:Number(b[2]),months:Number(b[1]),days:Number(b[0])});return this};Date.prototype.set=function(b){var a=b.year||this.getFullYear();if(isset(b.days)&&isset(b.months)&&getMonthLength(this.getMonth(),a)<Number(b.days)){this.setMonth(b.months);if(getMonthLength(this.getMonth(),a)<Number(b.days)){this.setDate(getMonthLength(this.getMonth(),a))}else{this.setDate(b.days)}}else{if(isset(b.days)){this.setDate(b.days)}if(isset(b.months)){if(getMonthLength(b.months,a)<this.getDate()){this.setDate(getMonthLength(b.months,a))}this.setMonth(b.months)}}if(isset(b.years)){this.setFullYear(b.years)}if(isset(b.hours)){this.setHours(b.hours)}if(isset(b.minutes)){this.setMinutes(b.minutes)}if(isset(b.seconds)){this.setSeconds(b.seconds)}if(isset(b.milliseconds)){this.setMilliseconds(b.milliseconds)}return this};Date.prototype.offset=function(b){var a={};if(b.days){a.days=this.getDate()+b.days}if(b.weeks){a.days=this.getDate()+b.weeks*7}if(b.months){a.months=this.getMonth()+b.months}if(b.years){a.years=this.getFullYear()+b.years}if(b.hours){a.hours=this.getHours()+b.hours}if(b.minutes){a.minutes=this.getMinutes()+b.minutes}if(b.seconds){a.seconds=this.getSeconds()+b.seconds}this.set(a);return this};Date.prototype.offsetDaysFromDate=function(a,b){this.setDate(a.getDate()+b);return this};Date.prototype.offsetDays=function(a){return this.offsetDaysFromDate(this,a)};Date.prototype.offsetMonthsFromDate=function(b,a){this.setMonth(this.getMonth()+(a||1));return this};Date.prototype.offsetMonths=function(a){return this.offsetMonthsFromDate(this,a)};Date.prototype.changeMonth=function(a){var b=this.getMonth()+a;this.setMonth(b);if(b>11){b=b%11-1}if(b<0){b=12+b}while(this.getMonth()!=b){this.offsetDaysFromDate(this,-1)}return this};Date.prototype.changeYear=function(a){var b=this.getMonth();this.setFullYear(this.getFullYear()+a);while(this.getMonth()!=b){this.offsetDaysFromDate(this,-1)}return this};Date.prototype.offsetYearsFromDate=function(b,a){this.setFullYear(this.getFullYear()+(a||1));return this};Date.prototype.offsetYears=function(a){return this.offsetYearsFromDate(this,a)};Date.prototype.getNearestWeekday=function(b,c){var a=0;while(this.getDay()!=b){this.offsetDays(c<0?-1:1);if(++a>6){return false}}return this};Date.prototype.getLastFullWeekBegin=function(){return this.getNearestWeekday(1,-1).offsetDays(-1).getNearestWeekday(1,-1)};Date.prototype.getLastFullWeekEnd=function(){return this.getNearestWeekday(1,-1).offsetDays(-1)};Date.prototype.getLastFullMonthEnd=function(){this.setDate(1);return this.offsetDays(-1)};Date.prototype.getLastFullMonthBegin=function(){this.offsetMonths(-1);this.setDate(1);return this};Date.prototype.getFullMonth=function(){var b=this.duplicate();var a=this.duplicate();b.setDate(1);a.offsetMonths(1).setDate(1);return{begin:b,end:a}};Date.prototype.getMonthBegin=function(){this.setDate(1);this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this};Date.prototype.getMonthEnd=function(){this.setDate(1);this.setHours(23);this.setMinutes(59);this.setSeconds(59);this.setMilliseconds(999);this.offsetMonths(1);this.offsetDays(-1);return this};Date.prototype.getFullDay=function(){var b=this.duplicate();var a=this.duplicate();b.setHours(0);b.setMinutes(0);b.setSeconds(0);a.setHours(23);a.setMinutes(59);a.setSeconds(59);return{begin:b,end:a}};Date.prototype.getNextMonthBegin=function(){this.setDate(1);this.offsetMonths(1);return this};Date.prototype.getWeek=function(){return{begin:this.duplicate().getNearestWeekday(1,-1),end:this.duplicate().getNearestWeekday(0,1)}};Date.prototype.getWeekday=function(){var a=this.getDay();return WEEKDAYS[a==0?6:a-1]};Date.prototype.getLastYearEnd=function(){this.setDate(1);this.setMonth(1);return this.offsetDays(-1)};Date.prototype.getNextYearBegin=function(){this.setDate(1);this.setMonth(1);return this.offsetYears(1)};Date.prototype.nullHms=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);return this};Date.prototype.equal=function(b,a){if(!is_date(b)){return false}return(this.getFullYear()==b.getFullYear()&&(a=="year"||this.getMonth()==b.getMonth()&&(a=="month"||this.getDate()==b.getDate())))};Date.prototype.equalMonth=function(a){if(!is_date(a)){return false}return(this.getFullYear()==a.getFullYear()&&this.getMonth()==a.getMonth())};Date.prototype.less=function(b,a){return(is_date(b)&&((!a&&this.getTime()<b.getTime())||(a&&Math.floor(this.getTime()/1000)<=Math.floor(b.getTime()/1000))))};Date.prototype.greater=function(b,a){return(!!(is_date(b)&&((!a&&this.getTime()>b.getTime())||(a&&this.getTime()>=b.getTime()))))};Date.prototype.between=function(b,a){return(is_date(b)&&is_date(a)&&this.getTime()>b.getTime()&&this.getTime()<a.getTime())};Date.prototype.between_s=function(b,a){if(is_date(b)&&is_date(a)){b.setMilliseconds(0);a.setMilliseconds(0);this.setMilliseconds(0);return(this.getTime()>=b.getTime()&&this.getTime()<=a.getTime())}return false};Date.prototype.setBetween=function(b,a){if(this.less(b)){return this.duplicate(b)}else{if(this.greater(a)){this.duplicate(a)}}return this};function getDaysDiff(b,a){return Math.round((b.duplicate().set({hours:0,minutes:0,seconds:0,milliseconds:0}).getTime()-a.duplicate().set({hours:0,minutes:0,seconds:0,milliseconds:0}).getTime())/(3600*24*1000))}Date.prototype.getDaysDiffStr=function(b,a){var c=getDaysDiff(b,a);switch(c){case 0:return _("today");case 1:return _("tomorrow");case 2:return _("after tomorrow");case -1:return _("yesterday");case -2:return _("before yesterday");default:if(c>0){return _("after (1) days",c)}else{return _("(1) days before",Math.abs(c))}}};Date.prototype.duplicate=function(a){if(a){this.setTime(a.getTime());return this}else{return new Date(this.getTime())}};Date.prototype.format=function(a){var b=this;if(!a){return}return a.replace(/([a-zA-Z]{1})/g,function(c,d){switch(d){case"H":return b.getHours().setDigits();break;case"i":return b.getMinutes().setDigits();break;case"s":return b.getSeconds().setDigits();break;case"j":return b.getDate();break;case"d":return b.getDate().setDigits();break;case"m":return(b.getMonth()+1).setDigits();break;case"M":return MONTHS[b.getMonth()];break;case"n":return String(MONTHS_SHORT[b.getMonth()]).firstCharUpper();break;case"F":return MONTHS_SHORT[b.getMonth()];break;case"G":return String(MONTHS_SHORT[b.getMonth()]).firstCharUpper();break;case"f":return MONTHS_NOMINATIVE[b.getMonth()];break;case"Y":return b.getFullYear().setDigits();break;case"y":return b.getFullYear().toString().substr(-2);break;case"r":return b.getDaysDiffStr(b,new Date());break;case"k":return b.getWeekday();break;case"e":return b.getWeekday().toLowerCase();break;case"w":return b.getWeekReadable();break;case"a":return b.duplicate().getNearestWeekday(1,-1);case"z":return b.duplicate().getNearestWeekday(0,1);case"o":return b.getMonthReadable();break}})};
