(function(){var W=this,AB,F=W.jQuery,S=W.$,T=W.jQuery=W.$=function(B,A){return new T.fn.init(B,A);},M=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,AC=/^.[^:#\[\.,]*$/;T.fn=T.prototype={init:function(c,B){c=c||document;if(c.nodeType){this[0]=c;this.length=1;this.context=c;return this;}if(typeof c==="string"){var C=M.exec(c);if(C&&(C[1]||!B)){if(C[1]){c=T.clean([C[1]],B);}else{var A=document.getElementById(C[3]);if(A&&A.id!=C[3]){return T().find(c);}var D=T(A||[]);D.context=document;D.selector=c;return D;}}else{return T(B).find(c);}}else{if(T.isFunction(c)){return T(document).ready(c);}}if(c.selector&&c.context){this.selector=c.selector;this.context=c.context;}return this.setArray(T.isArray(c)?c:T.makeArray(c));},selector:"",jquery:"1.3.2",size:function(){return this.length;},get:function(A){return A===AB?Array.prototype.slice.call(this):this[A];},pushStack:function(C,A,D){var B=T(C);B.prevObject=this;B.context=this.context;if(A==="find"){B.selector=this.selector+(this.selector?" ":"")+D;}else{if(A){B.selector=this.selector+"."+A+"("+D+")";}}return B;},setArray:function(A){this.length=0;Array.prototype.push.apply(this,A);return this;},each:function(A,B){return T.each(this,A,B);},index:function(A){return T.inArray(A&&A.jquery?A[0]:A,this);},attr:function(C,A,B){var D=C;if(typeof C==="string"){if(A===AB){return this[0]&&T[B||"attr"](this[0],C);}else{D={};D[C]=A;}}return this.each(function(c){for(C in D){T.attr(B?this.style:this,C,T.prop(this,D[C],B,c,C));}});},css:function(B,A){if((B=="width"||B=="height")&&parseFloat(A)<0){A=AB;}return this.attr(B,A,"curCSS");},text:function(A){if(typeof A!=="object"&&A!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(A));}var B="";T.each(A||this,function(){T.each(this.childNodes,function(){if(this.nodeType!=8){B+=this.nodeType!=1?this.nodeValue:T.fn.text([this]);}});});return B;},wrapAll:function(B){if(this[0]){var A=T(B,this[0].ownerDocument).clone();if(this[0].parentNode){A.insertBefore(this[0]);}A.map(function(){var C=this;while(C.firstChild){C=C.firstChild;}return C;}).append(this);}return this;},wrapInner:function(A){return this.each(function(){T(this).contents().wrapAll(A);});},wrap:function(A){return this.each(function(){T(this).wrapAll(A);});},append:function(){return this.domManip(arguments,true,function(A){if(this.nodeType==1){this.appendChild(A);}});},prepend:function(){return this.domManip(arguments,true,function(A){if(this.nodeType==1){this.insertBefore(A,this.firstChild);}});},before:function(){return this.domManip(arguments,false,function(A){this.parentNode.insertBefore(A,this);});},after:function(){return this.domManip(arguments,false,function(A){this.parentNode.insertBefore(A,this.nextSibling);});},end:function(){return this.prevObject||T([]);},push:[].push,sort:[].sort,splice:[].splice,find:function(B){if(this.length===1){var A=this.pushStack([],"find",B);A.length=0;T.find(B,this[0],A);return A;}else{return this.pushStack(T.unique(T.map(this,function(C){return T.find(B,C);})),"find",B);}},clone:function(B){var D=this.map(function(){if(!T.support.noCloneEvent&&!T.isXMLDoc(this)){var d=this.outerHTML;if(!d){var c=this.ownerDocument.createElement("div");c.appendChild(this.cloneNode(true));d=c.innerHTML;}return T.clean([d.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0];}else{return this.cloneNode(true);}});if(B===true){var A=this.find("*").andSelf(),C=0;D.find("*").andSelf().each(function(){if(this.nodeName!==A[C].nodeName){return ;}var e=T.data(A[C],"events");for(var c in e){for(var d in e[c]){T.event.add(this,c,e[c][d],e[c][d].data);}}C++;});}return D;},filter:function(A){return this.pushStack(T.isFunction(A)&&T.grep(this,function(B,C){return A.call(B,C);})||T.multiFilter(A,T.grep(this,function(B){return B.nodeType===1;})),"filter",A);},closest:function(C){var A=T.expr.match.POS.test(C)?T(C):null,B=0;return this.map(function(){var D=this;while(D&&D.ownerDocument){if(A?A.index(D)>-1:T(D).is(C)){T.data(D,"closest",B);return D;}D=D.parentNode;B++;}});},not:function(B){if(typeof B==="string"){if(AC.test(B)){return this.pushStack(T.multiFilter(B,this,true),"not",B);}else{B=T.multiFilter(B,this);}}var A=B.length&&B[B.length-1]!==AB&&!B.nodeType;return this.filter(function(){return A?T.inArray(this,B)<0:this!=B;});},add:function(A){return this.pushStack(T.unique(T.merge(this.get(),typeof A==="string"?T(A):T.makeArray(A))));},is:function(A){return !!A&&T.multiFilter(A,this).length>0;},hasClass:function(A){return !!A&&this.is("."+A);},val:function(C){if(C===AB){var g=this[0];if(g){if(T.nodeName(g,"option")){return(g.attributes.value||{}).specified?g.value:g.text;}if(T.nodeName(g,"select")){var c=g.selectedIndex,B=[],A=g.options,d=g.type=="select-one";if(c<0){return null;}for(var f=d?c:0,D=d?c+1:A.length;f<D;f++){var e=A[f];if(e.selected){C=T(e).val();if(d){return C;}B.push(C);}}return B;}return(g.value||"").replace(/\r/g,"");}return AB;}if(typeof C==="number"){C+="";}return this.each(function(){if(this.nodeType!=1){return ;}if(T.isArray(C)&&/radio|checkbox/.test(this.type)){this.checked=(T.inArray(this.value,C)>=0||T.inArray(this.name,C)>=0);}else{if(T.nodeName(this,"select")){var h=T.makeArray(C);T("option",this).each(function(){this.selected=(T.inArray(this.value,h)>=0||T.inArray(this.text,h)>=0);});if(!h.length){this.selectedIndex=-1;}}else{this.value=C;}}});},html:function(A){return A===AB?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(A);},replaceWith:function(A){return this.after(A).remove();},eq:function(A){return this.slice(A,+A+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","));},map:function(A){return this.pushStack(T.map(this,function(B,C){return A.call(B,C,B);}));},andSelf:function(){return this.add(this.prevObject);},domManip:function(D,A,B){if(this[0]){var c=(this[0].ownerDocument||this[0]).createDocumentFragment(),f=T.clean(D,(this[0].ownerDocument||this[0]),c),d=c.firstChild;if(d){for(var e=0,g=this.length;e<g;e++){B.call(C(this[e],d),this.length>1||e>0?c.cloneNode(true):c);}}if(f){T.each(f,E);}}return this;function C(k,h){return A&&T.nodeName(k,"table")&&T.nodeName(h,"tr")?(k.getElementsByTagName("tbody")[0]||k.appendChild(k.ownerDocument.createElement("tbody"))):k;}}};T.fn.init.prototype=T.fn;function E(B,A){if(A.src){T.ajax({url:A.src,async:false,dataType:"script"});}else{T.globalEval(A.text||A.textContent||A.innerHTML||"");}if(A.parentNode){A.parentNode.removeChild(A);}}function AD(){return +new Date;}T.extend=T.fn.extend=function(){var C=arguments[0]||{},c=1,D=arguments.length,f=false,d;if(typeof C==="boolean"){f=C;C=arguments[1]||{};c=2;}if(typeof C!=="object"&&!T.isFunction(C)){C={};}if(D==c){C=this;--c;}for(;c<D;c++){if((d=arguments[c])!=null){for(var e in d){var B=C[e],A=d[e];if(C===A){continue;}if(f&&A&&typeof A==="object"&&!A.nodeType){C[e]=T.extend(f,B||(A.length!=null?[]:{}),A);}else{if(A!==AB){C[e]=A;}}}}}return C;};var AG=/z-?index|font-?weight|opacity|zoom|line-?height/i,Q=document.defaultView||{},L=Object.prototype.toString;T.extend({noConflict:function(A){W.$=S;if(A){W.jQuery=F;}return T;},isFunction:function(A){return L.call(A)==="[object Function]";},isArray:function(A){return L.call(A)==="[object Array]";},isXMLDoc:function(A){return A.nodeType===9&&A.documentElement.nodeName!=="HTML"||!!A.ownerDocument&&T.isXMLDoc(A.ownerDocument);},globalEval:function(A){if(A&&/\S/.test(A)){var B=document.getElementsByTagName("head")[0]||document.documentElement,C=document.createElement("script");C.type="text/javascript";if(T.support.scriptEval){C.appendChild(document.createTextNode(A));}else{C.text=A;}B.insertBefore(C,B.firstChild);B.removeChild(C);}},nodeName:function(A,B){return A.nodeName&&A.nodeName.toUpperCase()==B.toUpperCase();},each:function(c,A,d){var e,D=0,C=c.length;if(d){if(C===AB){for(e in c){if(A.apply(c[e],d)===false){break;}}}else{for(;D<C;){if(A.apply(c[D++],d)===false){break;}}}}else{if(C===AB){for(e in c){if(A.call(c[e],e,c[e])===false){break;}}}else{for(var B=c[0];D<C&&A.call(B,D,B)!==false;B=c[++D]){}}}return c;},prop:function(B,A,C,D,c){if(T.isFunction(A)){A=A.call(B,D);}return typeof A==="number"&&C=="curCSS"&&!AG.test(c)?A+"px":A;},className:{add:function(B,A){T.each((A||"").split(/\s+/),function(D,C){if(B.nodeType==1&&!T.className.has(B.className,C)){B.className+=(B.className?" ":"")+C;}});},remove:function(B,A){if(B.nodeType==1){B.className=A!==AB?T.grep(B.className.split(/\s+/),function(C){return !T.className.has(A,C);}).join(" "):"";}},has:function(A,B){return A&&T.inArray(B,(A.className||A).toString().split(/\s+/))>-1;}},swap:function(B,C,A){var c={};for(var D in C){c[D]=B.style[D];B.style[D]=C[D];}A.call(B);for(var D in C){B.style[D]=c[D];}},css:function(c,e,C,f){if(e=="width"||e=="height"){var A,d={position:"absolute",visibility:"hidden",display:"block"},B=e=="width"?["Left","Right"]:["Top","Bottom"];function D(){A=e=="width"?c.offsetWidth:c.offsetHeight;if(f==="border"){return ;}T.each(B,function(){if(!f){A-=parseFloat(T.curCSS(c,"padding"+this,true))||0;}if(f==="margin"){A+=parseFloat(T.curCSS(c,"margin"+this,true))||0;}else{A-=parseFloat(T.curCSS(c,"border"+this+"Width",true))||0;}});}if(c.offsetWidth!==0){D();}else{T.swap(c,d,D);}return Math.max(0,Math.round(A));}return T.curCSS(c,e,C);},curCSS:function(c,f,e){var B,g=c.style;if(f=="opacity"&&!T.support.opacity){B=T.attr(g,"opacity");return B==""?"1":B;}if(f.match(/float/i)){f=H;}if(!e&&g&&g[f]){B=g[f];}else{if(Q.getComputedStyle){if(f.match(/float/i)){f="float";}f=f.replace(/([A-Z])/g,"-$1").toLowerCase();var A=Q.getComputedStyle(c,null);if(A){B=A.getPropertyValue(f);}if(f=="opacity"&&B==""){B="1";}}else{if(c.currentStyle){var D=f.replace(/\-(\w)/g,function(k,h){return h.toUpperCase();});B=c.currentStyle[f]||c.currentStyle[D];if(!/^\d+(px)?$/i.test(B)&&/^\d/.test(B)){var d=g.left,C=c.runtimeStyle.left;c.runtimeStyle.left=c.currentStyle.left;g.left=B||0;B=g.pixelLeft+"px";g.left=d;c.runtimeStyle.left=C;}}}}return B;},clean:function(e,B,D){B=B||document;if(typeof B.createElement==="undefined"){B=B.ownerDocument||B[0]&&B[0].ownerDocument||document;}if(!D&&e.length===1&&typeof e[0]==="string"){var c=/^<(\w+)\s*\/?>$/.exec(e[0]);if(c){return[B.createElement(c[1])];}}var d=[],f=[],A=B.createElement("div");T.each(e,function(l,g){if(typeof g==="number"){g+="";}if(!g){return ;}if(typeof g==="string"){g=g.replace(/(<(\w+)[^>]*?)\/>/g,function(q,p,r){return r.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?q:p+"></"+r+">";});var m=g.replace(/^\s+/,"").substring(0,10).toLowerCase();var k=!m.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!m.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||m.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!m.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!m.indexOf("<td")||!m.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!m.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!T.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];A.innerHTML=k[1]+g+k[2];while(k[0]--){A=A.lastChild;}if(!T.support.tbody){var h=/<tbody/i.test(g),n=!m.indexOf("<table")&&!h?A.firstChild&&A.firstChild.childNodes:k[1]=="<table>"&&!h?A.childNodes:[];for(var o=n.length-1;o>=0;--o){if(T.nodeName(n[o],"tbody")&&!n[o].childNodes.length){n[o].parentNode.removeChild(n[o]);}}}if(!T.support.leadingWhitespace&&/^\s/.test(g)){A.insertBefore(B.createTextNode(g.match(/^\s*/)[0]),A.firstChild);}g=T.makeArray(A.childNodes);}if(g.nodeType){d.push(g);}else{d=T.merge(d,g);}});if(D){for(var C=0;d[C];C++){if(T.nodeName(d[C],"script")&&(!d[C].type||d[C].type.toLowerCase()==="text/javascript")){f.push(d[C].parentNode?d[C].parentNode.removeChild(d[C]):d[C]);}else{if(d[C].nodeType===1){d.splice.apply(d,[C+1,0].concat(T.makeArray(d[C].getElementsByTagName("script"))));}D.appendChild(d[C]);}}return f;}return d;},attr:function(C,d,B){if(!C||C.nodeType==3||C.nodeType==8){return AB;}var c=!T.isXMLDoc(C),A=B!==AB;d=c&&T.props[d]||d;if(C.tagName){var e=/href|src|style/.test(d);if(d=="selected"&&C.parentNode){C.parentNode.selectedIndex;}if(d in C&&c&&!e){if(A){if(d=="type"&&T.nodeName(C,"input")&&C.parentNode){throw"type property can't be changed";}C[d]=B;}if(T.nodeName(C,"form")&&C.getAttributeNode(d)){return C.getAttributeNode(d).nodeValue;}if(d=="tabIndex"){var D=C.getAttributeNode("tabIndex");return D&&D.specified?D.value:C.nodeName.match(/(button|input|object|select|textarea)/i)?0:C.nodeName.match(/^(a|area)$/i)&&C.href?0:AB;}return C[d];}if(!T.support.style&&c&&d=="style"){return T.attr(C.style,"cssText",B);}if(A){C.setAttribute(d,""+B);}var f=!T.support.hrefNormalized&&c&&e?C.getAttribute(d,2):C.getAttribute(d);return f===null?AB:f;}if(!T.support.opacity&&d=="opacity"){if(A){C.zoom=1;C.filter=(C.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(B)+""=="NaN"?"":"alpha(opacity="+B*100+")");}return C.filter&&C.filter.indexOf("opacity=")>=0?(parseFloat(C.filter.match(/opacity=([^)]*)/)[1])/100)+"":"";}d=d.replace(/-([a-z])/ig,function(h,g){return g.toUpperCase();});if(A){C[d]=B;}return C[d];},trim:function(A){return(A||"").replace(/^\s+|\s+$/g,"");},makeArray:function(A){var C=[];if(A!=null){var B=A.length;if(B==null||typeof A==="string"||T.isFunction(A)||A.setInterval){C[0]=A;}else{while(B){C[--B]=A[B];}}}return C;},inArray:function(B,A){for(var D=0,C=A.length;D<C;D++){if(A[D]===B){return D;}}return -1;},merge:function(B,c){var D=0,C,A=B.length;if(!T.support.getAll){while((C=c[D++])!=null){if(C.nodeType!=8){B[A++]=C;}}}else{while((C=c[D++])!=null){B[A++]=C;}}return B;},unique:function(A){var d=[],e={};try{for(var c=0,D=A.length;c<D;c++){var B=T.data(A[c]);if(!e[B]){e[B]=true;d.push(A[c]);}}}catch(C){d=A;}return d;},grep:function(c,A,d){var D=[];for(var C=0,B=c.length;C<B;C++){if(!d!=!A(c[C],C)){D.push(c[C]);}}return D;},map:function(d,A){var c=[];for(var D=0,C=d.length;D<C;D++){var B=A(d[D],D);if(B!=null){c[c.length]=B;}}return c.concat.apply([],c);}});var O=navigator.userAgent.toLowerCase();T.browser={version:(O.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(O),opera:/opera/.test(O),msie:/msie/.test(O)&&!/opera/.test(O),mozilla:/mozilla/.test(O)&&!/(compatible|webkit)/.test(O)};T.each({parent:function(A){return A.parentNode;},parents:function(A){return T.dir(A,"parentNode");},next:function(A){return T.nth(A,2,"nextSibling");},prev:function(A){return T.nth(A,2,"previousSibling");},nextAll:function(A){return T.dir(A,"nextSibling");},prevAll:function(A){return T.dir(A,"previousSibling");},siblings:function(A){return T.sibling(A.parentNode.firstChild,A);},children:function(A){return T.sibling(A.firstChild);},contents:function(A){return T.nodeName(A,"iframe")?A.contentDocument||A.contentWindow.document:T.makeArray(A.childNodes);}},function(B,A){T.fn[B]=function(D){var C=T.map(this,A);if(D&&typeof D=="string"){C=T.multiFilter(D,C);}return this.pushStack(T.unique(C),B,D);};});T.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(B,A){T.fn[B]=function(f){var c=[],C=T(f);for(var D=0,e=C.length;D<e;D++){var d=(D>0?this.clone(true):this).get();T.fn[A].apply(T(C[D]),d);c=c.concat(d);}return this.pushStack(c,B,f);};});T.each({removeAttr:function(A){T.attr(this,A,"");if(this.nodeType==1){this.removeAttribute(A);}},addClass:function(A){T.className.add(this,A);},removeClass:function(A){T.className.remove(this,A);},toggleClass:function(A,B){if(typeof B!=="boolean"){B=!T.className.has(this,A);}T.className[B?"add":"remove"](this,A);},remove:function(A){if(!A||T.filter(A,[this]).length){T("*",this).add([this]).each(function(){T.event.remove(this);T.removeData(this);});if(this.parentNode){this.parentNode.removeChild(this);}}},empty:function(){T(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild);}}},function(B,A){T.fn[B]=function(){return this.each(A,arguments);};});function Y(B,A){return B[0]&&parseInt(T.curCSS(B[0],A,true),10)||0;}var AA="jQuery"+AD(),I=0,R={};T.extend({cache:{},data:function(C,D,B){C=C==W?R:C;var A=C[AA];if(!A){A=C[AA]=++I;}if(D&&!T.cache[A]){T.cache[A]={};}if(B!==AB){T.cache[A][D]=B;}return D?T.cache[A][D]:A;},removeData:function(C,D){C=C==W?R:C;var A=C[AA];if(D){if(T.cache[A]){delete T.cache[A][D];D="";for(D in T.cache[A]){break;}if(!D){T.removeData(C);}}}else{try{delete C[AA];}catch(B){if(C.removeAttribute){C.removeAttribute(AA);}}delete T.cache[A];}},queue:function(C,D,A){if(C){D=(D||"fx")+"queue";var B=T.data(C,D);if(!B||T.isArray(A)){B=T.data(C,D,T.makeArray(A));}else{if(A){B.push(A);}}}return B;},dequeue:function(A,B){var D=T.queue(A,B),C=D.shift();if(!B||B==="fx"){C=D[0];}if(C!==AB){C.call(A);}}});T.fn.extend({data:function(D,B){var A=D.split(".");A[1]=A[1]?"."+A[1]:"";if(B===AB){var C=this.triggerHandler("getData"+A[1]+"!",[A[0]]);if(C===AB&&this.length){C=T.data(this[0],D);}return C===AB&&A[1]?this.data(A[0]):C;}else{return this.trigger("setData"+A[1]+"!",[A[0],B]).each(function(){T.data(this,D,B);});}},removeData:function(A){return this.each(function(){T.removeData(this,A);});},queue:function(B,A){if(typeof B!=="string"){A=B;B="fx";}if(A===AB){return T.queue(this[0],B);}return this.each(function(){var C=T.queue(this,B,A);if(B=="fx"&&C.length==1){C[0].call(this);}});},dequeue:function(A){return this.each(function(){T.dequeue(this,A);});}});(function(){var B=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,f=0,l=Object.prototype.toString;var n=function(r,v,AN,AM){AN=AN||[];v=v||document;if(v.nodeType!==1&&v.nodeType!==9){return[];}if(!r||typeof r!=="string"){return AN;}var q=[],t,AJ,y,w,AL,u,s=true;B.lastIndex=0;while((t=B.exec(r))!==null){q.push(t[1]);if(t[2]){u=RegExp.rightContext;break;}}if(q.length>1&&e.exec(r)){if(q.length===2&&k.relative[q[0]]){AJ=h(q[0]+q[1],v);}else{AJ=k.relative[q[0]]?[v]:n(q.shift(),v);while(q.length){r=q.shift();if(k.relative[r]){r+=q.shift();}AJ=h(r,AJ);}}}else{var AK=AM?{expr:q.pop(),set:o(AM)}:n.find(q.pop(),q.length===1&&v.parentNode?v.parentNode:v,C(v));AJ=n.filter(AK.expr,AK.set);if(q.length>0){y=o(AJ);}else{s=false;}while(q.length){var z=q.pop(),AI=z;if(!k.relative[z]){z="";}else{AI=q.pop();}if(AI==null){AI=v;}k.relative[z](y,AI,C(v));}}if(!y){y=AJ;}if(!y){throw"Syntax error, unrecognized expression: "+(z||r);}if(l.call(y)==="[object Array]"){if(!s){AN.push.apply(AN,y);}else{if(v.nodeType===1){for(var p=0;y[p]!=null;p++){if(y[p]&&(y[p]===true||y[p].nodeType===1&&g(v,y[p]))){AN.push(AJ[p]);}}}else{for(var p=0;y[p]!=null;p++){if(y[p]&&y[p].nodeType===1){AN.push(AJ[p]);}}}}}else{o(y,AN);}if(u){n(u,v,AN,AM);if(m){hasDuplicate=false;AN.sort(m);if(hasDuplicate){for(var p=1;p<AN.length;p++){if(AN[p]===AN[p-1]){AN.splice(p--,1);}}}}}return AN;};n.matches=function(q,p){return n(q,null,null,p);};n.find=function(p,w,y){var q,s;if(!p){return[];}for(var t=0,u=k.order.length;t<u;t++){var r=k.order[t],s;if((s=k.match[r].exec(p))){var v=RegExp.leftContext;if(v.substr(v.length-1)!=="\\"){s[1]=(s[1]||"").replace(/\\/g,"");q=k.find[r](s,w,y);if(q!=null){p=p.replace(k.match[r],"");break;}}}}if(!q){q=w.getElementsByTagName("*");}return{set:q,expr:p};};n.filter=function(AL,AM,AI,t){var u=AL,y=[],p=AM,r,w,q=AM&&AM[0]&&C(AM[0]);while(AL&&AM.length){for(var AN in k.filter){if((r=k.match[AN].exec(AL))!=null){var v=k.filter[AN],z,AJ;w=false;if(p==y){y=[];}if(k.preFilter[AN]){r=k.preFilter[AN](r,p,AI,y,t,q);if(!r){w=z=true;}else{if(r===true){continue;}}}if(r){for(var s=0;(AJ=p[s])!=null;s++){if(AJ){z=v(AJ,r,s,p);var AK=t^!!z;if(AI&&z!=null){if(AK){w=true;}else{p[s]=false;}}else{if(AK){y.push(AJ);w=true;}}}}}if(z!==AB){if(!AI){p=y;}AL=AL.replace(k.match[AN],"");if(!w){return[];}break;}}}if(AL==u){if(w==null){throw"Syntax error, unrecognized expression: "+AL;}else{break;}}u=AL;}return p;};var k=n.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(p){return p.getAttribute("href");}},relative:{"+":function(p,w,q){var s=typeof w==="string",y=s&&!/\W/.test(w),r=s&&!y;if(y&&!q){w=w.toUpperCase();}for(var t=0,u=p.length,v;t<u;t++){if((v=p[t])){while((v=v.previousSibling)&&v.nodeType!==1){}p[t]=r||v&&v.nodeName===w?v||false:v===w;}}if(r){n.filter(w,p,true);}},">":function(u,r,t){var w=typeof r==="string";if(w&&!/\W/.test(r)){r=t?r:r.toUpperCase();for(var q=0,s=u.length;q<s;q++){var v=u[q];if(v){var p=v.parentNode;u[q]=p.nodeName===r?p:false;}}}else{for(var q=0,s=u.length;q<s;q++){var v=u[q];if(v){u[q]=w?v.parentNode:v.parentNode===r;}}if(w){n.filter(r,u,true);}}},"":function(p,r,t){var q=f++,s=A;if(!r.match(/\W/)){var u=r=t?r:r.toUpperCase();s=D;}s("parentNode",r,q,p,u,t);},"~":function(p,r,t){var q=f++,s=A;if(typeof r==="string"&&!r.match(/\W/)){var u=r=t?r:r.toUpperCase();s=D;}s("previousSibling",r,q,p,u,t);}},find:{ID:function(r,q,p){if(typeof q.getElementById!=="undefined"&&!p){var s=q.getElementById(r[1]);return s?[s]:[];}},NAME:function(q,u,t){if(typeof u.getElementsByName!=="undefined"){var r=[],v=u.getElementsByName(q[1]);for(var p=0,s=v.length;p<s;p++){if(v[p].getAttribute("name")===q[1]){r.push(v[p]);}}return r.length===0?null:r;}},TAG:function(q,p){return p.getElementsByTagName(q[1]);}},preFilter:{CLASS:function(p,r,q,s,u,t){p=" "+p[1].replace(/\\/g,"")+" ";if(t){return p;}for(var w=0,v;(v=r[w])!=null;w++){if(v){if(u^(v.className&&(" "+v.className+" ").indexOf(p)>=0)){if(!q){s.push(v);}}else{if(q){r[w]=false;}}}}return false;},ID:function(p){return p[1].replace(/\\/g,"");},TAG:function(q,r){for(var p=0;r[p]===false;p++){}return r[p]&&C(r[p])?q[1]:q[1].toUpperCase();},CHILD:function(q){if(q[1]=="nth"){var p=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(q[2]=="even"&&"2n"||q[2]=="odd"&&"2n+1"||!/\D/.test(q[2])&&"0n+"+q[2]||q[2]);q[2]=(p[1]+(p[2]||1))-0;q[3]=p[3]-0;}q[0]=f++;return q;},ATTR:function(v,r,q,s,u,t){var p=v[1].replace(/\\/g,"");if(!t&&k.attrMap[p]){v[1]=k.attrMap[p];}if(v[2]==="~="){v[4]=" "+v[4]+" ";}return v;},PSEUDO:function(u,r,q,s,t){if(u[1]==="not"){if(u[3].match(B).length>1||/^\w/.test(u[3])){u[3]=n(u[3],null,null,r);}else{var p=n.filter(u[3],r,q,true^t);if(!q){s.push.apply(s,p);}return false;}}else{if(k.match.POS.test(u[0])||k.match.CHILD.test(u[0])){return true;}}return u;},POS:function(p){p.unshift(true);return p;}},filters:{enabled:function(p){return p.disabled===false&&p.type!=="hidden";},disabled:function(p){return p.disabled===true;},checked:function(p){return p.checked===true;},selected:function(p){p.parentNode.selectedIndex;return p.selected===true;},parent:function(p){return !!p.firstChild;},empty:function(p){return !p.firstChild;},has:function(p,q,r){return !!n(r[3],p).length;},header:function(p){return/h\d/i.test(p.nodeName);},text:function(p){return"text"===p.type;},radio:function(p){return"radio"===p.type;},checkbox:function(p){return"checkbox"===p.type;},file:function(p){return"file"===p.type;},password:function(p){return"password"===p.type;},submit:function(p){return"submit"===p.type;},image:function(p){return"image"===p.type;},reset:function(p){return"reset"===p.type;},button:function(p){return"button"===p.type||p.nodeName.toUpperCase()==="BUTTON";},input:function(p){return/input|select|textarea|button/i.test(p.nodeName);}},setFilters:{first:function(p,q){return q===0;},last:function(q,r,s,p){return r===p.length-1;},even:function(p,q){return q%2===0;},odd:function(p,q){return q%2===1;},lt:function(p,q,r){return q<r[3]-0;},gt:function(p,q,r){return q>r[3]-0;},nth:function(p,q,r){return r[3]-0==q;},eq:function(p,q,r){return r[3]-0==q;}},filter:{PSEUDO:function(u,q,p,t){var r=q[1],w=k.filters[r];if(w){return w(u,p,q,t);}else{if(r==="contains"){return(u.textContent||u.innerText||"").indexOf(q[3])>=0;}else{if(r==="not"){var v=q[3];for(var p=0,s=v.length;p<s;p++){if(v[p]===u){return false;}}return true;}}}},CHILD:function(w,t){var q=t[1],v=w;switch(q){case"only":case"first":while(v=v.previousSibling){if(v.nodeType===1){return false;}}if(q=="first"){return true;}v=w;case"last":while(v=v.nextSibling){if(v.nodeType===1){return false;}}return true;case"nth":var u=t[2],y=t[3];if(u==1&&y==0){return true;}var r=t[0],z=w.parentNode;if(z&&(z.sizcache!==r||!w.nodeIndex)){var s=0;for(v=z.firstChild;v;v=v.nextSibling){if(v.nodeType===1){v.nodeIndex=++s;}}z.sizcache=r;}var p=w.nodeIndex-y;if(u==0){return p==0;}else{return(p%u==0&&p/u>=0);}}},ID:function(p,q){return p.nodeType===1&&p.getAttribute("id")===q;},TAG:function(p,q){return(q==="*"&&p.nodeType===1)||p.nodeName===q;},CLASS:function(p,q){return(" "+(p.className||p.getAttribute("class"))+" ").indexOf(q)>-1;},ATTR:function(u,p){var q=p[1],s=k.attrHandle[q]?k.attrHandle[q](u):u[q]!=null?u[q]:u.getAttribute(q),t=s+"",v=p[2],r=p[4];return s==null?v==="!=":v==="="?t===r:v==="*="?t.indexOf(r)>=0:v==="~="?(" "+t+" ").indexOf(r)>=0:!r?t&&s!==false:v==="!="?t!=r:v==="^="?t.indexOf(r)===0:v==="$="?t.substr(t.length-r.length)===r:v==="|="?t===r||t.substr(0,r.length+1)===r+"-":false;},POS:function(u,r,q,t){var s=r[2],p=k.setFilters[s];if(p){return p(u,q,r,t);}}}};var e=k.match.POS;for(var c in k.match){k.match[c]=RegExp(k.match[c].source+/(?![^\[]*\])(?![^\(]*\))/.source);}var o=function(p,q){p=Array.prototype.slice.call(p);if(q){q.push.apply(q,p);return q;}return p;};try{Array.prototype.slice.call(document.documentElement.childNodes);}catch(d){o=function(t,p){var r=p||[];if(l.call(t)==="[object Array]"){Array.prototype.push.apply(r,t);}else{if(typeof t.length==="number"){for(var q=0,s=t.length;q<s;q++){r.push(t[q]);}}else{for(var q=0;t[q];q++){r.push(t[q]);}}}return r;};}var m;if(document.documentElement.compareDocumentPosition){m=function(q,r){var p=q.compareDocumentPosition(r)&4?-1:q===r?0:1;if(p===0){hasDuplicate=true;}return p;};}else{if("sourceIndex" in document.documentElement){m=function(q,r){var p=q.sourceIndex-r.sourceIndex;if(p===0){hasDuplicate=true;}return p;};}else{if(document.createRange){m=function(p,r){var q=p.ownerDocument.createRange(),s=r.ownerDocument.createRange();q.selectNode(p);q.collapse(true);s.selectNode(r);s.collapse(true);var t=q.compareBoundaryPoints(Range.START_TO_END,s);if(t===0){hasDuplicate=true;}return t;};}}}(function(){var q=document.createElement("form"),p="script"+(new Date).getTime();q.innerHTML="<input name='"+p+"'/>";var r=document.documentElement;r.insertBefore(q,r.firstChild);if(!!document.getElementById(p)){k.find.ID=function(v,u,t){if(typeof u.getElementById!=="undefined"&&!t){var s=u.getElementById(v[1]);return s?s.id===v[1]||typeof s.getAttributeNode!=="undefined"&&s.getAttributeNode("id").nodeValue===v[1]?[s]:AB:[];}};k.filter.ID=function(t,s){var u=typeof t.getAttributeNode!=="undefined"&&t.getAttributeNode("id");return t.nodeType===1&&u&&u.nodeValue===s;};}r.removeChild(q);})();(function(){var p=document.createElement("div");p.appendChild(document.createComment(""));if(p.getElementsByTagName("*").length>0){k.find.TAG=function(s,t){var u=t.getElementsByTagName(s[1]);if(s[1]==="*"){var q=[];for(var r=0;u[r];r++){if(u[r].nodeType===1){q.push(u[r]);}}u=q;}return u;};}p.innerHTML="<a href='#'></a>";if(p.firstChild&&typeof p.firstChild.getAttribute!=="undefined"&&p.firstChild.getAttribute("href")!=="#"){k.attrHandle.href=function(q){return q.getAttribute("href",2);};}})();if(document.querySelectorAll){(function(){var q=n,p=document.createElement("div");p.innerHTML="<p class='TEST'></p>";if(p.querySelectorAll&&p.querySelectorAll(".TEST").length===0){return ;}n=function(u,v,s,r){v=v||document;if(!r&&v.nodeType===9&&!C(v)){try{return o(v.querySelectorAll(u),s);}catch(t){}}return q(u,v,s,r);};n.find=q.find;n.filter=q.filter;n.selectors=q.selectors;n.matches=q.matches;})();}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var p=document.createElement("div");p.innerHTML="<div class='test e'></div><div class='test'></div>";if(p.getElementsByClassName("e").length===0){return ;}p.lastChild.className="e";if(p.getElementsByClassName("e").length===1){return ;}k.order.splice(1,0,"CLASS");k.find.CLASS=function(s,r,q){if(typeof r.getElementsByClassName!=="undefined"&&!q){return r.getElementsByClassName(s[1]);}};})();}function D(v,q,r,y,p,z){var AI=v=="previousSibling"&&!z;for(var t=0,u=y.length;t<u;t++){var w=y[t];if(w){if(AI&&w.nodeType===1){w.sizcache=r;w.sizset=t;}w=w[v];var s=false;while(w){if(w.sizcache===r){s=y[w.sizset];break;}if(w.nodeType===1&&!z){w.sizcache=r;w.sizset=t;}if(w.nodeName===q){s=w;break;}w=w[v];}y[t]=s;}}}function A(v,q,r,y,p,z){var AI=v=="previousSibling"&&!z;for(var t=0,u=y.length;t<u;t++){var w=y[t];if(w){if(AI&&w.nodeType===1){w.sizcache=r;w.sizset=t;}w=w[v];var s=false;while(w){if(w.sizcache===r){s=y[w.sizset];break;}if(w.nodeType===1){if(!z){w.sizcache=r;w.sizset=t;}if(typeof q!=="string"){if(w===q){s=true;break;}}else{if(n.filter(q,[w]).length>0){s=w;break;}}}w=w[v];}y[t]=s;}}}var g=document.compareDocumentPosition?function(p,q){return p.compareDocumentPosition(q)&16;}:function(p,q){return p!==q&&(p.contains?p.contains(q):true);};var C=function(p){return p.nodeType===9&&p.documentElement.nodeName!=="HTML"||!!p.ownerDocument&&C(p.ownerDocument);};var h=function(s,u){var p=[],w="",v,q=u.nodeType?[u]:u;while((v=k.match.PSEUDO.exec(s))){w+=v[0];s=s.replace(k.match.PSEUDO,"");}s=k.relative[s]?s+"*":s;for(var t=0,r=q.length;t<r;t++){n(s,q[t],p);}return n.filter(w,p);};T.find=n;T.filter=n.filter;T.expr=n.selectors;T.expr[":"]=T.expr.filters;n.selectors.filters.hidden=function(p){return p.offsetWidth===0||p.offsetHeight===0;};n.selectors.filters.visible=function(p){return p.offsetWidth>0||p.offsetHeight>0;};n.selectors.filters.animated=function(p){return T.grep(T.timers,function(q){return p===q.elem;}).length;};T.multiFilter=function(p,r,q){if(q){p=":not("+p+")";}return n.matches(p,r);};T.dir=function(q,r){var s=[],p=q[r];while(p&&p!=document){if(p.nodeType==1){s.push(p);}p=p[r];}return s;};T.nth=function(t,s,q,p){s=s||1;var r=0;for(;t;t=t[q]){if(t.nodeType==1&&++r==s){break;}}return t;};T.sibling=function(p,q){var r=[];for(;p;p=p.nextSibling){if(p.nodeType==1&&p!=q){r.push(p);}}return r;};return ;W.Sizzle=n;})();T.event={add:function(C,d,D,A){if(C.nodeType==3||C.nodeType==8){return ;}if(C.setInterval&&C!=W){C=W;}if(!D.guid){D.guid=this.guid++;}if(A!==AB){var c=D;D=this.proxy(c);D.data=A;}var e=T.data(C,"events")||T.data(C,"events",{}),B=T.data(C,"handle")||T.data(C,"handle",function(){return typeof T!=="undefined"&&!T.event.triggered?T.event.handle.apply(arguments.callee.elem,arguments):AB;});B.elem=C;T.each(d.split(/\s+/),function(k,h){var g=h.split(".");h=g.shift();D.type=g.slice().sort().join(".");var f=e[h];if(T.event.specialAll[h]){T.event.specialAll[h].setup.call(C,A,g);}if(!f){f=e[h]={};if(!T.event.special[h]||T.event.special[h].setup.call(C,A,g)===false){if(C.addEventListener){C.addEventListener(h,B,false);}else{if(C.attachEvent){C.attachEvent("on"+h,B);}}}}f[D.guid]=D;T.event.global[h]=true;});C=null;},guid:1,global:{},remove:function(B,c,C){if(B.nodeType==3||B.nodeType==8){return ;}var d=T.data(B,"events"),e,f;if(d){if(c===AB||(typeof c==="string"&&c.charAt(0)==".")){for(var D in d){this.remove(B,D+(c||""));}}else{if(c.type){C=c.handler;c=c.type;}T.each(c.split(/\s+/),function(m,k){var g=k.split(".");k=g.shift();var l=RegExp("(^|\\.)"+g.slice().sort().join(".*\\.")+"(\\.|$)");if(d[k]){if(C){delete d[k][C.guid];}else{for(var h in d[k]){if(l.test(d[k][h].type)){delete d[k][h];}}}if(T.event.specialAll[k]){T.event.specialAll[k].teardown.call(B,g);}for(e in d[k]){break;}if(!e){if(!T.event.special[k]||T.event.special[k].teardown.call(B,g)===false){if(B.removeEventListener){B.removeEventListener(k,T.data(B,"handle"),false);}else{if(B.detachEvent){B.detachEvent("on"+k,T.data(B,"handle"));}}}e=null;delete d[k];}}});}for(e in d){break;}if(!e){var A=T.data(B,"handle");if(A){A.elem=null;}T.removeData(B,"events");T.removeData(B,"handle");}}},trigger:function(D,B,c,f){var d=D.type||D;if(!f){D=typeof D==="object"?D[AA]?D:T.extend(T.Event(d),D):T.Event(d);if(d.indexOf("!")>=0){D.type=d=d.slice(0,-1);D.exclusive=true;}if(!c){D.stopPropagation();if(this.global[d]){T.each(T.cache,function(){if(this.events&&this.events[d]){T.event.trigger(D,B,this.handle.elem);}});}}if(!c||c.nodeType==3||c.nodeType==8){return AB;}D.result=AB;D.target=c;B=T.makeArray(B);B.unshift(D);}D.currentTarget=c;var C=T.data(c,"handle");if(C){C.apply(c,B);}if((!c[d]||(T.nodeName(c,"a")&&d=="click"))&&c["on"+d]&&c["on"+d].apply(c,B)===false){D.result=false;}if(!f&&c[d]&&!D.isDefaultPrevented()&&!(T.nodeName(c,"a")&&d=="click")){this.triggered=true;try{c[d]();}catch(A){}}this.triggered=false;if(!D.isPropagationStopped()){var e=c.parentNode||c.ownerDocument;if(e){T.event.trigger(D,B,e,true);}}},handle:function(B){var C,f;B=arguments[0]=T.event.fix(B||W.event);B.currentTarget=this;var A=B.type.split(".");B.type=A.shift();C=!A.length&&!B.exclusive;var D=RegExp("(^|\\.)"+A.slice().sort().join(".*\\.")+"(\\.|$)");f=(T.data(this,"events")||{})[B.type];for(var d in f){var c=f[d];if(C||D.test(c.type)){B.handler=c;B.data=c.data;var e=c.apply(this,arguments);if(e!==AB){B.result=e;if(e===false){B.preventDefault();B.stopPropagation();}}if(B.isImmediatePropagationStopped()){break;}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(C){if(C[AA]){return C;}var c=C;C=T.Event(c);for(var D=this.props.length,A;D;){A=this.props[--D];C[A]=c[A];}if(!C.target){C.target=C.srcElement||document;}if(C.target.nodeType==3){C.target=C.target.parentNode;}if(!C.relatedTarget&&C.fromElement){C.relatedTarget=C.fromElement==C.target?C.toElement:C.fromElement;}if(C.pageX==null&&C.clientX!=null){var B=document.documentElement,d=document.body;C.pageX=C.clientX+(B&&B.scrollLeft||d&&d.scrollLeft||0)-(B.clientLeft||0);C.pageY=C.clientY+(B&&B.scrollTop||d&&d.scrollTop||0)-(B.clientTop||0);}if(!C.which&&((C.charCode||C.charCode===0)?C.charCode:C.keyCode)){C.which=C.charCode||C.keyCode;}if(!C.metaKey&&C.ctrlKey){C.metaKey=C.ctrlKey;}if(!C.which&&C.button){C.which=(C.button&1?1:(C.button&2?3:(C.button&4?2:0)));}return C;},proxy:function(A,B){B=B||function(){return A.apply(this,arguments);};B.guid=A.guid=A.guid||B.guid||this.guid++;return B;},special:{ready:{setup:P,teardown:function(){}}},specialAll:{live:{setup:function(B,A){T.event.add(this,A[0],AF);},teardown:function(A){if(A.length){var C=0,B=RegExp("(^|\\.)"+A[0]+"(\\.|$)");T.each((T.data(this,"events").live||{}),function(){if(B.test(this.type)){C++;}});if(C<1){T.event.remove(this,A[0],AF);}}}}}};T.Event=function(A){if(!this.preventDefault){return new T.Event(A);}if(A&&A.type){this.originalEvent=A;this.type=A.type;}else{this.type=A;}this.timeStamp=AD();this[AA]=true;};function X(){return false;}function J(){return true;}T.Event.prototype={preventDefault:function(){this.isDefaultPrevented=J;var A=this.originalEvent;if(!A){return ;}if(A.preventDefault){A.preventDefault();}A.returnValue=false;},stopPropagation:function(){this.isPropagationStopped=J;var A=this.originalEvent;if(!A){return ;}if(A.stopPropagation){A.stopPropagation();}A.cancelBubble=true;},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=J;this.stopPropagation();},isDefaultPrevented:X,isPropagationStopped:X,isImmediatePropagationStopped:X};var AH=function(B){var C=B.relatedTarget;while(C&&C!=this){try{C=C.parentNode;}catch(A){C=this;}}if(C!=this){B.type=B.data;T.event.handle.apply(this,arguments);}};T.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(A,B){T.event.special[B]={setup:function(){T.event.add(this,A,AH,B);},teardown:function(){T.event.remove(this,A,AH);}};});T.fn.extend({bind:function(B,A,C){return B=="unload"?this.one(B,A,C):this.each(function(){T.event.add(this,B,C||A,C&&A);});},one:function(B,A,C){var D=T.event.proxy(C||A,function(c){T(this).unbind(c,D);return(C||A).apply(this,arguments);});return this.each(function(){T.event.add(this,B,D,C&&A);});},unbind:function(A,B){return this.each(function(){T.event.remove(this,A,B);});},trigger:function(B,A){return this.each(function(){T.event.trigger(B,A,this);});},triggerHandler:function(C,A){if(this[0]){var B=T.Event(C);B.preventDefault();B.stopPropagation();T.event.trigger(B,A,this[0]);return B.result;}},toggle:function(A){var C=arguments,B=1;while(B<C.length){T.event.proxy(A,C[B++]);}return this.click(T.event.proxy(A,function(D){this.lastToggle=(this.lastToggle||0)%B;D.preventDefault();return C[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(B,A){return this.mouseenter(B).mouseleave(A);},ready:function(A){P();if(T.isReady){A.call(document,T);}else{T.readyList.push(A);}return this;},live:function(A,B){var C=T.event.proxy(B);C.guid+=this.selector+A;T(document).bind(Z(A,this.selector),this.selector,C);return this;},die:function(A,B){T(document).unbind(Z(A,this.selector),B?{guid:B.guid+this.selector+A}:null);return this;}});function AF(A){var D=RegExp("(^|\\.)"+A.type+"(\\.|$)"),B=true,C=[];T.each(T.data(this,"events").live||[],function(e,d){if(D.test(d.type)){var c=T(A.target).closest(d.data)[0];if(c){C.push({elem:c,fn:d});}}});C.sort(function(c,d){return T.data(c.elem,"closest")-T.data(d.elem,"closest");});T.each(C,function(){if(this.fn.call(this.elem,A,this.fn.data)===false){return(B=false);}});return B;}function Z(A,B){return["live",A,B.replace(/\./g,"`").replace(/ /g,"|")].join(".");}T.extend({isReady:false,readyList:[],ready:function(){if(!T.isReady){T.isReady=true;if(T.readyList){T.each(T.readyList,function(){this.call(document,T);});T.readyList=null;}T(document).triggerHandler("ready");}}});var G=false;function P(){if(G){return ;}G=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);T.ready();},false);}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);T.ready();}});if(document.documentElement.doScroll&&W==W.top){(function(){if(T.isReady){return ;}try{document.documentElement.doScroll("left");}catch(A){setTimeout(arguments.callee,0);return ;}T.ready();})();}}}T.event.add(W,"load",T.ready);}T.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(A,B){T.fn[B]=function(C){return C?this.bind(B,C):this.trigger(B);};});T(W).bind("unload",function(){for(var A in T.cache){if(A!=1&&T.cache[A].handle){T.event.remove(T.cache[A].handle.elem);}}});(function(){T.support={};var d=document.documentElement,c=document.createElement("script"),A=document.createElement("div"),B="script"+(new Date).getTime();A.style.display="none";A.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var D=A.getElementsByTagName("*"),e=A.getElementsByTagName("a")[0];if(!D||!D.length||!e){return ;}T.support={leadingWhitespace:A.firstChild.nodeType==3,tbody:!A.getElementsByTagName("tbody").length,objectAll:!!A.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!A.getElementsByTagName("link").length,style:/red/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:e.style.opacity==="0.5",cssFloat:!!e.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};c.type="text/javascript";try{c.appendChild(document.createTextNode("window."+B+"=1;"));}catch(C){}d.insertBefore(c,d.firstChild);if(W[B]){T.support.scriptEval=true;delete W[B];}d.removeChild(c);if(A.attachEvent&&A.fireEvent){A.attachEvent("onclick",function(){T.support.noCloneEvent=false;A.detachEvent("onclick",arguments.callee);});A.cloneNode(true).fireEvent("onclick");}T(function(){var f=document.createElement("div");f.style.width=f.style.paddingLeft="1px";document.body.appendChild(f);T.boxModel=T.support.boxModel=f.offsetWidth===2;document.body.removeChild(f).style.display="none";});})();var H=T.support.cssFloat?"cssFloat":"styleFloat";T.props={"for":"htmlFor","class":"className","float":H,cssFloat:H,styleFloat:H,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};T.fn.extend({_load:T.fn.load,load:function(c,B,A){if(typeof c!=="string"){return this._load(c);}var C=c.indexOf(" ");if(C>=0){var e=c.slice(C,c.length);c=c.slice(0,C);}var D="GET";if(B){if(T.isFunction(B)){A=B;B=null;}else{if(typeof B==="object"){B=T.param(B);D="POST";}}}var d=this;T.ajax({url:c,type:D,dataType:"html",data:B,complete:function(g,f){if(f=="success"||f=="notmodified"){d.html(e?T("<div/>").append(g.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(e):g.responseText);}if(A){d.each(A,[g.responseText,f,g]);}}});return this;},serialize:function(){return T.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return this.elements?T.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type));}).map(function(C,B){var A=T(this).val();return A==null?null:T.isArray(A)?T.map(A,function(D,c){return{name:B.name,value:D};}):{name:B.name,value:A};}).get();}});T.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(B,A){T.fn[A]=function(C){return this.bind(A,C);};});var N=AD();T.extend({get:function(D,B,A,C){if(T.isFunction(B)){A=B;B=null;}return T.ajax({type:"GET",url:D,data:B,success:A,dataType:C});},getScript:function(B,A){return T.get(B,null,A,"script");},getJSON:function(C,B,A){return T.get(C,B,A,"json");},post:function(D,B,A,C){if(T.isFunction(B)){A=B;B={};}return T.ajax({type:"POST",url:D,data:B,success:A,dataType:C});},ajaxSetup:function(A){T.extend(T.ajaxSettings,A);},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return W.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(k){k=T.extend(true,k,T.extend(true,{},T.ajaxSettings,k));var A,r=/=\?(&|$)/g,d,B,q=k.type.toUpperCase();if(k.data&&k.processData&&typeof k.data!=="string"){k.data=T.param(k.data);}if(k.dataType=="jsonp"){if(q=="GET"){if(!k.url.match(r)){k.url+=(k.url.match(/\?/)?"&":"?")+(k.jsonp||"callback")+"=?";}}else{if(!k.data||!k.data.match(r)){k.data=(k.data?k.data+"&":"")+(k.jsonp||"callback")+"=?";}}k.dataType="json";}if(k.dataType=="json"&&(k.data&&k.data.match(r)||k.url.match(r))){A="jsonp"+N++;if(k.data){k.data=(k.data+"").replace(r,"="+A+"$1");}k.url=k.url.replace(r,"="+A+"$1");k.dataType="script";W[A]=function(u){B=u;o();l();W[A]=AB;try{delete W[A];}catch(t){}if(p){p.removeChild(D);}};}if(k.dataType=="script"&&k.cache==null){k.cache=false;}if(k.cache===false&&q=="GET"){var s=AD();var C=k.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+s+"$2");k.url=C+((C==k.url)?(k.url.match(/\?/)?"&":"?")+"_="+s:"");}if(k.data&&q=="GET"){k.url+=(k.url.match(/\?/)?"&":"?")+k.data;k.data=null;}if(k.global&&!T.active++){T.event.trigger("ajaxStart");}var e=/^(\w+:)?\/\/([^\/?#]+)/.exec(k.url);if(k.dataType=="script"&&q=="GET"&&e&&(e[1]&&e[1]!=location.protocol||e[2]!=location.host)){var p=document.getElementsByTagName("head")[0];var D=document.createElement("script");D.src=k.url;if(k.scriptCharset){D.charset=k.scriptCharset;}if(!A){var g=false;D.onload=D.onreadystatechange=function(){if(!g&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){g=true;o();l();D.onload=D.onreadystatechange=null;p.removeChild(D);}};}p.appendChild(D);return AB;}var m=false;var n=k.xhr();if(k.username){n.open(q,k.url,k.async,k.username,k.password);}else{n.open(q,k.url,k.async);}try{if(k.data){n.setRequestHeader("Content-Type",k.contentType);}if(k.ifModified){n.setRequestHeader("If-Modified-Since",T.lastModified[k.url]||"Thu, 01 Jan 1970 00:00:00 GMT");}n.setRequestHeader("X-Requested-With","XMLHttpRequest");n.setRequestHeader("Accept",k.dataType&&k.accepts[k.dataType]?k.accepts[k.dataType]+", */*":k.accepts._default);}catch(c){}if(k.beforeSend&&k.beforeSend(n,k)===false){if(k.global&&!--T.active){T.event.trigger("ajaxStop");}n.abort();return false;}if(k.global){T.event.trigger("ajaxSend",[n,k]);}var h=function(v){if(n.readyState==0){if(f){clearInterval(f);f=null;if(k.global&&!--T.active){T.event.trigger("ajaxStop");}}}else{if(!m&&n&&(n.readyState==4||v=="timeout")){m=true;if(f){clearInterval(f);f=null;}d=v=="timeout"?"timeout":!T.httpSuccess(n)?"error":k.ifModified&&T.httpNotModified(n,k.url)?"notmodified":"success";if(d=="success"){try{B=T.httpData(n,k.dataType,k);}catch(t){d="parsererror";}}if(d=="success"){var u;try{u=n.getResponseHeader("Last-Modified");}catch(t){}if(k.ifModified&&u){T.lastModified[k.url]=u;}if(!A){o();}}else{T.handleError(k,n,d);}l();if(v){n.abort();}if(k.async){n=null;}}}};if(k.async){var f=setInterval(h,13);if(k.timeout>0){setTimeout(function(){if(n&&!m){h("timeout");}},k.timeout);}}try{n.send(k.data);}catch(c){T.handleError(k,n,null,c);}if(!k.async){h();}function o(){if(k.success){k.success(B,d);}if(k.global){T.event.trigger("ajaxSuccess",[n,k]);}}function l(){if(k.complete){k.complete(n,d);}if(k.global){T.event.trigger("ajaxComplete",[n,k]);}if(k.global&&!--T.active){T.event.trigger("ajaxStop");}}return n;},handleError:function(C,A,D,B){if(C.error){C.error(A,D,B);}if(C.global){T.event.trigger("ajaxError",[A,C,B]);}},active:0,httpSuccess:function(A){try{return !A.status&&location.protocol=="file:"||(A.status>=200&&A.status<300)||A.status==304||A.status==1223;}catch(B){}return false;},httpNotModified:function(B,D){try{var A=B.getResponseHeader("Last-Modified");return B.status==304||A==T.lastModified[D];}catch(C){}return false;},httpData:function(A,C,D){var c=A.getResponseHeader("content-type"),d=C=="xml"||!C&&c&&c.indexOf("xml")>=0,B=d?A.responseXML:A.responseText;if(d&&B.documentElement.tagName=="parsererror"){throw"parsererror";}if(D&&D.dataFilter){B=D.dataFilter(B,C);}if(typeof B==="string"){if(C=="script"){T.globalEval(B);}if(C=="json"){B=W["eval"]("("+B+")");}}return B;},param:function(D){var B=[];function A(d,c){B[B.length]=encodeURIComponent(d)+"="+encodeURIComponent(c);}if(T.isArray(D)||D.jquery){T.each(D,function(){A(this.name,this.value);});}else{for(var C in D){if(T.isArray(D[C])){T.each(D[C],function(){A(C,this);});}else{A(C,T.isFunction(D[C])?D[C]():D[C]);}}}return B.join("&").replace(/%20/g,"+");}});var V={},U,AE=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function K(B,C){var A={};T.each(AE.concat.apply([],AE.slice(0,C)),function(){A[this]=B;});return A;}T.fn.extend({show:function(C,A){if(C){return this.animate(K("show",3),C,A);}else{for(var c=0,e=this.length;c<e;c++){var f=T.data(this[c],"olddisplay");this[c].style.display=f||"";if(T.css(this[c],"display")==="none"){var d=this[c].tagName,B;if(V[d]){B=V[d];}else{var D=T("<"+d+" />").appendTo("body");B=D.css("display");if(B==="none"){B="block";}D.remove();V[d]=B;}T.data(this[c],"olddisplay",B);}}for(var c=0,e=this.length;c<e;c++){this[c].style.display=T.data(this[c],"olddisplay")||"";}return this;}},hide:function(B,A){if(B){return this.animate(K("hide",3),B,A);}else{for(var C=0,D=this.length;C<D;C++){var c=T.data(this[C],"olddisplay");if(!c&&c!=="none"){T.data(this[C],"olddisplay",T.css(this[C],"display"));}}for(var C=0,D=this.length;C<D;C++){this[C].style.display="none";}return this;}},_toggle:T.fn.toggle,toggle:function(A,B){var C=typeof A==="boolean";return T.isFunction(A)&&T.isFunction(B)?this._toggle.apply(this,arguments):A==null||C?this.each(function(){var D=C?A:T(this).is(":hidden");T(this)[D?"show":"hide"]();}):this.animate(K("toggle",3),A,B);},fadeTo:function(C,A,B){return this.animate({opacity:A},C,B);},animate:function(A,D,B,C){var c=T.speed(D,B,C);return this[c.queue===false?"each":"queue"](function(){var e=T.extend({},c),g,d=this.nodeType==1&&T(this).is(":hidden"),f=this;for(g in A){if(A[g]=="hide"&&d||A[g]=="show"&&!d){return e.complete.call(this);}if((g=="height"||g=="width")&&this.style){e.display=T.css(this,"display");e.overflow=this.style.overflow;}}if(e.overflow!=null){this.style.overflow="hidden";}e.curAnim=T.extend({},A);T.each(A,function(o,k){var l=new T.fx(f,e,o);if(/toggle|show|hide/.test(k)){l[k=="toggle"?d?"show":"hide":k](A);}else{var m=k.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),h=l.cur(true)||0;if(m){var p=parseFloat(m[2]),n=m[3]||"px";if(n!="px"){f.style[o]=(p||1)+n;h=((p||1)/l.cur(true))*h;f.style[o]=h+n;}if(m[1]){p=((m[1]=="-="?-1:1)*p)+h;}l.custom(h,p,n);}else{l.custom(h,k,"");}}});return true;});},stop:function(B,C){var A=T.timers;if(B){this.queue([]);}this.each(function(){for(var D=A.length-1;D>=0;D--){if(A[D].elem==this){if(C){A[D](true);}A.splice(D,1);}}});if(!C){this.dequeue();}return this;}});T.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(B,A){T.fn[B]=function(D,C){return this.animate(A,D,C);};});T.extend({speed:function(B,A,C){var D=typeof B==="object"?B:{complete:C||!C&&A||T.isFunction(B)&&B,duration:B,easing:C&&A||A&&!T.isFunction(A)&&A};D.duration=T.fx.off?0:typeof D.duration==="number"?D.duration:T.fx.speeds[D.duration]||T.fx.speeds._default;D.old=D.complete;D.complete=function(){if(D.queue!==false){T(this).dequeue();}if(T.isFunction(D.old)){D.old.call(this);}};return D;},easing:{linear:function(B,A,D,C){return D+C*B;},swing:function(B,A,D,C){return((-Math.cos(B*Math.PI)/2)+0.5)*C+D;}},timers:[],fx:function(B,C,A){this.options=C;this.elem=B;this.prop=A;if(!C.orig){C.orig={};}}});T.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this);}(T.fx.step[this.prop]||T.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block";}},cur:function(A){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop];}var B=parseFloat(T.css(this.elem,this.prop,A));return B&&B>-10000?B:parseFloat(T.curCSS(this.elem,this.prop))||0;},custom:function(A,B,C){this.startTime=AD();this.start=A;this.end=B;this.unit=C||this.unit||"px";this.now=this.start;this.pos=this.state=0;var c=this;function D(d){return c.step(d);}D.elem=this.elem;if(D()&&T.timers.push(D)&&!U){U=setInterval(function(){var d=T.timers;for(var e=0;e<d.length;e++){if(!d[e]()){d.splice(e--,1);}}if(!d.length){clearInterval(U);U=AB;}},13);}},show:function(){this.options.orig[this.prop]=T.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());T(this.elem).show();},hide:function(){this.options.orig[this.prop]=T.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(C){var D=AD();if(C||D>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var d=true;for(var c in this.options.curAnim){if(this.options.curAnim[c]!==true){d=false;}}if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(T.css(this.elem,"display")=="none"){this.elem.style.display="block";}}if(this.options.hide){T(this.elem).hide();}if(this.options.hide||this.options.show){for(var B in this.options.curAnim){T.attr(this.elem.style,B,this.options.orig[B]);}}this.options.complete.call(this.elem);}return false;}else{var A=D-this.startTime;this.state=A/this.options.duration;this.pos=T.easing[this.options.easing||(T.easing.swing?"swing":"linear")](this.state,A,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};T.extend(T.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(A){T.attr(A.elem.style,"opacity",A.now);},_default:function(A){if(A.elem.style&&A.elem.style[A.prop]!=null){A.elem.style[A.prop]=A.now+A.unit;}else{A.elem[A.prop]=A.now;}}}});if(document.documentElement.getBoundingClientRect){T.fn.offset=function(){if(!this[0]){return{top:0,left:0};}if(this[0]===this[0].ownerDocument.body){return T.offset.bodyOffset(this[0]);}var d=this[0].getBoundingClientRect(),C=this[0].ownerDocument,e=C.body,f=C.documentElement,A=f.clientTop||e.clientTop||0,B=f.clientLeft||e.clientLeft||0,D=d.top+(self.pageYOffset||T.boxModel&&f.scrollTop||e.scrollTop)-A,c=d.left+(self.pageXOffset||T.boxModel&&f.scrollLeft||e.scrollLeft)-B;return{top:D,left:c};};}else{T.fn.offset=function(){if(!this[0]){return{top:0,left:0};}if(this[0]===this[0].ownerDocument.body){return T.offset.bodyOffset(this[0]);}T.offset.initialized||T.offset.initialize();var d=this[0],g=d.offsetParent,h=d,A=d.ownerDocument,C,f=A.documentElement,c=A.body,D=A.defaultView,k=D.getComputedStyle(d,null),B=d.offsetTop,e=d.offsetLeft;while((d=d.parentNode)&&d!==c&&d!==f){C=D.getComputedStyle(d,null);B-=d.scrollTop,e-=d.scrollLeft;if(d===g){B+=d.offsetTop,e+=d.offsetLeft;if(T.offset.doesNotAddBorder&&!(T.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(d.tagName))){B+=parseInt(C.borderTopWidth,10)||0,e+=parseInt(C.borderLeftWidth,10)||0;}h=g,g=d.offsetParent;}if(T.offset.subtractsBorderForOverflowNotVisible&&C.overflow!=="visible"){B+=parseInt(C.borderTopWidth,10)||0,e+=parseInt(C.borderLeftWidth,10)||0;}k=C;}if(k.position==="relative"||k.position==="static"){B+=c.offsetTop,e+=c.offsetLeft;}if(k.position==="fixed"){B+=Math.max(f.scrollTop,c.scrollTop),e+=Math.max(f.scrollLeft,c.scrollLeft);}return{top:B,left:e};};}T.offset={initialize:function(){if(this.initialized){return ;}var C=document.body,g=document.createElement("div"),e,f,A,d,B,h,c=C.style.marginTop,D='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';B={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(h in B){g.style[h]=B[h];}g.innerHTML=D;C.insertBefore(g,C.firstChild);e=g.firstChild,f=e.firstChild,d=e.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(f.offsetTop!==5);this.doesAddBorderForTableAndCells=(d.offsetTop===5);e.style.overflow="hidden",e.style.position="relative";this.subtractsBorderForOverflowNotVisible=(f.offsetTop===-5);C.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(C.offsetTop===0);C.style.marginTop=c;C.removeChild(g);this.initialized=true;},bodyOffset:function(C){T.offset.initialized||T.offset.initialize();var A=C.offsetTop,B=C.offsetLeft;if(T.offset.doesNotIncludeMarginInBodyOffset){A+=parseInt(T.curCSS(C,"marginTop",true),10)||0,B+=parseInt(T.curCSS(C,"marginLeft",true),10)||0;}return{top:A,left:B};}};T.fn.extend({position:function(){var B=0,C=0,c;if(this[0]){var D=this.offsetParent(),A=this.offset(),d=/^body|html$/i.test(D[0].tagName)?{top:0,left:0}:D.offset();A.top-=Y(this,"marginTop");A.left-=Y(this,"marginLeft");d.top+=Y(D,"borderTopWidth");d.left+=Y(D,"borderLeftWidth");c={top:A.top-d.top,left:A.left-d.left};}return c;},offsetParent:function(){var A=this[0].offsetParent||document.body;while(A&&(!/^body|html$/i.test(A.tagName)&&T.css(A,"position")=="static")){A=A.offsetParent;}return T(A);}});T.each(["Left","Top"],function(B,C){var A="scroll"+C;T.fn[A]=function(D){if(!this[0]){return null;}return D!==AB?this.each(function(){this==W||this==document?W.scrollTo(!B?D:T(W).scrollLeft(),B?D:T(W).scrollTop()):this[A]=D;}):this[0]==W||this[0]==document?self[B?"pageYOffset":"pageXOffset"]||T.boxModel&&document.documentElement[A]||document.body[A]:this[0][A];};});T.each(["Height","Width"],function(B,D){var d=B?"Left":"Top",C=B?"Right":"Bottom",c=D.toLowerCase();T.fn["inner"+D]=function(){return this[0]?T.css(this[0],c,false,"padding"):null;};T.fn["outer"+D]=function(e){return this[0]?T.css(this[0],c,false,e?"margin":"border"):null;};var A=D.toLowerCase();T.fn[A]=function(e){return this[0]==W?document.compatMode=="CSS1Compat"&&document.documentElement["client"+D]||document.body["client"+D]:this[0]==document?Math.max(document.documentElement["client"+D],document.body["scroll"+D],document.documentElement["scroll"+D],document.body["offset"+D],document.documentElement["offset"+D]):e===AB?(this.length?T.css(this[0],A):null):this.css(A,typeof e==="string"?e:e+"px");};});})();jQuery.ui||(function(G){var A=G.fn.remove,F=G.browser.mozilla&&(parseFloat(G.browser.version)<1.9);G.ui={version:"1.7.2",plugin:{add:function(L,K,N){var J=G.ui[L].prototype;for(var M in N){J.plugins[M]=J.plugins[M]||[];J.plugins[M].push([K,N[M]]);}},call:function(M,K,L){var N=M.plugins[K];if(!N||!M.element[0].parentNode){return ;}for(var J=0;J<N.length;J++){if(M.options[N[J][0]]){N[J][1].apply(M.element,L);}}}},contains:function(J,K){return document.compareDocumentPosition?J.compareDocumentPosition(K)&16:J!==K&&J.contains(K);},hasScroll:function(J,L){if(G(J).css("overflow")=="hidden"){return false;}var M=(L&&L=="left")?"scrollLeft":"scrollTop",K=false;if(J[M]>0){return true;}J[M]=1;K=(J[M]>0);J[M]=0;return K;},isOverAxis:function(K,L,J){return(K>L)&&(K<(L+J));},isOver:function(N,L,O,J,M,K){return G.ui.isOverAxis(N,O,M)&&G.ui.isOverAxis(L,J,K);},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(F){var D=G.attr,E=G.fn.removeAttr,B="http://www.w3.org/2005/07/aaa",I=/^aria-/,H=/^wairole:/;G.attr=function(L,M,K){var J=K!==undefined;return(M=="role"?(J?D.call(this,L,M,"wairole:"+K):(D.apply(this,arguments)||"").replace(H,"")):(I.test(M)?(J?L.setAttributeNS(B,M.replace(I,"aaa:"),K):D.call(this,L,M.replace(I,"aaa:"))):D.apply(this,arguments)));};G.fn.removeAttr=function(J){return(I.test(J)?this.each(function(){this.removeAttributeNS(B,J.replace(I,""));}):E.call(this,J));};}G.fn.extend({remove:function(){G("*",this).add(this).each(function(){G(this).triggerHandler("remove");});return A.apply(this,arguments);},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui");},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false;});},scrollParent:function(){var J;if((G.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){J=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(G.curCSS(this,"position",1))&&(/(auto|scroll)/).test(G.curCSS(this,"overflow",1)+G.curCSS(this,"overflow-y",1)+G.curCSS(this,"overflow-x",1));}).eq(0);}else{J=this.parents().filter(function(){return(/(auto|scroll)/).test(G.curCSS(this,"overflow",1)+G.curCSS(this,"overflow-y",1)+G.curCSS(this,"overflow-x",1));}).eq(0);}return(/fixed/).test(this.css("position"))||!J.length?G(document):J;}});G.extend(G.expr[":"],{data:function(J,K,L){return !!G.data(J,L[3]);},focusable:function(K){var J=K.nodeName.toLowerCase(),L=G.attr(K,"tabindex");return(/input|select|textarea|button|object/.test(J)?!K.disabled:"a"==J||"area"==J?K.href||!isNaN(L):!isNaN(L))&&!G(K)["area"==J?"parents":"closest"](":hidden").length;},tabbable:function(J){var K=G.attr(J,"tabindex");return(isNaN(K)||K>=0)&&G(J).is(":focusable");}});function C(J,O,N,K){function L(P){var Q=G[J][O][P]||[];return(typeof Q=="string"?Q.split(/,?\s+/):Q);}var M=L("getter");if(K.length==1&&typeof K[0]=="string"){M=M.concat(L("getterSetter"));}return(G.inArray(N,M)!=-1);}G.widget=function(K,L){var J=K.split(".")[0];K=K.split(".")[1];G.fn[K]=function(N){var P=(typeof N=="string"),O=Array.prototype.slice.call(arguments,1);if(P&&N.substring(0,1)=="_"){return this;}if(P&&C(J,K,N,O)){var M=G.data(this[0],K);return(M?M[N].apply(M,O):undefined);}return this.each(function(){var Q=G.data(this,K);(!Q&&!P&&G.data(this,K,new G[J][K](this,N))._init());(Q&&P&&G.isFunction(Q[N])&&Q[N].apply(Q,O));});};G[J]=G[J]||{};G[J][K]=function(N,O){var M=this;this.namespace=J;this.widgetName=K;this.widgetEventPrefix=G[J][K].eventPrefix||K;this.widgetBaseClass=J+"-"+K;this.options=G.extend({},G.widget.defaults,G[J][K].defaults,G.metadata&&G.metadata.get(N)[K],O);this.element=G(N).bind("setData."+K,function(Q,R,P){if(Q.target==N){return M._setData(R,P);}}).bind("getData."+K,function(P,Q){if(P.target==N){return M._getData(Q);}}).bind("remove",function(){return M.destroy();});};G[J][K].prototype=G.extend({},G.widget.prototype,L);G[J][K].getterSetter="option";};G.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled");},option:function(K,J){var L=K,M=this;if(typeof K=="string"){if(J===undefined){return this._getData(K);}L={};L[K]=J;}G.each(L,function(O,N){M._setData(O,N);});},_getData:function(J){return this.options[J];},_setData:function(K,J){this.options[K]=J;if(K=="disabled"){this.element[J?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",J);}},enable:function(){this._setData("disabled",false);},disable:function(){this._setData("disabled",true);},_trigger:function(K,J,P){var N=this.options[K],M=(K==this.widgetEventPrefix?K:this.widgetEventPrefix+K);J=G.Event(J);J.type=M;if(J.originalEvent){for(var L=G.event.props.length,O;L;){O=G.event.props[--L];J[O]=J.originalEvent[O];}}this.element.trigger(J,P);return !(G.isFunction(N)&&N.call(this.element[0],J,P)===false||J.isDefaultPrevented());}};G.widget.defaults={disabled:false};G.ui.mouse={_mouseInit:function(){var J=this;this.element.bind("mousedown."+this.widgetName,function(K){return J._mouseDown(K);}).bind("click."+this.widgetName,function(K){if(J._preventClickEvent){J._preventClickEvent=false;K.stopImmediatePropagation();return false;}});if(G.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on");}this.started=false;},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(G.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable));},_mouseDown:function(K){K.originalEvent=K.originalEvent||{};if(K.originalEvent.mouseHandled){return ;}(this._mouseStarted&&this._mouseUp(K));this._mouseDownEvent=K;var L=this,J=(K.which==1),M=(typeof this.options.cancel=="string"?G(K.target).parents().add(K.target).filter(this.options.cancel).length:false);if(!J||M||!this._mouseCapture(K)){return true;}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){L.mouseDelayMet=true;},this.options.delay);}if(this._mouseDistanceMet(K)&&this._mouseDelayMet(K)){this._mouseStarted=(this._mouseStart(K)!==false);if(!this._mouseStarted){K.preventDefault();return true;}}this._mouseMoveDelegate=function(N){return L._mouseMove(N);};this._mouseUpDelegate=function(N){return L._mouseUp(N);};G(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(G.browser.safari||K.preventDefault());K.originalEvent.mouseHandled=true;return true;},_mouseMove:function(J){if(G.browser.msie&&!J.button){return this._mouseUp(J);}if(this._mouseStarted){this._mouseDrag(J);return J.preventDefault();}if(this._mouseDistanceMet(J)&&this._mouseDelayMet(J)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,J)!==false);(this._mouseStarted?this._mouseDrag(J):this._mouseUp(J));}return !this._mouseStarted;},_mouseUp:function(J){G(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(J.target==this._mouseDownEvent.target);this._mouseStop(J);}return false;},_mouseDistanceMet:function(J){return(Math.max(Math.abs(this._mouseDownEvent.pageX-J.pageX),Math.abs(this._mouseDownEvent.pageY-J.pageY))>=this.options.distance);},_mouseDelayMet:function(J){return this.mouseDelayMet;},_mouseStart:function(J){},_mouseDrag:function(J){},_mouseStop:function(J){},_mouseCapture:function(J){return true;}};G.ui.mouse.defaults={cancel:null,distance:1,delay:0};})(jQuery);(function(A){A.widget("ui.draggable",A.extend({},A.ui.mouse,{_init:function(){if(this.options.helper=="original"&&!(/^(?:r|a|f)/).test(this.element.css("position"))){this.element[0].style.position="relative";}(this.options.addClasses&&this.element.addClass("ui-draggable"));(this.options.disabled&&this.element.addClass("ui-draggable-disabled"));this._mouseInit();},destroy:function(){if(!this.element.data("draggable")){return ;}this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();},_mouseCapture:function(B){var C=this.options;if(this.helper||C.disabled||A(B.target).is(".ui-resizable-handle")){return false;}this.handle=this._getHandle(B);if(!this.handle){return false;}return true;},_mouseStart:function(B){var C=this.options;this.helper=this._createHelper(B);this._cacheHelperProportions();if(A.ui.ddmanager){A.ui.ddmanager.current=this;}this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};A.extend(this.offset,{click:{left:B.pageX-this.offset.left,top:B.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(B);this.originalPageX=B.pageX;this.originalPageY=B.pageY;if(C.cursorAt){this._adjustOffsetFromHelper(C.cursorAt);}if(C.containment){this._setContainment();}this._trigger("start",B);this._cacheHelperProportions();if(A.ui.ddmanager&&!C.dropBehaviour){A.ui.ddmanager.prepareOffsets(this,B);}this.helper.addClass("ui-draggable-dragging");this._mouseDrag(B,true);return true;},_mouseDrag:function(B,C){this.position=this._generatePosition(B);this.positionAbs=this._convertPositionTo("absolute");if(!C){var D=this._uiHash();this._trigger("drag",B,D);this.position=D.position;}if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px";}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px";}if(A.ui.ddmanager){A.ui.ddmanager.drag(this,B);}return false;},_mouseStop:function(D){var C=false;if(A.ui.ddmanager&&!this.options.dropBehaviour){C=A.ui.ddmanager.drop(this,D);}if(this.dropped){C=this.dropped;this.dropped=false;}if((this.options.revert=="invalid"&&!C)||(this.options.revert=="valid"&&C)||this.options.revert===true||(A.isFunction(this.options.revert)&&this.options.revert.call(this.element,C))){var B=this;A(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){B._trigger("stop",D);B._clear();});}else{this._trigger("stop",D);this._clear();}return false;},_getHandle:function(B){var C=!this.options.handle||!A(this.options.handle,this.element).length?true:false;A(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==B.target){C=true;}});return C;},_createHelper:function(D){var C=this.options;var B=A.isFunction(C.helper)?A(C.helper.apply(this.element[0],[D])):(C.helper=="clone"?this.element.clone():this.element);if(!B.parents("body").length){B.appendTo((C.appendTo=="parent"?this.element[0].parentNode:C.appendTo));}if(B[0]!=this.element[0]&&!(/(fixed|absolute)/).test(B.css("position"))){B.css("position","absolute");}return B;},_adjustOffsetFromHelper:function(B){if(B.left!=undefined){this.offset.click.left=B.left+this.margins.left;}if(B.right!=undefined){this.offset.click.left=this.helperProportions.width-B.right+this.margins.left;}if(B.top!=undefined){this.offset.click.top=B.top+this.margins.top;}if(B.bottom!=undefined){this.offset.click.top=this.helperProportions.height-B.bottom+this.margins.top;}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var B=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&A.ui.contains(this.scrollParent[0],this.offsetParent[0])){B.left+=this.scrollParent.scrollLeft();B.top+=this.scrollParent.scrollTop();}if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&A.browser.msie)){B={top:0,left:0};}return{top:B.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:B.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var B=this.element.position();return{top:B.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:B.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()};}else{return{top:0,left:0};}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)};},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};},_setContainment:function(){var C=this.options;if(C.containment=="parent"){C.containment=this.helper[0].parentNode;}if(C.containment=="document"||C.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,A(C.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(A(C.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];}if(!(/^(document|window|parent)$/).test(C.containment)&&C.containment.constructor!=Array){var E=A(C.containment)[0];if(!E){return ;}var D=A(C.containment).offset();var B=(A(E).css("overflow")!="hidden");this.containment=[D.left+(parseInt(A(E).css("borderLeftWidth"),10)||0)+(parseInt(A(E).css("paddingLeft"),10)||0)-this.margins.left,D.top+(parseInt(A(E).css("borderTopWidth"),10)||0)+(parseInt(A(E).css("paddingTop"),10)||0)-this.margins.top,D.left+(B?Math.max(E.scrollWidth,E.offsetWidth):E.offsetWidth)-(parseInt(A(E).css("borderLeftWidth"),10)||0)-(parseInt(A(E).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,D.top+(B?Math.max(E.scrollHeight,E.offsetHeight):E.offsetHeight)-(parseInt(A(E).css("borderTopWidth"),10)||0)-(parseInt(A(E).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top];}else{if(C.containment.constructor==Array){this.containment=C.containment;}}},_convertPositionTo:function(E,C){if(!C){C=this.position;}var G=E=="absolute"?1:-1;var F=this.options,B=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&A.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,D=(/(html|body)/i).test(B[0].tagName);return{top:(C.top+this.offset.relative.top*G+this.offset.parent.top*G-(A.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(D?0:B.scrollTop()))*G)),left:(C.left+this.offset.relative.left*G+this.offset.parent.left*G-(A.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():D?0:B.scrollLeft())*G))};},_generatePosition:function(G){var D=this.options,B=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&A.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,C=(/(html|body)/i).test(B[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset();}var H=G.pageX;var I=G.pageY;if(this.originalPosition){if(this.containment){if(G.pageX-this.offset.click.left<this.containment[0]){H=this.containment[0]+this.offset.click.left;}if(G.pageY-this.offset.click.top<this.containment[1]){I=this.containment[1]+this.offset.click.top;}if(G.pageX-this.offset.click.left>this.containment[2]){H=this.containment[2]+this.offset.click.left;}if(G.pageY-this.offset.click.top>this.containment[3]){I=this.containment[3]+this.offset.click.top;}}if(D.grid){var E=this.originalPageY+Math.round((I-this.originalPageY)/D.grid[1])*D.grid[1];I=this.containment?(!(E-this.offset.click.top<this.containment[1]||E-this.offset.click.top>this.containment[3])?E:(!(E-this.offset.click.top<this.containment[1])?E-D.grid[1]:E+D.grid[1])):E;var F=this.originalPageX+Math.round((H-this.originalPageX)/D.grid[0])*D.grid[0];H=this.containment?(!(F-this.offset.click.left<this.containment[0]||F-this.offset.click.left>this.containment[2])?F:(!(F-this.offset.click.left<this.containment[0])?F-D.grid[0]:F+D.grid[0])):F;}}return{top:(I-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(A.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(C?0:B.scrollTop())))),left:(H-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(A.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():C?0:B.scrollLeft())))};},_clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval){this.helper.remove();}this.helper=null;this.cancelHelperRemoval=false;},_trigger:function(B,D,C){C=C||this._uiHash();A.ui.plugin.call(this,B,[D,C]);if(B=="drag"){this.positionAbs=this._convertPositionTo("absolute");}return A.widget.prototype._trigger.call(this,B,D,C);},plugins:{},_uiHash:function(B){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,offset:this.positionAbs};}}));A.extend(A.ui.draggable,{version:"1.7.2",eventPrefix:"drag",defaults:{addClasses:true,appendTo:"parent",axis:false,cancel:":input,option",connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,delay:0,distance:1,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false}});A.ui.plugin.add("draggable","connectToSortable",{start:function(F,D){var E=A(this).data("draggable"),C=E.options,B=A.extend({},D,{item:E.element});E.sortables=[];A(C.connectToSortable).each(function(){var G=A.data(this,"sortable");if(G&&!G.options.disabled){E.sortables.push({instance:G,shouldRevert:G.options.revert});G._refreshItems();G._trigger("activate",F,B);}});},stop:function(E,C){var D=A(this).data("draggable"),B=A.extend({},C,{item:D.element});A.each(D.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;D.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert){this.instance.options.revert=true;}this.instance._mouseStop(E);this.instance.options.helper=this.instance.options._helper;if(D.options.helper=="original"){this.instance.currentItem.css({top:"auto",left:"auto"});}}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",E,B);}});},drag:function(F,C){var D=A(this).data("draggable"),B=this;var E=function(M){var H=this.offset.click.top,I=this.offset.click.left;var O=this.positionAbs.top,K=this.positionAbs.left;var L=M.height,J=M.width;var G=M.top,N=M.left;return A.ui.isOver(O+H,K+I,G,N,L,J);};A.each(D.sortables,function(G){this.instance.positionAbs=D.positionAbs;this.instance.helperProportions=D.helperProportions;this.instance.offset.click=D.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=A(B).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return C.helper[0];};F.target=this.instance.currentItem[0];this.instance._mouseCapture(F,true);this.instance._mouseStart(F,true,true);this.instance.offset.click.top=D.offset.click.top;this.instance.offset.click.left=D.offset.click.left;this.instance.offset.parent.left-=D.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=D.offset.parent.top-this.instance.offset.parent.top;D._trigger("toSortable",F);D.dropped=this.instance.element;D.currentItem=D.element;this.instance.fromOutside=D;}if(this.instance.currentItem){this.instance._mouseDrag(F);}}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",F,this.instance._uiHash(this.instance));this.instance._mouseStop(F,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder){this.instance.placeholder.remove();}D._trigger("fromSortable",F);D.dropped=false;}}});}});A.ui.plugin.add("draggable","cursor",{start:function(E,D){var B=A("body"),C=A(this).data("draggable").options;if(B.css("cursor")){C._cursor=B.css("cursor");}B.css("cursor",C.cursor);},stop:function(B,D){var C=A(this).data("draggable").options;if(C._cursor){A("body").css("cursor",C._cursor);}}});A.ui.plugin.add("draggable","iframeFix",{start:function(B,D){var C=A(this).data("draggable").options;A(C.iframeFix===true?"iframe":C.iframeFix).each(function(){A('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(A(this).offset()).appendTo("body");});},stop:function(B,C){A("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this);});}});A.ui.plugin.add("draggable","opacity",{start:function(E,D){var B=A(D.helper),C=A(this).data("draggable").options;if(B.css("opacity")){C._opacity=B.css("opacity");}B.css("opacity",C.opacity);},stop:function(B,D){var C=A(this).data("draggable").options;if(C._opacity){A(D.helper).css("opacity",C._opacity);}}});A.ui.plugin.add("draggable","scroll",{start:function(D,C){var B=A(this).data("draggable");if(B.scrollParent[0]!=document&&B.scrollParent[0].tagName!="HTML"){B.overflowOffset=B.scrollParent.offset();}},drag:function(E,D){var F=A(this).data("draggable"),C=F.options,B=false;if(F.scrollParent[0]!=document&&F.scrollParent[0].tagName!="HTML"){if(!C.axis||C.axis!="x"){if((F.overflowOffset.top+F.scrollParent[0].offsetHeight)-E.pageY<C.scrollSensitivity){F.scrollParent[0].scrollTop=B=F.scrollParent[0].scrollTop+C.scrollSpeed;}else{if(E.pageY-F.overflowOffset.top<C.scrollSensitivity){F.scrollParent[0].scrollTop=B=F.scrollParent[0].scrollTop-C.scrollSpeed;}}}if(!C.axis||C.axis!="y"){if((F.overflowOffset.left+F.scrollParent[0].offsetWidth)-E.pageX<C.scrollSensitivity){F.scrollParent[0].scrollLeft=B=F.scrollParent[0].scrollLeft+C.scrollSpeed;}else{if(E.pageX-F.overflowOffset.left<C.scrollSensitivity){F.scrollParent[0].scrollLeft=B=F.scrollParent[0].scrollLeft-C.scrollSpeed;}}}}else{if(!C.axis||C.axis!="x"){if(E.pageY-A(document).scrollTop()<C.scrollSensitivity){B=A(document).scrollTop(A(document).scrollTop()-C.scrollSpeed);}else{if(A(window).height()-(E.pageY-A(document).scrollTop())<C.scrollSensitivity){B=A(document).scrollTop(A(document).scrollTop()+C.scrollSpeed);}}}if(!C.axis||C.axis!="y"){if(E.pageX-A(document).scrollLeft()<C.scrollSensitivity){B=A(document).scrollLeft(A(document).scrollLeft()-C.scrollSpeed);}else{if(A(window).width()-(E.pageX-A(document).scrollLeft())<C.scrollSensitivity){B=A(document).scrollLeft(A(document).scrollLeft()+C.scrollSpeed);}}}}if(B!==false&&A.ui.ddmanager&&!C.dropBehaviour){A.ui.ddmanager.prepareOffsets(F,E);}}});A.ui.plugin.add("draggable","snap",{start:function(E,D){var B=A(this).data("draggable"),C=B.options;B.snapElements=[];A(C.snap.constructor!=String?(C.snap.items||":data(draggable)"):C.snap).each(function(){var F=A(this);var G=F.offset();if(this!=B.element[0]){B.snapElements.push({item:this,width:F.outerWidth(),height:F.outerHeight(),top:G.top,left:G.left});}});},drag:function(G,K){var Q=A(this).data("draggable"),I=Q.options;var C=I.snapTolerance;var D=K.offset.left,E=D+Q.helperProportions.width,R=K.offset.top,S=R+Q.helperProportions.height;for(var F=Q.snapElements.length-1;F>=0;F--){var H=Q.snapElements[F].left,L=H+Q.snapElements[F].width,M=Q.snapElements[F].top,J=M+Q.snapElements[F].height;if(!((H-C<D&&D<L+C&&M-C<R&&R<J+C)||(H-C<D&&D<L+C&&M-C<S&&S<J+C)||(H-C<E&&E<L+C&&M-C<R&&R<J+C)||(H-C<E&&E<L+C&&M-C<S&&S<J+C))){if(Q.snapElements[F].snapping){(Q.options.snap.release&&Q.options.snap.release.call(Q.element,G,A.extend(Q._uiHash(),{snapItem:Q.snapElements[F].item})));}Q.snapElements[F].snapping=false;continue;}if(I.snapMode!="inner"){var T=Math.abs(M-S)<=C;var B=Math.abs(J-R)<=C;var O=Math.abs(H-E)<=C;var N=Math.abs(L-D)<=C;if(T){K.position.top=Q._convertPositionTo("relative",{top:M-Q.helperProportions.height,left:0}).top-Q.margins.top;}if(B){K.position.top=Q._convertPositionTo("relative",{top:J,left:0}).top-Q.margins.top;}if(O){K.position.left=Q._convertPositionTo("relative",{top:0,left:H-Q.helperProportions.width}).left-Q.margins.left;}if(N){K.position.left=Q._convertPositionTo("relative",{top:0,left:L}).left-Q.margins.left;}}var P=(T||B||O||N);if(I.snapMode!="outer"){var T=Math.abs(M-R)<=C;var B=Math.abs(J-S)<=C;var O=Math.abs(H-D)<=C;var N=Math.abs(L-E)<=C;if(T){K.position.top=Q._convertPositionTo("relative",{top:M,left:0}).top-Q.margins.top;}if(B){K.position.top=Q._convertPositionTo("relative",{top:J-Q.helperProportions.height,left:0}).top-Q.margins.top;}if(O){K.position.left=Q._convertPositionTo("relative",{top:0,left:H}).left-Q.margins.left;}if(N){K.position.left=Q._convertPositionTo("relative",{top:0,left:L-Q.helperProportions.width}).left-Q.margins.left;}}if(!Q.snapElements[F].snapping&&(T||B||O||N||P)){(Q.options.snap.snap&&Q.options.snap.snap.call(Q.element,G,A.extend(Q._uiHash(),{snapItem:Q.snapElements[F].item})));}Q.snapElements[F].snapping=(T||B||O||N||P);}}});A.ui.plugin.add("draggable","stack",{start:function(B,E){var C=A(this).data("draggable").options;var D=A.makeArray(A(C.stack.group)).sort(function(F,G){return(parseInt(A(F).css("zIndex"),10)||C.stack.min)-(parseInt(A(G).css("zIndex"),10)||C.stack.min);});A(D).each(function(F){this.style.zIndex=C.stack.min+F;});this[0].style.zIndex=C.stack.min+D.length;}});A.ui.plugin.add("draggable","zIndex",{start:function(E,D){var B=A(D.helper),C=A(this).data("draggable").options;if(B.css("zIndex")){C._zIndex=B.css("zIndex");}B.css("zIndex",C.zIndex);},stop:function(B,D){var C=A(this).data("draggable").options;if(C._zIndex){A(D.helper).css("zIndex",C._zIndex);}}});})(jQuery);(function(A){A.widget("ui.droppable",{_init:function(){var C=this.options,B=C.accept;this.isover=0;this.isout=1;this.options.accept=this.options.accept&&A.isFunction(this.options.accept)?this.options.accept:function(D){return D.is(B);};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};A.ui.ddmanager.droppables[this.options.scope]=A.ui.ddmanager.droppables[this.options.scope]||[];A.ui.ddmanager.droppables[this.options.scope].push(this);(this.options.addClasses&&this.element.addClass("ui-droppable"));},destroy:function(){var B=A.ui.ddmanager.droppables[this.options.scope];for(var C=0;C<B.length;C++){if(B[C]==this){B.splice(C,1);}}this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");},_setData:function(B,C){if(B=="accept"){this.options.accept=C&&A.isFunction(C)?C:function(D){return D.is(C);};}else{A.widget.prototype._setData.apply(this,arguments);}},_activate:function(C){var B=A.ui.ddmanager.current;if(this.options.activeClass){this.element.addClass(this.options.activeClass);}(B&&this._trigger("activate",C,this.ui(B)));},_deactivate:function(C){var B=A.ui.ddmanager.current;if(this.options.activeClass){this.element.removeClass(this.options.activeClass);}(B&&this._trigger("deactivate",C,this.ui(B)));},_over:function(C){var B=A.ui.ddmanager.current;if(!B||(B.currentItem||B.element)[0]==this.element[0]){return ;}if(this.options.accept.call(this.element[0],(B.currentItem||B.element))){if(this.options.hoverClass){this.element.addClass(this.options.hoverClass);}this._trigger("over",C,this.ui(B));}},_out:function(C){var B=A.ui.ddmanager.current;if(!B||(B.currentItem||B.element)[0]==this.element[0]){return ;}if(this.options.accept.call(this.element[0],(B.currentItem||B.element))){if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass);}this._trigger("out",C,this.ui(B));}},_drop:function(E,D){var B=D||A.ui.ddmanager.current;if(!B||(B.currentItem||B.element)[0]==this.element[0]){return false;}var C=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var F=A.data(this,"droppable");if(F.options.greedy&&A.ui.intersect(B,A.extend(F,{offset:F.element.offset()}),F.options.tolerance)){C=true;return false;}});if(C){return false;}if(this.options.accept.call(this.element[0],(B.currentItem||B.element))){if(this.options.activeClass){this.element.removeClass(this.options.activeClass);}if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass);}this._trigger("drop",E,this.ui(B));return this.element;}return false;},ui:function(B){return{draggable:(B.currentItem||B.element),helper:B.helper,position:B.position,absolutePosition:B.positionAbs,offset:B.positionAbs};}});A.extend(A.ui.droppable,{version:"1.7.2",eventPrefix:"drop",defaults:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"}});A.ui.intersect=function(B,H,D){if(!H.offset){return false;}var M=(B.positionAbs||B.position.absolute).left,N=M+B.helperProportions.width,E=(B.positionAbs||B.position.absolute).top,F=E+B.helperProportions.height;var K=H.offset.left,O=K+H.proportions.width,C=H.offset.top,G=C+H.proportions.height;switch(D){case"fit":return(K<M&&N<O&&C<E&&F<G);break;case"intersect":return(K<M+(B.helperProportions.width/2)&&N-(B.helperProportions.width/2)<O&&C<E+(B.helperProportions.height/2)&&F-(B.helperProportions.height/2)<G);break;case"pointer":var J=((B.positionAbs||B.position.absolute).left+(B.clickOffset||B.offset.click).left),I=((B.positionAbs||B.position.absolute).top+(B.clickOffset||B.offset.click).top),L=A.ui.isOver(I,J,C,K,H.proportions.height,H.proportions.width);return L;break;case"touch":return((E>=C&&E<=G)||(F>=C&&F<=G)||(E<C&&F>G))&&((M>=K&&M<=O)||(N>=K&&N<=O)||(M<K&&N>O));break;default:return false;break;}};A.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(F,D){var B=A.ui.ddmanager.droppables[F.options.scope];var E=D?D.type:null;var C=(F.currentItem||F.element).find(":data(droppable)").andSelf();droppablesLoop:for(var G=0;G<B.length;G++){if(B[G].options.disabled||(F&&!B[G].options.accept.call(B[G].element[0],(F.currentItem||F.element)))){continue;}for(var H=0;H<C.length;H++){if(C[H]==B[G].element[0]){B[G].proportions.height=0;continue droppablesLoop;}}B[G].visible=B[G].element.css("display")!="none";if(!B[G].visible){continue;}B[G].offset=B[G].element.offset();B[G].proportions={width:B[G].element[0].offsetWidth,height:B[G].element[0].offsetHeight};if(E=="mousedown"){B[G]._activate.call(B[G],D);}}},drop:function(B,D){var C=false;A.each(A.ui.ddmanager.droppables[B.options.scope],function(){if(!this.options){return ;}if(!this.options.disabled&&this.visible&&A.ui.intersect(B,this,this.options.tolerance)){C=this._drop.call(this,D);}if(!this.options.disabled&&this.visible&&this.options.accept.call(this.element[0],(B.currentItem||B.element))){this.isout=1;this.isover=0;this._deactivate.call(this,D);}});return C;},drag:function(B,C){if(B.options.refreshPositions){A.ui.ddmanager.prepareOffsets(B,C);}A.each(A.ui.ddmanager.droppables[B.options.scope],function(){if(this.options.disabled||this.greedyChild||!this.visible){return ;}var F=A.ui.intersect(B,this,this.options.tolerance);var D=!F&&this.isover==1?"isout":(F&&this.isover==0?"isover":null);if(!D){return ;}var E;if(this.options.greedy){var G=this.element.parents(":data(droppable):eq(0)");if(G.length){E=A.data(G[0],"droppable");E.greedyChild=(D=="isover"?1:0);}}if(E&&D=="isover"){E.isover=0;E.isout=1;E._out.call(E,C);}this[D]=1;this[D=="isout"?"isover":"isout"]=0;this[D=="isover"?"_over":"_out"].call(this,C);if(E&&D=="isout"){E.isout=0;E.isover=1;E._over.call(E,C);}});}};})(jQuery);(function(C){C.widget("ui.resizable",C.extend({},C.ui.mouse,{_init:function(){var I=this,E=this.options;this.element.addClass("ui-resizable");C.extend(this,{_aspectRatio:!!(E.aspectRatio),aspectRatio:E.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:E.helper||E.ghost||E.animate?E.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){if(/relative/.test(this.element.css("position"))&&C.browser.opera){this.element.css({position:"relative",top:"auto",left:"auto"});}this.element.wrap(C('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize();}this.handles=E.handles||(!C(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw";}var D=this.handles.split(",");this.handles={};for(var H=0;H<D.length;H++){var F=C.trim(D[H]),J="ui-resizable-"+F;var G=C('<div class="ui-resizable-handle '+J+'"></div>');if(/sw|se|ne|nw/.test(F)){G.css({zIndex:++E.zIndex});}if("se"==F){G.addClass("ui-icon ui-icon-gripsmall-diagonal-se");}this.handles[F]=".ui-resizable-"+F;this.element.append(G);}}this._renderAxis=function(M){M=M||this.element;for(var K in this.handles){if(this.handles[K].constructor==String){this.handles[K]=C(this.handles[K],this.element).show();}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var O=C(this.handles[K],this.element),N=0;N=/sw|ne|nw|se|n|s/.test(K)?O.outerHeight():O.outerWidth();var L=["padding",/ne|nw|n/.test(K)?"Top":/se|sw|s/.test(K)?"Bottom":/^e$/.test(K)?"Right":"Left"].join("");M.css(L,N);this._proportionallyResize();}if(!C(this.handles[K]).length){continue;}}};this._renderAxis(this.element);this._handles=C(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!I.resizing){if(this.className){var K=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);}I.axis=K&&K[1]?K[1]:"se";}});if(E.autoHide){this._handles.hide();C(this.element).addClass("ui-resizable-autohide").hover(function(){C(this).removeClass("ui-resizable-autohide");I._handles.show();},function(){if(!I.resizing){C(this).addClass("ui-resizable-autohide");I._handles.hide();}});}this._mouseInit();},destroy:function(){this._mouseDestroy();var E=function(F){C(F).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove();};if(this.elementIsWrapper){E(this.element);var D=this.element;D.parent().append(this.originalElement.css({position:D.css("position"),width:D.outerWidth(),height:D.outerHeight(),top:D.css("top"),left:D.css("left")})).end().remove();}this.originalElement.css("resize",this.originalResizeStyle);E(this.originalElement);},_mouseCapture:function(E){var D=false;for(var F in this.handles){if(C(this.handles[F])[0]==E.target){D=true;}}return this.options.disabled||!!D;},_mouseStart:function(H){var E=this.options,I=this.element.position(),J=this.element;this.resizing=true;this.documentScroll={top:C(document).scrollTop(),left:C(document).scrollLeft()};if(J.is(".ui-draggable")||(/absolute/).test(J.css("position"))){J.css({position:"absolute",top:I.top,left:I.left});}if(C.browser.opera&&(/relative/).test(J.css("position"))){J.css({position:"relative",top:"auto",left:"auto"});}this._renderProxy();var D=A(this.helper.css("left")),G=A(this.helper.css("top"));if(E.containment){D+=C(E.containment).scrollLeft()||0;G+=C(E.containment).scrollTop()||0;}this.offset=this.helper.offset();this.position={left:D,top:G};this.size=this._helper?{width:J.outerWidth(),height:J.outerHeight()}:{width:J.width(),height:J.height()};this.originalSize=this._helper?{width:J.outerWidth(),height:J.outerHeight()}:{width:J.width(),height:J.height()};this.originalPosition={left:D,top:G};this.sizeDiff={width:J.outerWidth()-J.width(),height:J.outerHeight()-J.height()};this.originalMousePosition={left:H.pageX,top:H.pageY};this.aspectRatio=(typeof E.aspectRatio=="number")?E.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var F=C(".ui-resizable-"+this.axis).css("cursor");C("body").css("cursor",F=="auto"?this.axis+"-resize":F);J.addClass("ui-resizable-resizing");this._propagate("start",H);return true;},_mouseDrag:function(P){var M=this.helper,N=this.options,H={},E=this,K=this.originalMousePosition,G=this.axis;var D=(P.pageX-K.left)||0,F=(P.pageY-K.top)||0;var L=this._change[G];if(!L){return false;}var I=L.apply(this,[P,D,F]),J=C.browser.msie&&C.browser.version<7,O=this.sizeDiff;if(this._aspectRatio||P.shiftKey){I=this._updateRatio(I,P);}I=this._respectSize(I,P);this._propagate("resize",P);M.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize();}this._updateCache(I);this._trigger("resize",P,this.ui());return false;},_mouseStop:function(J){this.resizing=false;var I=this.options,E=this;if(this._helper){var K=this._proportionallyResizeElements,M=K.length&&(/textarea/i).test(K[0].nodeName),L=M&&C.ui.hasScroll(K[0],"left")?0:E.sizeDiff.height,G=M?0:E.sizeDiff.width;var D={width:(E.size.width-G),height:(E.size.height-L)},H=(parseInt(E.element.css("left"),10)+(E.position.left-E.originalPosition.left))||null,F=(parseInt(E.element.css("top"),10)+(E.position.top-E.originalPosition.top))||null;if(!I.animate){this.element.css(C.extend(D,{top:F,left:H}));}E.helper.height(E.size.height);E.helper.width(E.size.width);if(this._helper&&!I.animate){this._proportionallyResize();}}C("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",J);if(this._helper){this.helper.remove();}return false;},_updateCache:function(E){var D=this.options;this.offset=this.helper.offset();if(B(E.left)){this.position.left=E.left;}if(B(E.top)){this.position.top=E.top;}if(B(E.height)){this.size.height=E.height;}if(B(E.width)){this.size.width=E.width;}},_updateRatio:function(F,G){var E=this.options,D=this.position,H=this.size,I=this.axis;if(F.height){F.width=(H.height*this.aspectRatio);}else{if(F.width){F.height=(H.width/this.aspectRatio);}}if(I=="sw"){F.left=D.left+(H.width-F.width);F.top=null;}if(I=="nw"){F.top=D.top+(H.height-F.height);F.left=D.left+(H.width-F.width);}return F;},_respectSize:function(J,O){var L=this.helper,M=this.options,E=this._aspectRatio||O.shiftKey,F=this.axis,R=B(J.width)&&M.maxWidth&&(M.maxWidth<J.width),I=B(J.height)&&M.maxHeight&&(M.maxHeight<J.height),N=B(J.width)&&M.minWidth&&(M.minWidth>J.width),D=B(J.height)&&M.minHeight&&(M.minHeight>J.height);if(N){J.width=M.minWidth;}if(D){J.height=M.minHeight;}if(R){J.width=M.maxWidth;}if(I){J.height=M.maxHeight;}var P=this.originalPosition.left+this.originalSize.width,G=this.position.top+this.size.height;var K=/sw|nw|w/.test(F),Q=/nw|ne|n/.test(F);if(N&&K){J.left=P-M.minWidth;}if(R&&K){J.left=P-M.maxWidth;}if(D&&Q){J.top=G-M.minHeight;}if(I&&Q){J.top=G-M.maxHeight;}var H=!J.width&&!J.height;if(H&&!J.left&&J.top){J.top=null;}else{if(H&&!J.top&&J.left){J.left=null;}}return J;},_proportionallyResize:function(){var D=this.options;if(!this._proportionallyResizeElements.length){return ;}var G=this.helper||this.element;for(var H=0;H<this._proportionallyResizeElements.length;H++){var F=this._proportionallyResizeElements[H];if(!this.borderDif){var I=[F.css("borderTopWidth"),F.css("borderRightWidth"),F.css("borderBottomWidth"),F.css("borderLeftWidth")],E=[F.css("paddingTop"),F.css("paddingRight"),F.css("paddingBottom"),F.css("paddingLeft")];this.borderDif=C.map(I,function(L,J){var K=parseInt(L,10)||0,M=parseInt(E[J],10)||0;return K+M;});}if(C.browser.msie&&!(!(C(G).is(":hidden")||C(G).parents(":hidden").length))){continue;}F.css({height:(G.height()-this.borderDif[0]-this.borderDif[2])||0,width:(G.width()-this.borderDif[1]-this.borderDif[3])||0});}},_renderProxy:function(){var G=this.element,D=this.options;this.elementOffset=G.offset();if(this._helper){this.helper=this.helper||C('<div style="overflow:hidden;"></div>');var H=C.browser.msie&&C.browser.version<7,F=(H?1:0),E=(H?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+E,height:this.element.outerHeight()+E,position:"absolute",left:this.elementOffset.left-F+"px",top:this.elementOffset.top-F+"px",zIndex:++D.zIndex});this.helper.appendTo("body").disableSelection();}else{this.helper=this.element;}},_change:{e:function(D,E,F){return{width:this.originalSize.width+E};},w:function(F,H,I){var D=this.options,G=this.originalSize,E=this.originalPosition;return{left:E.left+H,width:G.width-H};},n:function(F,H,I){var D=this.options,G=this.originalSize,E=this.originalPosition;return{top:E.top+I,height:G.height-I};},s:function(D,E,F){return{height:this.originalSize.height+F};},se:function(D,E,F){return C.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[D,E,F]));},sw:function(D,E,F){return C.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[D,E,F]));},ne:function(D,E,F){return C.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[D,E,F]));},nw:function(D,E,F){return C.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[D,E,F]));}},_propagate:function(D,E){C.ui.plugin.call(this,D,[E,this.ui()]);(D!="resize"&&this._trigger(D,E,this.ui()));},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition};}}));C.extend(C.ui.resizable,{version:"1.7.2",eventPrefix:"resize",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input,option",containment:false,delay:0,distance:1,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000}});C.ui.plugin.add("resizable","alsoResize",{start:function(F,E){var G=C(this).data("resizable"),D=G.options;_store=function(H){C(H).each(function(){C(this).data("resizable-alsoresize",{width:parseInt(C(this).width(),10),height:parseInt(C(this).height(),10),left:parseInt(C(this).css("left"),10),top:parseInt(C(this).css("top"),10)});});};if(typeof (D.alsoResize)=="object"&&!D.alsoResize.parentNode){if(D.alsoResize.length){D.alsoResize=D.alsoResize[0];_store(D.alsoResize);}else{C.each(D.alsoResize,function(I,H){_store(I);});}}else{_store(D.alsoResize);}},resize:function(I,G){var J=C(this).data("resizable"),F=J.options,H=J.originalSize,D=J.originalPosition;var E={height:(J.size.height-H.height)||0,width:(J.size.width-H.width)||0,top:(J.position.top-D.top)||0,left:(J.position.left-D.left)||0},K=function(M,L){C(M).each(function(){var O=C(this),N=C(this).data("resizable-alsoresize"),P={},Q=L&&L.length?L:["width","height","top","left"];C.each(Q||["width","height","top","left"],function(T,R){var S=(N[R]||0)+(E[R]||0);if(S&&S>=0){P[R]=S||null;}});if(/relative/.test(O.css("position"))&&C.browser.opera){J._revertToRelativePosition=true;O.css({position:"absolute",top:"auto",left:"auto"});}O.css(P);});};if(typeof (F.alsoResize)=="object"&&!F.alsoResize.nodeType){C.each(F.alsoResize,function(M,L){K(M,L);});}else{K(F.alsoResize);}},stop:function(E,D){var F=C(this).data("resizable");if(F._revertToRelativePosition&&C.browser.opera){F._revertToRelativePosition=false;el.css({position:"relative"});}C(this).removeData("resizable-alsoresize-start");}});C.ui.plugin.add("resizable","animate",{stop:function(J,E){var D=C(this).data("resizable"),I=D.options;var K=D._proportionallyResizeElements,N=K.length&&(/textarea/i).test(K[0].nodeName),M=N&&C.ui.hasScroll(K[0],"left")?0:D.sizeDiff.height,G=N?0:D.sizeDiff.width;var L={width:(D.size.width-G),height:(D.size.height-M)},H=(parseInt(D.element.css("left"),10)+(D.position.left-D.originalPosition.left))||null,F=(parseInt(D.element.css("top"),10)+(D.position.top-D.originalPosition.top))||null;D.element.animate(C.extend(L,F&&H?{top:F,left:H}:{}),{duration:I.animateDuration,easing:I.animateEasing,step:function(){var O={width:parseInt(D.element.css("width"),10),height:parseInt(D.element.css("height"),10),top:parseInt(D.element.css("top"),10),left:parseInt(D.element.css("left"),10)};if(K&&K.length){C(K[0]).css({width:O.width,height:O.height});}D._updateCache(O);D._propagate("resize",J);}});}});C.ui.plugin.add("resizable","containment",{start:function(O,E){var Q=C(this).data("resizable"),K=Q.options,I=Q.element;var N=K.containment,J=(N instanceof C)?N.get(0):(/parent/.test(N))?I.parent().get(0):N;if(!J){return ;}Q.containerElement=C(J);if(/document/.test(N)||N==document){Q.containerOffset={left:0,top:0};Q.containerPosition={left:0,top:0};Q.parentData={element:C(document),left:0,top:0,width:C(document).width(),height:C(document).height()||document.body.parentNode.scrollHeight};}else{var G=C(J),L=[];C(["Top","Right","Left","Bottom"]).each(function(R,S){L[R]=A(G.css("padding"+S));});Q.containerOffset=G.offset();Q.containerPosition=G.position();Q.containerSize={height:(G.innerHeight()-L[3]),width:(G.innerWidth()-L[1])};var F=Q.containerOffset,P=Q.containerSize.height,H=Q.containerSize.width,M=(C.ui.hasScroll(J,"left")?J.scrollWidth:H),D=(C.ui.hasScroll(J)?J.scrollHeight:P);Q.parentData={element:J,left:F.left,top:F.top,width:M,height:D};}},resize:function(O,F){var R=C(this).data("resizable"),M=R.options,P=R.containerSize,G=R.containerOffset,I=R.size,H=R.position,E=R._aspectRatio||O.shiftKey,Q={top:0,left:0},N=R.containerElement;if(N[0]!=document&&(/static/).test(N.css("position"))){Q=G;}if(H.left<(R._helper?G.left:0)){R.size.width=R.size.width+(R._helper?(R.position.left-G.left):(R.position.left-Q.left));if(E){R.size.height=R.size.width/M.aspectRatio;}R.position.left=M.helper?G.left:0;}if(H.top<(R._helper?G.top:0)){R.size.height=R.size.height+(R._helper?(R.position.top-G.top):R.position.top);if(E){R.size.width=R.size.height*M.aspectRatio;}R.position.top=R._helper?G.top:0;}R.offset.left=R.parentData.left+R.position.left;R.offset.top=R.parentData.top+R.position.top;var J=Math.abs((R._helper?R.offset.left-Q.left:(R.offset.left-Q.left))+R.sizeDiff.width),D=Math.abs((R._helper?R.offset.top-Q.top:(R.offset.top-G.top))+R.sizeDiff.height);var K=R.containerElement.get(0)==R.element.parent().get(0),L=/relative|absolute/.test(R.containerElement.css("position"));if(K&&L){J-=R.parentData.left;}if(J+R.size.width>=R.parentData.width){R.size.width=R.parentData.width-J;if(E){R.size.height=R.size.width/R.aspectRatio;}}if(D+R.size.height>=R.parentData.height){R.size.height=R.parentData.height-D;if(E){R.size.width=R.size.height*R.aspectRatio;}}},stop:function(N,G){var E=C(this).data("resizable"),M=E.options,I=E.position,H=E.containerOffset,O=E.containerPosition,L=E.containerElement;var K=C(E.helper),D=K.offset(),F=K.outerWidth()-E.sizeDiff.width,J=K.outerHeight()-E.sizeDiff.height;if(E._helper&&!M.animate&&(/relative/).test(L.css("position"))){C(this).css({left:D.left-O.left-H.left,width:F,height:J});}if(E._helper&&!M.animate&&(/static/).test(L.css("position"))){C(this).css({left:D.left-O.left-H.left,width:F,height:J});}}});C.ui.plugin.add("resizable","ghost",{start:function(F,E){var H=C(this).data("resizable"),D=H.options,G=H.size;H.ghost=H.originalElement.clone();H.ghost.css({opacity:0.25,display:"block",position:"relative",height:G.height,width:G.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof D.ghost=="string"?D.ghost:"");H.ghost.appendTo(H.helper);},resize:function(F,E){var G=C(this).data("resizable"),D=G.options;if(G.ghost){G.ghost.css({position:"relative",height:G.size.height,width:G.size.width});}},stop:function(F,E){var G=C(this).data("resizable"),D=G.options;if(G.ghost&&G.helper){G.helper.get(0).removeChild(G.ghost.get(0));}}});C.ui.plugin.add("resizable","grid",{resize:function(N,F){var D=C(this).data("resizable"),K=D.options,H=D.size,J=D.originalSize,I=D.originalPosition,E=D.axis,G=K._aspectRatio||N.shiftKey;K.grid=typeof K.grid=="number"?[K.grid,K.grid]:K.grid;var L=Math.round((H.width-J.width)/(K.grid[0]||1))*(K.grid[0]||1),M=Math.round((H.height-J.height)/(K.grid[1]||1))*(K.grid[1]||1);if(/^(se|s|e)$/.test(E)){D.size.width=J.width+L;D.size.height=J.height+M;}else{if(/^(ne)$/.test(E)){D.size.width=J.width+L;D.size.height=J.height+M;D.position.top=I.top-M;}else{if(/^(sw)$/.test(E)){D.size.width=J.width+L;D.size.height=J.height+M;D.position.left=I.left-L;}else{D.size.width=J.width+L;D.size.height=J.height+M;D.position.top=I.top-M;D.position.left=I.left-L;}}}}});var A=function(D){return parseInt(D,10)||0;};var B=function(D){return !isNaN(parseInt(D,10));};})(jQuery);(function(A){A.widget("ui.selectable",A.extend({},A.ui.mouse,{_init:function(){var B=this;this.element.addClass("ui-selectable");this.dragged=false;var C;this.refresh=function(){C=A(B.options.filter,B.element[0]);C.each(function(){var E=A(this);var D=E.offset();A.data(this,"selectable-item",{element:this,$element:E,left:D.left,top:D.top,right:D.left+E.outerWidth(),bottom:D.top+E.outerHeight(),startselected:false,selected:E.hasClass("ui-selected"),selecting:E.hasClass("ui-selecting"),unselecting:E.hasClass("ui-unselecting")});});};this.refresh();this.selectees=C.addClass("ui-selectee");this._mouseInit();this.helper=A(document.createElement("div")).css({border:"1px dotted black"}).addClass("ui-selectable-helper");},destroy:function(){this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();},_mouseStart:function(C){var B=this;this.opos=[C.pageX,C.pageY];if(this.options.disabled){return ;}var D=this.options;this.selectees=A(D.filter,this.element[0]);this._trigger("start",C);A(D.appendTo).append(this.helper);this.helper.css({"z-index":100,position:"absolute",left:C.clientX,top:C.clientY,width:0,height:0});if(D.autoRefresh){this.refresh();}this.selectees.filter(".ui-selected").each(function(){var E=A.data(this,"selectable-item");E.startselected=true;if(!C.metaKey){E.$element.removeClass("ui-selected");E.selected=false;E.$element.addClass("ui-unselecting");E.unselecting=true;B._trigger("unselecting",C,{unselecting:E.element});}});A(C.target).parents().andSelf().each(function(){var E=A.data(this,"selectable-item");if(E){E.$element.removeClass("ui-unselecting").addClass("ui-selecting");E.unselecting=false;E.selecting=true;E.selected=true;B._trigger("selecting",C,{selecting:E.element});return false;}});},_mouseDrag:function(C){var I=this;this.dragged=true;if(this.options.disabled){return ;}var G=this.options;var H=this.opos[0],D=this.opos[1],B=C.pageX,E=C.pageY;if(H>B){var F=B;B=H;H=F;}if(D>E){var F=E;E=D;D=F;}this.helper.css({left:H,top:D,width:B-H,height:E-D});this.selectees.each(function(){var K=A.data(this,"selectable-item");if(!K||K.element==I.element[0]){return ;}var J=false;if(G.tolerance=="touch"){J=(!(K.left>B||K.right<H||K.top>E||K.bottom<D));}else{if(G.tolerance=="fit"){J=(K.left>H&&K.right<B&&K.top>D&&K.bottom<E);}}if(J){if(K.selected){K.$element.removeClass("ui-selected");K.selected=false;}if(K.unselecting){K.$element.removeClass("ui-unselecting");K.unselecting=false;}if(!K.selecting){K.$element.addClass("ui-selecting");K.selecting=true;I._trigger("selecting",C,{selecting:K.element});}}else{if(K.selecting){if(C.metaKey&&K.startselected){K.$element.removeClass("ui-selecting");K.selecting=false;K.$element.addClass("ui-selected");K.selected=true;}else{K.$element.removeClass("ui-selecting");K.selecting=false;if(K.startselected){K.$element.addClass("ui-unselecting");K.unselecting=true;}I._trigger("unselecting",C,{unselecting:K.element});}}if(K.selected){if(!C.metaKey&&!K.startselected){K.$element.removeClass("ui-selected");K.selected=false;K.$element.addClass("ui-unselecting");K.unselecting=true;I._trigger("unselecting",C,{unselecting:K.element});}}}});return false;},_mouseStop:function(C){var B=this;this.dragged=false;var D=this.options;A(".ui-unselecting",this.element[0]).each(function(){var E=A.data(this,"selectable-item");E.$element.removeClass("ui-unselecting");E.unselecting=false;E.startselected=false;B._trigger("unselected",C,{unselected:E.element});});A(".ui-selecting",this.element[0]).each(function(){var E=A.data(this,"selectable-item");E.$element.removeClass("ui-selecting").addClass("ui-selected");E.selecting=false;E.selected=true;E.startselected=true;B._trigger("selected",C,{selected:E.element});});this._trigger("stop",C);this.helper.remove();return false;}}));A.extend(A.ui.selectable,{version:"1.7.2",defaults:{appendTo:"body",autoRefresh:true,cancel:":input,option",delay:0,distance:0,filter:"*",tolerance:"touch"}});})(jQuery);(function(A){A.widget("ui.sortable",A.extend({},A.ui.mouse,{_init:function(){var B=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?(/left|right/).test(this.items[0].item.css("float")):false;this.offset=this.element.offset();this._mouseInit();},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var B=this.items.length-1;B>=0;B--){this.items[B].item.removeData("sortable-item");}},_mouseCapture:function(E,D){if(this.reverting){return false;}if(this.options.disabled||this.options.type=="static"){return false;}this._refreshItems(E);var F=null,G=this,B=A(E.target).parents().each(function(){if(A.data(this,"sortable-item")==G){F=A(this);return false;}});if(A.data(E.target,"sortable-item")==G){F=A(E.target);}if(!F){return false;}if(this.options.handle&&!D){var C=false;A(this.options.handle,F).find("*").andSelf().each(function(){if(this==E.target){C=true;}});if(!C){return false;}}this.currentItem=F;this._removeCurrentsFromItems();return true;},_mouseStart:function(E,D,B){var C=this.options,G=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(E);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");A.extend(this.offset,{click:{left:E.pageX-this.offset.left,top:E.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(E);this.originalPageX=E.pageX;this.originalPageY=E.pageY;if(C.cursorAt){this._adjustOffsetFromHelper(C.cursorAt);}this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!=this.currentItem[0]){this.currentItem.hide();}this._createPlaceholder();if(C.containment){this._setContainment();}if(C.cursor){if(A("body").css("cursor")){this._storedCursor=A("body").css("cursor");}A("body").css("cursor",C.cursor);}if(C.opacity){if(this.helper.css("opacity")){this._storedOpacity=this.helper.css("opacity");}this.helper.css("opacity",C.opacity);}if(C.zIndex){if(this.helper.css("zIndex")){this._storedZIndex=this.helper.css("zIndex");}this.helper.css("zIndex",C.zIndex);}if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){this.overflowOffset=this.scrollParent.offset();}this._trigger("start",E,this._uiHash());if(!this._preserveHelperProportions){this._cacheHelperProportions();}if(!B){for(var F=this.containers.length-1;F>=0;F--){this.containers[F]._trigger("activate",E,G._uiHash(this));}}if(A.ui.ddmanager){A.ui.ddmanager.current=this;}if(A.ui.ddmanager&&!C.dropBehaviour){A.ui.ddmanager.prepareOffsets(this,E);}this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(E);return true;},_mouseDrag:function(E){this.position=this._generatePosition(E);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs;}if(this.options.scroll){var D=this.options,B=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if((this.overflowOffset.top+this.scrollParent[0].offsetHeight)-E.pageY<D.scrollSensitivity){this.scrollParent[0].scrollTop=B=this.scrollParent[0].scrollTop+D.scrollSpeed;}else{if(E.pageY-this.overflowOffset.top<D.scrollSensitivity){this.scrollParent[0].scrollTop=B=this.scrollParent[0].scrollTop-D.scrollSpeed;}}if((this.overflowOffset.left+this.scrollParent[0].offsetWidth)-E.pageX<D.scrollSensitivity){this.scrollParent[0].scrollLeft=B=this.scrollParent[0].scrollLeft+D.scrollSpeed;}else{if(E.pageX-this.overflowOffset.left<D.scrollSensitivity){this.scrollParent[0].scrollLeft=B=this.scrollParent[0].scrollLeft-D.scrollSpeed;}}}else{if(E.pageY-A(document).scrollTop()<D.scrollSensitivity){B=A(document).scrollTop(A(document).scrollTop()-D.scrollSpeed);}else{if(A(window).height()-(E.pageY-A(document).scrollTop())<D.scrollSensitivity){B=A(document).scrollTop(A(document).scrollTop()+D.scrollSpeed);}}if(E.pageX-A(document).scrollLeft()<D.scrollSensitivity){B=A(document).scrollLeft(A(document).scrollLeft()-D.scrollSpeed);}else{if(A(window).width()-(E.pageX-A(document).scrollLeft())<D.scrollSensitivity){B=A(document).scrollLeft(A(document).scrollLeft()+D.scrollSpeed);}}}if(B!==false&&A.ui.ddmanager&&!D.dropBehaviour){A.ui.ddmanager.prepareOffsets(this,E);}}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px";}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px";}for(var G=this.items.length-1;G>=0;G--){var F=this.items[G],H=F.item[0],C=this._intersectsWithPointer(F);if(!C){continue;}if(H!=this.currentItem[0]&&this.placeholder[C==1?"next":"prev"]()[0]!=H&&!A.ui.contains(this.placeholder[0],H)&&(this.options.type=="semi-dynamic"?!A.ui.contains(this.element[0],H):true)){this.direction=C==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(F)){this._rearrange(E,F);}else{break;}this._trigger("change",E,this._uiHash());break;}}this._contactContainers(E);if(A.ui.ddmanager){A.ui.ddmanager.drag(this,E);}this._trigger("sort",E,this._uiHash());this.lastPositionAbs=this.positionAbs;return false;},_mouseStop:function(E,D){if(!E){return ;}if(A.ui.ddmanager&&!this.options.dropBehaviour){A.ui.ddmanager.drop(this,E);}if(this.options.revert){var B=this;var C=B.placeholder.offset();B.reverting=true;A(this.helper).animate({left:C.left-this.offset.parent.left-B.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:C.top-this.offset.parent.top-B.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){B._clear(E);});}else{this._clear(E,D);}return false;},cancel:function(){var B=this;if(this.dragging){this._mouseUp();if(this.options.helper=="original"){this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");}else{this.currentItem.show();}for(var C=this.containers.length-1;C>=0;C--){this.containers[C]._trigger("deactivate",null,B._uiHash(this));if(this.containers[C].containerCache.over){this.containers[C]._trigger("out",null,B._uiHash(this));this.containers[C].containerCache.over=0;}}}if(this.placeholder[0].parentNode){this.placeholder[0].parentNode.removeChild(this.placeholder[0]);}if(this.options.helper!="original"&&this.helper&&this.helper[0].parentNode){this.helper.remove();}A.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){A(this.domPosition.prev).after(this.currentItem);}else{A(this.domPosition.parent).prepend(this.currentItem);}return true;},serialize:function(C){var B=this._getItemsAsjQuery(C&&C.connected);var D=[];C=C||{};A(B).each(function(){var E=(A(C.item||this).attr(C.attribute||"id")||"").match(C.expression||(/(.+)[-=_](.+)/));if(E){D.push((C.key||E[1]+"[]")+"="+(C.key&&C.expression?E[1]:E[2]));}});return D.join("&");},toArray:function(C){var B=this._getItemsAsjQuery(C&&C.connected);var D=[];C=C||{};B.each(function(){D.push(A(C.item||this).attr(C.attribute||"id")||"");});return D;},_intersectsWith:function(D){var K=this.positionAbs.left,L=K+this.helperProportions.width,E=this.positionAbs.top,F=E+this.helperProportions.height;var J=D.left,M=J+D.width,C=D.top,G=C+D.height;var B=this.offset.click.top,H=this.offset.click.left;var I=(E+B)>C&&(E+B)<G&&(K+H)>J&&(K+H)<M;if(this.options.tolerance=="pointer"||this.options.forcePointerForContainers||(this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>D[this.floating?"width":"height"])){return I;}else{return(J<K+(this.helperProportions.width/2)&&L-(this.helperProportions.width/2)<M&&C<E+(this.helperProportions.height/2)&&F-(this.helperProportions.height/2)<G);}},_intersectsWithPointer:function(F){var E=A.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,F.top,F.height),G=A.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,F.left,F.width),C=E&&G,B=this._getDragVerticalDirection(),D=this._getDragHorizontalDirection();if(!C){return false;}return this.floating?(((D&&D=="right")||B=="down")?2:1):(B&&(B=="down"?2:1));},_intersectsWithSides:function(D){var F=A.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,D.top+(D.height/2),D.height),E=A.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,D.left+(D.width/2),D.width),B=this._getDragVerticalDirection(),C=this._getDragHorizontalDirection();if(this.floating&&C){return((C=="right"&&E)||(C=="left"&&!E));}else{return B&&((B=="down"&&F)||(B=="up"&&!F));}},_getDragVerticalDirection:function(){var B=this.positionAbs.top-this.lastPositionAbs.top;return B!=0&&(B>0?"down":"up");},_getDragHorizontalDirection:function(){var B=this.positionAbs.left-this.lastPositionAbs.left;return B!=0&&(B>0?"right":"left");},refresh:function(B){this._refreshItems(B);this.refreshPositions();},_connectWith:function(){var B=this.options;return B.connectWith.constructor==String?[B.connectWith]:B.connectWith;},_getItemsAsjQuery:function(J){var B=this;var E=[];var G=[];var D=this._connectWith();if(D&&J){for(var H=D.length-1;H>=0;H--){var C=A(D[H]);for(var I=C.length-1;I>=0;I--){var F=A.data(C[I],"sortable");if(F&&F!=this&&!F.options.disabled){G.push([A.isFunction(F.options.items)?F.options.items.call(F.element):A(F.options.items,F.element).not(".ui-sortable-helper"),F]);}}}}G.push([A.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):A(this.options.items,this.element).not(".ui-sortable-helper"),this]);for(var H=G.length-1;H>=0;H--){G[H][0].each(function(){E.push(this);});}return A(E);},_removeCurrentsFromItems:function(){var C=this.currentItem.find(":data(sortable-item)");for(var D=0;D<this.items.length;D++){for(var B=0;B<C.length;B++){if(C[B]==this.items[D].item[0]){this.items.splice(D,1);}}}},_refreshItems:function(N){this.items=[];this.containers=[this];var H=this.items;var B=this;var J=[[A.isFunction(this.options.items)?this.options.items.call(this.element[0],N,{item:this.currentItem}):A(this.options.items,this.element),this]];var F=this._connectWith();if(F){for(var K=F.length-1;K>=0;K--){var E=A(F[K]);for(var L=E.length-1;L>=0;L--){var I=A.data(E[L],"sortable");if(I&&I!=this&&!I.options.disabled){J.push([A.isFunction(I.options.items)?I.options.items.call(I.element[0],N,{item:this.currentItem}):A(I.options.items,I.element),I]);this.containers.push(I);}}}}for(var K=J.length-1;K>=0;K--){var G=J[K][1];var M=J[K][0];for(var L=0,D=M.length;L<D;L++){var C=A(M[L]);C.data("sortable-item",G);H.push({item:C,instance:G,width:0,height:0,left:0,top:0});}}},refreshPositions:function(B){if(this.offsetParent&&this.helper){this.offset.parent=this._getParentOffset();}for(var E=this.items.length-1;E>=0;E--){var D=this.items[E];if(D.instance!=this.currentContainer&&this.currentContainer&&D.item[0]!=this.currentItem[0]){continue;}var F=this.options.toleranceElement?A(this.options.toleranceElement,D.item):D.item;if(!B){D.width=F.outerWidth();D.height=F.outerHeight();}var C=F.offset();D.left=C.left;D.top=C.top;}if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this);}else{for(var E=this.containers.length-1;E>=0;E--){var C=this.containers[E].element.offset();this.containers[E].containerCache.left=C.left;this.containers[E].containerCache.top=C.top;this.containers[E].containerCache.width=this.containers[E].element.outerWidth();this.containers[E].containerCache.height=this.containers[E].element.outerHeight();}}},_createPlaceholder:function(D){var B=D||this,C=B.options;if(!C.placeholder||C.placeholder.constructor==String){var E=C.placeholder;C.placeholder={element:function(){var F=A(document.createElement(B.currentItem[0].nodeName)).addClass(E||B.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!E){F.style.visibility="hidden";}return F;},update:function(G,F){if(E&&!C.forcePlaceholderSize){return ;}if(!F.height()){F.height(B.currentItem.innerHeight()-parseInt(B.currentItem.css("paddingTop")||0,10)-parseInt(B.currentItem.css("paddingBottom")||0,10));}if(!F.width()){F.width(B.currentItem.innerWidth()-parseInt(B.currentItem.css("paddingLeft")||0,10)-parseInt(B.currentItem.css("paddingRight")||0,10));}}};}B.placeholder=A(C.placeholder.element.call(B.element,B.currentItem));B.currentItem.after(B.placeholder);C.placeholder.update(B,B.placeholder);},_contactContainers:function(G){for(var H=this.containers.length-1;H>=0;H--){if(this._intersectsWith(this.containers[H].containerCache)){if(!this.containers[H].containerCache.over){if(this.currentContainer!=this.containers[H]){var C=10000;var D=null;var F=this.positionAbs[this.containers[H].floating?"left":"top"];for(var B=this.items.length-1;B>=0;B--){if(!A.ui.contains(this.containers[H].element[0],this.items[B].item[0])){continue;}var E=this.items[B][this.containers[H].floating?"left":"top"];if(Math.abs(E-F)<C){C=Math.abs(E-F);D=this.items[B];}}if(!D&&!this.options.dropOnEmpty){continue;}this.currentContainer=this.containers[H];D?this._rearrange(G,D,null,true):this._rearrange(G,null,this.containers[H].element,true);this._trigger("change",G,this._uiHash());this.containers[H]._trigger("change",G,this._uiHash(this));this.options.placeholder.update(this.currentContainer,this.placeholder);}this.containers[H]._trigger("over",G,this._uiHash(this));this.containers[H].containerCache.over=1;}}else{if(this.containers[H].containerCache.over){this.containers[H]._trigger("out",G,this._uiHash(this));this.containers[H].containerCache.over=0;}}}},_createHelper:function(D){var C=this.options;var B=A.isFunction(C.helper)?A(C.helper.apply(this.element[0],[D,this.currentItem])):(C.helper=="clone"?this.currentItem.clone():this.currentItem);if(!B.parents("body").length){A(C.appendTo!="parent"?C.appendTo:this.currentItem[0].parentNode)[0].appendChild(B[0]);}if(B[0]==this.currentItem[0]){this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")};}if(B[0].style.width==""||C.forceHelperSize){B.width(this.currentItem.width());}if(B[0].style.height==""||C.forceHelperSize){B.height(this.currentItem.height());}return B;},_adjustOffsetFromHelper:function(B){if(B.left!=undefined){this.offset.click.left=B.left+this.margins.left;}if(B.right!=undefined){this.offset.click.left=this.helperProportions.width-B.right+this.margins.left;}if(B.top!=undefined){this.offset.click.top=B.top+this.margins.top;}if(B.bottom!=undefined){this.offset.click.top=this.helperProportions.height-B.bottom+this.margins.top;}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var B=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&A.ui.contains(this.scrollParent[0],this.offsetParent[0])){B.left+=this.scrollParent.scrollLeft();B.top+=this.scrollParent.scrollTop();}if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&A.browser.msie)){B={top:0,left:0};}return{top:B.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:B.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var B=this.currentItem.position();return{top:B.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:B.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()};}else{return{top:0,left:0};}},_cacheMargins:function(){this.margins={left:(parseInt(this.currentItem.css("marginLeft"),10)||0),top:(parseInt(this.currentItem.css("marginTop"),10)||0)};},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};},_setContainment:function(){var C=this.options;if(C.containment=="parent"){C.containment=this.helper[0].parentNode;}if(C.containment=="document"||C.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,A(C.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(A(C.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];}if(!(/^(document|window|parent)$/).test(C.containment)){var E=A(C.containment)[0];var D=A(C.containment).offset();var B=(A(E).css("overflow")!="hidden");this.containment=[D.left+(parseInt(A(E).css("borderLeftWidth"),10)||0)+(parseInt(A(E).css("paddingLeft"),10)||0)-this.margins.left,D.top+(parseInt(A(E).css("borderTopWidth"),10)||0)+(parseInt(A(E).css("paddingTop"),10)||0)-this.margins.top,D.left+(B?Math.max(E.scrollWidth,E.offsetWidth):E.offsetWidth)-(parseInt(A(E).css("borderLeftWidth"),10)||0)-(parseInt(A(E).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,D.top+(B?Math.max(E.scrollHeight,E.offsetHeight):E.offsetHeight)-(parseInt(A(E).css("borderTopWidth"),10)||0)-(parseInt(A(E).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top];}},_convertPositionTo:function(E,C){if(!C){C=this.position;}var G=E=="absolute"?1:-1;var F=this.options,B=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&A.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,D=(/(html|body)/i).test(B[0].tagName);return{top:(C.top+this.offset.relative.top*G+this.offset.parent.top*G-(A.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(D?0:B.scrollTop()))*G)),left:(C.left+this.offset.relative.left*G+this.offset.parent.left*G-(A.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():D?0:B.scrollLeft())*G))};},_generatePosition:function(G){var D=this.options,B=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&A.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,C=(/(html|body)/i).test(B[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset();}var H=G.pageX;var I=G.pageY;if(this.originalPosition){if(this.containment){if(G.pageX-this.offset.click.left<this.containment[0]){H=this.containment[0]+this.offset.click.left;}if(G.pageY-this.offset.click.top<this.containment[1]){I=this.containment[1]+this.offset.click.top;}if(G.pageX-this.offset.click.left>this.containment[2]){H=this.containment[2]+this.offset.click.left;}if(G.pageY-this.offset.click.top>this.containment[3]){I=this.containment[3]+this.offset.click.top;}}if(D.grid){var E=this.originalPageY+Math.round((I-this.originalPageY)/D.grid[1])*D.grid[1];I=this.containment?(!(E-this.offset.click.top<this.containment[1]||E-this.offset.click.top>this.containment[3])?E:(!(E-this.offset.click.top<this.containment[1])?E-D.grid[1]:E+D.grid[1])):E;var F=this.originalPageX+Math.round((H-this.originalPageX)/D.grid[0])*D.grid[0];H=this.containment?(!(F-this.offset.click.left<this.containment[0]||F-this.offset.click.left>this.containment[2])?F:(!(F-this.offset.click.left<this.containment[0])?F-D.grid[0]:F+D.grid[0])):F;}}return{top:(I-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(A.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(C?0:B.scrollTop())))),left:(H-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(A.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():C?0:B.scrollLeft())))};},_rearrange:function(C,D,G,E){G?G[0].appendChild(this.placeholder[0]):D.item[0].parentNode.insertBefore(this.placeholder[0],(this.direction=="down"?D.item[0]:D.item[0].nextSibling));this.counter=this.counter?++this.counter:1;var F=this,B=this.counter;window.setTimeout(function(){if(B==F.counter){F.refreshPositions(!E);}},0);},_clear:function(E,D){this.reverting=false;var C=[],B=this;if(!this._noFinalSort&&this.currentItem[0].parentNode){this.placeholder.before(this.currentItem);}this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var F in this._storedCSS){if(this._storedCSS[F]=="auto"||this._storedCSS[F]=="static"){this._storedCSS[F]="";}}this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");}else{this.currentItem.show();}if(this.fromOutside&&!D){C.push(function(G){this._trigger("receive",G,this._uiHash(this.fromOutside));});}if((this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!D){C.push(function(G){this._trigger("update",G,this._uiHash());});}if(!A.ui.contains(this.element[0],this.currentItem[0])){if(!D){C.push(function(G){this._trigger("remove",G,this._uiHash());});}for(var F=this.containers.length-1;F>=0;F--){if(A.ui.contains(this.containers[F].element[0],this.currentItem[0])&&!D){C.push((function(G){return function(H){G._trigger("receive",H,this._uiHash(this));};}).call(this,this.containers[F]));C.push((function(G){return function(H){G._trigger("update",H,this._uiHash(this));};}).call(this,this.containers[F]));}}}for(var F=this.containers.length-1;F>=0;F--){if(!D){C.push((function(G){return function(H){G._trigger("deactivate",H,this._uiHash(this));};}).call(this,this.containers[F]));}if(this.containers[F].containerCache.over){C.push((function(G){return function(H){G._trigger("out",H,this._uiHash(this));};}).call(this,this.containers[F]));this.containers[F].containerCache.over=0;}}if(this._storedCursor){A("body").css("cursor",this._storedCursor);}if(this._storedOpacity){this.helper.css("opacity",this._storedOpacity);}if(this._storedZIndex){this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex);}this.dragging=false;if(this.cancelHelperRemoval){if(!D){this._trigger("beforeStop",E,this._uiHash());for(var F=0;F<C.length;F++){C[F].call(this,E);}this._trigger("stop",E,this._uiHash());}return false;}if(!D){this._trigger("beforeStop",E,this._uiHash());}this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.helper[0]!=this.currentItem[0]){this.helper.remove();}this.helper=null;if(!D){for(var F=0;F<C.length;F++){C[F].call(this,E);}this._trigger("stop",E,this._uiHash());}this.fromOutside=false;return true;},_trigger:function(){if(A.widget.prototype._trigger.apply(this,arguments)===false){this.cancel();}},_uiHash:function(C){var B=C||this;return{helper:B.helper,placeholder:B.placeholder||A([]),position:B.position,absolutePosition:B.positionAbs,offset:B.positionAbs,item:B.currentItem,sender:C?C.element:null};}}));A.extend(A.ui.sortable,{getter:"serialize toArray",version:"1.7.2",eventPrefix:"sort",defaults:{appendTo:"parent",axis:false,cancel:":input,option",connectWith:false,containment:false,cursor:"auto",cursorAt:false,delay:0,distance:1,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1000}});})(jQuery);jQuery.effects||(function(D){D.effects={version:"1.7.2",save:function(G,F){for(var H=0;H<F.length;H++){if(F[H]!==null){G.data("ec.storage."+F[H],G[0].style[F[H]]);}}},restore:function(G,F){for(var H=0;H<F.length;H++){if(F[H]!==null){G.css(F[H],G.data("ec.storage."+F[H]));}}},setMode:function(G,F){if(F=="toggle"){F=G.is(":hidden")?"show":"hide";}return F;},getBaseline:function(H,G){var F,I;switch(H[0]){case"top":F=0;break;case"middle":F=0.5;break;case"bottom":F=1;break;default:F=H[0]/G.height;}switch(H[1]){case"left":I=0;break;case"center":I=0.5;break;case"right":I=1;break;default:I=H[1]/G.width;}return{x:I,y:F};},createWrapper:function(J){if(J.parent().is(".ui-effects-wrapper")){return J.parent();}var I={width:J.outerWidth(true),height:J.outerHeight(true),"float":J.css("float")};J.wrap('<div class="ui-effects-wrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');var F=J.parent();if(J.css("position")=="static"){F.css({position:"relative"});J.css({position:"relative"});}else{var G=J.css("top");if(isNaN(parseInt(G,10))){G="auto";}var H=J.css("left");if(isNaN(parseInt(H,10))){H="auto";}F.css({position:J.css("position"),top:G,left:H,zIndex:J.css("z-index")}).show();J.css({position:"relative",top:0,left:0});}F.css(I);return F;},removeWrapper:function(F){if(F.parent().is(".ui-effects-wrapper")){return F.parent().replaceWith(F);}return F;},setTransition:function(H,F,I,G){G=G||{};D.each(F,function(J,K){unit=H.cssUnit(K);if(unit[0]>0){G[K]=unit[0]*I+unit[1];}});return G;},animateClass:function(I,H,F,G){var K=(typeof F=="function"?F:(G?G:null));var J=(typeof F=="string"?F:null);return this.each(function(){var O={};var Q=D(this);var P=Q.attr("style")||"";if(typeof P=="object"){P=P.cssText;}if(I.toggle){Q.hasClass(I.toggle)?I.remove=I.toggle:I.add=I.toggle;}var M=D.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(I.add){Q.addClass(I.add);}if(I.remove){Q.removeClass(I.remove);}var L=D.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(I.add){Q.removeClass(I.add);}if(I.remove){Q.addClass(I.remove);}for(var N in L){if(typeof L[N]!="function"&&L[N]&&N.indexOf("Moz")==-1&&N.indexOf("length")==-1&&L[N]!=M[N]&&(N.match(/color/i)||(!N.match(/color/i)&&!isNaN(parseInt(L[N],10))))&&(M.position!="static"||(M.position=="static"&&!N.match(/left|top|bottom|right/)))){O[N]=L[N];}}Q.animate(O,H,J,function(){if(typeof D(this).attr("style")=="object"){D(this).attr("style")["cssText"]="";D(this).attr("style")["cssText"]=P;}else{D(this).attr("style",P);}if(I.add){D(this).addClass(I.add);}if(I.remove){D(this).removeClass(I.remove);}if(K){K.apply(this,arguments);}});});}};function E(I,J){var G=I[1]&&I[1].constructor==Object?I[1]:{};if(J){G.mode=J;}var H=I[1]&&I[1].constructor!=Object?I[1]:(G.duration?G.duration:I[2]);H=D.fx.off?0:typeof H==="number"?H:D.fx.speeds[H]||D.fx.speeds._default;var F=G.callback||(D.isFunction(I[1])&&I[1])||(D.isFunction(I[2])&&I[2])||(D.isFunction(I[3])&&I[3]);return[I[0],G,H,F];}D.fn.extend({_show:D.fn.show,_hide:D.fn.hide,__toggle:D.fn.toggle,_addClass:D.fn.addClass,_removeClass:D.fn.removeClass,_toggleClass:D.fn.toggleClass,effect:function(H,I,G,F){return D.effects[H]?D.effects[H].call(this,{method:H,options:I||{},duration:G,callback:F}):null;},show:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._show.apply(this,arguments);}else{return this.effect.apply(this,E(arguments,"show"));}},hide:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._hide.apply(this,arguments);}else{return this.effect.apply(this,E(arguments,"hide"));}},toggle:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))||(D.isFunction(arguments[0])||typeof arguments[0]=="boolean")){return this.__toggle.apply(this,arguments);}else{return this.effect.apply(this,E(arguments,"toggle"));}},addClass:function(H,I,F,G){return I?D.effects.animateClass.apply(this,[{add:H},I,F,G]):this._addClass(H);},removeClass:function(H,I,F,G){return I?D.effects.animateClass.apply(this,[{remove:H},I,F,G]):this._removeClass(H);},toggleClass:function(H,I,F,G){return((typeof I!=="boolean")&&I)?D.effects.animateClass.apply(this,[{toggle:H},I,F,G]):this._toggleClass(H,I);},morph:function(J,H,I,F,G){return D.effects.animateClass.apply(this,[{add:H,remove:J},I,F,G]);},switchClass:function(){return this.morph.apply(this,arguments);},cssUnit:function(H){var G=this.css(H),F=[];D.each(["em","px","%","pt"],function(J,I){if(G.indexOf(I)>0){F=[parseFloat(G),I];}});return F;}});D.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(F,G){D.fx.step[G]=function(H){if(H.state==0){H.start=C(H.elem,G);H.end=A(H.end);}H.elem.style[G]="rgb("+[Math.max(Math.min(parseInt((H.pos*(H.end[0]-H.start[0]))+H.start[0],10),255),0),Math.max(Math.min(parseInt((H.pos*(H.end[1]-H.start[1]))+H.start[1],10),255),0),Math.max(Math.min(parseInt((H.pos*(H.end[2]-H.start[2]))+H.start[2],10),255),0)].join(",")+")";};});function A(F){var G;if(F&&F.constructor==Array&&F.length==3){return F;}if(G=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(F)){return[parseInt(G[1],10),parseInt(G[2],10),parseInt(G[3],10)];}if(G=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(F)){return[parseFloat(G[1])*2.55,parseFloat(G[2])*2.55,parseFloat(G[3])*2.55];}if(G=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(F)){return[parseInt(G[1],16),parseInt(G[2],16),parseInt(G[3],16)];}if(G=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(F)){return[parseInt(G[1]+G[1],16),parseInt(G[2]+G[2],16),parseInt(G[3]+G[3],16)];}if(G=/rgba\(0, 0, 0, 0\)/.exec(F)){return B.transparent;}return B[D.trim(F).toLowerCase()];}function C(F,H){var G;do{G=D.curCSS(F,H);if(G!=""&&G!="transparent"||D.nodeName(F,"body")){break;}H="backgroundColor";}while(F=F.parentNode);return A(G);}var B={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};D.easing.jswing=D.easing.swing;D.extend(D.easing,{def:"easeOutQuad",swing:function(I,H,J,F,G){return D.easing[D.easing.def](I,H,J,F,G);},easeInQuad:function(I,H,J,F,G){return F*(H/=G)*H+J;},easeOutQuad:function(I,H,J,F,G){return -F*(H/=G)*(H-2)+J;},easeInOutQuad:function(I,H,J,F,G){if((H/=G/2)<1){return F/2*H*H+J;}return -F/2*((--H)*(H-2)-1)+J;},easeInCubic:function(I,H,J,F,G){return F*(H/=G)*H*H+J;},easeOutCubic:function(I,H,J,F,G){return F*((H=H/G-1)*H*H+1)+J;},easeInOutCubic:function(I,H,J,F,G){if((H/=G/2)<1){return F/2*H*H*H+J;}return F/2*((H-=2)*H*H+2)+J;},easeInQuart:function(I,H,J,F,G){return F*(H/=G)*H*H*H+J;},easeOutQuart:function(I,H,J,F,G){return -F*((H=H/G-1)*H*H*H-1)+J;},easeInOutQuart:function(I,H,J,F,G){if((H/=G/2)<1){return F/2*H*H*H*H+J;}return -F/2*((H-=2)*H*H*H-2)+J;},easeInQuint:function(I,H,J,F,G){return F*(H/=G)*H*H*H*H+J;},easeOutQuint:function(I,H,J,F,G){return F*((H=H/G-1)*H*H*H*H+1)+J;},easeInOutQuint:function(I,H,J,F,G){if((H/=G/2)<1){return F/2*H*H*H*H*H+J;}return F/2*((H-=2)*H*H*H*H+2)+J;},easeInSine:function(I,H,J,F,G){return -F*Math.cos(H/G*(Math.PI/2))+F+J;},easeOutSine:function(I,H,J,F,G){return F*Math.sin(H/G*(Math.PI/2))+J;},easeInOutSine:function(I,H,J,F,G){return -F/2*(Math.cos(Math.PI*H/G)-1)+J;},easeInExpo:function(I,H,J,F,G){return(H==0)?J:F*Math.pow(2,10*(H/G-1))+J;},easeOutExpo:function(I,H,J,F,G){return(H==G)?J+F:F*(-Math.pow(2,-10*H/G)+1)+J;},easeInOutExpo:function(I,H,J,F,G){if(H==0){return J;}if(H==G){return J+F;}if((H/=G/2)<1){return F/2*Math.pow(2,10*(H-1))+J;}return F/2*(-Math.pow(2,-10*--H)+2)+J;},easeInCirc:function(I,H,J,F,G){return -F*(Math.sqrt(1-(H/=G)*H)-1)+J;},easeOutCirc:function(I,H,J,F,G){return F*Math.sqrt(1-(H=H/G-1)*H)+J;},easeInOutCirc:function(I,H,J,F,G){if((H/=G/2)<1){return -F/2*(Math.sqrt(1-H*H)-1)+J;}return F/2*(Math.sqrt(1-(H-=2)*H)+1)+J;},easeInElastic:function(L,J,M,F,G){var I=1.70158;var H=0;var K=F;if(J==0){return M;}if((J/=G)==1){return M+F;}if(!H){H=G*0.3;}if(K<Math.abs(F)){K=F;var I=H/4;}else{var I=H/(2*Math.PI)*Math.asin(F/K);}return -(K*Math.pow(2,10*(J-=1))*Math.sin((J*G-I)*(2*Math.PI)/H))+M;},easeOutElastic:function(L,J,M,F,G){var I=1.70158;var H=0;var K=F;if(J==0){return M;}if((J/=G)==1){return M+F;}if(!H){H=G*0.3;}if(K<Math.abs(F)){K=F;var I=H/4;}else{var I=H/(2*Math.PI)*Math.asin(F/K);}return K*Math.pow(2,-10*J)*Math.sin((J*G-I)*(2*Math.PI)/H)+F+M;},easeInOutElastic:function(L,J,M,F,G){var I=1.70158;var H=0;var K=F;if(J==0){return M;}if((J/=G/2)==2){return M+F;}if(!H){H=G*(0.3*1.5);}if(K<Math.abs(F)){K=F;var I=H/4;}else{var I=H/(2*Math.PI)*Math.asin(F/K);}if(J<1){return -0.5*(K*Math.pow(2,10*(J-=1))*Math.sin((J*G-I)*(2*Math.PI)/H))+M;}return K*Math.pow(2,-10*(J-=1))*Math.sin((J*G-I)*(2*Math.PI)/H)*0.5+F+M;},easeInBack:function(J,I,K,F,G,H){if(H==undefined){H=1.70158;}return F*(I/=G)*I*((H+1)*I-H)+K;},easeOutBack:function(J,I,K,F,G,H){if(H==undefined){H=1.70158;}return F*((I=I/G-1)*I*((H+1)*I+H)+1)+K;},easeInOutBack:function(J,I,K,F,G,H){if(H==undefined){H=1.70158;}if((I/=G/2)<1){return F/2*(I*I*(((H*=(1.525))+1)*I-H))+K;}return F/2*((I-=2)*I*(((H*=(1.525))+1)*I+H)+2)+K;},easeInBounce:function(I,H,J,F,G){return F-D.easing.easeOutBounce(I,G-H,0,F,G)+J;},easeOutBounce:function(I,H,J,F,G){if((H/=G)<(1/2.75)){return F*(7.5625*H*H)+J;}else{if(H<(2/2.75)){return F*(7.5625*(H-=(1.5/2.75))*H+0.75)+J;}else{if(H<(2.5/2.75)){return F*(7.5625*(H-=(2.25/2.75))*H+0.9375)+J;}else{return F*(7.5625*(H-=(2.625/2.75))*H+0.984375)+J;}}}},easeInOutBounce:function(I,H,J,F,G){if(H<G/2){return D.easing.easeInBounce(I,H*2,0,F,G)*0.5+J;}return D.easing.easeOutBounce(I,H*2-G,0,F,G)*0.5+F*0.5+J;}});})(jQuery);(function(A){var E,B=[];function C(H,I,F){var G;G=A.fn[I];A.fn[I]=function(){var J;if(H!=="after"){J=F.apply(this,arguments);if(J!==undefined){return J;}}J=G.apply(this,arguments);if(H!=="before"){F.apply(this,arguments);}return J;};}A.fn.tinymce=function(H){var I=this,J,G="",K;if(!I.length){return ;}if(!H){return tinyMCE.get(this[0].id);}function F(){if(D){D();D=null;}I.each(function(L,N){var M,O=N.id||tinymce.DOM.uniqueId();N.id=O;M=new tinymce.Editor(O,H);M.render();});}if(!window.tinymce&&!E&&(J=H.script_url)){E=1;if(/_(src|dev)\.js/g.test(J)){G="_src";}window.tinyMCEPreInit={base:J.substring(0,J.lastIndexOf("/")),suffix:G,query:""};A.getScript(J,function(){tinymce.dom.Event.domLoaded=1;E=2;F();A.each(B,function(M,L){L();});});}else{if(E===1){B.push(F);}else{F();}}};A.extend(A.expr[":"],{tinymce:function(F){return F.id&&!!tinyMCE.get(F.id);}});function D(){function G(){this.find("span.mceEditor,div.mceEditor").each(function(I,H){var J;if(J=tinyMCE.get(H.id.replace(/_parent$/,""))){J.remove();}});}function F(H){var I;if(H!==undefined){G.call(this);this.each(function(K,J){var L;if(L=tinyMCE.get(J.id)){L.setContent(H);}});}else{if(this.length>0){if(I=tinyMCE.get(this[0].id)){return I.getContent();}}}}C("both","text",function(H){if(H!==undefined){return F.call(this,H);}if(this.length>0){if(ed=tinyMCE.get(this[0].id)){return ed.getContent().replace(/<[^>]+>/g,"");}}});A.each(["val","html"],function(H,I){C("both",I,F);});A.each(["append","prepend"],function(H,I){C("before",I,function(J){if(J!==undefined){this.each(function(L,K){var M;if(M=tinyMCE.get(K.id)){if(I==="append"){M.setContent(M.getContent()+J);}else{M.setContent(J+M.getContent());}}});}});});C("both","attr",function(I,H){if(I&&I==="value"){return F.call(this,H);}});A.each(["remove","replaceWith","replaceAll","empty"],function(H,I){C("before",I,G);});}})(jQuery);(function(){$.fn.getCardsBlock=function(){return'<div class="w_pop_smc" style="width: 320px; left: 23px;"><div class="w_pop_smc_top"></div><div class="w_pop_smc_body"><ul><li><a href="#"><img src="/img/smile_card/101.png"></a></li> <li><a href="#"><img src="/img/smile_card/102.png"></a></li> <li><a href="#"><img src="/img/smile_card/103.png"></a></li> <li><a href="#"><img src="/img/smile_card/104.png"></a></li> <li><a href="#"><img src="/img/smile_card/105.png"></a></li> <li><a href="#"><img src="/img/smile_card/106.png"></a></li> <li><a href="#"><img src="/img/smile_card/107.png"></a></li> <li><a href="#"><img src="/img/smile_card/108.png"></a></li> <li><a href="#"><img src="/img/smile_card/109.png"></a></li> <li><a href="#"><img src="/img/smile_card/110.png"></a></li> <li><a href="#"><img src="/img/smile_card/111.png"></a></li> <li><a href="#"><img src="/img/smile_card/112.png"></a></li> <li><a href="#"><img src="/img/smile_card/113.png"></a></li> <li><a href="#"><img src="/img/smile_card/201.png"></a></li> <li><a href="#"><img src="/img/smile_card/202.png"></a></li> <li><a href="#"><img src="/img/smile_card/203.png"></a></li> <li><a href="#"><img src="/img/smile_card/204.png"></a></li> <li><a href="#"><img src="/img/smile_card/205.png"></a></li> <li><a href="#"><img src="/img/smile_card/206.png"></a></li> <li><a href="#"><img src="/img/smile_card/207.png"></a></li> <li><a href="#"><img src="/img/smile_card/208.png"></a></li> <li><a href="#"><img src="/img/smile_card/209.png"></a></li> <li><a href="#"><img src="/img/smile_card/210.png"></a></li> <li><a href="#"><img src="/img/smile_card/211.png"></a></li> <li><a href="#"><img src="/img/smile_card/212.png"></a></li> <li><a href="#"><img src="/img/smile_card/213.png"></a></li> <li><a href="#"><img src="/img/smile_card/301.png"></a></li> <li><a href="#"><img src="/img/smile_card/302.png"></a></li> <li><a href="#"><img src="/img/smile_card/303.png"></a></li> <li><a href="#"><img src="/img/smile_card/304.png"></a></li> <li><a href="#"><img src="/img/smile_card/305.png"></a></li> <li><a href="#"><img src="/img/smile_card/306.png"></a></li> <li><a href="#"><img src="/img/smile_card/307.png"></a></li> <li><a href="#"><img src="/img/smile_card/308.png"></a></li> <li><a href="#"><img src="/img/smile_card/309.png"></a></li> <li><a href="#"><img src="/img/smile_card/310.png"></a></li> <li><a href="#"><img src="/img/smile_card/311.png"></a></li> <li><a href="#"><img src="/img/smile_card/312.png"></a></li> <li><a href="#"><img src="/img/smile_card/313.png"></a></li> <li><a href="#"><img src="/img/smile_card/401.png"></a></li> <li><a href="#"><img src="/img/smile_card/402.png"></a></li> <li><a href="#"><img src="/img/smile_card/403.png"></a></li> <li><a href="#"><img src="/img/smile_card/404.png"></a></li> <li><a href="#"><img src="/img/smile_card/405.png"></a></li> <li><a href="#"><img src="/img/smile_card/406.png"></a></li> <li><a href="#"><img src="/img/smile_card/407.png"></a></li> <li><a href="#"><img src="/img/smile_card/408.png"></a></li> <li><a href="#"><img src="/img/smile_card/409.png"></a></li> <li><a href="#"><img src="/img/smile_card/410.png"></a></li> <li><a href="#"><img src="/img/smile_card/411.png"></a></li> <li><a href="#"><img src="/img/smile_card/412.png"></a></li> <li><a href="#"><img src="/img/smile_card/413.png"></a></li> </ul></div></div>';};$.fn.getSmilesBlock=function(){return'<div class="w_pop_smc" style=" width: 323px; left: 0px;"><div class="w_pop_smc_top"></div><div class="w_pop_smc_body w_pop_sm_body"><ul style="height: 168px; overflow-y: scroll;"><li><a ><img src="/img/smiles/aa.gif"></a></li><li><a ><img src="/img/smiles/ab.gif"></a></li><li><a ><img src="/img/smiles/ac.gif"></a></li><li><a ><img src="/img/smiles/ad.gif"></a></li><li><a ><img src="/img/smiles/ae.gif"></a></li><li><a ><img src="/img/smiles/af.gif"></a></li><li><a ><img src="/img/smiles/ag.gif"></a></li><li><a ><img src="/img/smiles/ah.gif"></a></li><li><a ><img src="/img/smiles/ai.gif"></a></li><li><a ><img src="/img/smiles/aj.gif"></a></li><li><a ><img src="/img/smiles/ak.gif"></a></li><li><a ><img src="/img/smiles/al.gif"></a></li><li><a ><img src="/img/smiles/am.gif"></a></li><li><a ><img src="/img/smiles/an.gif"></a></li><li><a ><img src="/img/smiles/ao.gif"></a></li><li><a ><img src="/img/smiles/ap.gif"></a></li><li><a ><img src="/img/smiles/aq.gif"></a></li><li><a ><img src="/img/smiles/ar.gif"></a></li><li><a ><img src="/img/smiles/as.gif"></a></li><li><a ><img src="/img/smiles/at.gif"></a></li><li><a ><img src="/img/smiles/au.gif"></a></li><li><a ><img src="/img/smiles/av.gif"></a></li><li><a ><img src="/img/smiles/aw.gif"></a></li><li><a ><img src="/img/smiles/ax.gif"></a></li><li><a ><img src="/img/smiles/ay.gif"></a></li><li><a ><img src="/img/smiles/az.gif"></a></li><li><a ><img src="/img/smiles/ba.gif"></a></li><li><a ><img src="/img/smiles/bb.gif"></a></li><li><a ><img src="/img/smiles/bc.gif"></a></li><li><a ><img src="/img/smiles/bd.gif"></a></li><li><a ><img src="/img/smiles/be.gif"></a></li><li><a ><img src="/img/smiles/bf.gif"></a></li><li><a ><img src="/img/smiles/bg.gif"></a></li><li><a ><img src="/img/smiles/bh.gif"></a></li><li><a ><img src="/img/smiles/bi.gif"></a></li><li><a ><img src="/img/smiles/bj.gif"></a></li><li><a ><img src="/img/smiles/bk.gif"></a></li><li><a ><img src="/img/smiles/bl.gif"></a></li><li><a ><img src="/img/smiles/bm.gif"></a></li><li><a ><img src="/img/smiles/bn.gif"></a></li><li><a ><img src="/img/smiles/bo.gif"></a></li><li><a ><img src="/img/smiles/bp.gif"></a></li><li><a ><img src="/img/smiles/bq.gif"></a></li><li><a ><img src="/img/smiles/br.gif"></a></li><li><a ><img src="/img/smiles/bs.gif"></a></li><li><a ><img src="/img/smiles/bt.gif"></a></li><li><a ><img src="/img/smiles/bu.gif"></a></li><li><a ><img src="/img/smiles/bv.gif"></a></li><li><a ><img src="/img/smiles/bw.gif"></a></li><li><a ><img src="/img/smiles/bx.gif"></a></li><li><a ><img src="/img/smiles/by.gif"></a></li><li><a ><img src="/img/smiles/bz.gif"></a></li><li><a ><img src="/img/smiles/ca.gif"></a></li><li><a ><img src="/img/smiles/cb.gif"></a></li><li><a ><img src="/img/smiles/cc.gif"></a></li><li><a ><img src="/img/smiles/cd.gif"></a></li><li><a ><img src="/img/smiles/ce.gif"></a></li><li><a ><img src="/img/smiles/cf.gif"></a></li><li><a ><img src="/img/smiles/cg.gif"></a></li><li><a ><img src="/img/smiles/ch.gif"></a></li><li><a ><img src="/img/smiles/ci.gif"></a></li><li><a ><img src="/img/smiles/cj.gif"></a></li><li><a ><img src="/img/smiles/ck.gif"></a></li><li><a ><img src="/img/smiles/cl.gif"></a></li><li><a ><img src="/img/smiles/cm.gif"></a></li><li><a ><img src="/img/smiles/cn.gif"></a></li><li><a ><img src="/img/smiles/co.gif"></a></li><li><a ><img src="/img/smiles/cp.gif"></a></li><li><a ><img src="/img/smiles/cq.gif"></a></li><li><a ><img src="/img/smiles/cr.gif"></a></li><li><a ><img src="/img/smiles/cs.gif"></a></li><li><a ><img src="/img/smiles/ct.gif"></a></li><li><a ><img src="/img/smiles/cu.gif"></a></li><li><a ><img src="/img/smiles/cv.gif"></a></li><li><a ><img src="/img/smiles/cw.gif"></a></li><li><a ><img src="/img/smiles/cx.gif"></a></li><li><a ><img src="/img/smiles/cy.gif"></a></li><li><a ><img src="/img/smiles/cz.gif"></a></li><li><a ><img src="/img/smiles/da.gif"></a></li><li><a ><img src="/img/smiles/db.gif"></a></li><li><a ><img src="/img/smiles/dc.gif"></a></li><li><a ><img src="/img/smiles/dd.gif"></a></li><li><a ><img src="/img/smiles/de.gif"></a></li><li><a ><img src="/img/smiles/df.gif"></a></li><li><a ><img src="/img/smiles/dg.gif"></a></li><li><a ><img src="/img/smiles/dh.gif"></a></li><li><a ><img src="/img/smiles/di.gif"></a></li><li><a ><img src="/img/smiles/dj.gif"></a></li><li><a ><img src="/img/smiles/dk.gif"></a></li><li><a ><img src="/img/smiles/dl.gif"></a></li><li><a ><img src="/img/smiles/dm.gif"></a></li><li><a ><img src="/img/smiles/dn.gif"></a></li><li><a ><img src="/img/smiles/do.gif"></a></li><li><a ><img src="/img/smiles/dp.gif"></a></li><li><a ><img src="/img/smiles/dq.gif"></a></li><li><a ><img src="/img/smiles/dr.gif"></a></li><li><a ><img src="/img/smiles/ds.gif"></a></li><li><a ><img src="/img/smiles/dt.gif"></a></li><li><a ><img src="/img/smiles/du.gif"></a></li><li><a ><img src="/img/smiles/dv.gif"></a></li><li><a ><img src="/img/smiles/dw.gif"></a></li><li><a ><img src="/img/smiles/dx.gif"></a></li><li><a ><img src="/img/smiles/dy.gif"></a></li><li><a ><img src="/img/smiles/dz.gif"></a></li><li><a ><img src="/img/smiles/ea.gif"></a></li></ul><div class="copy_col">&copy; kolobok.us</div></div></div>';};$.fn.getLinkvideoBlock=function(){return'<div style="width: 403px; left: 29px;" class="w_pop_smc"><div class="w_pop_smc_top"></div><div class="w_pop_smc_body"><div class="pop_smc_vid"><input type="edit" id="linkvideodesc" value="Название видео" class="edit" onfocus="if(this.value==\'Название видео\') this.value=\'\';" onblur="if(this.value==\'\') this.value=\'Название видео\';"; /><div class="pop_smc_vidt"><input type="edit" id="linkvideolink" name="" value="" class="edit" /></div><div class="pop_smc_vidb"><div class="b-big-t1 copy_col"><a><span>Добавить</span></a></div></div><div class="clear"></div><p class="hint">Введите URL. Поддерживаемые видеохостинги - Youtube, Vimeo, Rutube.</p></div></div></div>';};$.fn.removeMCE=function(){var A=this.attr("name");if(typeof (tinyMCE)=="object"){if(typeof (tinyMCE.get(A))=="object"){tinyMCE.execCommand("mceRemoveControl",false,A);}}return true;};$.fn.casinorubbcode=function(A){this.tinymce({theme:"advanced",mode:"none",plugins:"bbcode",theme_advanced_buttons1:"bold,italic,underline,|,link,unlink,|,casremoticons,casrcards,insertimage,casrlinkvideo",theme_advanced_buttons2:"",theme_advanced_buttons3:"",script_url:"/js/lib/tinymce/tiny_mce.js",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",theme_advanced_styles:"Code=codeStyle;Quote=quoteStyle",content_css:"/css/wysiwyg.css,/css/reset.css",entity_encoding:"raw",add_unload_trigger:false,remove_linebreaks:false,relative_urls:false,inline_styles:false,convert_newlines_to_brs:true,convert_fonts_to_spans:false,setup:function(D){D.cards=tinymce.DOM.create("div",{id:"cards"},$().getCardsBlock());D.emoticons=tinymce.DOM.create("div",{id:"emoticons"},$().getSmilesBlock());D.linkvideo=tinymce.DOM.create("div",{id:"linkvideo"},$().getLinkvideoBlock());D.onInit.add(function(){var H=tinymce.DOM.get(D.id+"_casremoticons");tinymce.DOM.insertAfter(D.emoticons,H);tinymce.DOM.hide(D.emoticons);$(D.emoticons).find("a").click(function(){var I=$(this).find("img");var J=D.dom.createHTML("img",{src:I.attr("src"),alt:I.attr("alt"),"class":"smilecard",title:I.attr("title"),border:0});D.execCommand("mceInsertContent",false,J);tinymce.DOM.hide(D.emoticons);return false;});var G=tinymce.DOM.get(D.id+"_casrcards");tinymce.DOM.insertAfter(D.cards,G);tinymce.DOM.hide(D.cards);$(D.cards).find("a").click(function(){var I=$(this).find("img");var J=D.dom.createHTML("img",{src:I.attr("src"),alt:I.attr("alt"),"class":"smilecard",title:I.attr("title"),border:0});D.execCommand("mceInsertContent",false,J);tinymce.DOM.hide(D.cards);return false;});var F=tinymce.DOM.get(D.id+"_casrlinkvideo");tinymce.DOM.insertAfter(D.linkvideo,F);tinymce.DOM.hide(D.linkvideo);$(D.linkvideo).find("a").click(function(){var J=$("#linkvideodesc").val();var I=$("#linkvideolink").val();D.execCommand("mceInsertContent",false,"<a href='"+I+"' style='background: url(/img/video.png) no-repeat 0px 2px; padding-left: 20px;'>"+J+"</a>");tinymce.DOM.hide(D.linkvideo);return false;});});D.addButton("casremoticons",{id:"casremoticons",title:"Добавить смайлик в текст",image:"/img/smile.gif",onclick:function(F){if(tinymce.DOM.getStyle(D.emoticons,"display")=="none"){tinymce.DOM.hide(D.cards);tinymce.DOM.hide(D.linkvideo);tinymce.DOM.show(D.emoticons);}else{tinymce.DOM.hide(D.emoticons);}return false;}});D.addButton("casrcards",{id:"casrcard",title:"Добавить карту в текст",image:"/img/card.gif",onclick:function(F){if(tinymce.DOM.getStyle(D.cards,"display")=="none"){tinymce.DOM.hide(D.emoticons);tinymce.DOM.hide(D.linkvideo);tinymce.DOM.show(D.cards);}else{tinymce.DOM.hide(D.cards);}return false;}});D.addButton("casrlinkvideo",{id:"casrlinkvideo",title:"Вставить ссылку на видео",image:"/img/youtube.gif",onclick:function(F){if(tinymce.DOM.getStyle(D.linkvideo,"display")=="none"){tinymce.DOM.hide(D.emoticons);tinymce.DOM.hide(D.cards);tinymce.DOM.show(D.linkvideo);}else{tinymce.DOM.hide(D.linkvideo);}return false;}});D.addButton("insertimage",{id:"insertimage",title:"Вставить изображение",image:"/img/image.gif",onclick:function(F){$("#body-wr").ImageManager({name:"widget_photo_gallery",before:"#comment-reply",before_render:function(){new Popup("#body-wr");},after_render:function(){document.popup.close();},select_action:function(){var G=$(this).selectImage();if(typeof (G)=="object"){var H=D.dom.createHTML("img",{src:G.full_path,alt:G.description,"class":"actimg",title:G.description,border:0});tinymce.EditorManager.activeEditor.execCommand("mceInsertContent",false,H);delete H;}}});}});var E=function(G){var I;var F=1024;var J=G.getDoc();if(document.all){return F-J.body.innerText.length;}var H=J.createRange();H.selectNodeContents(J.body);return F-H.toString().length;};var C=function(G){var F=new Popup("#body-wr");F.setContent("Превышен лимит количества символов в комментарии. Допустимое количество: 1024.");};var B=function(F){var G=$().getCommentForm();G.find("#char_left").text(F);};D.onPaste.add(function(G){var F=E(G);if(F<0){C();}B(F);});D.onKeyPress.add(function(G){var F=E(G);if(F<0){C();}B(F);});D.onChange.add(function(G){var F=E(G);if(F<0){C();}B(F);});}});};$.fn.casinorutinymce=function(A){$(this).tinymce({language:"ru",theme:"advanced",relative_urls:false,theme_advanced_resizing:true,content_css:"/css/wysiwyg.css,/css/reset.css",script_url:"/js/lib/tinymce/tiny_mce.js",plugins:"safari,style,layer,advhr,advimage,iespell,inlinepopups,paste,directionality,noneditable,visualchars,nonbreaking,xhtmlxtras,template",theme_advanced_buttons1:"h2,h3,|,bold,italic,strikethrough,|,casremoticons,casrcards,insertimage,|,justifyleft,justifycenter,justifyright,|,numlist,bullist,|,link,unlink,|,pastetext,|,pasteword,removeformat,casrcutline",theme_advanced_buttons2:"",theme_advanced_buttons3:"",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",theme_advanced_blockformats:"p,h2,h3,h4,h5,h6",theme_advanced_font_sizes:"8px, 10px, 12px",theme_advanced_statusbar_location:"bottom",theme_advanced_resize_horizontal:false,setup:function(B){B.cards=tinymce.DOM.create("div",{id:"cards"},$().getCardsBlock());B.emoticons=tinymce.DOM.create("div",{id:"emoticons"},$().getSmilesBlock());B.onInit.add(function(){var D=tinymce.DOM.get(B.id+"_casremoticons");tinymce.DOM.insertAfter(B.emoticons,D);tinymce.DOM.hide(B.emoticons);$(B.emoticons).find("a").click(function(){var E=$(this).find("img");var F=B.dom.createHTML("img",{src:E.attr("src"),alt:E.attr("alt"),"class":"smilecard",title:E.attr("title"),border:0});B.execCommand("mceInsertContent",false,F);tinymce.DOM.hide(B.emoticons);return false;});var C=tinymce.DOM.get(B.id+"_casrcards");tinymce.DOM.insertAfter(B.cards,C);tinymce.DOM.hide(B.cards);$(B.cards).find("a").click(function(){var E=$(this).find("img");var F=B.dom.createHTML("img",{src:E.attr("src"),alt:E.attr("alt"),"class":"smilecard",title:E.attr("title"),border:0});B.execCommand("mceInsertContent",false,F);tinymce.DOM.hide(B.cards);return false;});});B.addButton("casremoticons",{id:"casremoticons",title:"Добавить смайлик в текст",image:"/img/smile.gif",onclick:function(C){if(tinymce.DOM.getStyle(B.emoticons,"display")=="none"){tinymce.DOM.hide(B.cards);tinymce.DOM.show(B.emoticons);}else{tinymce.DOM.hide(B.emoticons);}return false;}});B.addButton("casrcards",{id:"casrcard",title:"Добавить карту в текст",image:"/img/card.gif",onclick:function(C){if(tinymce.DOM.getStyle(B.cards,"display")=="none"){tinymce.DOM.hide(B.emoticons);tinymce.DOM.show(B.cards);}else{tinymce.DOM.hide(B.cards);}return false;}});B.addButton("casrcutline",{id:"casrcutline",title:"Убрать под кат",image:"/img/cutline.gif",onclick:function(C){B.execCommand("mceInsertContent",false,"<hr/>");}});B.addButton("h2",{id:"h2",title:"Заголовок второго уровня",image:"/img/h2.gif",onclick:function(F){B.focus();var D=B.selection;var C=B.dom.getParent(D.getNode(),"H2");if(D.isCollapsed()&&!C){return false;}if(!C){B.selection.setContent("<h2>"+B.selection.getContent()+"</h2>");return true;}var E=C.innerHTML;B.dom.remove(C);B.selection.setContent(E);return true;}});B.onNodeChange.add(function(D,C,F,E){C.setDisabled("h2",E&&F.nodeName!="H2");C.setActive("h2",F.nodeName=="H2"&&!F.name);});B.addButton("h3",{id:"h3",title:"Заголовок третьего уровня",image:"/img/h3.gif",onclick:function(F){B.focus();var D=B.selection;var C=B.dom.getParent(D.getNode(),"H3");if(D.isCollapsed()&&!C){return false;}if(!C){B.selection.setContent("<h3>"+B.selection.getContent()+"</h3>");return true;}var E=C.innerHTML;B.dom.remove(C);B.selection.setContent(E);return true;}});B.onNodeChange.add(function(D,C,F,E){C.setDisabled("h3",E&&F.nodeName!="H3");C.setActive("h3",F.nodeName=="H3"&&!F.name);});B.addButton("insertimage",{id:"insertimage",title:"Вставить изображение",image:"/img/image.gif",onclick:function(C){$(B).ImageManager({name:"widget_photo_gallery",before:"#"+B.id,before_render:function(){new Popup("#body-wr");},after_render:function(){document.popup.close();},select_action:function(){var D=$(this).selectImage();if(typeof (D)=="object"){var E=B.dom.createHTML("img",{src:D.full_path,alt:D.description,"class":"actimg",title:D.description,border:0});B.execCommand("mceInsertContent",false,E);delete E;}}});}});}});return this;};})();(function(A){A.fn.getWysiwyg=function(C){C=A(C);return A.data(C.get(0),"wysiwyg");};A.fn.documentSelection=function(){var C=this[0];if(C.contentWindow.document.selection){return C.contentWindow.document.selection.createRange().text;}else{return C.contentWindow.getSelection().toString();}};A.fn.document=function(){var C=this[0];if(C.nodeName.toLowerCase()=="iframe"){return C.contentWindow.document;}else{return A(this);}};A.fn.wysiwyg=function(D){if(arguments.length>0&&arguments[0].constructor==String){var F=arguments[0].toString();var H=[];for(var E=1;E<arguments.length;E++){H[E-1]=arguments[E];}if(F in B){return this.each(function(){A.data(this,"wysiwyg").designMode();B[F].apply(this,H);});}else{return this;}}var C={};if(D&&D.controls){var C=D.controls;delete D.controls;}var D=A.extend({html:'<?xml version="1.0" encoding="WINDOWS-1251"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=WINDOWS-1251"><link href="/css/wysiwyg.css" type="text/css" rel="stylesheet">STYLE_SHEET</head><body class="post-text">INITIAL_CONTENT</body></html>',css:{},debug:false,autoSave:true,rmUnwantedBr:true,brIE:true,controls:{},messages:{}},D);D.messages=A.extend(true,D.messages,B.MSGS_EN);D.controls=A.extend(true,D.controls,B.TOOLBAR);for(var G in C){if(G in D.controls){A.extend(D.controls[G],C[G]);}else{D.controls[G]=C[G];}}return this.each(function(){B(this,D);});};function B(D,C){return this instanceof B?this.init(D,C):new B(D,C);}A.extend(B,{insertImage:function(F,E){var D=A.data(this,"wysiwyg");if(D.constructor==B&&F&&F.length>0){if(E){D.editorDoc.execCommand("insertImage",false,"#jwysiwyg#");var C=D.getElementByAttributeValue("img","src","#jwysiwyg#");if(C){C.src=F;for(var G in E){C.setAttribute(G,E[G]);}}}else{D.editorDoc.execCommand("insertImage",false,F);}}},createLink:function(E){var C=A.data(this,"wysiwyg");if(C.constructor==B&&E&&E.length>0){var D=A(C.editor).documentSelection();if(D.length>0){C.editorDoc.execCommand("unlink",false,[]);C.editorDoc.execCommand("createLink",false,E);}else{if(C.options.messages.nonSelection){alert(C.options.messages.nonSelection);}}}},setContent:function(C){var D=A.data(this,"wysiwyg");D.setContent(C);D.saveContent();},clear:function(){var C=A.data(this,"wysiwyg");C.setContent("");C.saveContent();},MSGS_EN:{nonSelection:"select the text you wish to link"},TOOLBAR:{undo:{visible:true},redo:{visible:true},separator03:{visible:true,separator:true},bold:{visible:true,tags:["b"],css:{fontWeight:"bold"}},italic:{visible:true,tags:["i","em"],css:{fontStyle:"italic"}},strikeThrough:{visible:true,tags:["s","strike"],css:{textDecoration:"line-through"}},underline:{visible:true,tags:["u"],css:{textDecoration:"underline"}},separator02:{visible:true,separator:true},justifyLeft:{visible:true,css:{textAlign:"left"}},justifyCenter:{visible:true,tags:["center"],css:{textAlign:"center"}},justifyRight:{visible:true,css:{textAlign:"right"}},justifyFull:{visible:true,css:{textAlign:"justify"}},separator01:{visible:true,separator:true},pmozilla:{visible:true&&A.browser.mozilla&&!(A.browser.safari),className:"p",command:"heading",arguments:["p"],tags:["p"]},h2mozilla:{visible:true&&A.browser.mozilla&&!(A.browser.safari),className:"h2",command:"heading",arguments:["h2"],tags:["h2"]},h3mozilla:{visible:true&&A.browser.mozilla&&!(A.browser.safari),className:"h3",command:"heading",arguments:["h3"],tags:["h3"]},h4mozilla:{visible:true&&A.browser.mozilla&&!(A.browser.safari),className:"h4",command:"heading",arguments:["h4"],tags:["h4"]},psafari:{visible:true&&(A.browser.safari)&&!(A.browser.mozilla),className:"p",command:"formatBlock",arguments:["p"],tags:["p"]},h2safari:{visible:true&&(A.browser.safari)&&!(A.browser.mozilla),className:"h2",command:"formatBlock",arguments:["h2"],tags:["h2"]},h3safari:{visible:true&&(A.browser.safari)&&!(A.browser.mozilla),className:"h3",command:"formatBlock",arguments:["h3"],tags:["h3"]},h4safari:{visible:true&&(A.browser.safari)&&!(A.browser.mozilla),className:"h4",command:"formatBlock",arguments:["h4"],tags:["h4"]},p:{visible:true&&!(A.browser.mozilla)&&!(A.browser.safari),className:"p",command:"formatBlock",arguments:["Simple Text"],tags:["p"]},h2:{visible:true&&!(A.browser.mozilla)&&!(A.browser.safari),className:"h2",command:"formatBlock",arguments:["Heading 1"],tags:["h2"]},h3:{visible:true&&!(A.browser.mozilla)&&!(A.browser.safari),className:"h3",command:"formatBlock",arguments:["Heading 2"],tags:["h3"]},h4:{visible:true&&!(A.browser.mozilla)&&!(A.browser.safari),className:"h4",command:"formatBlock",arguments:["Heading 3"],tags:["h4"]},increaseFontSize:{visible:true&&!(A.browser.msie),tags:["big"]},decreaseFontSize:{visible:true&&!(A.browser.msie),tags:["small"]},separator00:{visible:true,separator:true},indent:{visible:true},outdent:{visible:true},separator04:{visible:true,separator:true},insertOrderedList:{visible:true,tags:["ol"]},insertUnorderedList:{visible:true,tags:["ul"]},insertHorizontalRule:{visible:true,tags:["hr"]},separator05:{separator:true},createLink:{visible:true,exec:function(){var D=A(this.editor).documentSelection();if(D.length>0){if(A.browser.msie){this.editorDoc.execCommand("createLink",true,null);}else{var C=prompt("URL","http://");if(C&&C.length>0){this.editorDoc.execCommand("unlink",false,[]);this.editorDoc.execCommand("createLink",false,C);}}}else{if(this.options.messages.nonSelection){alert(this.options.messages.nonSelection);}}},tags:["a"]},separator07:{visible:false,separator:true},cut:{visible:false},copy:{visible:false},paste:{visible:false},separator09:{visible:false,separator:true},html:{visible:false,exec:function(){if(this.viewHTML){this.setContent(A(this.original).val());A(this.original).hide();}else{this.saveContent();A(this.original).show();}this.viewHTML=!(this.viewHTML);}},removeFormat:{visible:true,exec:function(){this.clearContent();}}}});A.extend(B.prototype,{original:null,options:{},element:null,editor:null,init:function(F,E){var D=this;this.editor=F;this.options=E||{};A.data(F,"wysiwyg",this);var I=F.width||F.clientWidth;var H=F.height||F.clientHeight;if(F.nodeName.toLowerCase()=="textarea"){this.original=F;if(I==0&&F.cols){I=(F.cols*8)+21;}if(H==0&&F.rows){H=(F.rows*16)+16;}var G=this.editor=A("<iframe></iframe>").css({minHeight:(H-6).toString()+"px",width:(I-8).toString()+"px"}).attr("id",A(F).attr("id")+"IFrame");if(A.browser.msie){this.editor.css("height",(H).toString()+"px");}}var C=this.panel=A("<ul></ul>").addClass("panel");this.appendControls();this.element=A("<div></div>").css({width:(I>0)?(I).toString()+"px":"100%"}).addClass("wysiwyg").append(C).append(A("<div><!-- --></div>").css({clear:"both"})).append(G);A(F).hide().before(this.element);this.viewHTML=false;this.initialHeight=H-8;this.initialContent=A(F).val();this.initFrame();if(this.initialContent.length==0){this.setContent("");}if(this.options.autoSave){A("form").submit(function(){D.saveContent();});}A("form").bind("reset",function(){D.setContent(D.initialContent);D.saveContent();});},initFrame:function(){var C=this;var D="";if(this.options.css&&this.options.css.constructor==String){D='<link rel="stylesheet" type="text/css" media="screen" href="'+this.options.css+'" />';}this.editorDoc=A(this.editor).document();this.editorDoc_designMode=false;this.editorDoc.open();try{this.editorDoc.designMode="on";this.editorDoc_designMode=true;}catch(E){A(this.editorDoc).focus(function(){C.designMode();});}this.editorDoc.write(this.options.html.replace(/INITIAL_CONTENT/,this.initialContent).replace(/STYLE_SHEET/,D));this.editorDoc.close();this.editorDoc.contentEditable="true";if(A.browser.msie){setTimeout(function(){A(C.editorDoc.body).css("border","none");},0);}A(this.editorDoc).click(function(F){C.checkTargets(F.target?F.target:F.srcElement);});A(this.original).focus(function(){A(C.editorDoc.body).focus();});A(this.editorDoc).keypress(function(H){if(typeof (H)!="undefined"){if(typeof (H.ctrlKey)!="undefined"){if(H.ctrlKey){var F=(window.event?parseInt(H.keyCode):parseInt(H.which));if(F==118){var G=C.getContent().length;pasteText=function(){var I=C.getContent().length;if(typeof (G)!="undefined"){if(typeof (I)!="undefined"){if(G==I){setTimeout("pasteText()",10);return false;}}}C.clearContent();return true;};setTimeout("pasteText()",10);}}}}return true;});if(this.options.autoSave){A(this.editorDoc).keydown(function(){C.saveContent();}).keyup(function(){C.saveContent();}).mousedown(function(){C.saveContent();});}if(this.options.css){setTimeout(function(){if(C.options.css.constructor==String){}else{A(C.editorDoc).find("body").css(C.options.css);}},0);}A(this.editorDoc).keydown(function(G){if(A.browser.msie&&C.options.brIE&&G.keyCode==13){var F=C.getRange();F.pasteHTML("<br/>");F.collapse(false);F.select();return false;}});},designMode:function(){if(!(this.editorDoc_designMode)){try{this.editorDoc.designMode="on";this.editorDoc_designMode=true;}catch(C){}}},getSelection:function(){return(window.getSelection)?window.getSelection():document.selection;},getRange:function(){var C=this.getSelection();if(!(C)){return null;}return(C.rangeCount>0)?C.getRangeAt(0):C.createRange();},getContent:function(){return A(A(this.editor).document()).find("body").html();},clearContent:function(){var C=this.getContent();this.setContent(C.replace(/<(?!br|img|a)(.(?!br|img|a)|[\s\w\d])*?>/gi,""));this.saveContent();},setContent:function(C){A(A(this.editor).document()).find("body").html(C);},saveContent:function(){if(this.original){var C=this.getContent();if(this.options.rmUnwantedBr){C=(C.substr(-4)=="<br/>")?C.substr(0,C.length-4):C;}A(this.original).val(C);}},appendMenu:function(G,D,F,E){var C=this;var D=D||[];A("<li></li>").append(A("<a><!-- --></a>").addClass(F||G)).mousedown(function(){if(E){E.apply(C);}else{C.editorDoc.execCommand(G,false,D);}if(C.options.autoSave){C.saveContent();}}).appendTo(this.panel);},appendMenuSeparator:function(){A('<li class="separator"></li>').appendTo(this.panel);},appendControls:function(){for(var C in this.options.controls){var D=this.options.controls[C];if(D.separator){if(D.visible!==false){this.appendMenuSeparator();}}else{if(D.visible){this.appendMenu(D.command||C,D.arguments||[],D.className||D.command||C||"empty",D.exec);}}}},checkTargets:function(E){for(var D in this.options.controls){var G=this.options.controls[D];var F=G.className||G.command||D||"empty";A("."+F,this.panel).removeClass("active");if(G.tags){var H=E;do{if(H.nodeType!=1){break;}if(A.inArray(H.tagName.toLowerCase(),G.tags)!=-1){A("."+F,this.panel).addClass("active");}}while(H=H.parentNode);}if(G.css){var H=A(E);do{if(H[0].nodeType!=1){break;}for(var C in G.css){if(H.css(C).toString().toLowerCase()==G.css[C]){A("."+F,this.panel).addClass("active");}}}while(H=H.parent());}}},getElementByAttributeValue:function(E,C,F){var H=this.editorDoc.getElementsByTagName(E);for(var D=0;D<H.length;D++){var G=H[D].getAttribute(C);if(A.browser.msie){G=G.substr(G.length-F.length);}if(G==F){return H[D];}}return false;}});})(jQuery);mySettings={onCtrlEnter:{keepDefault:false,openWith:"\n[p]",closeWith:"[/p]"},onEnter:{keepDefault:false,replaceWith:"[br/]\n"},onTab:{keepDefault:false,replaceWith:"    "},markupSet:[{name:"",className:"fbold first",key:"B",openWith:"[b]",closeWith:"[/b]"},{name:"",className:"fitalic",key:"I",openWith:"[i]",closeWith:"[/i]"},{name:"",className:"fstrike",key:"S",openWith:"[s]",closeWith:"[/s]"},{name:"",className:"fquote",key:"d",openWith:'[div class="quote"]',closeWith:"[/div]"}]};(function($){$.fn.markItUp=function(settings,extraSettings){var options,ctrlKey,shiftKey,altKey;ctrlKey=shiftKey=altKey=false;options={id:"",nameSpace:"",root:"",previewInWindow:"",previewAutoRefresh:true,previewPosition:"after",previewTemplatePath:"~/templates/preview.html",previewParserPath:"",previewParserVar:"data",resizeHandle:true,beforeInsert:"",afterInsert:"",onEnter:{},onShiftEnter:{},onCtrlEnter:{},onTab:{},markupSet:[{}]};$.extend(options,settings,extraSettings);if(!options.root){$("script").each(function(a,tag){miuScript=$(tag).get(0).src.match(/(.*)jquery\.markitup(\.pack)?\.js$/);if(miuScript!==null){options.root=miuScript[1];}});}return this.each(function(){var $$,textarea,levels,scrollPosition,caretPosition,caretOffset,clicked,hash,header,footer,previewWindow,template,iFrame,abort;$$=$(this);textarea=this;levels=[];abort=false;scrollPosition=caretPosition=0;caretOffset=-1;options.previewParserPath=localize(options.previewParserPath);options.previewTemplatePath=localize(options.previewTemplatePath);function localize(data,inText){if(inText){return data.replace(/("|')~\//g,"$1"+options.root);}return data.replace(/^~\//,options.root);}function init(){id="";nameSpace="";if(options.id){id='id="'+options.id+'"';}else{if($$.attr("id")){id='id="markItUp'+($$.attr("id").substr(0,1).toUpperCase())+($$.attr("id").substr(1))+'"';}}if(options.nameSpace){nameSpace='class="'+options.nameSpace+'"';}$$.wrap("<div "+nameSpace+"></div>");$$.wrap("<div "+id+' class="markItUp"></div>');$$.wrap('<div class="markItUpContainer"></div>');$$.addClass("markItUpEditor");header=$('<div class="markItUpHeader"></div>').insertBefore($$);$(dropMenus(options.markupSet)).appendTo(header);footer=$('<div class="markItUpFooter"></div>').insertAfter($$);if(options.resizeHandle===true&&$.browser.safari!==true){resizeHandle=$('<div class="markItUpResizeHandle"></div>').insertAfter($$).bind("mousedown",function(e){var h=$$.height(),y=e.clientY,mouseMove,mouseUp;mouseMove=function(e){$$.css("height",Math.max(20,e.clientY+h-y)+"px");return false;};mouseUp=function(e){$("html").unbind("mousemove",mouseMove).unbind("mouseup",mouseUp);return false;};$("html").bind("mousemove",mouseMove).bind("mouseup",mouseUp);});footer.append(resizeHandle);}$$.keydown(keyPressed).keyup(keyPressed);$$.bind("insertion",function(e,settings){if(settings.target!==false){get();}if(textarea===$.markItUp.focused){markup(settings);}});$$.focus(function(){$.markItUp.focused=this;});}function dropMenus(markupSet){var ul=$("<ul></ul>"),i=0;$("li:hover > ul",ul).css("display","block");$.each(markupSet,function(){var button=this,t="",title,li,j;title=(button.key)?(button.name||"")+" [Ctrl+"+button.key+"]":(button.name||"");key=(button.key)?'accesskey="'+button.key+'"':"";if(button.separator){li=$('<li class="markItUpSeparator">'+(button.separator||"")+"</li>").appendTo(ul);}else{i++;for(j=levels.length-1;j>=0;j--){t+=levels[j]+"-";}li=$('<li class="markItUpButton markItUpButton'+t+(i)+" "+(button.className||"")+'"><a href="" '+key+' title="'+title+'">'+(button.name||"")+"</a></li>").bind("contextmenu",function(){return false;}).click(function(){return false;}).mouseup(function(){if(button.call){eval(button.call)();}markup(button);return false;}).hover(function(){$("> ul",this).show();$(document).one("click",function(){$("ul ul",header).hide();});},function(){$("> ul",this).hide();}).appendTo(ul);if(button.dropMenu){levels.push(i);$(li).addClass("markItUpDropMenu").append(dropMenus(button.dropMenu));}}});levels.pop();return ul;}function magicMarkups(string){if(string){string=string.toString();string=string.replace(/\(\!\(([\s\S]*?)\)\!\)/g,function(x,a){var b=a.split("|!|");if(altKey===true){return(b[1]!==undefined)?b[1]:b[0];}else{return(b[1]===undefined)?"":b[0];}});string=string.replace(/\[\!\[([\s\S]*?)\]\!\]/g,function(x,a){var b=a.split(":!:");if(abort===true){return false;}value=prompt(b[0],(b[1])?b[1]:"");if(value===null){abort=true;}return value;});return string;}return"";}function prepare(action){if($.isFunction(action)){action=action(hash);}return magicMarkups(action);}function build(string){openWith=prepare(clicked.openWith);placeHolder=prepare(clicked.placeHolder);replaceWith=prepare(clicked.replaceWith);closeWith=prepare(clicked.closeWith);if(replaceWith!==""){block=openWith+replaceWith+closeWith;}else{if(selection===""&&placeHolder!==""){block=openWith+placeHolder+closeWith;}else{block=openWith+(string||selection)+closeWith;}}return{block:block,openWith:openWith,replaceWith:replaceWith,placeHolder:placeHolder,closeWith:closeWith};}function markup(button){var len,j,n,i;hash=clicked=button;get();$.extend(hash,{line:"",root:options.root,textarea:textarea,selection:(selection||""),caretPosition:caretPosition,ctrlKey:ctrlKey,shiftKey:shiftKey,altKey:altKey});prepare(options.beforeInsert);prepare(clicked.beforeInsert);if(ctrlKey===true&&shiftKey===true){prepare(clicked.beforeMultiInsert);}$.extend(hash,{line:1});if(ctrlKey===true&&shiftKey===true){lines=selection.split(/\r?\n/);for(j=0,n=lines.length,i=0;i<n;i++){if($.trim(lines[i])!==""){$.extend(hash,{line:++j,selection:lines[i]});lines[i]=build(lines[i]).block;}else{lines[i]="";}}string={block:lines.join("\n")};start=caretPosition;len=string.block.length+(($.browser.opera)?n:0);}else{if(ctrlKey===true){string=build(selection);start=caretPosition+string.openWith.length;len=string.block.length-string.openWith.length-string.closeWith.length;len-=fixIeBug(string.block);}else{if(shiftKey===true){string=build(selection);start=caretPosition;len=string.block.length;len-=fixIeBug(string.block);}else{string=build(selection);start=caretPosition+string.block.length;len=0;start-=fixIeBug(string.block);}}}if((selection===""&&string.replaceWith==="")){caretOffset+=fixOperaBug(string.block);start=caretPosition+string.openWith.length;len=string.block.length-string.openWith.length-string.closeWith.length;caretOffset=$$.val().substring(caretPosition,$$.val().length).length;caretOffset-=fixOperaBug($$.val().substring(0,caretPosition));}$.extend(hash,{caretPosition:caretPosition,scrollPosition:scrollPosition});if(string.block!==selection&&abort===false){insert(string.block);set(start,len);}else{caretOffset=-1;}get();$.extend(hash,{line:"",selection:selection});if(ctrlKey===true&&shiftKey===true){prepare(clicked.afterMultiInsert);}prepare(clicked.afterInsert);prepare(options.afterInsert);if(previewWindow&&options.previewAutoRefresh){refreshPreview();}shiftKey=altKey=ctrlKey=abort=false;}function fixOperaBug(string){if($.browser.opera){return string.length-string.replace(/\n*/g,"").length;}return 0;}function fixIeBug(string){if($.browser.msie){return string.length-string.replace(/\r*/g,"").length;}return 0;}function insert(block){if(document.selection){var newSelection=document.selection.createRange();newSelection.text=block;}else{$$.val($$.val().substring(0,caretPosition)+block+$$.val().substring(caretPosition+selection.length,$$.val().length));}}function set(start,len){if(textarea.createTextRange){if($.browser.opera&&$.browser.version>=9.5&&len==0){return false;}range=textarea.createTextRange();range.collapse(true);range.moveStart("character",start);range.moveEnd("character",len);range.select();}else{if(textarea.setSelectionRange){textarea.setSelectionRange(start,start+len);}}textarea.scrollTop=scrollPosition;textarea.focus();}function get(){textarea.focus();scrollPosition=textarea.scrollTop;if(document.selection){selection=document.selection.createRange().text;if($.browser.msie){var range=document.selection.createRange(),rangeCopy=range.duplicate();rangeCopy.moveToElementText(textarea);caretPosition=-1;while(rangeCopy.inRange(range)){rangeCopy.moveStart("character");caretPosition++;}}else{caretPosition=textarea.selectionStart;}}else{caretPosition=textarea.selectionStart;selection=$$.val().substring(caretPosition,textarea.selectionEnd);}return selection;}function preview(){if(!previewWindow||previewWindow.closed){if(options.previewInWindow){previewWindow=window.open("","preview",options.previewInWindow);}else{iFrame=$('<iframe class="markItUpPreviewFrame"></iframe>');if(options.previewPosition=="after"){iFrame.insertAfter(footer);}else{iFrame.insertBefore(header);}previewWindow=iFrame[iFrame.length-1].contentWindow||frame[iFrame.length-1];}}else{if(altKey===true){if(iFrame){iFrame.remove();}previewWindow.close();previewWindow=iFrame=false;}}if(!options.previewAutoRefresh){refreshPreview();}}function refreshPreview(){if(previewWindow.document){try{sp=previewWindow.document.documentElement.scrollTop;}catch(e){sp=0;}previewWindow.document.open();previewWindow.document.write(renderPreview());previewWindow.document.close();previewWindow.document.documentElement.scrollTop=sp;}if(options.previewInWindow){previewWindow.focus();}}function renderPreview(){if(options.previewParserPath!==""){$.ajax({type:"POST",async:false,url:options.previewParserPath,data:options.previewParserVar+"="+encodeURIComponent($$.val()),success:function(data){phtml=localize(data,1);}});}else{if(!template){$.ajax({async:false,url:options.previewTemplatePath,success:function(data){template=localize(data,1);}});}phtml=template.replace(/<!-- content -->/g,$$.val());}return phtml;}function keyPressed(e){shiftKey=e.shiftKey;altKey=e.altKey;ctrlKey=(!(e.altKey&&e.ctrlKey))?e.ctrlKey:false;if(e.type==="keydown"){if(ctrlKey===true){li=$("a[accesskey="+String.fromCharCode(e.keyCode)+"]",header).parent("li");if(li.length!==0){ctrlKey=false;li.triggerHandler("mouseup");return false;}}if(e.keyCode===13||e.keyCode===10){if(ctrlKey===true){ctrlKey=false;markup(options.onCtrlEnter);return options.onCtrlEnter.keepDefault;}else{if(shiftKey===true){shiftKey=false;markup(options.onShiftEnter);return options.onShiftEnter.keepDefault;}else{markup(options.onEnter);return options.onEnter.keepDefault;}}}if(e.keyCode===9){if(shiftKey==true||ctrlKey==true||altKey==true){return false;}if(caretOffset!==-1){get();caretOffset=$$.val().length-caretOffset;set(caretOffset,0);caretOffset=-1;return false;}else{markup(options.onTab);return options.onTab.keepDefault;}}}}init();});};$.fn.markItUpRemove=function(){return this.each(function(){$$=$(this).unbind().removeClass("markItUpEditor");$$.parent("div").parent("div.markItUp").parent("div").replaceWith($$);});};$.markItUp=function(settings){var options={target:false};$.extend(options,settings);if(options.target){return $(options.target).each(function(){$(this).focus();$(this).trigger("insertion",[options]);});}else{$("textarea").trigger("insertion",[options]);}};})(jQuery);(function(B){var A=function(){var C={},N={years:"datepickerViewYears",moths:"datepickerViewMonths",days:"datepickerViewDays"},K={wrapper:'<div class="datepicker"><div class="datepickerBorderT" /><div class="datepickerBorderB" /><div class="datepickerBorderL" /><div class="datepickerBorderR" /><div class="datepickerBorderTL" /><div class="datepickerBorderTR" /><div class="datepickerBorderBL" /><div class="datepickerBorderBR" /><div class="datepickerContainer"><table cellspacing="0" cellpadding="0"><tbody><tr></tr></tbody></table></div></div>',head:["<td>",'<table cellspacing="0" cellpadding="0">',"<thead>","<tr>",'<th class="datepickerGoPrev"><a href="#"><span><%=prev%></span></a></th>','<th colspan="6" class="datepickerMonth"><a href="#"><span></span></a></th>','<th class="datepickerGoNext"><a href="#"><span><%=next%></span></a></th>',"</tr>",'<tr class="datepickerDoW">',"<th><span><%=week%></span></th>","<th><span><%=day1%></span></th>","<th><span><%=day2%></span></th>","<th><span><%=day3%></span></th>","<th><span><%=day4%></span></th>","<th><span><%=day5%></span></th>","<th><span><%=day6%></span></th>","<th><span><%=day7%></span></th>","</tr>","</thead>","</table></td>"],space:'<td class="datepickerSpace"><div></div></td>',days:['<tbody class="datepickerDays">',"<tr>",'<th class="datepickerWeek"><a href="#"><span><%=weeks[0].week%></span></a></th>','<td class="<%=weeks[0].days[0].classname%>"><a href="#"><span><%=weeks[0].days[0].text%></span></a></td>','<td class="<%=weeks[0].days[1].classname%>"><a href="#"><span><%=weeks[0].days[1].text%></span></a></td>','<td class="<%=weeks[0].days[2].classname%>"><a href="#"><span><%=weeks[0].days[2].text%></span></a></td>','<td class="<%=weeks[0].days[3].classname%>"><a href="#"><span><%=weeks[0].days[3].text%></span></a></td>','<td class="<%=weeks[0].days[4].classname%>"><a href="#"><span><%=weeks[0].days[4].text%></span></a></td>','<td class="<%=weeks[0].days[5].classname%>"><a href="#"><span><%=weeks[0].days[5].text%></span></a></td>','<td class="<%=weeks[0].days[6].classname%>"><a href="#"><span><%=weeks[0].days[6].text%></span></a></td>',"</tr>","<tr>",'<th class="datepickerWeek"><a href="#"><span><%=weeks[1].week%></span></a></th>','<td class="<%=weeks[1].days[0].classname%>"><a href="#"><span><%=weeks[1].days[0].text%></span></a></td>','<td class="<%=weeks[1].days[1].classname%>"><a href="#"><span><%=weeks[1].days[1].text%></span></a></td>','<td class="<%=weeks[1].days[2].classname%>"><a href="#"><span><%=weeks[1].days[2].text%></span></a></td>','<td class="<%=weeks[1].days[3].classname%>"><a href="#"><span><%=weeks[1].days[3].text%></span></a></td>','<td class="<%=weeks[1].days[4].classname%>"><a href="#"><span><%=weeks[1].days[4].text%></span></a></td>','<td class="<%=weeks[1].days[5].classname%>"><a href="#"><span><%=weeks[1].days[5].text%></span></a></td>','<td class="<%=weeks[1].days[6].classname%>"><a href="#"><span><%=weeks[1].days[6].text%></span></a></td>',"</tr>","<tr>",'<th class="datepickerWeek"><a href="#"><span><%=weeks[2].week%></span></a></th>','<td class="<%=weeks[2].days[0].classname%>"><a href="#"><span><%=weeks[2].days[0].text%></span></a></td>','<td class="<%=weeks[2].days[1].classname%>"><a href="#"><span><%=weeks[2].days[1].text%></span></a></td>','<td class="<%=weeks[2].days[2].classname%>"><a href="#"><span><%=weeks[2].days[2].text%></span></a></td>','<td class="<%=weeks[2].days[3].classname%>"><a href="#"><span><%=weeks[2].days[3].text%></span></a></td>','<td class="<%=weeks[2].days[4].classname%>"><a href="#"><span><%=weeks[2].days[4].text%></span></a></td>','<td class="<%=weeks[2].days[5].classname%>"><a href="#"><span><%=weeks[2].days[5].text%></span></a></td>','<td class="<%=weeks[2].days[6].classname%>"><a href="#"><span><%=weeks[2].days[6].text%></span></a></td>',"</tr>","<tr>",'<th class="datepickerWeek"><a href="#"><span><%=weeks[3].week%></span></a></th>','<td class="<%=weeks[3].days[0].classname%>"><a href="#"><span><%=weeks[3].days[0].text%></span></a></td>','<td class="<%=weeks[3].days[1].classname%>"><a href="#"><span><%=weeks[3].days[1].text%></span></a></td>','<td class="<%=weeks[3].days[2].classname%>"><a href="#"><span><%=weeks[3].days[2].text%></span></a></td>','<td class="<%=weeks[3].days[3].classname%>"><a href="#"><span><%=weeks[3].days[3].text%></span></a></td>','<td class="<%=weeks[3].days[4].classname%>"><a href="#"><span><%=weeks[3].days[4].text%></span></a></td>','<td class="<%=weeks[3].days[5].classname%>"><a href="#"><span><%=weeks[3].days[5].text%></span></a></td>','<td class="<%=weeks[3].days[6].classname%>"><a href="#"><span><%=weeks[3].days[6].text%></span></a></td>',"</tr>","<tr>",'<th class="datepickerWeek"><a href="#"><span><%=weeks[4].week%></span></a></th>','<td class="<%=weeks[4].days[0].classname%>"><a href="#"><span><%=weeks[4].days[0].text%></span></a></td>','<td class="<%=weeks[4].days[1].classname%>"><a href="#"><span><%=weeks[4].days[1].text%></span></a></td>','<td class="<%=weeks[4].days[2].classname%>"><a href="#"><span><%=weeks[4].days[2].text%></span></a></td>','<td class="<%=weeks[4].days[3].classname%>"><a href="#"><span><%=weeks[4].days[3].text%></span></a></td>','<td class="<%=weeks[4].days[4].classname%>"><a href="#"><span><%=weeks[4].days[4].text%></span></a></td>','<td class="<%=weeks[4].days[5].classname%>"><a href="#"><span><%=weeks[4].days[5].text%></span></a></td>','<td class="<%=weeks[4].days[6].classname%>"><a href="#"><span><%=weeks[4].days[6].text%></span></a></td>',"</tr>","<tr>",'<th class="datepickerWeek"><a href="#"><span><%=weeks[5].week%></span></a></th>','<td class="<%=weeks[5].days[0].classname%>"><a href="#"><span><%=weeks[5].days[0].text%></span></a></td>','<td class="<%=weeks[5].days[1].classname%>"><a href="#"><span><%=weeks[5].days[1].text%></span></a></td>','<td class="<%=weeks[5].days[2].classname%>"><a href="#"><span><%=weeks[5].days[2].text%></span></a></td>','<td class="<%=weeks[5].days[3].classname%>"><a href="#"><span><%=weeks[5].days[3].text%></span></a></td>','<td class="<%=weeks[5].days[4].classname%>"><a href="#"><span><%=weeks[5].days[4].text%></span></a></td>','<td class="<%=weeks[5].days[5].classname%>"><a href="#"><span><%=weeks[5].days[5].text%></span></a></td>','<td class="<%=weeks[5].days[6].classname%>"><a href="#"><span><%=weeks[5].days[6].text%></span></a></td>',"</tr>","</tbody>"],months:['<tbody class="<%=className%>">',"<tr>",'<td colspan="2"><a href="#"><span><%=data[0]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[1]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[2]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[3]%></span></a></td>',"</tr>","<tr>",'<td colspan="2"><a href="#"><span><%=data[4]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[5]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[6]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[7]%></span></a></td>',"</tr>","<tr>",'<td colspan="2"><a href="#"><span><%=data[8]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[9]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[10]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[11]%></span></a></td>',"</tr>","</tbody>"]},G={flat:false,starts:1,prev:"&lt;",next:"&gt;",lastSel:false,mode:"single",view:"days",calendars:1,format:"Y-m-d",position:"bottom",eventName:"click",onRender:function(){return{};},onChange:function(){return true;},onShow:function(){return true;},onBeforeShow:function(){return true;},onHide:function(){return true;},locale:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekMin:"wk"}},P=function(R){var U=B(R).data("datepicker");var Y=B(R);var S=Math.floor(U.calendars/2),k,m,Z,l,g=0,e,V,T,W,X,c;Y.find("td>table tbody").remove();for(var h=0;h<U.calendars;h++){k=new Date(U.current);k.addMonths(-S+h);c=Y.find("table").eq(h+1);switch(c[0].className){case"datepickerViewDays":Z=Q(k,"B, Y");break;case"datepickerViewMonths":Z=k.getFullYear();break;case"datepickerViewYears":Z=(k.getFullYear()-6)+" - "+(k.getFullYear()+5);break;}c.find("thead tr:first th:eq(1) span").text(Z);Z=k.getFullYear()-6;m={data:[],className:"datepickerYears"};for(var f=0;f<12;f++){m.data.push(Z+f);}X=tmpl(K.months.join(""),m);k.setDate(1);m={weeks:[],test:10};l=k.getMonth();var Z=(k.getDay()-U.starts)%7;k.addDays(-(Z+(Z<0?7:0)));e=-1;g=0;while(g<42){T=parseInt(g/7,10);W=g%7;if(!m.weeks[T]){e=k.getWeekNumber();m.weeks[T]={week:e,days:[]};}m.weeks[T].days[W]={text:k.getDate(),classname:[]};if(l!=k.getMonth()){m.weeks[T].days[W].classname.push("datepickerNotInMonth");}if(k.getDay()==0){m.weeks[T].days[W].classname.push("datepickerSunday");}if(k.getDay()==6){m.weeks[T].days[W].classname.push("datepickerSaturday");}var d=U.onRender(k);var n=k.valueOf();if(d.selected||U.date==n||B.inArray(n,U.date)>-1||(U.mode=="range"&&n>=U.date[0]&&n<=U.date[1])){m.weeks[T].days[W].classname.push("datepickerSelected");}if(d.disabled){m.weeks[T].days[W].classname.push("datepickerDisabled");}if(d.className){m.weeks[T].days[W].classname.push(d.className);}m.weeks[T].days[W].classname=m.weeks[T].days[W].classname.join(" ");g++;k.addDays(1);}X=tmpl(K.days.join(""),m)+X;m={data:U.locale.monthsShort,className:"datepickerMonths"};X=tmpl(K.months.join(""),m)+X;c.append(X);}},E=function(S,e){if(S.constructor==Date){return new Date(S);}var W=S.split(/\W+/);var T=e.split(/\W+/),Z,U,c,Y,V,R=new Date();for(var X=0;X<W.length;X++){switch(T[X]){case"d":case"e":Z=parseInt(W[X],10);break;case"m":U=parseInt(W[X],10)-1;break;case"Y":case"y":c=parseInt(W[X],10);c+=c>100?0:(c<29?2000:1900);break;case"H":case"I":case"k":case"l":Y=parseInt(W[X],10);break;case"P":case"p":if(/pm/i.test(W[X])&&Y<12){Y+=12;}else{if(/am/i.test(W[X])&&Y>=12){Y-=12;}}break;case"M":V=parseInt(W[X],10);break;}}return new Date(c===undefined?R.getFullYear():c,U===undefined?R.getMonth():U,Z===undefined?R.getDate():Z,Y===undefined?R.getHours():Y,V===undefined?R.getMinutes():V,0);},Q=function(S,f){var T=S.getMonth();var c=S.getDate();var e=S.getFullYear();var g=S.getWeekNumber();var h=S.getDay();var n={};var k=S.getHours();var U=(k>=12);var Y=(U)?(k-12):k;var l=S.getDayOfYear();if(Y==0){Y=12;}var W=S.getMinutes();var Z=S.getSeconds();var V=f.split(""),R;for(var X=0;X<V.length;X++){R=V[X];switch(V[X]){case"a":R=S.getDayName();break;case"A":R=S.getDayName(true);break;case"b":R=S.getMonthName();break;case"B":R=S.getMonthName(true);break;case"C":R=1+Math.floor(e/100);break;case"d":R=(c<10)?("0"+c):c;break;case"e":R=c;break;case"H":R=(k<10)?("0"+k):k;break;case"I":R=(Y<10)?("0"+Y):Y;break;case"j":R=(l<100)?((l<10)?("00"+l):("0"+l)):l;break;case"k":R=k;break;case"l":R=Y;break;case"m":R=(T<9)?("0"+(1+T)):(1+T);break;case"M":R=(W<10)?("0"+W):W;break;case"p":case"P":R=U?"PM":"AM";break;case"s":R=Math.floor(S.getTime()/1000);break;case"S":R=(Z<10)?("0"+Z):Z;break;case"u":R=h+1;break;case"w":R=h;break;case"y":R=(""+e).substr(2,2);break;case"Y":R=e;break;}V[X]=R;}return V.join("");},F=function(R){if(Date.prototype.tempDate){return ;}Date.prototype.tempDate=null;Date.prototype.months=R.months;Date.prototype.monthsShort=R.monthsShort;Date.prototype.days=R.days;Date.prototype.daysShort=R.daysShort;Date.prototype.getMonthName=function(S){return this[S?"months":"monthsShort"][this.getMonth()];};Date.prototype.getDayName=function(S){return this[S?"days":"daysShort"][this.getDay()];};Date.prototype.addDays=function(S){this.setDate(this.getDate()+S);this.tempDate=this.getDate();};Date.prototype.addMonths=function(S){if(this.tempDate==null){this.tempDate=this.getDate();}this.setDate(1);this.setMonth(this.getMonth()+S);this.setDate(Math.min(this.tempDate,this.getMaxDays()));};Date.prototype.addYears=function(S){if(this.tempDate==null){this.tempDate=this.getDate();}this.setDate(1);this.setFullYear(this.getFullYear()+S);this.setDate(Math.min(this.tempDate,this.getMaxDays()));};Date.prototype.getMaxDays=function(){var T=new Date(Date.parse(this)),U=28,S;S=T.getMonth();U=28;while(T.getMonth()==S){U++;T.setDate(U);}return U-1;};Date.prototype.getFirstDay=function(){var S=new Date(Date.parse(this));S.setDate(1);return S.getDay();};Date.prototype.getWeekNumber=function(){var S=new Date(this);S.setDate(S.getDate()-(S.getDay()+6)%7+3);var T=S.valueOf();S.setMonth(0);S.setDate(4);return Math.round((T-S.valueOf())/(604800000))+1;};Date.prototype.getDayOfYear=function(){var S=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var U=new Date(this.getFullYear(),0,0,0,0,0);var T=S-U;return Math.floor(T/24*60*60*1000);};},I=function(V){var S=B(V).data("datepicker");var X=B("#"+S.id);if(!S.extraHeight){var U=B(V).find("div");S.extraHeight=U.get(0).offsetHeight+U.get(1).offsetHeight;S.extraWidth=U.get(2).offsetWidth+U.get(3).offsetWidth;}var W=X.find("table:first").get(0);var T=W.offsetWidth;var R=W.offsetHeight;X.css({width:T+S.extraWidth+"px",height:R+S.extraHeight+"px"}).find("div.datepickerContainer").css({width:T+"px",height:R+"px"});},O=function(Y){if(B(Y.target).is("span")){Y.target=Y.target.parentNode;}var T=B(Y.target);if(T.is("a")){Y.target.blur();if(T.hasClass("datepickerDisabled")){return false;}var c=B(this).data("datepicker");var X=T.parent();var S=X.parent().parent().parent();var Z=B("table",this).index(S.get(0))-1;var W=new Date(c.current);var V=false;var R=false;if(X.is("th")){if(X.hasClass("datepickerWeek")&&c.mode=="range"&&!X.next().hasClass("datepickerDisabled")){var U=parseInt(X.next().text(),10);W.addMonths(Z-Math.floor(c.calendars/2));if(X.next().hasClass("datepickerNotInMonth")){W.addMonths(U>15?-1:1);}W.setDate(U);c.date[0]=(W.setHours(0,0,0,0)).valueOf();W.setHours(23,59,59,0);W.addDays(6);c.date[1]=W.valueOf();R=true;V=true;c.lastSel=false;}else{if(X.hasClass("datepickerMonth")){W.addMonths(Z-Math.floor(c.calendars/2));switch(S.get(0).className){case"datepickerViewDays":S.get(0).className="datepickerViewMonths";T.find("span").text(W.getFullYear());break;case"datepickerViewMonths":S.get(0).className="datepickerViewYears";T.find("span").text((W.getFullYear()-6)+" - "+(W.getFullYear()+5));break;case"datepickerViewYears":S.get(0).className="datepickerViewDays";T.find("span").text(Q(W,"B, Y"));break;}}else{if(X.parent().parent().is("thead")){switch(S.get(0).className){case"datepickerViewDays":c.current.addMonths(X.hasClass("datepickerGoPrev")?-1:1);break;case"datepickerViewMonths":c.current.addYears(X.hasClass("datepickerGoPrev")?-1:1);break;case"datepickerViewYears":c.current.addYears(X.hasClass("datepickerGoPrev")?-12:12);break;}R=true;}}}}else{if(X.is("td")&&!X.hasClass("datepickerDisabled")){switch(S.get(0).className){case"datepickerViewMonths":c.current.setMonth(S.find("tbody.datepickerMonths td").index(X));c.current.setFullYear(parseInt(S.find("thead th.datepickerMonth span").text(),10));c.current.addMonths(Math.floor(c.calendars/2)-Z);S.get(0).className="datepickerViewDays";break;case"datepickerViewYears":c.current.setFullYear(parseInt(T.text(),10));S.get(0).className="datepickerViewMonths";break;default:var U=parseInt(T.text(),10);W.addMonths(Z-Math.floor(c.calendars/2));if(X.hasClass("datepickerNotInMonth")){W.addMonths(U>15?-1:1);}W.setDate(U);switch(c.mode){case"multiple":U=(W.setHours(0,0,0,0)).valueOf();if(B.inArray(U,c.date)>-1){B.each(c.date,function(d,e){if(e==U){c.date.splice(d,1);return false;}});}else{c.date.push(U);}break;case"range":if(!c.lastSel){c.date[0]=(W.setHours(0,0,0,0)).valueOf();}U=(W.setHours(23,59,59,0)).valueOf();if(U<c.date[0]){c.date[1]=c.date[0]+86399000;c.date[0]=U-86399000;}else{c.date[1]=U;}c.lastSel=!c.lastSel;break;default:c.date=W.valueOf();break;}break;}R=true;V=true;}}if(R){P(this);}if(V){c.onChange.apply(this,J(c));}}return false;},J=function(R){var S;if(R.mode=="single"){S=new Date(R.date);return[Q(S,R.format),S,R.el];}else{S=[[],[],R.el];B.each(R.date,function(U,V){var T=new Date(V);S[0].push(Q(T,R.format));S[1].push(T);});return S;}},D=function(){var R=document.compatMode=="CSS1Compat";return{l:window.pageXOffset||(R?document.documentElement.scrollLeft:document.body.scrollLeft),t:window.pageYOffset||(R?document.documentElement.scrollTop:document.body.scrollTop),w:window.innerWidth||(R?document.documentElement.clientWidth:document.body.clientWidth),h:window.innerHeight||(R?document.documentElement.clientHeight:document.body.clientHeight)};},L=function(T,S,R){if(T==S){return true;}if(T.contains){return T.contains(S);}if(T.compareDocumentPosition){return !!(T.compareDocumentPosition(S)&16);}var U=S.parentNode;while(U&&U!=R){if(U==T){return true;}U=U.parentNode;}return false;},M=function(W){var R=B("#"+B(this).data("datepickerId"));if(!R.is(":visible")){var X=R.get(0);P(X);var Z=R.data("datepicker");Z.onBeforeShow.apply(this,[R.get(0)]);var U=B(this).offset();var Y=D();var V=U.top;var S=U.left;var T=B.curCSS(X,"display");R.css({visibility:"hidden",display:"block"});I(X);switch(Z.position){case"top":V-=X.offsetHeight;break;case"left":S-=X.offsetWidth;break;case"right":S+=this.offsetWidth;break;case"bottom":V+=this.offsetHeight;break;}if(V+X.offsetHeight>Y.t+Y.h){V=U.top-X.offsetHeight;}if(V<Y.t){V=U.top+this.offsetHeight+X.offsetHeight;}if(S+X.offsetWidth>Y.l+Y.w){S=U.left-X.offsetWidth;}if(S<Y.l){S=U.left+this.offsetWidth;}R.css({visibility:"visible",display:"block",top:V+"px",left:S+"px"});if(Z.onShow.apply(this,[R.get(0)])!=false){R.show();}B(document).bind("mousedown",{cal:R,trigger:this},H);}return false;},H=function(R){if(R.target!=R.data.trigger&&!L(R.data.cal.get(0),R.target,R.data.cal.get(0))){if(R.data.cal.data("datepicker").onHide.apply(this,[R.data.cal.get(0)])!=false){R.data.cal.hide();}B(document).unbind("mousedown",H);}};return{init:function(R){R=B.extend({},G,R||{});F(R.locale);R.calendars=Math.max(1,parseInt(R.calendars,10)||1);R.mode=/single|multiple|range/.test(R.mode)?R.mode:"single";return this.each(function(){if(!B(this).data("datepicker")){R.el=this;if(R.date.constructor==String){R.date=E(R.date,R.format);R.date.setHours(0,0,0,0);}if(R.mode!="single"){if(R.date.constructor!=Array){R.date=[R.date.valueOf()];if(R.mode=="range"){R.date.push(((new Date(R.date[0])).setHours(23,59,59,0)).valueOf());}}else{for(var U=0;U<R.date.length;U++){R.date[U]=(E(R.date[U],R.format).setHours(0,0,0,0)).valueOf();}if(R.mode=="range"){R.date[1]=((new Date(R.date[1])).setHours(23,59,59,0)).valueOf();}}}else{R.date=R.date.valueOf();}if(!R.current){R.current=new Date();}else{R.current=E(R.current,R.format);}R.current.setDate(1);R.current.setHours(0,0,0,0);var W="datepicker_"+parseInt(Math.random()*1000),T;R.id=W;B(this).data("datepickerId",R.id);var V=B(K.wrapper).attr("id",W).bind("click",O).data("datepicker",R);if(R.className){V.addClass(R.className);}var S="";for(var U=0;U<R.calendars;U++){T=R.starts;if(U>0){S+=K.space;}S+=tmpl(K.head.join(""),{week:R.locale.weekMin,prev:R.prev,next:R.next,day1:R.locale.daysMin[(T++)%7],day2:R.locale.daysMin[(T++)%7],day3:R.locale.daysMin[(T++)%7],day4:R.locale.daysMin[(T++)%7],day5:R.locale.daysMin[(T++)%7],day6:R.locale.daysMin[(T++)%7],day7:R.locale.daysMin[(T++)%7]});}V.find("tr:first").append(S).find("table").addClass(N[R.view]);P(V.get(0));if(R.flat){V.appendTo(this).show().css("position","relative");I(V.get(0));}else{V.appendTo(document.body);B(this).bind(R.eventName,M);}}});},showPicker:function(){return this.each(function(){if(B(this).data("datepickerId")){M.apply(this);}});},hidePicker:function(){return this.each(function(){if(B(this).data("datepickerId")){B("#"+B(this).data("datepickerId")).hide();}});},setDate:function(R,S){return this.each(function(){if(B(this).data("datepickerId")){var V=B("#"+B(this).data("datepickerId"));var T=V.data("datepicker");T.date=R;if(T.date.constructor==String){T.date=E(T.date,T.format);T.date.setHours(0,0,0,0);}if(T.mode!="single"){if(T.date.constructor!=Array){T.date=[T.date.valueOf()];if(T.mode=="range"){T.date.push(((new Date(T.date[0])).setHours(23,59,59,0)).valueOf());}}else{for(var U=0;U<T.date.length;U++){T.date[U]=(E(T.date[U],T.format).setHours(0,0,0,0)).valueOf();}if(T.mode=="range"){T.date[1]=((new Date(T.date[1])).setHours(23,59,59,0)).valueOf();}}}else{T.date=T.date.valueOf();}if(S){T.current=new Date(T.mode!="single"?T.date[0]:T.date);}P(V.get(0));}});},getDate:function(R){if(this.size()>0){return J(B("#"+B(this).data("datepickerId")).data("datepicker"))[R?0:1];}},clear:function(){return this.each(function(){if(B(this).data("datepickerId")){var S=B("#"+B(this).data("datepickerId"));var R=S.data("datepicker");if(R.mode!="single"){R.date=[];P(S.get(0));}}});},fixLayout:function(){return this.each(function(){if(B(this).data("datepickerId")){var S=B("#"+B(this).data("datepickerId"));var R=S.data("datepicker");if(R.flat){I(S.get(0));}}});}};}();B.fn.extend({DatePicker:A.init,DatePickerHide:A.hidePicker,DatePickerShow:A.showPicker,DatePickerSetDate:A.setDate,DatePickerGetDate:A.getDate,DatePickerClear:A.clear,DatePickerLayout:A.fixLayout});})(jQuery);(function(){var B={};this.tmpl=function A(E,D){var C=!/\W/.test(E)?B[E]=B[E]||A(document.getElementById(E).innerHTML):new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+E.replace(/[\r\t\n]/g," ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split("\t").join("');").split("%>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');");return D?C(D):C;};})();(function(){$.fn.OptionsLoader=function(A){if(typeof (A)!="object"){throw"Please define config for OptionsLoader plugin";}this.change(function(){new B($(this).val());});function B(C){this.init(C);return this;}B.config=$.extend({url:undefined,clear:undefined,distination:undefined},A);B.prototype={init:function(C){if(typeof (B.config.distination)!="object"){B.config.distination=$(B.config.distination);}B.config.distination.attr("disabled","disabled");$.getJSON(B.config.url+C,function(D){if(typeof (B.config.distination)!="object"){B.config.distination=$(B.config.distination);}B.config.distination.find("option").remove();if(typeof (B.config.clear)=="object"){for(i=0;i<B.config.clear.length;i++){$(B.config.clear[i]).find("option").remove();$(B.config.clear[i]).attr("disabled","disabled");}}$.each(D,function(E,F){$("<option/>").val(F.id).text(F.name).appendTo(B.config.distination);});B.config.distination.removeAttr("disabled");});}};return this;};})();jQuery.autocomplete=function(D,S){var N=this;var W=$(D).attr("autocomplete","off");if(S.inputClass){W.addClass(S.inputClass);}var O=document.createElement("div");var H=$(O);H.hide().addClass(S.resultsClass).css("position","absolute");if(S.width>0){H.css("width",S.width);}$("body").append(O);D.autocompleter=N;var h=null;var V="";var l=-1;var I={};var Y=false;var J=false;var A=null;function K(){I={};I.data={};I.length=0;}K();if(S.data!=null){var Q="",q={},L=[];if(typeof S.url!="string"){S.cacheLength=1;}for(var o=0;o<S.data.length;o++){L=((typeof S.data[o]=="string")?[S.data[o]]:S.data[o]);if(L[0].length>0){Q=L[0].substring(0,1).toLowerCase();if(!q[Q]){q[Q]=[];}q[Q].push(L);}}for(var n in q){S.cacheLength++;E(n,q[n]);}}W.keydown(function(k){A=k.keyCode;switch(k.keyCode){case 38:k.preventDefault();d(-1);break;case 40:k.preventDefault();d(1);break;case 9:case 13:if(f()){W.get(0).blur();k.preventDefault();}break;default:l=-1;if(h){clearTimeout(h);}h=setTimeout(function(){R();},S.delay);break;}}).focus(function(){J=true;}).blur(function(){J=false;C();});T();function R(){if(A==46||(A>8&&A<32)){return H.hide();}var k=W.val();if(k==V){return ;}V=k;if(k.length>=S.minChars){W.addClass(S.loadingClass);c(k);}else{W.removeClass(S.loadingClass);H.hide();}}function d(r){var k=$("li",O);if(!k){return ;}l+=r;if(l<0){l=0;}else{if(l>=k.size()){l=k.size()-1;}}k.removeClass("ac_over");$(k[l]).addClass("ac_over");}function f(){var k=$("li.ac_over",O)[0];if(!k){var r=$("li",O);if(S.selectOnly){if(r.length==1){k=r[0];}}else{if(S.selectFirst){k=r[0];}}}if(k){P(k);return true;}else{return false;}}function P(k){if(!k){k=document.createElement("li");k.extra=[];k.selectValue="";}var r=$.trim(k.selectValue?k.selectValue:k.innerHTML);D.lastSelected=r;V=r;H.html("");W.val(r);T();if(S.onItemSelect){setTimeout(function(){S.onItemSelect(k);},1);}}function B(t,r){var s=W.get(0);if(s.createTextRange){var k=s.createTextRange();k.collapse(true);k.moveStart("character",t);k.moveEnd("character",r);k.select();}else{if(s.setSelectionRange){s.setSelectionRange(t,r);}else{if(s.selectionStart){s.selectionStart=t;s.selectionEnd=r;}}}s.focus();}function U(k){if(A!=8){W.val(W.val()+k.substring(V.length));B(V.length,k.length);}}function e(){var r=X(D);var k=(S.width>0)?S.width:W.width();H.css({width:parseInt(k)+"px",top:(r.y+D.offsetHeight)+"px",left:r.x+"px"}).show();}function C(){if(h){clearTimeout(h);}h=setTimeout(T,200);}function T(){if(h){clearTimeout(h);}W.removeClass(S.loadingClass);if(H.is(":visible")){H.hide();}if(S.mustMatch){var k=W.val();if(k!=D.lastSelected){P(null);}}}function G(r,k){if(k){W.removeClass(S.loadingClass);O.innerHTML="";if(!J||k.length==0){return T();}if($.browser.msie){H.append(document.createElement("iframe"));}O.appendChild(m(k));if(S.autoFill&&(W.val().toLowerCase()==r.toLowerCase())){U(k[0][0]);}e();}else{T();}}function F(t){if(!t){return null;}var k=[];var s=t.split(S.lineSeparator);for(var r=0;r<s.length;r++){var u=$.trim(s[r]);if(u){k[k.length]=u.split(S.cellSeparator);}}return k;}function m(w){var v=document.createElement("ul");var t=w.length;if((S.maxItemsToShow>0)&&(S.maxItemsToShow<t)){t=S.maxItemsToShow;}for(var u=0;u<t;u++){var y=w[u];if(!y){continue;}var r=document.createElement("li");if(S.formatItem){r.innerHTML=S.formatItem(y,u,t);r.selectValue=y[0];}else{r.innerHTML=y[0];r.selectValue=y[0];}var k=null;if(y.length>1){k=[];for(var s=1;s<y.length;s++){k[k.length]=y[s];}}r.extra=k;v.appendChild(r);$(r).hover(function(){$("li",v).removeClass("ac_over");$(this).addClass("ac_over");l=$("li",v).indexOf($(this).get(0));},function(){$(this).removeClass("ac_over");}).click(function(z){z.preventDefault();z.stopPropagation();P(this);});}return v;}function c(r){if(!S.matchCase){r=r.toLowerCase();}var k=S.cacheLength?p(r):null;if(k){G(r,k);}else{if((typeof S.url=="string")&&(S.url.length>0)){$.get(M(r),function(s){s=F(s);E(r,s);G(r,s);});}else{W.removeClass(S.loadingClass);}}}function M(s){var k=S.url+"?q="+encodeURI(s);for(var r in S.extraParams){k+="&"+r+"="+encodeURI(S.extraParams[r]);}return k;}function p(w){if(!w){return null;}if(I.data[w]){return I.data[w];}if(S.matchSubset){for(var u=w.length-1;u>=S.minChars;u--){var r=w.substr(0,u);var y=I.data[r];if(y){var v=[];for(var s=0;s<y.length;s++){var k=y[s];var t=k[0];if(Z(t,w)){v[v.length]=k;}}return v;}}}return null;}function Z(t,r){if(!S.matchCase){t=t.toLowerCase();}var k=t.indexOf(r);if(k==-1){return false;}return k==0||S.matchContains;}this.flushCache=function(){K();};this.setExtraParams=function(k){S.extraParams=k;};this.findValue=function(){var r=W.val();if(!S.matchCase){r=r.toLowerCase();}var k=S.cacheLength?p(r):null;if(k){g(r,k);}else{if((typeof S.url=="string")&&(S.url.length>0)){$.get(M(r),function(s){s=F(s);E(r,s);g(r,s);});}else{g(r,null);}}};function g(w,v){if(v){W.removeClass(S.loadingClass);}var t=(v)?v.length:0;var r=null;for(var u=0;u<t;u++){var y=v[u];if(y[0].toLowerCase()==w.toLowerCase()){r=document.createElement("li");if(S.formatItem){r.innerHTML=S.formatItem(y,u,t);r.selectValue=y[0];}else{r.innerHTML=y[0];r.selectValue=y[0];}var k=null;if(y.length>1){k=[];for(var s=1;s<y.length;s++){k[k.length]=y[s];}}r.extra=k;}}if(S.onFindValue){setTimeout(function(){S.onFindValue(r);},1);}}function E(r,k){if(!k||!r||!S.cacheLength){return ;}if(!I.length||I.length>S.cacheLength){K();I.length++;}else{if(!I[r]){I.length++;}}I.data[r]=k;}function X(r){var s=r.offsetLeft||0;var k=r.offsetTop||0;while(r=r.offsetParent){s+=r.offsetLeft;k+=r.offsetTop;}return{x:s,y:k};}};jQuery.fn.autocomplete=function(B,A,C){A=A||{};A.url=B;A.data=((typeof C=="object")&&(C.constructor==Array))?C:null;A.inputClass=A.inputClass||"ac_input";A.resultsClass=A.resultsClass||"ac_results";A.lineSeparator=A.lineSeparator||"\n";A.cellSeparator=A.cellSeparator||"|";A.minChars=A.minChars||1;A.delay=A.delay||400;A.matchCase=A.matchCase||0;A.matchSubset=A.matchSubset||1;A.matchContains=A.matchContains||0;A.cacheLength=A.cacheLength||1;A.mustMatch=A.mustMatch||0;A.extraParams=A.extraParams||{};A.loadingClass=A.loadingClass||"ac_loading";A.selectFirst=A.selectFirst||false;A.selectOnly=A.selectOnly||false;A.maxItemsToShow=A.maxItemsToShow||-1;A.autoFill=A.autoFill||false;A.width=parseInt(A.width,10)||0;this.each(function(){var D=this;new jQuery.autocomplete(D,A);});return this;};jQuery.fn.autocompleteArray=function(B,A){return this.autocomplete(null,A,B);};jQuery.fn.indexOf=function(B){for(var A=0;A<this.length;A++){if(this[A]==B){return A;}}return -1;};(function(){$.fn.appendNewItem=function(jsonObject){template_item=$(this.config.template_item);template_item.attr("id","i_"+jsonObject.id);template_item.find(".description").text(jsonObject.short_description);template_item.find(".description").attr("id","descrid_"+jsonObject.id);template_item.find("img").attr("alt",jsonObject.description);template_item.find("img").attr("src",jsonObject.path);template_item.find(".pim-c-edit").attr("id","e_"+jsonObject.id);template_item.find(".pim-c-edit").data("item",{self:template_item,config:this.config});if(typeof (this.config.edit_action)=="function"){$(template_item.find(".pim-c-edit").get(0)).click(this.config.edit_action);}template_item.find(".pim-c-select").attr("id","s_"+jsonObject.id);template_item.find(".pim-c-select").data("item",{self:template_item,config:this.config});template_item.find(".pim-c-select").data("object",{self:jsonObject});if(typeof (this.config.select_action)=="function"){$(template_item.find(".pim-c-select").get(0)).click(this.config.select_action);}template_item.find(".pim-c-delete").attr("id","d_"+jsonObject.id);template_item.find(".pim-c-delete").data("item",{self:template_item,config:this.config});if(typeof (this.config.delete_action)=="function"){$(template_item.find(".pim-c-delete").get(0)).click(this.config.delete_action);}this.template.find("#image_container").prepend(template_item);return template_item;};$.fn.upload=function($element){var manager=$(this).data("manager");if(typeof (manager)=="object"&&typeof (manager.self)=="object"){manager=manager.self;new AjaxUpload(manager.template.find("#upload"),{name:manager.config.name,action:manager.config.url,onComplete:function(file,response){var response=eval("("+response+")");if(typeof (response)=="object"){if(response.result){var item=manager.appendNewItem(response.file);$(this).data("item",{self:item,config:manager.config});$(this).editImage();document.popup.close();}if(typeof (response.error)!="undefined"){if(response.error.length){document.popup.setContent(response.error);}}}},onSubmit:function(file,ext){new Popup("#body-wr");},onChange:function(file,ext){}});}};$.fn.clearList=function(){var self=$(this).data("manager");self=self.self;self.template.find("ul[id=image_container]>li").remove();return false;};$.fn.findImage=function(){var self=$(this).data("manager");self=self.self;var char_map=self.template.find("#search_image").val();new Popup("#body-wr");var options={};options[self.config.name]="find";options.text=char_map;$.getJSON(self.config.url,options,function(response){if(response.files){self.clearList();if(response.length){self.template.find("#norecords").hide();for(i in response.files){self.appendNewItem(response.files[i]);}}else{self.template.find("#norecords").show();}document.popup.close();}});return false;};$.fn.closeGallery=function(){var manager=$(this).data("manager");if(typeof (manager)=="object"){manager=manager.self;manager.template.hide();return true;}return false;};$.fn.openGallery=function(){var manager=$(this).data("manager");if(typeof (manager)=="object"){manager=manager.self;manager.template.show();}return false;};$.fn.selectImage=function(){var manager=$(this).data("object");return manager.self;};$.fn.getImageItem=function(){var manager=$(this).data("item");return manager.self;};$.fn.deleteImage=function(){if(!confirm("Вы действительно хотите удалить это изображение с сервера?\n Это действие необратимо.")){return false;}var item=$(this).data("item");if(typeof (item)=="object"&&typeof (item.self)=="object"){config=item.config;item=item.self;var options={};options[config.name]="remove";options.imgid=item.attr("id").substr(2);new Popup("#body-wr");$.getJSON(config.url,options,function(response){if(typeof (response)=="object"){if(typeof (response.error)!="undefined"&&response.error.length){document.popup.setContent(response.error);return false;}if(response.result){item.remove();document.popup.close();}}});}return false;};$.fn.editImage=function(){var item=$(this).data("item");if(typeof (item)=="object"&&typeof (item.self)=="object"){config=item.config;var item=item.self;var options={};options[config.name]="modify";options.imgid=item.attr("id").substr(2);new Popup("#body-wr",config.url,options,function(content){if(typeof (content)=="object"){content.find("#description").focus();content.find("a[id=save]").live("click",function(){document.popup.content.find("#description").attr("disabled","disabled");var form_name=document.popup.content.find("form").attr("name");var description=document.popup.content.find("#description").val();var img_id=$("#id").val();var url=window.location.pathname+(window.location.search?window.location.search+"&":"?")+config.name+"=modify&imgid="+img_id;$.post(url,{_name:form_name,description:description},function(result){var result=eval("("+result+")");if(result.result){content.remove();$("#descrid_"+img_id).text(result.file.short_description);document.popup.close();}});return false;});content.find("a[id=cancel]").live("click",function(){document.popup.close();return false;});content.find("#description").keypress(function(event){if(event.keyCode==13){content.find("a[id=save]").click();}});}if(typeof (content)=="string"){var content=eval("("+content+")");var template=$(document.popup.default_template);template.find("#popup-content").text(content.error);document.popup.changeContent(template);}});}return false;};$.fn.ImageManager=function(config){if(typeof ($(this).data("manager"))!="undefined"){$(this).openGallery();return true;}var url=window.location.pathname+window.location.search;this.config=$.extend({url:url,name:"",after_render:function(){},before_render:function(){},after:"div[class=p-ill-ctl]",before:"",template_item:'<li id="" class="image_block"><div class="pim-image"><img src="" alt="" title="" style="width: 96px; height: 65px;" /></div><p class="description"></p><div class="pim-control" style="display: none"><a class="pim-c-select" id="" title="Использовать изображение" href="javascript: void(0)"></a><a class="pim-c-edit" id="" title="Редактировать описание изображения" href="javascript: void(0)"></a><a class="pim-c-delete" id="" title="Удалить изображение" href="javascript: void(0)"></a></div></li>',template:'<div class="clear"></div><div class="post-image-manager"><div class="post-image-controls"><div class="control_sh"><a id="close_gallery" href="javascript: void(0)">Закрыть</a></div><ul><li><p class="hint">Воспользуйтесь поиском или загрузите изображение с диска (до 2Мб формат: jpg, png, gif).</p></li></ul><ul><li><input class="edit-s" id="search_image" name="search_image" value="Введите описание" />&nbsp;&nbsp;<input type="button" value="Искать" name="search_button" id="search_button" style="width: 70px;" />&nbsp;&nbsp;&nbsp;или&nbsp;&nbsp;&nbsp;<input type="button" value="Загрузить с диска" id="upload" style="width: 134px;" /></li></ul></div><div class="post-image-gallery"><p style="padding-bottom: 8px; display:none;" id="norecords">Изображения не найдены</p><ul id="image_container"></ul></div></div>',delete_action:function(){return $(this).deleteImage();},select_action:function(){return $(this).selectImage();},edit_action:function(){return $(this).editImage();}},config);$(this).data("manager",{self:this});var self=this;self.config.before_render();var options={};options[self.config.name]="getuploads";$.getJSON(self.config.url,options,function(response){if(response.files){self.template=$(self.config.template);for(i in response.files){self.appendNewItem(response.files[i]);}self.template.find("#upload").data("manager",{self:self});self.template.find("#upload").upload();self.template.find("#close_gallery").data("manager",{self:self});self.template.find("#close_gallery").live("click",function(){return $(this).closeGallery();});self.template.find("#search_button").data("manager",{self:self});self.template.find("#search_button").live("click",function(){return $(this).findImage();});self.template.find("#search_image").data("manager",{self:self});self.template.find("#search_image").click(function(event){$(this).val("");});self.template.find("#search_image").keypress(function(event){if(event.keyCode==13){return $(this).findImage();}});if(self.config.before){self.template.insertBefore(self.config.before);}else{if(self.config.after){self.template.insertAfter(self.config.after);}}self.config.after_render();}});return this;};})();(function(){$.fn.loadImage=function(A){var A=$.extend({},A);$().data("loadImage",A);this.live("click",function(){var B=this.className;var F=$($(this).data("carousel"));F.find("li").attr("class","");F.find("li:has(img[id="+this.id+"])").attr("class","selected");var E=$("<img/>");E.attr("title",this.title);E.attr("alt",this.title);var D=$("div[class=image][id="+B+"]");var C=D.find("img");E.load(function(){var G=$().data("loadImage");G.height=this.height;$().data("loadImage",G);C.fadeOut("slow",function(){var J=this.height;var I=$().data("loadImage");var H=I.height;if(typeof (H)=="undefined"){H=J;}H=parseInt(H)+8;D.animate({opacity:1,height:H},0,function(){C.remove();D.append(E);});});});E.attr("src",this.id);return false;});};$.fn.topicImageCarouselList=function(A){var A=$.extend({visible_image_count:5,button1:"a[class=pimgrw_r]",button2:"a[class=pimgrw_l]",real_image_count:""},A);$().data("topicImageCarouselList",A);$.each($(this),function(I,E){var C=$().data("topicImageCarouselList");var J=$("table:has(div[id="+E.id+"])");var B=parseInt(J.find("li").length);var G=J.find(C.button1);var F=J.find(C.button2);var H=parseInt(C.visible_image_count);if(B<=H){J.find(C.button1).hide();J.find(C.button2).hide();H=B;}$(E).jCarouselLite({btnNext:G,btnPrev:F,scroll:1,start:0,circular:0,visible:H});var D=$(E).find("li img");D.data("carousel",this);D.loadImage();});};$.fn.topicImageCarousel=function(A){var A=$.extend({visible_image_count:5,button1:"a[class=pimgrw_r]",button2:"a[class=pimgrw_l]",real_image_count:$(".carousel").find("li").length},A);$().data("topicImageCarousel",A);if(A.real_image_count<=A.visible_image_count){$(A.button1).hide();$(A.button2).hide();A.visible_image_count=A.real_image_count;}$(this).jCarouselLite({btnNext:$(A.button1),btnPrev:$(A.button2),scroll:1,start:0,circular:0,visible:A.visible_image_count});var B=$(this).find("li img");B.data("carousel",this);B.loadImage();};$.fn.topicDelete=function(A){var A=$.extend({confirm:function(){if(confirm("Вы действительно хотите удалить этот пост?\n Это действие необратимо.")){new Popup("#body-wr");return true;}return false;},callback:function(B){if(B.error){document.popup.setContent(B.error);return false;}document.popup.close();if(typeof (B.topic)!="undefined"){window.location="/community/blog/view?b="+B.topic.talk_id;}}},A);$().data("topicDelete",A);this.click(function(){var B=$().data("topicDelete");B.id=this.id;$().data("topicDelete",B);if(typeof (B.id)=="undefined"){throw"Topic id can not be undefined";}if(typeof (B.callback)!="function"){throw"Vote callback function can not be undefined";}if(typeof (B.confirm)=="function"){if(!B.confirm(this)){return false;}}$.getJSON("/data/topic",{t:B.id,action:"delete"},B.callback);return false;});return this;};$.fn.topicEnable=function(A){var A=$.extend({confirm:function(){new Popup("#body-wr");return true;},callback:function(B){var C=$().data("topicEnable");if(B.error){document.popup.setContent(B.error);return false;}var D=$('<a class="action_topic_disable" id="'+C.id+'">Блокировать</a>');D.topicDisable();$(".bo-act-priv").append(D);$("a[class=action_topic_enable]").remove();document.popup.close();}},A);$().data("topicEnable",A);this.click(function(){var B=$().data("topicEnable");B.id=this.id;$().data("topicEnable",B);if(typeof (B.id)=="undefined"){throw"Topic id can not be undefined";}if(typeof (B.callback)!="function"){throw"Vote callback function can not be undefined";}if(typeof (B.confirm)=="function"){if(!B.confirm(this)){return false;}}$.getJSON("/data/topic",{t:B.id,action:"enable"},B.callback);return false;});return this;};$.fn.topicDisable=function(A){var A=$.extend({confirm:function(){new Popup("#body-wr");return true;},callback:function(B){var C=$().data("topicDisable");if(B.error){document.popup.setContent(B.error);return false;}var D=$('<a class="action_topic_enable" id="'+C.id+'">Разблокировать</a>');D.topicEnable();$(".bo-act-priv").append(D);$("a[class=action_topic_disable]").remove();document.popup.close();}},A);$().data("topicDisable",A);this.click(function(){var B=$().data("topicDisable");B.id=this.id;$().data("topicDisable",B);if(typeof (B.id)=="undefined"){throw"Topic id can not be undefined";}if(typeof (B.callback)!="function"){throw"Vote callback function can not be undefined";}if(typeof (B.confirm)=="function"){if(!B.confirm(this)){return false;}}$.getJSON("/data/topic",{t:B.id,action:"disable"},B.callback);return false;});return this;};$.fn.topicVotePlus=function(A){var A=$.extend({confirm:function(){new Popup("#body-wr");return true;},callback:function(C){if(C.error){document.popup.setContent(C.error);return false;}var B=$("li[id=rating]");var D="";if(parseInt(C.rating)>0){D="+";}B.text(D+C.rating);if(parseInt(C.rating)>0){B.attr("class","post-rate-count prc_pos");}else{if(parseInt(C.rating)==0){B.attr("class","post-rate-count prc_inf");}else{B.attr("class","post-rate-count prc_neg");}}document.popup.close();}},A);$().data("topicVotePlus",A);this.click(function(){var B=$().data("topicVotePlus");B.id=this.id;$().data("topicVotePlus",B);if(typeof (B.id)=="undefined"){throw"Topic id can not be undefined";}if(typeof (B.callback)!="function"){throw"Vote callback function can not be undefined";}if(typeof (B.confirm)=="function"){if(!B.confirm(this)){return false;}}$.getJSON("/data/topic",{t:B.id,action:"vote",vote:"1"},B.callback);return false;});return this;};$.fn.topicVoteMinus=function(A){var A=$.extend({confirm:function(){new Popup("#body-wr");return true;},callback:function(C){if(C.error){document.popup.setContent(C.error);return false;}var B=$("li[id=rating]");var D="";if(parseInt(C.rating)>0){D="+";}B.text(D+C.rating);if(parseInt(C.rating)>0){B.attr("class","post-rate-count prc_pos");}else{if(parseInt(C.rating)==0){B.attr("class","post-rate-count prc_inf");}else{B.attr("class","post-rate-count prc_neg");}}document.popup.close();}},A);$().data("topicVoteMinus",A);this.click(function(){var B=$().data("topicVoteMinus");B.id=this.id;$().data("topicVoteMinus",B);if(typeof (B.id)=="undefined"){throw"Topic id can not be undefined";}if(typeof (B.callback)!="function"){throw"Vote callback function can not be undefined";}if(typeof (B.confirm)=="function"){if(!B.confirm(this)){return false;}}$.getJSON("/data/topic",{t:B.id,action:"vote",vote:"-1"},B.callback);return false;});return this;};})();(function(){$.fn.userShowTerms=function(){this.live("click",function(){window.open("/terms","_blank","height=800,width=800");return false;});};$.fn.userBan=function(A){var A=$.extend({confirm:function(){if(confirm("Вы действительно хотите забанить этого пользователя?")){new Popup("#body-wr");return true;}return false;},callback:function(B){if(B.error){document.popup.setContent(B.error);return false;}var C=$().data("userBan");$(C.link).remove();document.popup.close();}},A);$().data("userBan",A);this.live("click",function(){var B=$().data("userBan");B.link=this;$().data("userBan",B);if(typeof (B.id)=="undefined"){throw"User id can not be undefined";}if(typeof (B.topic_id)=="undefined"){throw"Topic id can not be undefined";}if(typeof (B.callback)!="function"){throw"Vote callback function can not be undefined";}if(typeof (B.confirm)=="function"){if(!B.confirm(this)){return false;}}$.getJSON("/data/user/ban",{u:B.id,t:B.topic_id},B.callback);return false;});return this;};$.fn.userBlock=function(A){var A=$.extend({confirm:function(){if(confirm("Вы действительно хотите забанить этого пользователя?")){new Popup("#body-wr");return true;}return false;},callback:function(B){if(B.error){document.popup.setContent(B.error);return false;}var C=$().data("userBlock");$(C.link).remove();document.popup.close();}},A);$().data("userBlock",A);this.live("click",function(){var B=$().data("userBlock");B.link=this;$().data("userBlock",B);if(typeof (B.id)=="undefined"){throw"User id can not be undefined";}if(typeof (B.callback)!="function"){throw"Vote callback function can not be undefined";}if(typeof (B.confirm)=="function"){if(!B.confirm(this)){return false;}}$.getJSON("/data/user/block",{u:B.id},B.callback);return false;});return this;};return false;})();(function(){$.fn.getCommentForm=function(){var form=$().data("comment_form");if(typeof (form)=="undefined"){var form=$("#comment-reply");$().data("comment_form",form);}form.show();return form;};$.fn.closeCommentForm=function(){this.find("#submit").unbind();$("#body-wr").closeGallery();this.hide();};$.fn.commentFormValues=function(object,flag){var object;var form=$().getCommentForm();for(key in object){if(key=="is_response_notify"){var element=form.find("#"+key);if(parseInt(object[key])){element.attr("checked","checked");}else{element.removeAttr("checked");}element.val(1);}else{form.find("#"+key).val(object[key]);}}$().data("comment_form",form);};$.fn.commentFormMove=function(place){var place;var form=$().getCommentForm();if(form.find("#text").removeMCE()){if(form.insertAfter(place)){form.find("#text").casinorubbcode();}}$().data("comment_form",form);return true;};$.fn.openAddForm=function(config){var config=$.extend({confirm:function(object){var form=$().getCommentForm();form.closeCommentForm();return true;},callback:function(){$().commentFormValues({parent_id:"",text:""});$().commentFormMove(".com-rp-bgn");var form=$().getCommentForm();form.commentAdd();var link=window.location;link=link.toString();link=link.split("#");window.location=link[0]+"#comment-reply";return false;}},config);$().data("openAddForm",config);this.live("click",function(){var config=$().data("openAddForm");if(!config.confirm()){return false;}return config.callback();});};$.fn.openResponseForm=function(config){var config=$.extend({confirm:function(){var form=$().getCommentForm();form.closeCommentForm();return true;},prepare:function(){var config=$().data("commentResponse");$().commentFormValues({parent_id:config.id,text:""});$().commentFormMove("li[id=comment_"+config.id+"]");var form=$().getCommentForm();form.commentAdd();}},config);$().data("commentResponse",config);this.live("click",function(){var config=$().data("commentResponse");config.id=this.id;$().data("commentResponse",config);if(typeof (config.confirm)=="function"){if(!config.confirm(this)){return false;}}config.prepare();return false;});return this;};$.fn.openEditForm=function(config){var config=$.extend({confirm:function(object){return true;},prepare:function(object){$("li[class=comment]").show();var comment_id=object.id;var config=$().data("openEditForm");var comment=$("li[id=comment_"+comment_id+"]");if($().commentFormMove(comment)){comment.hide();}$.getJSON("/data/comment/edit",{c:comment_id},function(response){$().commentFormValues({parent_id:"",id:response.comment.id,text:response.comment.text,is_response_notify:response.comment.is_response_notify});var form=$().getCommentForm();form.commentEdit({id:response.comment.id});});return false;}},config);$().data("openEditForm",config);this.live("click",function(){var config=$().data("openEditForm");config.id=this.id;$().data("openEditForm",config);if(!config.confirm()){return false;}return config.prepare(this);});};$.fn.commentEdit=function(config){var config=$.extend({id:0,confirm:function(object){new Popup("#body-wr");return true;},callback:function(response){var responseObject=$(response);if(responseObject.is("span")){if(responseObject.attr("id")=="error"){document.popup.setContent(response);return false;}}var config=$().data("commentEdit");var comment=$("li[id=comment_"+config.id+"]");responseObject.replaceAll(comment);var form=$().getCommentForm();form.closeCommentForm();document.popup.close();return true;}},config);$().data("commentEdit",config);this.find("#submit").click(function(){var form=$().getCommentForm();var config=$().data("commentEdit");if(!config.confirm()){return false;}var is_notify=0;var id=form.find("#id").val();var text=form.find("#text").val();if(form.find("#is_response_notify:checked").is("input")){is_notify=1;}form.find("#text").attr("disabled","disabled");$.post("/data/comment/edit",{_name:"edit_form",id:id,text:text,is_response_notify:is_notify},config.callback);return false;});};$.fn.commentAdd=function(config){var config=$.extend({confirm:function(object){new Popup("#body-wr");return true;},callback:function(response){var responseObject=$(response);if(responseObject.is("span")){if(responseObject.attr("id")=="error"){document.popup.setContent(response);return false;}}document.popup.close();var form=$().getCommentForm();form.closeCommentForm();var config=$().data("commentAdd");if(parseInt(config.parent_id)){responseObject.insertAfter("li[id=comment_"+config.parent_id+"]");return false;}$("#commentlist").append(responseObject);var commentsCount=$("#comments_count");commentsCount.text(parseInt(commentsCount.text())+1);$("div[class=comments-header]").show();return false;}},config);$().data("commentAdd",config);this.find("a[id=submit]").live("click",function(){var form=$().getCommentForm();var config=$().data("commentAdd");if(!config.confirm()){return false;}var text=form.find("#text").val();var topic_id=form.find("#topic_id").val();var parent_id=form.find("#parent_id").val();config.parent_id=parent_id;$().data("commentAdd",config);var is_notify=0;if(form.find("#is_response_notify:checked").is("input")){is_notify=1;}$.post("/data/comment/add",{topic_id:topic_id,parent_id:parent_id,text:text,is_response_notify:is_notify},config.callback);return false;});};$.fn.commentComplain=function(config){var config=$.extend({id:this.attr("id"),template:'<form action="/community/topic/view/complain?t=2317&amp;c=" method="post" id="complain" name="complain"><input type="hidden" value="complain" name="_name"><div class=""><label for="text" class="frm-lbl">Укажите несоответствие в комментарии</label><textarea id="text" name="text" rows="5" cols="5" class="edit"></textarea><p class="hint">Укажите, пожалуйста, что именно является ошибкой и почему вы так считаете.</p></div><div class="clear"></div><ul class="save"><li><div class="b-big-t1"><a onclick="javascript: return false;" href="#" id="submit"><span>Отправить</span></a></div></li></ul><div class="clear"></div><div class="clear"></div></form>'},config);$().data("commentComplain",{config:config});this.live("click",function(){var commentComplain=$().data("commentComplain");var popup=new Popup("#body-wr");popup.setContent(commentComplain.config.template);popup.content.find("#submit").data("config",commentComplain.config);popup.content.find("#submit").live("click",function(){var commentComplain=$().data("commentComplain");var complain_text=document.popup.content.find("textarea").val();$.post("/data/comment/complain",{id:commentComplain.config.id,text:complain_text},function(data){var response=eval("("+data+")");if(response.error){document.popup.setContent(response.error);}if(response.result){document.popup.close();}});return false;});return false;});};$.fn.commentRemove=function(config){var config=$.extend({confirm:function(object){if(confirm("Вы действительно хотите удалить комментарий?")){new Popup("#body-wr");return true;}return false;},callback:function(response){if(response.error){document.popup.setContent(response.error);return false;}var commentRemove=$().data("commentRemove");var config=commentRemove.config;var obj=$("em[class=topic_comments_count]>span");obj.html(parseInt(obj.html())-1);$(response).replaceAll($("#comment_"+config.id));document.popup.close();}},config);$().data("commentRemove",{config:config});this.data("config",config);this.live("click",function(){var commentRemove=$().data("commentRemove");var config=commentRemove.config;config.id=this.id;$().data("commentRemove",{config:config});if(typeof (config.id)=="undefined"){throw"Comment id can not be undefined";}if(typeof (config.callback)!="function"){throw"Vote callback function can not be undefined";}if(typeof (config.confirm)=="function"){if(!config.confirm(this)){return false;}}$.get("/data/comment/remove",{c:config.id},config.callback);return false;});return this;};$.fn.commentVotePlus=function(config){var config=$.extend({confirm:function(){new Popup("#body-wr");return true;},callback:function(response){if(response.error){document.popup.setContent(response.error);return false;}var rating_html=$("li[id=rating_"+config.id+"]");var plus="";if(parseInt(response.rating)>0){plus="+";}rating_html.html("<strong>"+plus+response.rating+"</strong>");if(parseInt(response.rating)>0){rating_html.attr("class","com-r-pos");}else{if(parseInt(response.rating)==0){rating_html.attr("class","");}else{rating_html.attr("class","com-r-neg");}}document.popup.close();}},config);$().data("commentVotePlus",config);this.click(function(){var config=$().data("commentVotePlus");config.id=this.id;$().data("commentVotePlus",config);if(typeof (config.id)=="undefined"){throw"Topic id can not be undefined";}if(typeof (config.callback)!="function"){throw"Vote callback function can not be undefined";}if(typeof (config.confirm)=="function"){if(!config.confirm(this)){return false;}}$.getJSON("/data/comment/vote",{t:config.id,action:"vote",vote:"1"},config.callback);return false;});return this;};$.fn.commentVoteMinus=function(config){var config=$.extend({confirm:function(){new Popup("#body-wr");return true;},callback:function(response){if(response.error){document.popup.setContent(response.error);return false;}var rating_html=$("li[id=rating_"+config.id+"]");var plus="";if(parseInt(response.rating)>0){plus="+";}rating_html.html("<strong>"+plus+response.rating+"</strong>");if(parseInt(response.rating)>0){rating_html.attr("class","com-r-pos");}else{if(parseInt(response.rating)==0){rating_html.attr("class","");}else{rating_html.attr("class","com-r-neg");}}document.popup.close();}},config);$().data("commentVoteMinus",config);this.click(function(){var config=$().data("commentVoteMinus");config.id=this.id;$().data("commentVoteMinus",config);if(typeof (config.id)=="undefined"){throw"Topic id can not be undefined";}if(typeof (config.callback)!="function"){throw"Vote callback function can not be undefined";}if(typeof (config.confirm)=="function"){if(!config.confirm(this)){return false;}}$.getJSON("/data/comment/vote",{t:config.id,action:"vote",vote:"-1"},config.callback);return false;});return this;};return false;})();Date.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.abbrDayNames=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];Date.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];Date.abbrMonthNames=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];Date.firstDayOfWeek=1;Date.format="dd/mm/yyyy";Date.fullYearStart="20";(function(){function B(C,D){if(!Date.prototype[C]){Date.prototype[C]=D;}}B("isLeapYear",function(){var C=this.getFullYear();return(C%4==0&&C%100!=0)||C%400==0;});B("isWeekend",function(){return this.getDay()==0||this.getDay()==6;});B("isWeekDay",function(){return !this.isWeekend();});B("getDaysInMonth",function(){return[31,(this.isLeapYear()?29:28),31,30,31,30,31,31,30,31,30,31][this.getMonth()];});B("getDayName",function(C){return C?Date.abbrDayNames[this.getDay()]:Date.dayNames[this.getDay()];});B("getMonthName",function(C){return C?Date.abbrMonthNames[this.getMonth()]:Date.monthNames[this.getMonth()];});B("getDayOfYear",function(){var C=new Date("1/1/"+this.getFullYear());return Math.floor((this.getTime()-C.getTime())/86400000);});B("getWeekOfYear",function(){return Math.ceil(this.getDayOfYear()/7);});B("setDayOfYear",function(C){this.setMonth(0);this.setDate(C);return this;});B("addYears",function(C){this.setFullYear(this.getFullYear()+C);return this;});B("addMonths",function(D){var C=this.getDate();this.setMonth(this.getMonth()+D);if(C>this.getDate()){this.addDays(-this.getDate());}return this;});B("addDays",function(C){this.setDate(this.getDate()+C);return this;});B("addHours",function(C){this.setHours(this.getHours()+C);return this;});B("addMinutes",function(C){this.setMinutes(this.getMinutes()+C);return this;});B("addSeconds",function(C){this.setSeconds(this.getSeconds()+C);return this;});B("zeroTime",function(){this.setMilliseconds(0);this.setSeconds(0);this.setMinutes(0);this.setHours(0);return this;});B("asString",function(D){var C=D||Date.format;return C.split("yyyy").join(this.getFullYear()).split("yy").join((this.getFullYear()+"").substring(2)).split("mmmm").join(this.getMonthName(false)).split("mmm").join(this.getMonthName(true)).split("mm").join(A(this.getMonth()+1)).split("dd").join(A(this.getDate()));});Date.fromString=function(K){var G=Date.format;var J=new Date("01/01/1977");var H=0;var C=G.indexOf("mmmm");if(C>-1){for(var E=0;E<Date.monthNames.length;E++){var D=K.substr(C,Date.monthNames[E].length);if(Date.monthNames[E]==D){H=Date.monthNames[E].length-4;break;}}J.setMonth(E);}else{C=G.indexOf("mmm");if(C>-1){var D=K.substr(C,3);for(var E=0;E<Date.abbrMonthNames.length;E++){if(Date.abbrMonthNames[E]==D){break;}}J.setMonth(E);}else{J.setMonth(Number(K.substr(G.indexOf("mm"),2))-1);}}var I=G.indexOf("yyyy");if(I>-1){if(C<I){I+=H;}J.setFullYear(Number(K.substr(I,4)));}else{if(C<I){I+=H;}J.setFullYear(Number(Date.fullYearStart+K.substr(G.indexOf("yy"),2)));}var F=G.indexOf("dd");if(C<F){F+=H;}J.setDate(Number(K.substr(F,2)));if(isNaN(J.getTime())){return false;}return J;};var A=function(C){var D="0"+C;return D.substring(D.length-2);};})();(function(){var G=document,K=window;function B(O){if(typeof O=="string"){O=G.getElementById(O);}return O;}function D(Q,P,O){if(K.addEventListener){Q.addEventListener(P,O,false);}else{if(K.attachEvent){var R=function(){O.call(Q,K.event);};Q.attachEvent("on"+P,R);}}}var C=function(){var O=G.createElement("div");return function(P){O.innerHTML=P;var Q=O.childNodes[0];O.removeChild(Q);return Q;};}();function E(P,O){return P.className.match(new RegExp("(\\s|^)"+O+"(\\s|$)"));}function F(P,O){if(!E(P,O)){P.className+=" "+O;}}function L(Q,O){var P=new RegExp("(\\s|^)"+O+"(\\s|$)");Q.className=Q.className.replace(P," ");}if(document.documentElement.getBoundingClientRect){var M=function(O){var T=O.getBoundingClientRect(),X=O.ownerDocument,U=X.body,P=X.documentElement,S=P.clientTop||U.clientTop||0,V=P.clientLeft||U.clientLeft||0,Y=1;if(U.getBoundingClientRect){var R=U.getBoundingClientRect();Y=(R.right-R.left)/U.clientWidth;}if(Y>1){S=0;V=0;}var W=T.top/Y+(window.pageYOffset||P&&P.scrollTop/Y||U.scrollTop/Y)-S,Q=T.left/Y+(window.pageXOffset||P&&P.scrollLeft/Y||U.scrollLeft/Y)-V;return{top:W,left:Q};};}else{var M=function(O){if(K.jQuery){return jQuery(O).offset();}var Q=0,P=0;do{Q+=O.offsetTop||0;P+=O.offsetLeft||0;}while(O=O.offsetParent);return{left:P,top:Q};};}function A(Q){var S,P,R,O;var T=M(Q);S=T.left;R=T.top;P=S+Q.offsetWidth;O=R+Q.offsetHeight;return{left:S,right:P,top:R,bottom:O};}function I(R){if(!R.pageX&&R.clientX){var Q=1;var O=document.body;if(O.getBoundingClientRect){var P=O.getBoundingClientRect();Q=(P.right-P.left)/O.clientWidth;}return{x:R.clientX/Q+G.body.scrollLeft+G.documentElement.scrollLeft,y:R.clientY/Q+G.body.scrollTop+G.documentElement.scrollTop};}return{x:R.pageX,y:R.pageY};}var H=function(){var O=0;return function(){return"ValumsAjaxUpload"+O++;};}();function N(O){return O.replace(/.*(\/|\\)/,"");}function J(O){return(/[.]/.exec(O))?/[^.]+$/.exec(O.toLowerCase()):"";}Ajax_upload=AjaxUpload=function(Q,O){switch(typeof (Q)){case"object":if(Q.jquery){Q=Q.get(0);}break;case"string":Q=Q.slice(1);break;}Q=B(Q);this._input=null;this._button=Q;this._disabled=false;this._submitting=false;this._justClicked=false;this._parentDialog=G.body;if(window.jQuery&&jQuery.ui&&jQuery.ui.dialog){var R=jQuery(this._button).parents(".ui-dialog");if(R.length){this._parentDialog=R[0];}}this._settings={action:"upload.php",name:"userfile",data:{},autoSubmit:true,responseType:false,onChange:function(S,T){},onSubmit:function(S,T){},onComplete:function(T,S){}};for(var P in O){this._settings[P]=O[P];}this._createInput();this._rerouteClicks();};AjaxUpload.prototype={setData:function(O){this._settings.data=O;},disable:function(){this._disabled=true;},enable:function(){this._disabled=false;},destroy:function(){if(this._input){if(this._input.parentNode){this._input.parentNode.removeChild(this._input);}this._input=null;}},_createInput:function(){var P=this;var O=G.createElement("input");O.setAttribute("type","file");O.setAttribute("name",this._settings.name);var R={position:"absolute",margin:"-5px 0 0 -175px",padding:0,width:"220px",height:"30px",fontSize:"14px",opacity:0,cursor:"pointer",display:"none",zIndex:2147483583};for(var Q in R){O.style[Q]=R[Q];}if(!(O.style.opacity==="0")){O.style.filter="alpha(opacity=0)";}this._parentDialog.appendChild(O);D(O,"change",function(){var S=N(this.value);if(P._settings.onChange.call(P,S,J(S))==false){return ;}if(P._settings.autoSubmit){P.submit();}});D(O,"click",function(){P.justClicked=true;setTimeout(function(){P.justClicked=false;},3000);});this._input=O;},_rerouteClicks:function(){var P=this;var Q,O={top:0,left:0},R=false;D(P._button,"mouseover",function(S){if(!P._input||R){return ;}R=true;Q=A(P._button);if(P._parentDialog!=G.body){O=M(P._parentDialog);}});D(document,"mousemove",function(T){var S=P._input;if(!S||!R){return ;}if(P._disabled){L(P._button,"hover");S.style.display="none";return ;}var U=I(T);if((U.x>=Q.left)&&(U.x<=Q.right)&&(U.y>=Q.top)&&(U.y<=Q.bottom)){S.style.top=U.y-O.top+"px";S.style.left=U.x-O.left+"px";S.style.display="block";F(P._button,"hover");}else{R=false;if(!P.justClicked){S.style.display="none";}L(P._button,"hover");}});},_createIframe:function(){var P=H();var O=C('<iframe src="javascript:false;" name="'+P+'" />');O.id=P;O.style.display="none";G.body.appendChild(O);return O;},submit:function(){var O=this,R=this._settings;if(this._input.value===""){return ;}var P=N(this._input.value);if(!(R.onSubmit.call(this,P,J(P))==false)){var Q=this._createIframe();var T=this._createForm(Q);T.appendChild(this._input);T.submit();G.body.removeChild(T);T=null;this._input=null;this._createInput();var S=false;D(Q,"load",function(W){if(Q.src=="javascript:'%3Chtml%3E%3C/html%3E';"||Q.src=="javascript:'<html></html>';"){if(S){setTimeout(function(){G.body.removeChild(Q);},0);}return ;}var V=Q.contentDocument?Q.contentDocument:frames[Q.id].document;if(V.readyState&&V.readyState!="complete"){return ;}if(V.body&&V.body.innerHTML=="false"){return ;}var U;if(V.XMLDocument){U=V.XMLDocument;}else{if(V.body){U=V.body.innerHTML;if(R.responseType&&R.responseType.toLowerCase()=="json"){if(V.body.firstChild&&V.body.firstChild.nodeName.toUpperCase()=="PRE"){U=V.body.firstChild.firstChild.nodeValue;}if(U){U=window["eval"]("("+U+")");}else{U={};}}}else{var U=V;}}R.onComplete.call(O,P,U);S=true;Q.src="javascript:'<html></html>';";});}else{G.body.removeChild(this._input);this._input=null;this._createInput();}},_createForm:function(Q){var P=this._settings;var R=C('<form method="post" enctype="multipart/form-data"></form>');R.style.display="none";R.action=P.action;R.target=Q.name;G.body.appendChild(R);for(var S in P.data){var O=G.createElement("input");O.type="hidden";O.name=S;O.value=P.data[S];R.appendChild(O);}return R;}};})();(function(D){D.fn.jCasrCarousel=function(E){E=D.extend({main:".jccarousel_wrap",btnNext:".jccright a",btnPrev:".jccleft a",visible:3,start:0,scroll:1,liwidth:148,},E||{});return this.each(function(){var L=false,J="left",G="width";var F=D(this),K=D(this).attr("id"),N=D("ul",F),Q=D("li",N),M=Q.size(),R=E.start,P=E.visible;F.css("visibility","visible");var I=B(Q,E);var O=I*M;D(N).css("width",O);if(M>E.visible){D("#"+K+" "+E.btnNext).removeClass("disabled");}if(E.btnPrev){D("#"+K+" "+E.btnPrev).click(function(){return H(R-E.scroll);});}if(E.btnNext){D("#"+K+" "+E.btnNext).click(function(){return H(R+E.scroll);});}function H(T){try{if(!L){if(E.beforeStart){E.beforeStart.call(this,vis());}if(E.circular){if(T<=E.start-P-1){N.css(J,-((M-(P*2))*I)+"px");R=T==E.start-P-1?M-(P*2)-1:M-(P*2)-E.scroll;}else{if(T>=M-P+1){N.css(J,-((P)*I)+"px");R=T==M-P+1?P+1:P+E.scroll;}else{R=T;}}}else{if(T<0||T>M-P){return false;}else{R=T;}}L=true;N.animate(J=="left"?{left:-(R*I)}:{top:-(R*I)},E.speed,E.easing,function(){if(E.afterEnd){E.afterEnd.call(this,vis());}L=false;});if(!E.circular){D("#"+K+" "+E.btnPrev).removeClass("disabled");D("#"+K+" "+E.btnNext).removeClass("disabled");D((R-E.scroll<0&&"#"+K+" "+E.btnPrev)||(R+E.scroll>M-P&&"#"+K+" "+E.btnNext)||[]).addClass("disabled");}}}catch(S){console.log(S);}return false;}});};function A(E,F){return parseInt(D.css(E[0],F))||0;}function C(E){return parseInt(E)||0;}function B(E,F){return F.liwidth+A(E,"marginLeft")+A(E,"marginRight");}})(jQuery);(function(D){D.fn.jCarouselLite=function(E){E=D.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,speed:200,easing:null,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null},E||{});return this.each(function(){var O=false,M=E.vertical?"top":"left",G=E.vertical?"height":"width";var F=D(this),Q=D("ul",F),I=D("li",Q),U=I.size(),T=E.visible;if(E.circular){Q.prepend(I.slice(U-T-1+1).clone()).append(I.slice(0,T).clone());E.start+=T;}var S=D("li",Q),P=S.size(),V=E.start;F.css("visibility","visible");var J={overflow:"hidden"};J["float"]=E.vertical?"none":"left";S.css(J);Q.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});F.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var L=E.vertical?A(S):C(S);var R=L*P;var N=L*T;S.css({width:S.width(),height:S.height()});Q.css(G,R+"px").css(M,-(V*L));F.css(G,N+"px");if(E.btnPrev){D(E.btnPrev).click(function(){return K(V-E.scroll);});}if(E.btnNext){D(E.btnNext).click(function(){return K(V+E.scroll);});}if(E.btnGo){D.each(E.btnGo,function(W,X){D(X).click(function(){return K(E.circular?E.visible+W:W);});});}if(E.mouseWheel&&F.mousewheel){F.mousewheel(function(W,X){return X>0?K(V-E.scroll):K(V+E.scroll);});}if(E.auto){setInterval(function(){K(V+E.scroll);},E.auto+E.speed);}function H(){return S.slice(V).slice(0,T);}function K(X){try{if(!O){if(E.beforeStart){E.beforeStart.call(this,H());}if(E.circular){if(X<=E.start-T-1){Q.css(M,-((P-(T*2))*L)+"px");V=X==E.start-T-1?P-(T*2)-1:P-(T*2)-E.scroll;}else{if(X>=P-T+1){Q.css(M,-((T)*L)+"px");V=X==P-T+1?T+1:T+E.scroll;}else{V=X;}}}else{if(X<0||X>P-T){return false;}else{V=X;}}O=true;Q.animate(M=="left"?{left:-(V*L)}:{top:-(V*L)},E.speed,E.easing,function(){if(E.afterEnd){E.afterEnd.call(this,H());}O=false;});if(!E.circular){D(E.btnPrev).removeClass("disabled");D(E.btnNext).removeClass("disabled");D((V-E.scroll<0&&E.btnPrev)||(V+E.scroll>P-T&&E.btnNext)||[]).addClass("disabled");}}}catch(W){alert(W);}return false;}});};function B(E,F){return E!=undefined&&E[0]!=undefined?parseInt(D.css(E[0],F))||0:0;}function C(E){return E!=undefined&&E[0]!=undefined?E[0].offsetWidth+B(E,"marginLeft")+B(E,"marginRight"):0;}function A(E){return E!=undefined&&E[0]!=undefined?E[0].offsetHeight+B(E,"marginTop")+B(E,"marginBottom"):0;}})(jQuery);function Popup(A,B,D,C){if(typeof (document.popup)=="object"){if(typeof (document.popup.content)=="object"){document.popup.content.remove();}}this.init(A,B,D,C);document.popup=this;return this;}Popup.prototype={default_template:'<div class="ppfm" id="popup" style="display:none;"><table class="flogin"><tr><td class="tl"></td><td class="tb"></td><td class="tl"></td></tr><tr><td class="cl"></td><td class="cb"><div class="cb-top"><h3>Уведомление</h3><div class="close"><a href="#"></a></div><div class="clear"></div></div><div class="cb-cont"><div id="popup-content"></div></div></div></td><td class="cl"></td></tr><tr><td class="tl"></td><td class="tb"></td><td class="tl"></td></tr></table></div>',location:undefined,content:undefined,onload:function(data){if(typeof (data)=="string"){var data=eval("("+data+")");var text="";if(typeof (data.text)!="undefined"){text+=data.text;}if(typeof (data.error)!="undefined"){text+=data.error;}var default_template=$(document.popup.default_template);default_template.find("#popup-content").html(text);document.popup.changeContent(default_template);this.centerPopup();}},init:function(A,B,D,C){cleanFlashWmode(true);this.getLoader(A);if(typeof (C)=="function"){this.onload=C;}this.location=A;if(typeof (B)!="undefined"){this.processRequest(A,B,D);}this.setCloseEvent();$(".baw").css("cssText","visibility: hidden !important");$(".ba").css("cssText","visibility: hidden !important");$(".rek").css("cssText","visibility: hidden !important");$(".baw object").css("cssText","visibility: hidden !important");$(".ba object").css("cssText","visibility: hidden !important");$(".rek object").css("cssText","visibility: hidden !important");$(window).resize(function(){document.popup.centerPopup();});$(document).keypress(function(E){if(E.keyCode=="27"){document.popup.close();}});},processRequest:function(location,url,param){$.get(url,param,function(data){document.popup.content.remove();var result_type;try{result_type=typeof (eval("("+data+")"));}catch($er){result_type=undefined;}switch(result_type){case"object":document.popup.onload(data);break;default:document.popup.content=$(data);document.popup.content.find("form").submit(function(){return false;});$(location).prepend(document.popup.content);document.popup.setCloseEvent();document.loader.hide();document.popup.centerPopup();document.darkshadow.show();if(typeof (document.popup.onload)=="function"){document.popup.onload(document.popup.content);}$(".ppfm").draggable();break;}});},setCloseEvent:function(){this.content.find(".close").live("click",function(){document.popup.content.remove();document.darkshadow.hide();return false;});},getLoader:function(A){document.loader.show();this.content=$(this.default_template);$(A).prepend(this.content);},setContent:function(A){this.content.find("#popup-content").html(A);document.loader.hide();document.darkshadow.show();$(".ppfm").show();this.centerPopup();$(".ppfm").draggable();},changeContent:function(A){this.content.remove();this.content=$(A);this.content.find("form").submit(function(){return false;});$(this.location).prepend(this.content);this.content.show();this.setCloseEvent();document.loader.hide();document.darkshadow.show();this.centerPopup();},close:function(){this.content.remove();document.loader.hide();document.darkshadow.hide();},centerPopup:function(){var F=document.body.scrollLeft||document.documentElement.scrollLeft||self.pageXOffset;var B=document.body.scrollTop||document.documentElement.scrollTop||self.pageYOffset;var A=document.body.clientWidth||document.documentElement.clientWidth||self.innerWidth;var H=document.body.clientHeight||document.documentElement.clientHeight||self.innerHeight;var G=$(".ppfm").height();var E=$(".ppfm").width();var D=(A-$(".ppfm").width())/2;var C=(H-$(".ppfm").height())/2;$(".ppfm").css({position:"fixed",left:"50%","margin-left":"-"+(E/2)+"px",top:"50%","margin-top":"-"+(G/2)+"px"});$("#backgroundPopup").css({height:H});}};var lottery=null;function Lottery(D,C,A,B){this.init(D,C,A,B);return this;}Lottery.prototype={form:null,betContainer:null,betimg:null,preview:null,thumbnails:null,bet:new Array(),init:function(D,C,A,B){document.lottery=this;this.betimg=$("span.bet");this.form=B;this.betContainer=A;this.preview=C;this.thumbnails=D;this.thumbnails.mouseover(function(){var E=$(this);for(key in document.lottery.preview){if(document.lottery.preview[key].id==this.id){$(document.lottery.preview[key]).css("z-index","9998").css("position","absolute").css("left",E.position().left-15).css("top",E.position().top-15).fadeIn("fast");$("img[class=full][id!="+this.id+"]").fadeOut("fast");break;}}return true;});this.preview.live("click",function(){if(typeof (this.id)!="undefined"){var E=document.lottery.bet.length;for(i in document.lottery.bet){if(typeof (document.lottery.bet[i])=="undefined"){E=i;break;}}if(E<=6){for(x in document.lottery.bet){if(document.lottery.bet[x]==this.id){return false;}}document.lottery.bet[E]=this.id;for(id=0;id<document.lottery.thumbnails.length;id++){var F=$(document.lottery.thumbnails[id]);if(document.lottery.bet[E]==F.attr("id")){F.hide();$(document.lottery.betContainer[E]).append($("<span/>").attr("class","bet "+F.attr("class")).attr("id",F.attr("id")));$(document.lottery.betContainer[E]).find(".shirt").hide();$(this).fadeOut("fast");if(document.lottery.isCompleted()){document.lottery.activateForm();}break;}}}}return false;});this.betimg.live("click",function(){if(typeof (this.id)!="undefined"){for(key in document.lottery.bet){if(document.lottery.bet[key]==this.id){$(document.lottery.betContainer[key]).find(".bet").remove();$(document.lottery.betContainer[key]).find(".shirt").slideDown("fast");for(id=0;id<document.lottery.thumbnails.length;id++){if(document.lottery.bet[key]==document.lottery.thumbnails[id].id){$(document.lottery.thumbnails[id]).slideDown("fast");break;}}document.lottery.bet[key]=undefined;break;}}}if(document.lottery.isCompleted()){document.lottery.activateForm();}else{document.lottery.deActivateForm();}return false;});},isCompleted:function(){var A=0;for(key in this.bet){if(typeof (this.bet[key])=="undefined"){A++;}}switch(this.bet.length){case 6:if(!A){return true;}break;case 7:if(A<=1){return true;}break;default:return false;return false;}},deActivateForm:function(){if(typeof (document.lottery.form.get(0))!="undefined"){document.lottery.form.find("a.submit").get(0).onclick=function(){return false;};}},activateForm:function(){if(typeof (document.lottery.form.get(0))!="undefined"){document.lottery.form.find("a.submit").get(0).onclick=function(){$(document.lottery.form.get(0).bet).val("|"+document.lottery.bet.join("||")+"|");document.lottery.form.get(0).submit();return false;};}}};function ImageLoader(A){this.selector=A;this.image_block=$(this.selector);this.current_image=this.image_block.find("img");this.image_block.data("parent",this);this.current_image.data("parent",this);this.loadImage=function(D,C,E){var D;var C;if(this.current_image.attr("id")==E){return false;}this.image_block.animate({height:this.current_image.attr("height"),opacity:0},500);this.current_image.remove();var B=new Image();B.style.display="none";B.id=E;B.title=C;$(B).data("parent",this);B.onload=function(){var F=$(this).data("parent");if(F.current_image.attr("id")==this.id){return false;}F.image_block.append(B);F.image_block.animate({opacity:1,height:this.height},500,function(){$(B).show("fast");});};B.src=D;$(B).ready(function(){if(typeof (this.onload)=="function"){this.onload();}});};}function Loader(){document.loader=this;this.init();return this;}Loader.prototype={template:'<div class="ov-loader" style="display:none;"><img src="/img/ajax-loader.gif" alt="" /><span>Загрузка...</span></div>',init:function(){$("#body-wr").after(this.template);},show:function(){$(".ov-loader").show();},hide:function(){$(".ov-loader").hide();}};$(document).ready(function(){new Loader();});function DarkShadow(){document.darkshadow=this;this.init();return this;}DarkShadow.prototype={template:'<div id="back_panel" style="display:none;position:fixed;top:0px;left:0px;width:100%;height:100%;background:#000000;opacity: 0.3; filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);z-index:5555; "></div>',init:function(){$("#body-wr").before(this.template);},show:function(){$("#back_panel").show();},hide:function(){$("#back_panel").hide();}};$(document).ready(function(){new DarkShadow();});$().ready(function(){$("a[class=leave_blog]").live("click",function(){if(typeof (internal_url)=="object"){new Popup("#wp-admin");var C=this.parentNode;var A=$(this).find("span").attr("id");var B=$(this).find("span").attr("class");$.getJSON(internal_url.blog_leave,{blog:B,user:A},function(D){$("li[class=un]").attr("class","ss");var E=$(C).find("a");E.attr("class","join_blog");E.find("span").text(translate.blog_join);document.popup.close();});}return false;});$("a[class=join_blog]").live("click",function(){if(typeof (internal_url)=="object"){new Popup("#wp-admin");var C=this.parentNode;var A=$(this).find("span").attr("id");var B=$(this).find("span").attr("class");$.getJSON(internal_url.blog_join,{blog:B,user:A},function(D){$("li[class=ss]").attr("class","un");var E=$(C).find("a");E.attr("class","leave_blog");E.find("span").text(translate.blog_unjoin);document.popup.close();});return false;}});$("a[class=friendship_remove]").live("click",function(){if(typeof (internal_url)=="object"){new Popup("#wp-admin");var B=this.parentNode;var A=$(this).find("span").attr("id");$.getJSON(internal_url.friendship_remove,{user:A},function(C){$("li[class=uw]").attr("class","fi");var D=$(B).find("a");D.attr("class","friendship_make");D.find("span").text(translate.friendship_make);document.popup.close();});return false;}});$("a[class=friendship_make]").live("click",function(){if(typeof (internal_url)=="object"){new Popup("#wp-admin");var B=this.parentNode;var A=$(this).find("span").attr("id");$.getJSON(internal_url.friendship_make,{user:A},function(C){$("li[class=fi]").attr("class","uw");var D=$(B).find("a");D.attr("class","friendship_remove");D.find("span").text(translate.friendship_remove);document.popup.close();});return false;}});});$().ready(function(){var A=$("a[class=action_profile_comment_remove]");if(A.is("a")){A.commentRemove({callback:function(B){if(B.error){document.popup.setContent(B.error);return false;}if(B.result){var D=$().data("commentRemove");var C=D.config;$("dl[id="+C.id+"]").remove();document.popup.close();}}});}});$().ready(function(){var I=$("#newcomment");if(I.is("a")){I.openAddForm();}var A=$("a[class=action_user_ban]");if(A.is("a")){var J=A.find("span").attr("id");var G=A.find("span").attr("class");A.userBan({id:J,topic_id:G});}var F=$("a[class=action_user_block]");if(F.is("a")){var J=F.attr("id");F.userBlock({id:J});}var E=$("a[class=action_topic_disable]");if(E.is("a")){E.topicDisable();}var C=$("a[class=action_topic_enable]");if(C.is("a")){C.topicEnable();}var B=$("a[class=action_topic_remove]");if(B.is("a")){B.topicDelete();}var H=$("a[class=action_topic_vote_plus]");if(H.is("a")){H.topicVotePlus();}var D=$("a[class=action_topic_vote_minus]");if(D.is("a")){D.topicVoteMinus();}$("a[class=action_comment_vote_plus]").commentVotePlus();$("a[class=action_comment_vote_minus]").commentVoteMinus();$("span[class=action_comment_remove]>a").commentRemove();$("span[class=action_comment_response]>a").openResponseForm();$("li[class=action_comment_complain]>a").commentComplain();$("span[class=action_comment_edit]>a").openEditForm();if($(".carousel").length>1){$(".carousel").topicImageCarouselList();}else{$(".carousel").topicImageCarousel();}});$().ready(function(){var B=$("textarea[id=body]");if(B.is("textarea")){B.casinorutinymce();}var A=$("#news_announce");if(A.is("textarea")){A.casinorutinymce();}});Date.format="dd.mm.yyyy";$().ready(function(){$("a.terms").userShowTerms();$("a.feedback").live("click",function(){window.open("/feedback","Messenger","height=615,width=650");return false;});$("button.get_money").live("click",function(){new Popup("#body-wr","/lottery/ticket/getcash",{tc:this.id},function(data){data.find(".save a").click(function(){var form=document.popup.content.find("form");$.post(form.attr("action")+"&__ajax=1",{_name:form.attr("name"),wmaccount:form.find("input[id=wmaccount]").val(),comment:form.find("textarea[id=comment]").val()},function(data){document.popup.content.find("span[class=error]").remove();var data=eval("("+data+")");if(typeof (data.result)!="undefined"){if(data.result){document.popup.close();if(typeof (data.text)!="undefined"){var popup=new Popup("#body-wr");popup.setContent(data.text);setTimeout("document.popup.close()",3000);}return false;}if(typeof (data.error)!="undefined"){document.popup.content.find("label[for=wmaccount]").append("<span class='error'>"+data.error+"</span>");}}});return false;});data.find("input").keypress(function(event){if(event.keyCode==13){data.find(".save a").click();}document.popup.content.find("span[class=error]").remove();});return false;});return false;});$("a.spot_changestatus").live("click",function(){var popup=new Popup("#body-wr");try{var object=this;$.get(this.href,{__ajax:1},function(data){var data=eval("("+data+")");if(data.result){$(".spot_status").text(data.status);popup.close();}});}catch(ex){popup.setContent(ex);}return false;});$("a.addfriend").live("click",function(){try{var object=$(this);object.text("Loading...");$.get(this.href,{__ajax:1},function(data){var data=eval("("+data+")");if(data.result){if(object.attr("href").search("join")!=parseInt("-1")){object.attr("href",object.attr("href").replace("join","leave"));}else{object.attr("href",object.attr("href").replace("leave","join"));}}else{var popup=new Popup("#body-wr");popup.setContent(data.error);}object.text(data.text);});}catch(ex){alert(ex);}return false;});$("a.setreader").live("click",function(){try{var object=$(this);object.text("Loading...");$.get(this.href,{__ajax:1},function(data){var data=eval("("+data+")");if(data.result){if(object.attr("href").search("join")!=parseInt("-1")){object.attr("href",object.attr("href").replace("join","leave"));}else{object.attr("href",object.attr("href").replace("leave","join"));}}else{var popup=new Popup("#body-wr");popup.setContent(data.error);}object.text(data.text);});}catch(ex){alert(ex);}return false;});$("a.comment_hide").live("click",function(){var popup=new Popup("#body-wr");try{var object=this;$.get(this.href,{__ajax:1},function(data){var data=eval("("+data+")");if(data.error){popup.setContent(data.error);}if(data.result){$("tr:has(a[id="+object.id+"])").find(".status").text(data.status);popup.close();}});}catch(ex){popup.setContent(ex);}return false;});$("a.request_remove").live("click",function(){var popup=new Popup("#body-wr");try{var object=this;$.get(this.href,{__ajax:1},function(data){var data=eval("("+data+")");if(data.error){popup.setContent(data.error);}if(data.result){$("tr:has(a[id="+object.id+"])").remove();popup.close();}});}catch(ex){popup.setContent(ex);}return false;});$("a.md").live("click",function(){var popup=new Popup("#body-wr",this.href,{__ajax:1});return false;});$("a.messenger").live("click",function(){var jid_id=this.id;jQuery.fn.messenger.OpenChat(jid_id);return false;});$("a.comment_remove").live("click",function(){var popup=new Popup("#body-wr");try{var object=this;$.get(this.href,{__ajax:1},function(data){var data=eval("("+data+")");if(data.error){popup.setContent(data.error);}if(data.result){$count=$(".ccnt");$count.text((parseInt($count.text())-1));$("tr:has(a[id="+object.id+"])").remove();popup.close();}});}catch(ex){popup.setContent(ex);}return false;});$("a.vote").live("click",function(){var popup=new Popup("#body-wr",this.href,{__ajax:1},function(data){var data=eval("("+data+")");if(data.result){if(typeof (data.comment_id)=="string"){$("li[id=comment_"+data.comment_id+"] span[class=rate]").text(data.rating);}popup.close();}if(typeof (data.error)=="string"){var default_template=$(document.popup.default_template);default_template.find("#popup-content").html(data.error);document.popup.changeContent(default_template);}});return false;});$("h2.main_comment").live("click",function(){var form=$("div[class=comment-form]");form.find("input[name=parent_id]").val("");form.css("margin-left","0px");form.insertAfter($(this));return false;});$("div.comment-actions a.reply").live("click",function(){var form=$("div[class=comment-form]");form.find("input[name=parent_id]").val(this.id);form.css("margin-left",$(this.hash).css("margin-left"));form.insertAfter($(this.hash));return false;});$("div.grid-act a").live("click",function(){if($(this.hash+" input:checked[type=checkbox]").length){var form=$(this.hash).get(0);form._name.value=this.className;form.submit();}return false;});$("th>input[type=checkbox]").live("click",function(){var checked=this.checked;var checboxes=$(this.parentNode.parentNode.parentNode.parentNode).find("td>input[type=checkbox]");for(i=0;i<checboxes.length;i++){checboxes.get(i).checked=checked;}});$("a[class=update_capcha]").live("click",function(){updateCapcha(this.id);return false;});new Lottery($("span.tmbh"),$("img.full"),$("a.bet"),$("form[id=user_bet]"));$(".bet").mouseover(function(){$("img.full").fadeOut("fast");return false;});if($("a[id=uploader]").is("a")){var id=$("#id").val();new Ajax_upload($("a[id=uploader]"),{name:"foto",action:"/data/upload/image/topic"+(id?"?t="+id:""),onSubmit:function(file,ext){this.disable();},onComplete:function(file,response){try{var response=eval("("+response+")");if(response.result){var row=$("<tr>");column=$("<td/>");column.append($('<input type="checkbox" name="img[]" id="img" value="'+response.image.id+'" '+(response.image.checked?" checked ":"")+"/>"));row.append(column);column=$("<td/>");column.append($('<img src="'+response.image.upload_id+'" alt="'+response.image.description+'" />'));row.append(column);column=$('<td class="txt"/>');column.append($('<textarea cols="40" rows="2" class="edit" name="desc['+response.image.id+']">'+response.image.description+"</textarea>"));row.append(column);row.insertBefore($($("#fotolist tr").get(0)));}if(typeof (response.error)=="string"){var row=$("<tr>");column=$('<td colspan="3"/>');column.append($('<span class="error"/>').html(response.error));row.append(column);row.insertBefore($($("#fotolist tr").get(0)));}}catch(ex){alert(ex);}this.enable();}});}$("a[class=tabset]").live("click",function(){var links=$("a[class=tabset]");for(i=0;i<links.length;i++){if(links.get(i).hash==this.hash){$(links.get(i).hash).slideDown("fast");}else{$(links.get(i).hash).hide("fast");}}return false;});});var cleanFlashWmodeDone=false;var cleanFlashWmodes=new Array();function cleanFlashWmode(A){if(cleanFlashWmodeDone&&!A){return ;}jQuery("#content-wrapper embed").each(function(D,C){for(var B=0;B<cleanFlashWmodes.length;B++){if(cleanFlashWmodes[B]==C){return true;}}var E=this.cloneNode(true);E.setAttribute("WMode","Opaque");C=jQuery(this).before(E);jQuery(this).remove();cleanFlashWmodes.push(C[0]);});jQuery("#content-wrapper object").each(function(E,D){for(var C=0;C<cleanFlashWmodes.length;C++){if(cleanFlashWmodes[C]==D){return true;}}var H=jQuery(this).children("embed");if(typeof (H.get(0))!="undefined"){if(typeof (H.get(0).outerHTML)!="undefined"){H.attr("wmode","transparent");D=jQuery(this.outerHTML).insertAfter(this);cleanFlashWmodes.push(D[0]);jQuery(this).remove();}return true;}var G=this.attributes;var F="<OBJECT ";for(var E=0;E<G.length;E++){F+=G[E].name+'="'+G[E].value+'" ';}F+=">";var B=false;jQuery(this).children().each(function(I){if(this.nodeName=="PARAM"){if(this.name=="wmode"){B=true;F+='<PARAM NAME="'+this.name+'" VALUE="transparent">';}else{F+='<PARAM NAME="'+this.name+'" VALUE="'+this.value+'">';}}});if(!B){F+='<PARAM NAME="wmode" VALUE="transparent">';}F+="</OBJECT>";var D=jQuery(F).insertAfter(this);cleanFlashWmodes.push(D[0]);jQuery(this).remove();});cleanFlashWmodeDone=true;}function topic_remove(form){try{if(typeof (form)=="object"){var url=form.action;var name=form._name.value;$.post(url+"&__ajax=1",{_name:name},function(data){var data=eval("("+data+")");if(data.result){var row=$("tr:has(form[id="+form.id+"])");if(row.is("tr")){$count=$(".tcnt");$count.text((parseInt($count.text())-1));row.remove();}else{if(typeof (data.remove)!="undefined"){window.location="/community/blog/view?b="+data.remove.talk_id;}}document.popup.close();}});}}catch(ex){alert(ex);}return false;}function add_tags(D){try{if(typeof (D)=="object"){var A=$("input[id=tags]").val();var C=$(D).find("input:checked[type=checkbox]");for(i=0;i<C.length;i++){if(A.search(C.get(i).value)==parseInt("-1")){A+=" "+C.get(i).value;}}$("input[id=tags]").val(A);}}catch(B){alert(B);}return false;}function invite_user(form){try{var url=form.action;var name=form._name.value;var email=form.email.value;var message=form.message.value;$.post(url+"?__ajax=1",{_name:name,email:email,message:message},function(data){var data=eval("("+data+")");if(data.result){document.popup.close();}if(data.error){$("label[for=email] span[class=error]").html(data.error.email);}});}catch(ex){alert(ex);}return false;}function send_inline(form){try{$.post(form.action+"&__ajax=1",{_name:form.name,email:form.email.value},function(data){var data=eval("("+data+")");if(data.result){$("tr:has(form[id="+form.id+"]) .email").text(data.invite.email);document.popup.close();}$("label[for=email]>span.error").text(data.error);});}catch(ex){alert(ex);}return false;}function multipleTopicViewCount(){$.get(window.location.toString(),{__ajax:1,v:1});}function multiply_counter(A){if(typeof (A)!="undefined"){$.get("/community/topic/view",{t:A,v:1,__ajax:1},function(B){});}}(function(){$.fn.PanTo=function(latitude,longitude){var axonmaps=this.data("Maps").self;if(typeof (axonmaps)=="object"){axonmaps.google_api.panTo(new google.maps.LatLng(latitude,longitude));axonmaps.yandex_api.panTo(new YMaps.GeoPoint(longitude,latitude));}};$.fn.NewPosition=function(latitude,longitude){var axonmaps=this.data("Maps").self;if(typeof (axonmaps)=="object"){axonmaps.google_api.setCenter(new google.maps.LatLng(latitude,longitude));axonmaps.yandex_api.setCenter(new YMaps.GeoPoint(longitude,latitude));}};$.fn.NewPositionZoom=function(latitude,longitude,zoom){var axonmaps=this.data("Maps").self;if(typeof (axonmaps)=="object"){axonmaps.google_api.setCenter(new google.maps.LatLng(latitude,longitude));axonmaps.google_api.setZoom(zoom);axonmaps.yandex_api.setCenter(new YMaps.GeoPoint(longitude,latitude));axonmaps.yandex_api.setZoom(zoom);}};$.fn.SetBestFit=function(){var axonmaps=this.data("Maps").self;if(typeof (axonmaps)=="object"){axonmaps.google_api.setZoom(2);axonmaps.yandex_api.setZoom(2);var str="";var max_lat,max_lng;var min_lat,min_lng;if(axonmaps.config.marks_arr.length<2){axonmaps.google_api.setZoom(10);axonmaps.yandex_api.setZoom(10);return 0;}for(var i=0;i<axonmaps.config.marks_arr.length;i++){cur_mark=axonmaps.config.marks_arr[i];cur_pos=cur_mark[0].getPosition();cur_lat=cur_pos.lat();cur_lng=cur_pos.lng();str=str+"|"+cur_lat+","+cur_lng;if(typeof (max_lat)=="undefined"){max_lat=cur_lat;}if(typeof (max_lng)=="undefined"){max_lng=cur_lng;}if(typeof (min_lat)=="undefined"){min_lat=cur_lat;}if(typeof (min_lng)=="undefined"){min_lng=cur_lng;}if(max_lat<cur_lat){max_lat=cur_lat;}if(max_lng<cur_lng){max_lng=cur_lng;}if(min_lat>cur_lat){min_lat=cur_lat;}if(min_lng>cur_lng){min_lng=cur_lng;}}center_lat=(max_lat+min_lat)/2;center_lng=(max_lng+min_lng)/2;this.NewPosition(center_lat,center_lng);flag_zoom=1;j=0;while((flag_zoom==1)&&(j<20)){var bounds=axonmaps.google_api.getBounds();if(typeof (bounds)=="undefined"){console.debug("ошибка! не могу определить координаты! "+bounds);}var new_min_lat=bounds.getSouthWest().lat();var new_min_lng=bounds.getSouthWest().lng();var new_max_lat=bounds.getNorthEast().lat();var new_max_lng=bounds.getNorthEast().lng();if((new_min_lat<min_lat)&&(new_min_lng<min_lng)&&(new_max_lat>max_lat)&&(new_max_lng>max_lng)){axonmaps.google_api.setZoom(axonmaps.google_api.getZoom()+1);axonmaps.yandex_api.setZoom(axonmaps.yandex_api.getZoom()+1);}else{if(axonmaps.google_api.getZoom()>2){axonmaps.google_api.setZoom(axonmaps.google_api.getZoom()-2);axonmaps.yandex_api.setZoom(axonmaps.yandex_api.getZoom()-2);}flag_zoom=0;}j++;}axonmaps.yandex_api.setZoom(axonmaps.google_api.getZoom());return axonmaps.config.marks_arr.length;}};$.fn.SetNewMark=function(latitude,longitude,mesg,options_array){options_array=$.extend({image:"/img/map_point.png",myclass:"myclass",click_event:"",dblclick_event:"",draggable:false,y_style:undefined},options_array);var axonmaps=this.data("Maps").self;if(typeof (axonmaps)=="object"){var self=this;var image_icon=new google.maps.MarkerImage(options_array.image,new google.maps.Size(26,45),new google.maps.Point(0,0),new google.maps.Point(20,45));var myLatLng=new google.maps.LatLng(latitude,longitude);var marker=new google.maps.Marker({draggable:options_array.draggable,position:myLatLng,map:axonmaps.google_api,icon:image_icon,title:mesg,elID:self.id});google.maps.event.addListener(marker,"click",function(){if(options_array.click_event!=""){eval(options_array.click_event);}self.NewPosition(latitude,longitude);});google.maps.event.addListener(marker,"dblclick",function(){if(options_array.dblclick_event!=""){eval(options_array.dblclick_event);}self.NewPosition(latitude,longitude);var zoom=axonmaps.google_api.getZoom();axonmaps.google_api.setZoom(zoom+1);axonmaps.yandex_api.setCenter(new YMaps.GeoPoint(longitude,latitude));axonmaps.yandex_api.setZoom(zoom+1);});if(typeof (y_style)=="undefined"){var y_style=new YMaps.Style();y_style.iconStyle=new YMaps.IconStyle();y_style.iconStyle.href=options_array.image;y_style.iconStyle.size=new YMaps.Point(26,45);y_style.iconStyle.offset=new YMaps.Point(-20,-45);y_style.iconStyle.shadow=new YMaps.IconShadowStyle();}var placemark=new YMaps.Placemark(new YMaps.GeoPoint(longitude,latitude),{draggable:options_array.draggable,hasBalloon:false,style:y_style});YMaps.Events.observe(placemark,placemark.Events.Click,function(obj){if(options_array.click_event!=""){eval(options_array.click_event);}self.NewPosition(latitude,longitude);});YMaps.Events.observe(placemark,placemark.Events.DblClick,function(obj){if(options.dblclick_event!=""){eval(options_array.dblclick_event);}self.NewPosition(latitude,longitude);var zoom=axonmaps.yandex_api.getZoom();axonmaps.yandex_api.setZoom(zoom+1);axonmaps.google_api.setZoom(zoom+1);});axonmaps.yandex_api.addOverlay(placemark);return[marker,placemark];}};$.fn.SetNewMarkInfo=function(latitude,longitude,mesg,contentString,options_array){var axonmaps=this.data("Maps").self;if(typeof (axonmaps)=="object"){var pgmap=axonmaps.google_api;var pymap=axonmaps.yandex_api;var self=this;options_array=$.extend({image:"/img/map_point.png",myclass:"myclass",click_event:"",dblclick_event:"",draggable:false,y_style:undefined},options_array);var infowindow=new google.maps.InfoWindow({content:contentString});var myLatLng=new google.maps.LatLng(latitude,longitude);var image_icon=new google.maps.MarkerImage(options_array.image,new google.maps.Size(26,45),new google.maps.Point(0,0),new google.maps.Point(20,45));var marker=new google.maps.Marker({position:myLatLng,map:pgmap,icon:image_icon,title:mesg});google.maps.event.addListener(marker,"click",function(){if(options_array.click_event!=""){eval(options_array.click_event);}infowindow.open(pgmap,marker);});google.maps.event.addListener(marker,"dblclick",function(){if(options_array.dblclick_event!=""){eval(options_array.dblclick_event);}self.NewPosition(latitude,longitude);pgmap.setZoom(pgmap.getZoom()+1);});if(typeof (options_array.y_style)=="undefined"){var y_style=new YMaps.Style();y_style.iconStyle=new YMaps.IconStyle();y_style.iconStyle.href=options_array.image;y_style.iconStyle.size=new YMaps.Point(26,45);y_style.iconStyle.offset=new YMaps.Point(-20,-45);y_style.iconStyle.shadow=new YMaps.IconShadowStyle();y_style.balloonContentStyle=new YMaps.BalloonContentStyle(new YMaps.Template('<div style="color:green">'+contentString+" </div>"));}else{y_style=options_array.y_style;}var placemark=new YMaps.Placemark(new YMaps.GeoPoint(longitude,latitude),{style:y_style});pymap.addOverlay(placemark);if(typeof (axonmaps.config.marks_arr)=="undefined"){marks_cnt=0;}else{marks_cnt=axonmaps.config.marks_arr.length;}axonmaps.config.marks_arr[marks_cnt]={0:marker,1:placemark};return[marker,placemark];}};$.fn.SetNewMarkInfoList=function(marks,options_array){var axonmaps=this.data("Maps").self;if(typeof (axonmaps)=="object"){axonmaps.google_api.setZoom(2);var max_lat,max_lng;var min_lat,min_lng;for(var i=0;i<marks.length;i++){cur_mark=marks[i];if(typeof (max_lat)=="undefined"){max_lat=cur_mark[0];}if(typeof (max_lng)=="undefined"){max_lng=cur_mark[1];}if(typeof (min_lat)=="undefined"){min_lat=cur_mark[0];}if(typeof (min_lng)=="undefined"){min_lng=cur_mark[1];}if(max_lat<cur_mark[0]){max_lat=cur_mark[0];}if(max_lng<cur_mark[1]){max_lng=cur_mark[1];}if(min_lat>cur_mark[0]){min_lat=cur_mark[0];}if(min_lng>cur_mark[1]){min_lng=cur_mark[1];}}center_lat=(max_lat+min_lat)/2;center_lng=(max_lng+min_lng)/2;this.NewPosition(center_lat,center_lng);flag_zoom=1;j=0;while((flag_zoom==1)&&(j<20)){var bounds=axonmaps.google_api.getBounds();var new_min_lat=bounds.getSouthWest().lat();var new_min_lng=bounds.getSouthWest().lng();var new_max_lat=bounds.getNorthEast().lat();var new_max_lng=bounds.getNorthEast().lng();if((new_min_lat<min_lat)&&(new_min_lng<min_lng)&&(new_max_lat>max_lat)&&(new_max_lng>max_lng)){axonmaps.google_api.setZoom(axonmaps.google_api.getZoom()+1);}else{if(axonmaps.google_api.getZoom()>2){axonmaps.google_api.setZoom(axonmaps.google_api.getZoom()-1);}flag_zoom=0;}j++;}axonmaps.yandex_api.setZoom(axonmaps.google_api.getZoom());for(var i=0;i<marks.length;i++){cur_mark=marks[i];this.SetNewMarkInfo(cur_mark[0],cur_mark[1],cur_mark[2],cur_mark[3],options_array);}}};$.fn.Maps=function(config){config=$.extend({url_gmap_api:"",url_ymap_api:"",template:'<div id="yandex" style="position: absolute;z-index: 1;"></div><div id="google" style="position: absolute;z-index: 1;"></div><div class="btn-sat"><a href="#" id="google_key">Спутник</a></div><div class="btn-map"><a href="#" id="yandex_key" class="active">Карта</a></div><div class="scale">Масштаб<a class="in" id="zoom_in" href="#"></a><a class="out" id="zoom_out" href="#"></a></div>',gmap:"#google",ymap:"#yandex",gmap_btn:"#google_key",ymap_btn:"#yandex_key",zoom_in:"#zoom_in",zoom_out:"#zoom_out",latitude:"55.753559",langitude:"37.609218",height:440,width:580,zoom:10,top:"google",marks_arr:new Array()},config);new Maps(this,config);return this;};function Maps(distination,config){this.__construct(distination,config);return this;}Maps.prototype={google_api:undefined,yandex_api:undefined,config:undefined,distination:undefined,initGoogleMap:function(){var coordinates=new google.maps.LatLng(this.config.latitude,this.config.langitude);var gmap_options={zoom:this.config.zoom,center:coordinates,mapTypeControl:false,scaleControl:false,navigationControl:false,mapTypeId:google.maps.MapTypeId.HYBRID};this.google_api=new google.maps.Map(this.distination.find(this.config.gmap).get(0),gmap_options);this.google_api.disableDoubleClickZoom=true;this.google_api.scrollwheel=true;this.distination.find(this.config.gmap).height(this.config.height);this.distination.find(this.config.gmap).width(this.config.width);},initYandexMap:function(){this.yandex_api=new YMaps.Map(this.distination.find(this.config.ymap).get(0));coordinates=new YMaps.GeoPoint(this.config.langitude,this.config.latitude);this.yandex_api.setCenter(coordinates,this.config.zoom,YMaps.MapType.MAP);this.yandex_api.disableDblClickZoom();this.yandex_api.enableScrollZoom();this.distination.find(this.config.ymap).height(this.config.height);this.distination.find(this.config.ymap).width(this.config.width);},displayMap:function(code){switch(code){case"google":this.google_api.setZoom(this.yandex_api.getZoom());var coordinates=this.yandex_api.getCenter();this.google_api.setCenter(new google.maps.LatLng(coordinates.getLat(),coordinates.getLng()));this.distination.find(this.config.gmap).animate({opacity:"show"},1000);this.distination.find(this.config.gmap_btn).attr("class","active");this.distination.find(this.config.ymap).animate({opacity:"hide"},1000);this.distination.find(this.config.ymap_btn).removeAttr("class");break;case"yandex":default:this.yandex_api.setZoom(this.google_api.getZoom());this.yandex_api.setCenter(new YMaps.GeoPoint(this.google_api.center.lng(),this.google_api.center.lat()));this.distination.find(this.config.ymap).animate({opacity:"show"},1000);this.distination.find(this.config.ymap_btn).attr("class","active");this.distination.find(this.config.gmap).animate({opacity:"hide"},1000);this.distination.find(this.config.gmap_btn).removeAttr("class");break;}},setZoomInAction:function(){var zoom_in_object=this.distination.find(this.config.zoom_in);zoom_in_object.data("Maps",{self:this});zoom_in_object.live("click",function(){var axonmaps=$(this).data("Maps").self;axonmaps.yandex_api.setZoom(axonmaps.yandex_api.getZoom()+1);axonmaps.google_api.setZoom(axonmaps.google_api.getZoom()+1);return false;});},setZoomOutAction:function(){var zoom_out_object=this.distination.find(this.config.zoom_out);zoom_out_object.data("Maps",{self:this});zoom_out_object.live("click",function(){var axonmaps=$(this).data("Maps").self;axonmaps.yandex_api.setZoom(axonmaps.yandex_api.getZoom()-1);axonmaps.google_api.setZoom(axonmaps.google_api.getZoom()-1);return false;});},setYandexButton:function(){var yandex_button_object=this.distination.find(this.config.ymap_btn);yandex_button_object.data("Maps",{self:this});yandex_button_object.live("click",function(){var axonmaps=$(this).data("Maps").self;var axonmaps=$(this).data("Maps").self;axonmaps.displayMap("yandex");return false;});},setGoogleButton:function(){var google_button_object=this.distination.find(this.config.gmap_btn);google_button_object.data("Maps",{self:this});google_button_object.live("click",function(){var axonmaps=$(this).data("Maps").self;axonmaps.displayMap("google");return false;});},__construct:function(distination,config){this.config=config;this.distination=distination;this.distination.html(this.config.template);this.initGoogleMap();this.initYandexMap();this.displayMap(this.config.top);this.setZoomInAction();this.setZoomOutAction();this.setYandexButton();this.setGoogleButton();this.distination.data("Maps",{self:this});}};jQuery.fn.AxonMaps=function(config){this.init(config);return this;};jQuery.fn.AxonMaps.prototype={me:this,pgmap:undefined,pymap:undefined,elID:undefined,marks_arr:new Array(),ales:function(){alert(this.elID);},dynjs:function(url_){var type_="js";var is_exist=false;var tag="script";var objects=document.getElementsByTagName(tag);var src="src";for(var i=0;i<objects.length;i++){var elem=objects[i];if(elem.getAttribute(src)==url_){is_exist=true;}}if(is_exist){return ;}var _elem=document.createElement(tag);var type="text/javascript";_elem.setAttribute("type",type);_elem.setAttribute(src,url_);document.getElementsByTagName("head")[0].appendChild(_elem);},include:function(script_filename,timeout){var f=function(){var html_doc=document.getElementsByTagName("head").item(0);var js=document.createElement("script");js.setAttribute("language","javascript");js.setAttribute("type","text/javascript");js.setAttribute("src",script_filename);html_doc.appendChild(js);};if(timeout!=null){setTimeout(f,timeout);}else{f();}},init:function(meconfig){meconfig=jQuery.extend({gmap_api:"http://maps.google.com/maps/api/js?sensor=true",ymap_api:"http://api-maps.yandex.ru/1.1/index.xml?key=APtfIksBAAAAXmwRaQMAkATitfCY-W360zB1wuXAtLrmABkAAAAAAAAAAABo065SpfEi6UMhb9fxVQviw11qQQ==",gmap:undefined,ymap:undefined,gmap_btn:undefined,ymap_btn:undefined,zoom_in:undefined,zoom_out:undefined,div_id:undefined,pLat:undefined,pLng:undefined,pHeight:undefined,pWidth:undefined,pZoom:undefined,startMap:undefined},meconfig);this.config=meconfig;config=this.config;this.elID=meconfig.div_id;var div_id=meconfig.div_id;$("#"+this.elID).data("AxonMaps",{id:div_id,self:this});if(typeof (config.gmap)!="object"){config.gmap=jQuery(config.gmap);}if(typeof (config.ymap)!="object"){config.ymap=jQuery(config.ymap);}jQuery("#"+config.div_id).css("width",config.pWidth+"px").css("height",config.pHeight+"px").html('<div id="'+config.div_id+'_y" style="position: absolute;z-index: 1;"></div><div id="'+config.div_id+'_g" style="position: absolute;z-index: 1;"></div><div class="data" id="balloon" style="display:none;"><a href="#" id="closeBalloon" class="close"></a><div class="body"><div class="title"><a href="#" id="b_casino"></a></div><p><b>Рейтинг:</b> <img src="/img/cas-rate-rate.jpg" width="65" height="15" alt="" /></p><p><b>Адрес:</b><span id="b_address"></span></p><p><b> Время работы:</b><span id="b_worktime"></span></p></div><div class="bottom"></div></div><div class="btn-sat"><a href="#" id="'+config.div_id+'_GlKey">Спутник</a></div><div class="btn-map"><a class="active" href="#" id="'+config.div_id+'_YaKey">Карта</a></div><div class="scale">Масштаб<a class="in" id="'+config.div_id+'_zoomIn" href="#"></a><a class="out" id="'+config.div_id+'_zoomOut" href="#"></a></div>  </div></div>');var div_g=document.getElementById(config.div_id+"_g");jQuery("#"+config.div_id+"_g").height(config.pHeight);jQuery("#"+config.div_id+"_g").width(config.pWidth);if(config.startMap=="G"){jQuery("#"+config.div_id+"_g").show();jQuery("#"+config.div_id+"_y").hide();jQuery("#"+config.div_id+"_GlKey").attr("class","active");jQuery("#"+config.div_id+"_YaKey").removeAttr("class");}var latlng=new google.maps.LatLng(config.pLat,config.pLng);var myOptions={zoom:config.pZoom,center:latlng,mapTypeControl:false,scaleControl:false,navigationControl:false,mapTypeId:google.maps.MapTypeId.HYBRID};gmap=new google.maps.Map(div_g,myOptions);this.pgmap=gmap;gmap.disableDoubleClickZoom=true;gmap.scrollwheel=true;google.maps.event.addListener(gmap,"click",function(event){});function placeMarker(location){var clickedLocation=new google.maps.LatLng(location);var marker=new google.maps.Marker({position:location,map:gmap});gmap.setCenter(location);}var div_y=document.getElementById(config.div_id+"_y");jQuery("#"+config.div_id+"_y").height(config.pHeight);jQuery("#"+config.div_id+"_y").width(config.pWidth);var ymap=new YMaps.Map(div_y);ymap.disableDblClickZoom();ymap.setCenter(new YMaps.GeoPoint(config.pLng,config.pLat),config.pZoom,YMaps.MapType.MAP);if(config.startMap=="Y"){jQuery("#"+config.div_id+"_y").show();jQuery("#"+config.div_id+"_YaKey").attr("class","active");jQuery("#"+config.div_id+"_GlKey").removeAttr("class");}this.pymap=ymap;ymap.enableScrollZoom();jQuery("#"+config.div_id+"_zoomIn").click(function(event){var self=$("#"+div_id).data("AxonMaps").self;self.pymap.setZoom(self.pymap.getZoom()+1);self.pgmap.setZoom(self.pgmap.getZoom()+1);a=self.pymap.getZoom();b=self.pgmap.getZoom();event.preventDefault();});jQuery("#"+config.div_id+"_zoomOut").click(function(event){var self=$("#"+div_id).data("AxonMaps").self;self.pymap.setZoom(self.pymap.getZoom()-1);self.pgmap.setZoom(self.pgmap.getZoom()-1);a=self.pymap.getZoom();b=self.pgmap.getZoom();event.preventDefault();});jQuery("#"+config.div_id+"_GlKey").click(function(event){var ii=$("#"+div_id).data("AxonMaps").id;var self=$("#"+div_id).data("AxonMaps").self;self.pgmap.setZoom(self.pymap.getZoom());var curpos=self.pymap.getCenter();self.pgmap.setCenter(new google.maps.LatLng(curpos.getLat(),curpos.getLng()));jQuery("#"+div_id+"_g").animate({opacity:"show"},1000);jQuery("#"+div_id+"_y").animate({opacity:"hide"},1000);jQuery("#"+div_id+"_GlKey").attr("class","active");jQuery("#"+div_id+"_YaKey").removeAttr("class");event.preventDefault();});jQuery("#"+config.div_id+"_YaKey").click(function(event){var self=$("#"+div_id).data("AxonMaps").self;self.pymap.setZoom(self.pgmap.getZoom());curLat=self.pgmap.center.Ia;curLng=self.pgmap.center.Ja;self.pymap.setCenter(new YMaps.GeoPoint(curLng,curLat));jQuery("#"+div_id+"_y").animate({opacity:"show"},1000);jQuery("#"+div_id+"_g").animate({opacity:"hide"},1000);jQuery("#"+div_id+"_YaKey").attr("class","active");jQuery("#"+div_id+"_GlKey").removeAttr("class");event.preventDefault();});jQuery(".YMaps-logo").remove();jQuery(".YMaps-copyrights").remove();},PanTo:function(nlat,nlng){this.pgmap.panTo(new google.maps.LatLng(nlat,nlng));this.pymap.panTo(new YMaps.GeoPoint(nlng,nlat));},NewPosition:function(nlat,nlng){var nlatlng=new google.maps.LatLng(nlat,nlng);this.pgmap.setCenter(nlatlng);this.pymap.setCenter(new YMaps.GeoPoint(nlng,nlat));},NewPositionZoom:function(nlat,nlng,zoom){var nlatlng=new google.maps.LatLng(nlat,nlng);this.pgmap.setCenter(nlatlng);this.pymap.setCenter(new YMaps.GeoPoint(nlng,nlat));this.pymap.setZoom(zoom);this.pgmap.setZoom(zoom);},SetBestFit:function(){this.pgmap.setZoom(2);this.pymap.setZoom(2);var str="";var max_lat,max_lng;var min_lat,min_lng;if(this.marks_arr.length<2){this.pgmap.setZoom(10);this.pymap.setZoom(10);return 0;}for(var i=0;i<this.marks_arr.length;i++){cur_mark=this.marks_arr[i];cur_pos=cur_mark[0].getPosition();cur_lat=cur_pos.lat();cur_lng=cur_pos.lng();str=str+"|"+cur_lat+","+cur_lng;if(typeof (max_lat)=="undefined"){max_lat=cur_lat;}if(typeof (max_lng)=="undefined"){max_lng=cur_lng;}if(typeof (min_lat)=="undefined"){min_lat=cur_lat;}if(typeof (min_lng)=="undefined"){min_lng=cur_lng;}if(max_lat<cur_lat){max_lat=cur_lat;}if(max_lng<cur_lng){max_lng=cur_lng;}if(min_lat>cur_lat){min_lat=cur_lat;}if(min_lng>cur_lng){min_lng=cur_lng;}}center_lat=(max_lat+min_lat)/2;center_lng=(max_lng+min_lng)/2;this.NewPosition(center_lat,center_lng);flag_zoom=1;j=0;while((flag_zoom==1)&&(j<20)){var bounds=this.pgmap.getBounds();if(typeof (bounds)=="undefined"){console.debug("ошибка! не могу определить координаты! "+bounds);}var new_min_lat=bounds.getSouthWest().lat();var new_min_lng=bounds.getSouthWest().lng();var new_max_lat=bounds.getNorthEast().lat();var new_max_lng=bounds.getNorthEast().lng();if((new_min_lat<min_lat)&&(new_min_lng<min_lng)&&(new_max_lat>max_lat)&&(new_max_lng>max_lng)){this.pgmap.setZoom(this.pgmap.getZoom()+1);this.pymap.setZoom(this.pymap.getZoom()+1);}else{if(this.pgmap.getZoom()>2){this.pgmap.setZoom(this.pgmap.getZoom()-2);this.pymap.setZoom(this.pymap.getZoom()-2);}flag_zoom=0;}j++;}this.pymap.setZoom(this.pgmap.getZoom());return this.marks_arr.length;},SetNewMarkInfoList:function(marks,options_array){this.pgmap.setZoom(2);var max_lat,max_lng;var min_lat,min_lng;for(var i=0;i<marks.length;i++){cur_mark=marks[i];if(typeof (max_lat)=="undefined"){max_lat=cur_mark[0];}if(typeof (max_lng)=="undefined"){max_lng=cur_mark[1];}if(typeof (min_lat)=="undefined"){min_lat=cur_mark[0];}if(typeof (min_lng)=="undefined"){min_lng=cur_mark[1];}if(max_lat<cur_mark[0]){max_lat=cur_mark[0];}if(max_lng<cur_mark[1]){max_lng=cur_mark[1];}if(min_lat>cur_mark[0]){min_lat=cur_mark[0];}if(min_lng>cur_mark[1]){min_lng=cur_mark[1];}}center_lat=(max_lat+min_lat)/2;center_lng=(max_lng+min_lng)/2;this.NewPosition(center_lat,center_lng);flag_zoom=1;j=0;while((flag_zoom==1)&&(j<20)){var bounds=this.pgmap.getBounds();var new_min_lat=bounds.getSouthWest().lat();var new_min_lng=bounds.getSouthWest().lng();var new_max_lat=bounds.getNorthEast().lat();var new_max_lng=bounds.getNorthEast().lng();if((new_min_lat<min_lat)&&(new_min_lng<min_lng)&&(new_max_lat>max_lat)&&(new_max_lng>max_lng)){this.pgmap.setZoom(this.pgmap.getZoom()+1);}else{if(this.pgmap.getZoom()>2){this.pgmap.setZoom(this.pgmap.getZoom()-1);}flag_zoom=0;}j++;}this.pymap.setZoom(this.pgmap.getZoom());for(var i=0;i<marks.length;i++){cur_mark=marks[i];this.SetNewMarkInfo(cur_mark[0],cur_mark[1],cur_mark[2],cur_mark[3],options_array);}},SetNewMarkInfo:function(nlat,nlng,mesg,contentString,options_array){pgmap=this.pgmap;pymap=this.pymap;var self=$("#"+this.elID).data("AxonMaps").self;if(typeof (options_array)=="undefined"){var options_array={};}var options={image:options_array.image||"/img/map_point.png",myclass:options_array.myclass||"myclass",click_event:options_array.click_event||"",dblclick_event:options_array.dblclick_event||"",y_style:options_array.y_style||undefined};var infowindow=new google.maps.InfoWindow({content:contentString});var image="/img/map_point.png";var myLatLng=new google.maps.LatLng(nlat,nlng);var image_icon=new google.maps.MarkerImage(options.image,new google.maps.Size(26,45),new google.maps.Point(0,0),new google.maps.Point(20,45));var marker=new google.maps.Marker({position:myLatLng,map:self.pgmap,icon:image_icon,title:mesg});google.maps.event.addListener(marker,"click",function(){if(options.click_event!=""){eval(options.click_event);}infowindow.open(self.pgmap,marker);});google.maps.event.addListener(marker,"dblclick",function(){if(options.dblclick_event!=""){eval(options.dblclick_event);}self.NewPosition(nlat,nlng);self.pgmap.setZoom(self.pgmap.getZoom()+1);});if(typeof (options.y_style)=="undefined"){var y_style=new YMaps.Style();y_style.iconStyle=new YMaps.IconStyle();y_style.iconStyle.href=options.image;y_style.iconStyle.size=new YMaps.Point(26,45);y_style.iconStyle.offset=new YMaps.Point(-20,-45);y_style.iconStyle.shadow=new YMaps.IconShadowStyle();y_style.balloonContentStyle=new YMaps.BalloonContentStyle(new YMaps.Template('<div style="color:green">'+contentString+" </div>"));}else{y_style=options.y_style;}var placemark=new YMaps.Placemark(new YMaps.GeoPoint(nlng,nlat),{style:y_style});self.pymap.addOverlay(placemark);if(typeof (self.marks_arr)=="undefined"){marks_cnt=0;}else{marks_cnt=self.marks_arr.length;}self.marks_arr[marks_cnt]={0:marker,1:placemark};return[marker,placemark];},SetNewMark:function(nlat,nlng,mesg,options_array){var self=$("#"+this.elID).data("AxonMaps").self;if(typeof (options_array)=="undefined"){var options_array={};}var options={image:options_array.image||"/img/map_point.png",myclass:options_array.myclass||"myclass",click_event:options_array.click_event||"",dblclick_event:options_array.dblclick_event||"",draggable:options_array.draggable||false,y_style:undefined||options_array.y_style};var image="/img/map_point.png";var image_icon=new google.maps.MarkerImage(options.image,new google.maps.Size(26,45),new google.maps.Point(0,0),new google.maps.Point(20,45));var myLatLng=new google.maps.LatLng(nlat,nlng);var marker=new google.maps.Marker({draggable:options.draggable,position:myLatLng,map:self.pgmap,icon:image_icon,title:mesg,elID:self.id});var elID=self.elID;google.maps.event.addListener(marker,"click",function(){var self=$("#"+elID).data("AxonMaps").self;if(options.click_event!=""){eval(options.click_event);}self.NewPosition(nlat,nlng);});google.maps.event.addListener(marker,"dblclick",function(){var self=$("#"+elID).data("AxonMaps").self;if(options.dblclick_event!=""){eval(options.dblclick_event);}self.NewPosition(nlat,nlng);self.pgmap.setZoom(self.pgmap.getZoom()+1);});if(typeof (y_style)=="undefined"){var y_style=new YMaps.Style();y_style.iconStyle=new YMaps.IconStyle();y_style.iconStyle.href=options.image;y_style.iconStyle.size=new YMaps.Point(26,45);y_style.iconStyle.offset=new YMaps.Point(-13,-45);y_style.iconStyle.shadow=new YMaps.IconShadowStyle();}var placemark=new YMaps.Placemark(new YMaps.GeoPoint(nlng,nlat),{draggable:options.draggable,hasBalloon:false,style:y_style});YMaps.Events.observe(placemark,placemark.Events.Click,function(obj){var self=$("#"+elID).data("AxonMaps").self;if(options.click_event!=""){eval(options.click_event);}self.NewPosition(nlat,nlng);});YMaps.Events.observe(placemark,placemark.Events.DblClick,function(obj){var self=$("#"+elID).data("AxonMaps").self;if(options.dblclick_event!=""){eval(options.dblclick_event);}self.NewPosition(nlat,nlng);self.pymap.setZoom(self.pymap.getZoom()+1);});self.pymap.addOverlay(placemark);return[marker,placemark];}};})();(function(){jQuery.fn.messenger=function(A){var C=this;var B=null;};jQuery.fn.messenger.OpenChat=function(A){if(A==""){var B=window.open("/messenger","Messenger","height=500,width=700");B.focus();}else{if((jQuery.fn.messenger.messengerHandler!=null)&&(typeof (jQuery.fn.messenger.messengerHandler.xmpp2js)!="undefined")){jQuery.fn.messenger.messengerHandler.xmpp2js.openchatBox(A);jQuery.fn.messenger.messengerHandler.focus();}else{var B=window.open("/messenger","Messenger","height=500,width=700");pnewwin=B;setTimeout("CheckObjectMessenger('"+A+"')",1000);}}};})();var pnewwin=null;function CheckObjectMessenger(A){if(typeof (pnewwin.xmpp2js)=="undefined"){setTimeout("CheckObjectMessenger('"+A+"')",1000);}else{pnewwin.xmpp2js.openchatBox(A);}}var ready=false;var new_icon,y_style;var gmark;var ymark;var gmap;var ymap;var newfileaploded=false;var image_loaded=false;var fileSelected=false;var videoUpload=false;var current="y";var current_opened_game=0;$(document).ready(function(){ready=true;if(typeof (current_page_code)=="undefined"){current_page_code=0;}if(current_page_code==1){$("#popupClose").click(function(event){event.preventDefault();hidePopUp();$("#add_edit_form").html("");});$("#add_new").click(function(event){editAction(0);event.preventDefault();});$("#hide").click(function(event){hidePopUp();event.preventDefault();});$("#actions_selector").click(function(event){$("input[name='id[]']").each(function(i){$(this).attr("checked",$("#actions_selector").attr("checked"));});});$("#publ_action").click(function(event){updateGrid("activate");event.preventDefault();});$("#hide_action").click(function(event){updateGrid("deactivate");event.preventDefault();});$("#del_action").click(function(event){updateGrid("delete");event.preventDefault();});function updateGrid(action){var checkedId=$("input[name='id[]']:checked");var ids=new Array();for(var k=0;k<checkedId.length;k++){ids[k]=checkedId[k].value;}if(ids.length>0){$.get("/data/update_actions",{casino_id:casino_id,ids:ids.toString(),action:action},function(data){if(trim(data)=="done"){window.location.href=window.location.href;}});}}}else{if(current_page_code==4){$("#popupClose").click(function(event){event.preventDefault();hidePopUp();document.darkshadow.hide();});$("#addnew").click(function(event){editLocation(0);event.preventDefault();});$("#locations_selector").click(function(event){$("input[name='id[]']").each(function(i){$(this).attr("checked",$("#locations_selector").attr("checked"));});});}else{if(current_page_code==5){$(".edit").change(function(event){$("#save_2").attr("class","b-small-t1");});$(".tbls input").change(function(event){$("#save_3").attr("class","b-small-t1");});$(".bon input").change(function(event){$("#save_4").attr("class","b-small-t1");});$(".o_t input").keydown(function(event){if(!((event.keyCode>47&&event.keyCode<58)||(event.keyCode>95&&event.keyCode<106)||event.keyCode==8||event.keyCode==46||event.keyCode==37||event.keyCode==39||event.keyCode==9)){event.preventDefault();}});$(".t_t input").keydown(function(event){var class_n=$(this).attr("class");if(!class_n||class_n=="c"){if(!((event.keyCode>47&&event.keyCode<58)||(event.keyCode>95&&event.keyCode<106)||event.keyCode==8||event.keyCode==46||event.keyCode==37||event.keyCode==39||event.keyCode==9)){event.preventDefault();}}});$("#c_game_1_name").keyup(function(event){var c_game_1_name=$(this).val();if(c_game_1_name.length>32){$(this).val(c_game_1_name.slice(0,32));}});$("#c_game_2_name").keyup(function(event){var c_game_2_name=$(this).val();if(c_game_2_name.length>32){$(this).val(c_game_2_name.slice(0,32));}});$("#c_game_3_name").keyup(function(event){var c_game_3_name=$(this).val();if(c_game_3_name.length>32){$(this).val(c_game_3_name.slice(0,32));}});$("#url").keyup(function(event){var url=$(this).val();if(url.length>255){$(this).val(url.slice(0,255));}});$("#custom1").keyup(function(event){var custom1=$(this).val();if(custom1.length>64){$(this).val(custom1.slice(0,64));}});$("#custom2").keyup(function(event){var custom2=$(this).val();if(custom2.length>64){$(this).val(custom2.slice(0,64));}});$("#custom3").keyup(function(event){var custom3=$(this).val();if(custom3.length>64){$(this).val(custom3.slice(0,64));}});$("#save_1, #save_2, #save_3, #save_4").click(function(event){event.preventDefault();no_error=true;$(".cont label span").remove();var url=$(".cont input").eq(1).val();if(url!=""&&!url.match(/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/)){$(".cont label").eq(1).append('<span class="error">Введите правильный вебсайт.</span>');no_error=false;}var description=trim($(".cont textarea").val());if(description==""){$(".cont label").eq(2).append('<span class="error">Это поле не может быть пустым.</span>');no_error=false;}if(description.length>1024){$(".cont label").eq(2).append('<span class="error">Максимальное колличество символов 1024.</span>');no_error=false;}if($("#selected1").attr("checked")&&trim($("#custom1").val())==""){$(".cont label").eq(4).append('<span class="error">Введите название бонуса.</span>');no_error=false;}if($("#selected2").attr("checked")&&trim($("#custom2").val())==""){$(".cont label").eq(4).append('<span class="error">Введите название бонуса.</span>');no_error=false;}if($("#selected3").attr("checked")&&trim($("#custom3").val())==""){$(".cont label").eq(4).append('<span class="error">Введите название бонуса.</span>');no_error=false;}if(no_error){$("#main_form").submit();}});}else{if(current_page_code==6){$("#popupClose").click(function(event){event.preventDefault();hidePopUp();});$("#gallery_selector").click(function(event){$("input[name='id[]']").each(function(i){$(this).attr("checked",$("#gallery_selector").attr("checked"));});});$("#del_selected").click(function(event){var checkedId=$("input[name='id[]']:checked");var ids=new Array();for(var k=0;k<checkedId.length;k++){ids[k]=checkedId[k].value;}if(ids.length>0){$.get("/data/delete_photos",{casino_id:casino_id,ids:ids.toString()},function(data){if(trim(data)=="done"){window.location.href=window.location.href;}});}event.preventDefault();});}else{if(current_page_code==7){$("#main_gallery_list").jCarouselLite({btnNext:".righta a",btnPrev:".lefta a",visible:8,scroll:1,circular:true});$("#close_gallery_popup").click(function(event){event.preventDefault();$("#cas-form").hide();});}else{if(current_page_code==8){$("form[id=add_news] textarea[id=article]").wysiwyg();$("form[id=add_news] input[id=news_date]").datePicker();new AjaxUpload("#upload_button",{action:"/data/add_news_image",name:"image",onComplete:function(file,response){var response=eval("("+response+")");if(typeof (response.result)!="undefined"){image_loaded=true;$("#upload_id").val(response.upload_id);$("#image").attr("src",response.image);}if(typeof (response.error)!="undefined"){alert(response.error);}}});$("#del_image").click(function(event){event.preventDefault();var up_id=$("#upload_id").val();if(trim(up_id)!=""&&IsNumeric(up_id)&&image_loaded){$.get("/data/delete_image?image="+up_id,function(data){if(data=="done"){$("#upload_id").val("");$("#image").attr("src","");image_loaded=false;}else{alert(data);}});}});$("#region_id option").remove();$("#city_id option").remove();$("#region_id").append(createOption("","Выберите регион"));$("#city_id").append(createOption("","Выберите город"));$("#country_code").change(function(){$("#region_id").attr("disabled","disabled");$("#city_id").attr("disabled","disabled");$("#region_id option").remove();$("#city_id option").remove();$("#region_id").append(createOption("","Выберите регион"));$("#city_id").append(createOption("","Выберите город"));var selected=$("#country_code").val();if(selected!=""){$.getJSON("/data/get_regions.html?c="+selected,function(data){$.each(data,function(id,region){$("#region_id").append(createOption(region.id,region.name));});$("#region_id").removeAttr("disabled");});}});$("#region_id").change(function(){$("#city_id").attr("disabled","disabled");$("#city_id option").remove();$("#city_id").append(createOption("","Выберите город"));var selected=$("#region_id").val();if(selected!=""){$.getJSON("/data/get_cities.html?c="+selected,function(data){$.each(data,function(id,region){$("#city_id").append(createOption(region.id,region.name));});$("#city_id").removeAttr("disabled");});}});function createOption(value,text){var thisOpt=document.createElement("option");thisOpt.value=value;thisOpt.appendChild(document.createTextNode(text));return thisOpt;}}else{if(current_page_code==10){$("#pulish_video").click(function(event){event.preventDefault();var ids=getSelected();if(ids.length>0){$.get("/data/publish_video",{casino_id:casino_id,ids:ids.toString()},function(data){if(trim(data)=="done"){window.location.href=window.location.href;}});}});$("#hide_video").click(function(event){event.preventDefault();var ids=getSelected();if(ids.length>0){$.get("/data/hide_video",{casino_id:casino_id,ids:ids.toString()},function(data){if(trim(data)=="done"){window.location.href=window.location.href;}});}});$("#del_video").click(function(event){event.preventDefault();var ids=getSelected();if(ids.length>0){$.get("/data/del_video",{casino_id:casino_id,ids:ids.toString()},function(data){if(trim(data)=="done"){window.location.href=window.location.href;}});}});function getSelected(){var checkedId=$("input[name='id[]']:checked");var ids=new Array();for(var k=0;k<checkedId.length;k++){ids[k]=checkedId[k].value;}return ids;}$("#popupClose").click(function(event){event.preventDefault();hidePopUp();});$("#video_edit_selector").click(function(event){$("input[name='id[]']").each(function(i){$(this).attr("checked",$("#video_edit_selector").attr("checked"));});});}else{if(current_page_code==11){}else{if(current_page_code==12){$("#software").change(function(event){var soft=$(this).val();var redirect_to="/online/rating?software="+soft;var money=$("#money").val();if(money!=0){redirect_to=redirect_to+"&money="+money;}window.location.href=redirect_to;});$("#money").change(function(event){var money=$(this).val();var redirect_to="/online/rating?money="+money;var soft=$("#software").val();if(soft!=0){redirect_to=redirect_to+"&software="+soft;}window.location.href=redirect_to;});$("select option").click(function(){var path="${path}";if(typeof (this.value)=="string"){if(this.value.length){path+="/"+this.value;}}window.location=path;});}else{if(current_page_code==13){now_location=GetDefaultMapLocation();now_lat=now_location[0];now_lng=now_location[1];linkmap_world=new jQuery.fn.AxonMaps({div_id:"wmaps",pLat:now_lat,pLng:now_lng,pWidth:620,pHeight:270,pZoom:2,startMap:"Y"});setCityOnMap();}else{if(current_page_code==14){$("#loadmoreregs").click(function(event){$("#loadmoreregsspan").html('<img src="/css/indicator.gif" />');$.get("/data/get_more_regions.html?country="+country_code,function(data){$("#loadmoreregsspan").html(data);$("#loadmoreregs").hide();$("#clearmoreregs").show();});event.preventDefault();});$("#sort").change(function(event){$("#sort_filter").submit();});$("#open_dropDown").click(function(event){event.preventDefault();$(".dropdown").show();});$("#close_dropDown").click(function(event){event.preventDefault();$(".dropdown").hide();});$("#clearmoreregs").click(function(event){event.preventDefault();$("#loadmoreregsspan").html("");$(this).hide();$("#loadmoreregs").show();});}else{if(current_page_code==15){activateMap();$("#open_dropDown").click(function(event){event.preventDefault();$(".dropdown").show();});$("#close_dropDown").click(function(event){event.preventDefault();$(".dropdown").hide();});}else{if(current_page_code==16){$("#open_casino_list").click(function(event){event.preventDefault();$(".dropdown").show();});$("#close_dropDown").click(function(event){event.preventDefault();$(".dropdown").hide();});function loadStatDay(url){$.get(url,function(data){$("#day_statistic").html(data);$("#stat_prev, #stat_next").click(function(event){event.preventDefault();if(trim($(this).attr("href"))!=""){loadStatDay($(this).attr("href"));}});});}loadStatDay("/data/stats_day?casino="+casino_id);$(".stat_detail .stat_item .info a").click(function(event){event.preventDefault();document.loader.show();$(".stat_detail .stat_item .info a").attr("class","sshow");$(this).removeClass("sshow").toggleClass("shide");var day_of_week=$(this).attr("rel");if(trim($("#data_raw_"+day_of_week).html())!=""){$(".stat_detail .stat_item .data").hide();$("#data_raw_"+day_of_week).show();document.loader.hide();}else{$.get("/data/personal_raw?day_of_week="+day_of_week+"&casino="+casino_id,function(data){$(".stat_detail .stat_item .data").hide();$("#data_raw_"+day_of_week).html(data).show();init_referrer();document.loader.hide();});}});$(".stat_detail .stat_item .data .list a").live("click",function(event){var id=$(this).attr("rel");if($("#referr_show"+id).attr("class")=="ds"){$("#referr_row"+id).show();$("#referr_show"+id).removeClass("ds").toggleClass("dh").parent().parent().toggleClass("noline");}else{$("#referr_row"+id).hide();$("#referr_show"+id).removeClass("dh").toggleClass("ds").parent().parent().removeClass("noline");}return false;});function init_referrer(){$(".stat_detail .stat_item .data .b-pagination ul li a").click(function(event){event.preventDefault();var url=$(this).attr("href");var id=$(this).parent().parent().parent().parent().attr("id");$.get(url,function(data){$("#"+id).html(data);init_referrer();});});}}}}}}}}}}}}}}});function regListShowHide(A){if($("#"+A).css("display")=="block"){$("#"+A).css("display","none");$("#head_"+A).attr("class","close");}else{$("#"+A).css("display","block");$("#head_"+A).attr("class","open");}return false;}function showMore(A){if(ready){$("#link"+A).html("<span><a onclick=\"return hideMore('"+A+"');\" href=\"#\"><img src='/img/ajax-loader.gif' /></a></span>");$.get("/data/get_world_rate.html?country="+A,function(B){$("#contaner_"+A).html(B);$("#link"+A+" span a").html("скрыть");});}return false;}function hideMore(B){if(ready){var A=0;$("#contaner_"+B+" span").each(function(){if(A>29){$(this).remove();}A++;});$("#contaner_"+B).append("...");$("#link"+B).html("<span><a onclick=\"return showMore('"+B+'\');" href="#">все города</a> - '+A+"</span>");}return false;}function deleteCasino(A){$.get("/data/delete_casino",{casino:A},function(B){if(IsNumeric(B)){$("#status_"+B).html("Удалено");}});return false;}function changeCasinoStatus(A){$.get("/data/status_casino",{casino:A},function(B){if(IsNumeric(B)){var C=trim($("#status_"+B).html());if(C=="Опубликовано"){$("#status_"+B).html("Скрыто");}else{if(C=="Скрыто"){$("#status_"+B).html("Опубликовано");}}}});return false;}function initVideoUpload(){fileSelected=false;videoUpload=new AjaxUpload("#upload_button",{action:"/data/upload_video?casino_id="+casino_id,name:"video",onComplete:function(B,A){if(A=="done"){$("#video_loading").hide();$("#cas-form").hide();window.location.href=window.location.href;}else{$("#video_upload_error").html(A);}},onSubmit:function(A,C){if(!(C&&/^(mov|mp4|avi|3gp|flv)$/.test(C))){$("#add_video div label span").eq(3).html("Неверный формат файла.");return false;}else{var B=$("#name").val();videoUpload.setData({_name:"add_video",name:B,description:$("#description").val(),tags:$("#tags").val()});$("#add_edit_form .cas-form-inner").hide();$("#video_loading").attr("class","cas-form-inner").show();}},autoSubmit:false,onChange:function(A,B){if(!(B&&/^(mov|mp4|avi|3gp|flv)$/.test(B))){$("#add_video div label span").eq(3).html("Неверный формат файла.");return false;}else{$("#upload_button").val(A);fileSelected=true;}}});}function show_hide_game_details(B){var A=false;if($("#"+B+" .body").css("display")=="none"){A=true;}$(".item .body").hide();$(".item .title .up").attr("class","down");if(A){$("#"+B+" .title span:first").attr("class","up");$("#"+B+" .body").show();current_opened_game=B;}else{current_opened_game=0;}return false;}function changeVideoStatus(A){if(ready){$.getJSON("/data/change_video_status",{id:A,casino_id:casino_id},function(B){if(B[0]!=undefined&&B[0]==1&&B[1]!=undefined&&B[2]!=undefined){if(B[1]==0){$("#status_"+B[2]).html("Скрыто");}else{if(B[1]==1){$("#status_"+B[2]).html("Опубликовано");}}}});}return false;}function delVideo(A){if(ready){$.get("/data/delete_video",{id:A,casino_id:casino_id},function(B){if(trim(B)=="done"){window.location.href=window.location.href;}});}return false;}function initVideoGameUpload(){fileSelected=false;videoUpload=new AjaxUpload("#upload_button",{action:"/data/upload_video?casino_id="+casino_id,name:"video",onComplete:function(B,A){if(A=="done"){$("#video_loading").hide();$("#cas-form").hide();window.location.href=window.location.href;}else{$("#video_upload_error").html(A);}},onSubmit:function(A,C){if(!(C&&/^(mov|mp4|avi|3gp|flv)$/.test(C))){$("#add_video div label span").eq(3).html("Неверный формат файла.");return false;}else{var B=$("#name").val();videoUpload.setData({_name:"add_video",name:B,description:$("#description").val(),tags:$("#tags").val(),game_id:$("#game_id").val()});$("#add_edit_form .cas-form-inner").hide();$("#video_loading").attr("class","cas-form-inner").show();}},autoSubmit:false,onChange:function(A,B){if(!(B&&/^(mov|mp4|avi|3gp|flv)$/.test(B))){$("#add_video div label span").eq(3).html("Неверный формат файла.");return false;}else{$("#upload_button").val(A);fileSelected=true;}}});}function showFullImage(B,A){if(ready){$("#image_src").attr("src",int2png(B));$("#image_descr").html(A);$("#cas-form").show();}return false;}function delPhoto(A){document.loader.show();if(ready){$.get("/data/delete_photo",{id:A,casino_id:casino_id},function(B){if(trim(B)=="done"){window.location.href=window.location.href;}});}return false;}function removeMark(){if(gmark!=null&&ymark!=null){gmap.removeOverlay(gmark);ymap.removeOverlay(ymark);}gmark=null;ymark=null;}function setMarker(A,B){if(ready){if(gmark==null||ymark==null){gmark=new GMarker(new GLatLng(B,A),{draggable:true,icon:new_icon});ymark=new YMaps.Placemark(new YMaps.GeoPoint(A,B),{draggable:true,style:y_style});ymark.disableBalloon();GEvent.addListener(gmark,"dragend",function(){var C=gmark.getLatLng();setMarker(C.lng(),C.lat());});YMaps.Events.observe(ymark,ymark.Events.DragEnd,function(){var C=ymark.getGeoPoint();setMarker(C.getLng(),C.getLat());});$("#longitude").attr("value",A);$("#latitude").attr("value",B);gmap.addOverlay(gmark);ymap.addOverlay(ymark);$("#map > div > div > div > img.gmnoprint").css("display","block");}else{ymark.setGeoPoint(new YMaps.GeoPoint(A,B));gmark.setLatLng(new GLatLng(B,A));$("#longitude").attr("value",A);$("#latitude").attr("value",B);}}}function createOption(B,C){var A=document.createElement("option");A.value=B;A.appendChild(document.createTextNode(C));return A;}function delAction(A){if(ready){$.get("/data/delete_action",{id:A,casino_id:casino_id},function(B){if(trim(B)=="done"){window.location.href=window.location.href;}});}return false;}function check_game(A){if(A<11){if($("#game_"+A+"_show").attr("checked")){$("#game_"+A).removeAttr("disabled");}else{$("#game_"+A).attr("disabled","disabled");}}else{A=A-10;if($("#c_game_"+A+"_show").attr("checked")){$("#c_game_"+A+"_name").removeAttr("disabled");$("#c_game_"+A+"_num").removeAttr("disabled");}else{$("#c_game_"+A+"_name").attr("disabled","disabled");$("#c_game_"+A+"_num").attr("disabled","disabled");}}}function clear_errors(){$("#add_online div label span").html("");}function trim(A){if(A==undefined){return"";}A=A.replace(/ /g," ");return A.replace(/(^\s+)|(\s+$)/g,"");}function IsNumeric(B){var D="0123456789.";var C=true;var A;for(i=0;i<B.length&&C==true;i++){A=B.charAt(i);if(D.indexOf(A)==-1){C=false;}}return C;}function centerPopup(){var A=$(document).width();var D=$(document).height();var C=$("#popupMain").height();var B=$("#popupMain").width();$("#popupMain").css({position:"absolute",top:D/2-C/2,left:A/2-B/2});$("#backgroundPopup").css({height:D});}function showPopUp(){$("#cas-form").show();}function hidePopUp(){$("#add_edit_form").html("");$("#cas-form").hide();}function int2png(B){var A=false;if(!isNaN(B)&&(B>=0||B<=4294967295)){A="/img/upload/"+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))+".png";}return A;}function updateCapcha(formName){$.get(window.location.pathname+"?__ajax=1&update_capcha=1&form_name="+formName,function(data){try{var result=eval("("+data+")");$("#image_"+result.name).attr("src",$("#image_"+result.name).attr("src").replace(/\d*$/,result.rand));}catch($ex){alert($ex);}});}function getEmbeddedId(A){var B=A.lastIndexOf("_");if(B>0){return A.substring(B+1);}else{return A;}}$().ready(function(){$("input[name=coocks]").live("click",function(){return $("input[name=coock]").click();});$("input[name=coock]").live("click",function(){var script=$("textarea[name=cookiecoderaw]").val();script=script.replace(/%counter_id%/,this.id);$("textarea[name=cookiecode]").val(script);return true;});$(".ct_sh").live("click",function(){var aid=$(this).attr("id");if($("#"+aid+"_bl").is(":visible")){$("#"+aid+"_bl").hide();}else{$("#"+aid+"_bl").show(1);$(".wr_c").hide();}});$("input[name=coocksm]").live("click",function(){return $("input[name=coock]").click();});$(".getcookie").live("click",function(){if(typeof (this.href)!="undefined"){window.open(this.href,"","height=660,width=800");}return false;});$(".casino_to_favorite").live("click",function(){var object=this;if(typeof (object.id)!="undefined"){var popup=new Popup(this.parentNode);$.get("/data/casino/tofavorite?casino_id="+object.id,{},function(data){var data=eval("("+data+")");if(typeof (data)!="undefined"){if(typeof (data.result)!="undefined"){switch(data.result){case true:popup.close();var count=parseInt($("#favoritees_num").html());$("#favoritees_num").html(count+1);$(object).removeAttr("class").css("color","#666").css("border","none");break;case false:if(typeof (data.error)!="undefined"){popup.setContent(data.error);}break;}}}});}return false;});$("input[name=game_kind[]]").click(function(){var id=getEmbeddedId(this.id);$("#game_save_"+id).attr("class","b-small-t1 online_game");});$("input").keypress(function(e){var id=getEmbeddedId(this.id);$("#game_save_"+id).attr("class","b-small-t1 online_game");});$(".online_game").live("click",function(){var game_kind="";var id=getEmbeddedId(this.id);var form=$("form[id=form_"+id+"]");form.find("input:checked[name=game_kind[]]").each(function(id,obj){game_kind+=(game_kind.length?",":"")+obj.value;});$.post(form.attr("action"),{_name:"save_game",game_name:form.find("input[name=game_name]").val(),game_kind:game_kind,game_count:form.find("input[name=game_count]").val(),game_jackpot:form.find("input[name=game_jackpot]").val()},function(data){var data=eval("("+data+")");if(typeof (data)!="undefined"){if(typeof (data.result)!="undefined"){if(data.result){if(typeof (data.game)!="undefined"&&typeof (data.game.id)!="undefined"){$("#game_save_"+data.game.id).attr("class","b-small-t2 online_game");if(typeof (data.game.name)!="undefined"){$("#game_title_"+data.game.id).html(data.game.name);}}}else{if(typeof (data.error)!="undefined"){if(typeof (data.game)!="undefined"&&typeof (data.game.id)!="undefined"){$("form[id=form_"+data.game.id).find("span[class=error]").text(data.error);$("#game_save_"+data.game.id).attr("class","b-small-t2 online_game");}}}}}});return false;});$(".games div[class=item]").mouseover(function(){$(this).css("background-color","#f2f6ef");});$(".games div[class=item]").mouseout(function(){$(this).css("background-color","");});$("#addnewgame a").live("click",function(){var game_name=$("input[name=newgame]").val();var game_type=$("select[name=newgametype]").val();if(typeof (game_name)!="undefined"){if(typeof (this.id)!="undefined"){$.getJSON("/online/casino/edit/add_new_online_game",{game:game_name,casino:this.id,game_type:game_type},function(data){if(typeof (data.result)!="undefined"){if(data.result){var link=window.location;link=link.toString();link=link.split("#");document.location=link[0];}}});}}return false;});$(".newgame .addnew").live("click",function(){$(".newgame_block").slideToggle("fast");return false;});if($("#is_network").is("input")){$("#is_network").live("click",function(){$("div[id=addresses]").slideToggle("slow");});}if($(".remove_location").is("a")){$(".remove_location").click(function(){$.get("/data/delete_location?casino_id="+this.id,{},function(data){if(trim(data)=="done"){window.location.href=window.location.href;}});return false;});}if($("#country_code").is("select")){$("#country_code").OptionsLoader({url:"/data/get_regions.html?c=",distination:"#region_id",clear:["#region_id","#city_id"]});if($("#region_id").is("select")){$("#region_id").OptionsLoader({url:"/data/get_cities.html?c=",distination:"#city_id"});}}$(".toggleGame").click(function(){if(typeof (this.id)!="undefined"){var id=getEmbeddedId(this.id);$("span[id=game_toggle_"+id+"]").toggleClass("up").toggleClass("down");$("div[class=body game_"+id+"]").slideToggle("slow");}return false;});$(".game_status").click(function(){if(typeof (this.id)!="undefined"){var parameters=this.id.split("|");if(typeof (parameters)!="undefined"){$.getJSON("/online/data/change_game_status?casino="+parameters[0]+"&game="+parameters[1],function(data){if(typeof (data)!="undefined"){var game=data[2];var casino=data[1];var status=data[0];var gcount=data[3];if(typeof (status)!="undefined"&&status){if(typeof (gcount)!="undefined"){$("form[id=form_"+game+"]").find("input[name=game_count]").val(gcount);}$("input[id="+casino+"|"+game+"]").attr("checked","checked");$("span[id="+casino+"|"+game+"]").text("Опубликовано");return true;}$("span[id="+casino+"|"+game+"]").text("Скрыто");$("input[id="+casino+"|"+game+"]").removeAttr("checked");return true;}});}}return false;});$(".new_location_link").live("click",function(event){var popup=new Popup($("#popupthis"),"/data/add_location?casino_id="+this.id,{__ajax:1},function(){now_location_arr=GetDefaultMapLocation();now_lat=now_location_arr[0];now_lng=now_location_arr[1];var lngDefault=$("#longitude").val()||now_lng;var latDefault=$("#latitude").val()||now_lat;if($("#longitude").val()==""){zoomDefault=2;}else{zoomDefault=10;}if(typeof (linkmap_edit)=="object"){linkmap_edit=null;}linkmap_edit=new jQuery.fn.AxonMaps({div_id:"emaps",pLat:latDefault,pLng:lngDefault,pWidth:540,pHeight:222,pZoom:zoomDefault,startMap:"Y"});if($("#longitude").val()!=""){var my_marks=linkmap_edit.SetNewMark($("#latitude").val(),$("#longitude").val(),"тут",{draggable:true});maps_marks[maps_marks.length]=my_marks;google.maps.event.addListener(my_marks[0],"dragend",function(){var point=my_marks[0].getPosition();my_marks[1].setGeoPoint(new YMaps.GeoPoint(point.lng(),point.lat()));$("#longitude").attr("value",point.lng());$("#latitude").attr("value",point.lat());});YMaps.Events.observe(my_marks[1],my_marks[1].Events.DragEnd,function(){var point=my_marks[1].getGeoPoint();my_marks[0].setPosition(new google.maps.LatLng(point.getLat(),point.getLng()));$("#longitude").attr("value",point.getLng());$("#latitude").attr("value",point.getLat());});}popup.content.find("#country_code").OptionsLoader({url:"/data/get_regions.html?c=",distination:"#region_id",clear:["#region_id","#city_id"]});popup.content.find("#region_id").OptionsLoader({url:"/data/get_cities.html?c=",distination:"#city_id"});popup.content.find("#found_point").live("click",function(){$("#found_point_error").remove();var country=$("#country_code option:selected").text();var region=$("#region_id option:selected").text();var city=$("#city_id option:selected").text();var address=$("#address").val();if(country.length){if(region.length){if(city.length){if(address.length){$.getJSON("/data/get_address.html?search="+country+","+region+","+city+","+address,function(data){var root=$("#address_ul");root.find("li[class=position]").remove();for(i in data){var li=$("<li/>").attr("class","position");var a=$("<a href='#' id='"+i+"'/>").text(data[i].text).click(function(){$("#adress_list").slideUp("fast");var lng=data[this.id].longitude;var lat=data[this.id].latitude;linkmap_edit.NewPositionZoom(lat,lng,16);$("#longitude").attr("value",lng);$("#latitude").attr("value",lat);for(var j=0;j<maps_marks.length;j++){linkmap_edit.pymap.removeOverlay(maps_marks[j][1]);maps_marks[j][0].setVisible(false);}maps_marks=new Array();var my_marks=linkmap_edit.SetNewMark(lat,lng,"тут",{draggable:true});maps_marks[maps_marks.length]=my_marks;google.maps.event.addListener(my_marks[0],"dragend",function(){var point=my_marks[0].getPosition();my_marks[1].setGeoPoint(new YMaps.GeoPoint(point.lng(),point.lat()));$("#longitude").attr("value",point.lng());$("#latitude").attr("value",point.lat());});YMaps.Events.observe(my_marks[1],my_marks[1].Events.DragEnd,function(){var point=my_marks[1].getGeoPoint();my_marks[0].setPosition(new google.maps.LatLng(point.getLat(),point.getLng()));$("#longitude").attr("value",point.getLng());$("#latitude").attr("value",point.getLat());});return false;});root.append(li.append(a));}$("#address_close").click(function(){$("#adress_list").slideUp("fast");return false;});$("#adress_list").slideDown("fast");});}}}}return false;});});return false;});});function setMarker(A,B){if(typeof (gmark)=="undefined"){if(typeof (ymark)=="undefined"){gmark=new GMarker(new GLatLng(B,A),{draggable:true,icon:new_icon});ymark=new YMaps.Placemark(new YMaps.GeoPoint(A,B),{draggable:true,style:y_style});ymark.disableBalloon();GEvent.addListener(gmark,"dragend",function(){var C=gmark.getLatLng();setMarker(C.lng(),C.lat());});YMaps.Events.observe(ymark,ymark.Events.DragEnd,function(){var C=ymark.getGeoPoint();setMarker(C.getLng(),C.getLat());});$("#longitude").attr("value",A);$("#latitude").attr("value",B);gmap.addOverlay(gmark);ymap.addOverlay(ymark);$("#map > div > div > div > img.gmnoprint").css("display","block");return false;}}ymark.setGeoPoint(new YMaps.GeoPoint(A,B));gmark.setLatLng(new GLatLng(B,A));$("#longitude").attr("value",A);$("#latitude").attr("value",B);return false;}function addedit_lock_submit(form){var id=form.id.value;var name=$("#name").val();var hours=$("#hours").val();var address=$("#address").val();var phone=$("#phone").val();var city_id=$("#city_id").val();var latitude=$("#latitude").val();var longitude=$("#longitude").val();var region_id=$("#region_id").val();var country_code=$("#country_code").val();document.loader.show();$.post(form.action,{id:id,name:name,address:address,longitude:longitude,latitude:latitude,country_code:country_code,region_id:region_id,city_id:city_id,hours:hours,phone:phone,_name:form._name.value},function(data){var data=eval("("+data+")");document.loader.hide();switch(data.result){case true:window.location=window.location.pathname+window.location.search;break;case false:switch(typeof (data.error)){case"object":for(key in data.error){$("label[for="+key+"] span[class=error]").text(data.error[key]);}break;case"string":alert(data.error);break;}break;}});}function GetDefaultMapLocation(){if((typeof (now_location)=="undefined")||(now_location.length<1)){console.warn("Default location constant undefined!");throw ("Default location constant undefined!");return false;}else{now_location_arr=now_location.replace(/(^[\s\xA0]+|[\s\xA0]+$)/g,"");now_location_arr=now_location_arr.split(",");now_lat=now_location_arr[0];now_lng=now_location_arr[1];return[now_lat,now_lng];}}if(Function.prototype.of==undefined){Function.prototype.of=function(B){var A=this;return function(){return A.apply(B,arguments);};};}if(typeof String.prototype.trim!=="function"){String.prototype.trim=function(){return this.replace(/^\s+|\s+$/,"");};}var CasrOnline={base:"/online"};CasrOnline.initOnlineProfileMain=function(C,B){var A=$.extend({item:".item",toggle_game:".toggle_game",show_game_all:".toggle_game_all",close_game_all:".toggle_game_all_close",image_preview:".item-ss a",video_preview:".item-ss a .v",images_screens:".conlp_games_scr",games:".games"},B);var D=new OnlineProfileMain(C,A);$(".jccarousel").jCasrCarousel({scroll:1});D.openFirstGame(A);$(A.toggle_game).click(D.toggleGame.of(D));$(A.show_game_all).click(D.showAllGames.of(D));$(A.close_game_all).click(D.closeAllGames.of(D));$(A.image_preview).click(D.showPreview.of(D));$(A.video_preview).click(D.showVideoPreview.of(D));};function OnlineProfileMain(B,A){this.cfg=A;this.openFirstGame=function(D){var C=A.games+" "+A.item+":first";$(C).toggleClass("i_vis");$(C+" .title span").toggleClass("up");$(C+" .body").slideDown("fast");};this.toggleGame=function(E){var F=$(E.target).attr("id");var C="#"+F+"_w";var D=C+" .body";if(!$(D).is(":visible")){}else{$(C).removeClass("i_vis");$(D).slideUp("fast");$("#"+F+"_down").removeClass("up");return false;}$(D).slideDown("fast");$(C).toggleClass("i_vis");$("#"+F+"_down").toggleClass("up");return false;};this.showAllGames=function(){$(A.item+" .body").slideDown(400);$(A.item).removeClass("i_vis");$(A.item).toggleClass("i_vis");$(".conlp_games_expand").removeClass("ge_open");$(".conlp_games_expand").toggleClass("ge_close");$(A.show_game_all).hide();$(A.close_game_all).show();};this.closeAllGames=function(){$(A.item+" .body").slideUp(400);$(".conlp_games_expand").removeClass("ge_close");$(".conlp_games_expand").toggleClass("ge_open");$(A.item).removeClass("i_vis");$(A.close_game_all).hide();$(A.show_game_all).show();};this.showPreview=function(E){var F=$(E.currentTarget).attr("rel");var D=$(E.currentTarget).attr("title");document.loader.show();var C=new Image();$("#popup_header").html("Cкриншот");$(C).load(function(){var G=new Popup("#body-wr");G.setContent('<div class="img_container" id="image_box"><div class="img_container_text" id="image_descr"><p></p></div></div>');G.content.find("div[class=cb-top]>h3").text("Изображение");$(".flogin").addClass("pf-edit-photo2");$(".flogin").removeClass("flogin");$("#image_box").append(this);G.content.find(".img_container").hover(function(){$(".img_container_text").slideDown(400);});G.content.find(".img_container").mouseout(function(){$(".img_container_text").slideUp(400);});$(".img_container_text").css("width",C.width-28+"px");$("#image_descr p").html(D);var I=$("#popup").height();var H=$("#popup").width();$("#popup").css({left:"50%","margin-left":"-"+(H/2)+"px",top:"50%","margin-top":"-"+(I/2)+"px"});});if(parseFloat(F).toString()==F){C.src=int2png(F);}else{C.src=F;}return false;};this.showVideoPreview=function(E){var C=$(E.currentTarget).attr("rel");var D=$(E.currentTarget).attr("title");new Popup("#body-wr","/online/data/online/gallery/video",{video_id:C});return false;};}CasrOnline.initOnlineProfileVote=function(C,B){var A=$.extend({vote_form:"#add_vote_from_save",show_rate:".conlp_r_l_item",rates_popup:".rates_popup",rate_block:".voteit a",submit_button:"#submit_button",reply_form:".reply-ans",reply_link:".rprt_right a",hide_reply:".rp_ans_canc a",send_reply:"a.sendreply",rate_link:".ratelink",com_plus:".com-plus",com_minus:".com-minus",symb_left:"#symb_left",curr_sum:0,},B);var D=new OnlineProfileVote(C,A);$(A.show_rate).mousemove(D.showRatePopup.of(D));$(A.rates_popup).mouseout(D.hideRatePopup.of(D));$(A.rate_block).click(D.applyVote.of(D));$(A.submit_button).click(D.submitVote.of(D));$(A.reply_link).click(D.showReply.of(D));$(A.hide_reply).click(D.hideReply.of(D));$(A.send_reply).click(D.sendReply.of(D));$(A.rate_link).click(D.voteRateSend.of(D));$(A.vote_form+" textarea").keyup(D.checkMaxSymbols.of(D));};function OnlineProfileVote(B,A){this.baseUrl="/online/data/add_cas_vote";this.voteUrl="/online/data/add_vote_rate";this.casinoId=B;this.cfg=A;this.checkMaxSymbols=function(){var C=$(A.vote_form+" textarea").val();$(A.symb_left).html(255-parseInt(C.length));A.curr_sum=parseInt(C.length);};this.applyVote=function(E){var D=$(E.target).parent().parent().attr("id");$("#"+D+" a").removeClass("sel");$(E.target).addClass("sel");var C=$(E.target).attr("rel");$("#"+D+"_val").val(C);return false;};this.showRatePopup=function(C){$(A.rates_popup).hide();var D=$(C.target).attr("id");$("#"+D+"_popup").show();};this.hideRatePopup=function(){$(A.rates_popup).hide();return false;};this.submitVote=function(){var D=$(A.vote_form+" textarea").val();var C=D.trim();if(A.curr_sum>255){popup=new Popup("#body-wr");popup.setContent("Превышено допустимое количество символов в отзыве.");return false;}if(C==null||C==""){popup=new Popup("#body-wr");popup.setContent("Отзыв не может быть пустым.");return false;}$(A.vote_form).submit();};this.sendReply=function(D){var C=$(D.currentTarget).attr("id");$("#"+C+"_frm").submit();return false;};this.showReply=function(D){$(A.reply_link).show();$(A.reply_form).hide();var C=$(D.target).attr("id");$(D.target).hide();$("#"+C+"_form").slideDown(400);return false;};this.hideReply=function(){$(A.reply_link).show();$(A.reply_form).hide();return false;};this.voteRateSend=function(E){E.preventDefault();var D=$(E.target).parent().parent().parent().attr("id");var C=D.substring(2);var F=$(E.target).attr("id");if(F=="pos"){vote_num=1;$("#"+D+" "+A.com_plus).empty().append("<em class='cract'></em>");$("#"+D+" "+A.com_minus).empty().append("<em></em>");}else{vote_num=-1;$("#"+D+" "+A.com_plus).empty().append("<em></em>");$("#"+D+" "+A.com_minus).empty().append("<em class='cract'></em>");}$.getJSON(this.voteUrl,{vote_id:C,rate:vote_num},function(I){if(I.result){var J=parseInt($("#vr"+I.vote.vote_id+" ul li strong").html());var G=I.vote.rate+J;$("#vr"+I.vote.vote_id+" ul li strong").html(G);var H=$("#"+D+" strong").parent().attr("class");$("#"+D+" strong").parent().removeClass(H);if(G>0){$("#"+D+" strong").parent().addClass("com-r-pos");}else{if(G<0){$("#"+D+" strong").parent().addClass("com-r-neg");}}}else{}});};}CasrOnline.initOnlineProfileEdit=function(C,B){var A=$.extend({remove_logo:"#remove span",remove_image:"#clear span"},B);var E=new OnlineProfileEdit(C,A);E.initAjaxUpload(A);$(A.remove_logo).click(E.removeOnlineLogo.of(E));$("#save_1, #save_2, #save_3, #save_4, #save_5").click(function(J){var H=false;$(".error").html("");var I=trim($("#description").val());if(I==""){$("#desc_error").html("Поле не может быть пустым.");H=true;}if(I.length>2048){$("#desc_error").html("Привышен лимит символов.");H=true;}var F=$("#software_download").val();if(F!=""&&!F.match(/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/)){$("#software_download_error").html("Введите корректную ссылку.");H=true;}if($("#software_show").val()==1&&F==""){$("#software_download_error").html("Ссылка не указана.");H=true;}var G=trim($("#name").val());if(G==""){$("#name_error").html("Поле не может быть пустым.");H=true;}if($("#selected1").attr("checked")&&trim($("#custom1").val())==""){$("#bonus_error").html("Введите название бонуса.");H=true;}if($("#selected2").attr("checked")&&trim($("#custom2").val())==""){$("#bonus_error").html("Введите название бонуса.");H=true;}if($("#selected3").attr("checked")&&trim($("#custom3").val())==""){$("#bonus_error").html("Введите название бонуса.");H=true;}if($("#selected4").attr("checked")&&trim($("#custom4").val())==""){$("#bonus_error").html("Введите название бонуса.");H=true;}if($("#selected5").attr("checked")&&trim($("#custom5").val())==""){$("#bonus_error").html("Введите название бонуса.");H=true;}if(!H){$("#casino_edit_form").submit();}});$(".devel select").change(function(F){$("#save_5").attr("class","b-small-t1");});$(".devel-inf select").change(function(F){$("#save_5").attr("class","b-small-t1");});$(".devel-inf input").change(function(F){$("#save_5").attr("class","b-small-t1");});$("#bonuses input").change(function(F){$("#save_4").attr("class","b-small-t1");});$("#money input").change(function(F){$("#save_3").attr("class","b-small-t1");});$("#description").change(function(F){$("#save_2").attr("class","b-small-t1");});$("#language").change(function(F){$("#save_2").attr("class","b-small-t1");});$("#name").change(function(F){$("#save_1").attr("class","b-small-t1");});$("#selected1").click(function(F){if($(this).attr("checked")){$("#custom1").removeAttr("disabled");}else{$("#custom1").attr("disabled","disabled");}});$("#selected2").click(function(F){if($(this).attr("checked")){$("#custom2").removeAttr("disabled");}else{$("#custom2").attr("disabled","disabled");}});$("#selected3").click(function(F){if($(this).attr("checked")){$("#custom3").removeAttr("disabled");}else{$("#custom3").attr("disabled","disabled");}});$("#selected4").click(function(F){if($(this).attr("checked")){$("#custom4").removeAttr("disabled");}else{$("#custom4").attr("disabled","disabled");}});$("#selected5").click(function(F){if($(this).attr("checked")){$("#custom5").removeAttr("disabled");}else{$("#custom5").attr("disabled","disabled");}});$("#clear_bonus_1").click(function(F){F.preventDefault();$("#custom_del1").val("1");$("#custom1").val("");$("#selected1").attr("checked","");});$("#clear_bonus_2").click(function(F){F.preventDefault();$("#custom_del2").val("1");$("#custom2").val("");$("#selected2").attr("checked","");});$("#clear_bonus_3").click(function(F){F.preventDefault();$("#custom_del3").val("1");$("#custom3").val("");$("#selected3").attr("checked","");});$("#clear_bonus_4").click(function(F){F.preventDefault();$("#custom_del4").val("1");$("#custom4").val("");$("#selected4").attr("checked","");});$("#clear_bonus_5").click(function(F){F.preventDefault();$("#custom_del5").val("1");$("#custom5").val("");$("#selected5").attr("checked","");});$("#software_id").change(function(G){var F=$(this).val();if(F=="new"){$("#newsoftware").parent().attr("style","display:block");$("#newsoftware").removeAttr("disabled");$("#newsoftware").val("");}else{$("#newsoftware").parent().attr("style","display:none");}});var D=$("#software_id").val();if(D=="new"){$("#newsoftware").parent().attr("style","display:block");$("#newsoftware").removeAttr("disabled");}else{$("#newsoftware").parent().attr("style","display:none");}};function OnlineProfileEdit(casinoId,cfg){this.cfg=cfg;this.casinoId=casinoId;this.initAjaxUpload=function(param){new AjaxUpload("#upload_small",{name:"logo",action:"/data/add_logo?casino_id="+casinoId,onComplete:function(file,response){if(typeof (response)=="string"){response=eval("("+response+")");if(response.result){if(response.path){$("img[id=smallimagelogo]").attr("src",response.path);$("input[id=logo_upload_id]").val(response.upload_id);document.popup.close();}}if(typeof (response.error)=="string"){var content=$(document.popup.default_template);content.find("#popup-content").text(response.error);document.popup.changeContent(content);}}},onSubmit:function(file,ext){new Popup("#body-wr");},onChange:function(file,ext){$("#logo_small").val(file);}});if(typeof ($("#upload_big").get(0))=="object"){new AjaxUpload("#upload_big",{name:"logo",action:"/data/add_logo?casino_id="+casinoId+"&big=1",onComplete:function(file,response){if(typeof (response)=="string"){response=eval("("+response+")");if(response.result){if(response.path){$("img[id=bigimagelogo]").attr("src",response.path);document.popup.close();}}if(typeof (response.error)=="string"){var content=$(document.popup.default_template);content.find("#popup-content").text(response.error);document.popup.changeContent(content);}}},onSubmit:function(file,ext){new Popup("#body-wr");},onChange:function(file,ext){$("#logo_big").val(file);}});}};this.removeOnlineLogo=function(event){switch($(event.target).attr("id")){case"small":new Popup("#body-wr");$.getJSON("/data/delete_logo",{casino_id:casinoId},function(data){if(data.result){$("img[id=smallimagelogo]").attr("src",cfg.def_image);document.popup.close();}if(typeof (data.error)=="string"){var content=$(document.popup.default_template);content.find("#popup-content").text(data.error);document.popup.changeContent(content);}});break;case"big":new Popup("#body-wr");$.getJSON("/data/delete_logo",{casino_id:casinoId,big:1},function(data){if(data.result){$("img[id=bigimagelogo]").attr("src",cfg.def_image);document.popup.close();}if(typeof (data.error)=="string"){var content=$(document.popup.default_template);content.find("#popup-content").text(data.error);document.popup.changeContent(content);}});break;}return false;};}CasrOnline.initOnlineSysProfileEdit=function(B,A){CasrOnline.initOnlineProfileEdit(B,A);};CasrOnline.initOnlineProfileGamesEdit=function(C,B){var A=$.extend({video_add:".add_video",video_edit:".edit_video",video_delete:".delete_video",photo_add:".add_photo",photo_edit:".photo_edit",photo_delete:".photo_delete"},B);var D=new OnlineProfileGamesEdit(C,A);$(A.video_add).click(D.addGameVideo.of(D));$(A.video_edit).click(D.editGameVideo.of(D));$(A.video_delete).click(D.deleteGameVideo.of(D));$(A.photo_add).click(D.addGamePhoto.of(D));$(A.photo_edit).live("click",D.editGamePhoto.of(D));$(A.photo_delete).live("click",D.deleteGamePhoto.of(D));CasrOnline.obj=D;};function OnlineProfileGamesEdit(casinoId,cfg){this.cfg=cfg;this.casinoId=casinoId;this.addGamePhoto=function(event){var gameId=getEmbeddedId($(event.target).attr("id"));$("a[class=add_photo]").each(function(index,domElement){new AjaxUpload(domElement,{name:"photo",data:{casino_id:casinoId,game_id:gameId,},action:"/online/casino/edit/gallery/photo/add",onSubmit:function(file,ext){var button=$(this._button);if(button.is("a")){this._settings.data.game=parseInt(button.attr("id"));}new Popup("#body-wr");},onComplete:function(file,response){if(typeof (response)=="string"){var response=eval("("+response+")");if(typeof (response.error)=="string"){var content=$(document.popup.default_template);content.find("#popup-content").text(response.error);document.popup.changeContent(content);}if(response.result){document.popup.close();$("#"+gameId+" .post-image-gallery ul").append('<li id="imgblock'+response.id+'"><div class="pim-image"><img alt="" src="'+response.thumbnail+'" /></div><p></p><div class="pim-control"><span class="pim-s-left"></span><a title="Изменить описание" href="javascript:void(0)" id="imged_'+response.id+'" class="pim-c-edit photo_edit"></a><a title="Удалить" href="javascript:void(0)" id="imgde_'+response.id+'" class="pim-c-delete photo_delete"></a></div></li>');CasrOnline.obj.editGamePhoto(response.id);}}}});});return false;};this.editGamePhoto=function(event){if(typeof (event)=="string"){var imgId=event;}else{var imgId=getEmbeddedId($(event.target).attr("id"));}var popup=new Popup("#body-wr","/online/casino/edit/gallery/photo/edit?casino_id="+casinoId+"&id="+imgId,{},function(){document.popup.centerPopup();popup.content.find("a[id=cancel]").click(function(){popup.close();return false;});popup.content.find("a[id=submit]").click(function(){var form=popup.content.find("form[name=edit_gallery]");$.post(form.attr("action"),{_name:form.attr("name"),description:form.find("input[name=description]").val()},function(data){if(typeof (data)=="string"){var data=eval("("+data+")");if(data.result){document.popup.close();var game_id=data.game_id;$("#imgblock"+data.photo.id+" p").html(data.photo.description);$("#imgblock"+data.photo.id+" .pim-image img").attr("alt",data.photo.description);}}});return false;});});};this.deleteGamePhoto=function(event){if(window.confirm("Вы действительно хотите удалить это изображение с сервера?\nЭто действие необратимо.")){var imgId=getEmbeddedId($(event.target).attr("id"));new Popup("#body-wr");$.getJSON("/online/casino/edit/photo/delete",{casino_id:casinoId,id:imgId},function(data){if(data.result){$(event.target).parent().parent().remove();}});}return false;};this.addGameVideo=function(event){var gameId=getEmbeddedId($(event.target).attr("id"));new Popup("#body-wr","/online/data/gallery/video/add",{__ajax:1,casino_id:casinoId,game_id:gameId},function(data){try{var result=eval("("+data+")");if(typeof (result)=="object"){if(typeof (result.error)=="string"){var default_template=$(document.popup.default_template);default_template.find("#popup-content").html(result.error);document.popup.changeContent(default_template);document.popup.centerPopup();return false;}}}catch($er){}data.find(".save a[id=submit]").click(function(){document.loader.show();var form=document.popup.content.find("form");$.post(form.attr("action"),{_name:form.attr("name"),description:form.find("textarea[id=description]").val(),olink:form.find("input[id=olink]").val(),name:form.find("input[id=name]").val(),tags:form.find("input[id=tags]").val()},function(data){if(typeof (data)=="string"){data=eval("("+data+")");if(data.result){document.popup.close();var game_id=data.game_id;document.loader.show();$("#"+gameId+" .post-video-gallery ul").append('<li><div class="pim-image"><img alt="'+data.add_video.description+'" src="/img/uploading_video.png"></div><p>'+data.add_video.description+"</p></li>");}if(typeof (data.error)=="string"){document.popup.content.find(".ferr").html("<p>"+data.error+"</p>");document.popup.content.find(".ferr").show();}document.loader.hide();}});return false;});data.find(".save a[id=cancel]").click(function(){document.popup.close();return false;});data.find("input").click(function(){document.popup.content.find(".ferr p").remove();document.popup.content.find(".ferr").hide();return false;});data.find("#olink").val("http://");});return false;};this.editGameVideo=function(event){var videoId=getEmbeddedId($(event.target).attr("id"));new Popup("#body-wr","/online/data/gallery/video/edit",{__ajax:1,casino_id:casinoId,video_id:videoId},function(data){try{var result=eval("("+data+")");if(typeof (result)=="object"){if(typeof (result.error)=="string"){var default_template=$(document.popup.default_template);default_template.find("#popup-content").html(result.error);document.popup.changeContent(default_template);document.popup.centerPopup();return false;}}}catch($er){}data.find(".save a[id=submit]").click(function(){document.loader.show();var form=document.popup.content.find("form");$.post(form.attr("action"),{_name:form.attr("name"),video_id:videoId,casino_id:casinoId,description:form.find("textarea[id=description]").val(),name:form.find("input[id=name]").val(),tags:form.find("input[id=tags]").val()},function(data){if(typeof (data)=="string"){data=eval("("+data+")");if(data.result){document.popup.close();var game_id=data.game_id;document.loader.show();$("#vidblock"+data.video+" p").html(data.description);$("#vidblock"+data.video+" .pim-image img").attr("alt",data.description);}if(typeof (data.error)=="string"){document.popup.content.find(".ferr").html("<p>"+data.error+"</p>");document.popup.content.find(".ferr").show();}document.loader.hide();}});return false;});data.find(".save a[id=cancel]").click(function(){document.popup.close();return false;});data.find("input").click(function(){document.popup.content.find(".ferr p").remove();document.popup.content.find(".ferr").hide();return false;});});return false;};this.deleteGameVideo=function(event){if(window.confirm("Вы действительно хотите удалить это видео с сервера?\nЭто действие необратимо.")){videoid=getEmbeddedId($(event.currentTarget).attr("id"));new Popup("#body-wr");$.getJSON("/online/data/video/delete",{casino_id:casinoId,id:videoid},function(data){if(data.result){$(event.currentTarget).parent().parent().remove();}});}return false;};}CasrOnline.addFavor=function(B,A){$.get("/data/add_favor?casino_id="+B,function(C){});$("#favor_"+B).removeAttr("href").removeAttr("OnClick").css("color","#666").css("border","none");$("#favor_num_"+B).html(parseInt($("#favor_num_"+B).html())+1);return false;};if(Function.prototype.of==undefined){Function.prototype.of=function(B){var A=this;return function(){return A.apply(B,arguments);};};}var CasrAds={base:"/ads"};CasrAds.initAdsDashboard=function(C,B){var A=$.extend({date_container:"#widgetField>a",date_range:"#date",widget_calendar:"#widgetCalendar",widget_button:"#widgetField>a",widget_datepicker:"#widgetCalendar div.datepicker",widget_datepicker_open:"open",widget_form:"#widget form",widget_daterange:"#dateRange"},B);var G=$(A.date_container);var F=$(A.date_range).val().split(" - ")[0];var D=$(A.date_range).val().split(" - ")[1];$(A.widget_calendar).DatePicker({flat:true,format:"d.m.Y",calendars:2,mode:"range",date:[F,D],starts:0,onRender:function(I){var H=new Date();return{disabled:(I.valueOf()>H.valueOf())};},onChange:function(K){function H(N){N=N.split(".");var L=new Array("???","???","???","???","???","???","???","???","???","???","???","???"),M=N[0],P=parseInt(N[1],10)-1,O=N[2];N=L[P]+" "+M+", "+O;return N;}var J=new Array();var I;for(I in K){J[I]=H(K[I]);}$(A.date_range).val(K.join(" - "));G.html(J.join(" - "));}});var E=false;$(A.widget_button).click(function(){$(A.widget_calendar).animate({height:E?0:$(A.widget_datepicker).get(0).offsetHeight},400,function(){if(E){$(this).addClass(A.widget_datepicker_open);}else{$(this).removeClass(A.widget_datepicker_open);}});E=!E;return false;});$(A.widget_calendar).css("position","absolute");$(A.widget_form).submit(function(){$(A.widget_daterange).val($(A.widget_button).html());});};CasrAds.doReconcile=function(B){var A=$("#"+B);A.submit();};CasrAds.doSubmit=function(B){var A=$("#"+B);A.submit();};CasrAds.showRow=function(A){$("#"+A+"_1").toggleClass("rh1");$("#"+A+"_2").toggleClass("off");};CasrAds.initMediaAdd=function(cfgOrig){var cfg=$.extend({upload_btn:"#upload_bn",upload_url:"/reklama/media/upload"},cfgOrig);return new AjaxUpload(cfg.upload_btn,{name:"media",action:cfg.upload_url,onComplete:function(file,response){response=eval("("+response+")");if(typeof (response)=="object"){if(response.result){$("#upload #name").val(file);document.popup.close();$("#upload #submit").removeClass("b-big-t3").addClass("b-big-t1").click(function(){document.forms.upload.submit();});}if(typeof (response.error)!="undefined"){$("#upload #submit").removeClass("b-big-t1").addClass("b-big-t3").click(function(){});if(response.error.length){document.popup.setContent(response.error);}}}},onSubmit:function(file,ext){new Popup("#body-wr");if(!(ext&&/^(swf|jpg|png|gif)$/i.test(ext))){document.popup.setContent("???? ?????? ???? ??????????? ????????????");return false;}},onChange:function(file,ext){}});};CasrAds.initIndex=function(B){var A=$.extend({ad_req_btn:".adrequest",ad_req_url:"/reklama/request",ad_place:".a_types a",ad_info:".a_info"},B);$(A.ad_place).live("click",function(){$(A.ad_place).removeClass("active");$(this).addClass("active");$(A.ad_info).fadeOut("slow");$(A.ad_info).css("display","none");$("#"+$(this).attr("id")+"_big").fadeIn("slow");return false;});var C=new CasrAds.AdsRequestPopup(A);$(A.ad_req_btn).live("click",C.showRequestPopup.of(C));};CasrAds.AdsRequestPopup=function(cfg){this.cfg=cfg;this.showRequestPopup=function(event){var f=this;new Popup("#body-wr",cfg.ad_req_url,{__ajax:1,banner_type:this.id},function(data){data.find(".save a").live("click",f.submitRequestPopup.of(f));data.find("input").keyup(function(event){document.popup.content.find("label[for=email] span[class=error]").text("");});data.find("textarea").keyup(function(event){data.find("input").keyup();});});return false;};this.submitRequestPopup=function(data){var form=$(data).find("form");var url=form.attr("action")+"?__ajax=1";$.post(this.cfg.ad_req_url,{_name:document.popup.content.find("form").attr("name"),email:document.popup.content.find("input[name=email]").val(),message:document.popup.content.find("textarea[name=message]").val(),banner_type:document.popup.content.find("select[name=banner_type]").val()},function(data){data=eval("("+data+")");if(data.result){new Popup("#body-wr");document.popup.setContent(data.msg);setTimeout("document.popup.close()",2000);}if(data.error){document.popup.content.find("label[for=email] span[class=error]").text(data.error);}});return false;};};CasrAds.initAccAdd=function(A){this.cfg=$.extend({submit_bnt:"#submit",form:"payment_form"},A);$(this.cfg.submit_bnt).click(function(){CasrAds.doSubmit(this.cfg.form);}.of(this));};