/*
* jQuery JavaScript Library v1.3.2
* http://jquery.com/
*
* Copyright (c) 2009 John Resig
* Dual licensed under the MIT and GPL licenses.
* http://docs.jquery.com/License
*
* Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
* Revision: 6246
*/
(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
/*
* Sizzle CSS Selector Engine - v0.9.3
*  Copyright 2009, The Dojo Foundation
*  Released under the MIT, BSD, and GPL Licenses.
*  More information: http://sizzlejs.com/
*/
(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.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(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.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(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.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(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.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 H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.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};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.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(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.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(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<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>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();/*
* jQuery UI 1.7
*
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI
*/
jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m<n.length;m++){if(j.options[n[m][0]]){n[m][1].apply(j.element,k)}}}},contains:function(k,j){return document.compareDocumentPosition?k.compareDocumentPosition(j)&16:k!==j&&k.contains(j)},hasScroll:function(m,k){if(c(m).css("overflow")=="hidden"){return false}var j=(k&&k=="left")?"scrollLeft":"scrollTop",l=false;if(m[j]>0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},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(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.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((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.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(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.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){c(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}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);;/*
* jQuery UI Tabs 1.7
*
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Tabs
*
* Depends:
*	ui.core.js
*/
(function(a){a.widget("ui.tabs",{_init:function(){if(this.options.deselectable!==undefined){this.options.collapsible=this.options.deselectable}this._tabify(true)},_setData:function(b,c){if(b=="selected"){if(this.options.collapsible&&c==this.options.selected){return}this.select(c)}else{this.options[b]=c;if(b=="deselectable"){this.options.collapsible=c}this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^A-Za-z0-9\-_:\.]/g,"")||this.options.idPrefix+a.data(b)},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+a.data(this.list[0]));return a.cookie.apply(null,[b].concat(a.makeArray(arguments)))},_ui:function(c,b){return{tab:c,panel:b,index:this.anchors.index(c)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=a(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(n){this.list=this.element.children("ul:first");this.lis=a("li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return a("a",this)[0]});this.panels=a([]);var p=this,d=this.options;var c=/^#.+/;this.anchors.each(function(r,o){var q=a(o).attr("href");var s=q.split("#")[0],u;if(s&&(s===location.toString().split("#")[0]||(u=a("base")[0])&&s===u.href)){q=o.hash;o.href=q}if(c.test(q)){p.panels=p.panels.add(p._sanitizeSelector(q))}else{if(q!="#"){a.data(o,"href.tabs",q);a.data(o,"load.tabs",q.replace(/#.*$/,""));var w=p._tabId(o);o.href="#"+w;var v=a("#"+w);if(!v.length){v=a(d.panelTemplate).attr("id",w).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(p.panels[r-1]||p.list);v.data("destroy.tabs",true)}p.panels=p.panels.add(v)}else{d.disabled.push(r)}}});if(n){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(d.selected===undefined){if(location.hash){this.anchors.each(function(q,o){if(o.hash==location.hash){d.selected=q;return false}})}if(typeof d.selected!="number"&&d.cookie){d.selected=parseInt(p._cookie(),10)}if(typeof d.selected!="number"&&this.lis.filter(".ui-tabs-selected").length){d.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}d.selected=d.selected||0}else{if(d.selected===null){d.selected=-1}}d.selected=((d.selected>=0&&this.anchors[d.selected])||d.selected<0)?d.selected:0;d.disabled=a.unique(d.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(q,o){return p.lis.index(q)}))).sort();if(a.inArray(d.selected,d.disabled)!=-1){d.disabled.splice(a.inArray(d.selected,d.disabled),1)}this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");if(d.selected>=0&&this.anchors.length){this.panels.eq(d.selected).removeClass("ui-tabs-hide");this.lis.eq(d.selected).addClass("ui-tabs-selected ui-state-active");p.element.queue("tabs",function(){p._trigger("show",null,p._ui(p.anchors[d.selected],p.panels[d.selected]))});this.load(d.selected)}a(window).bind("unload",function(){p.lis.add(p.anchors).unbind(".tabs");p.lis=p.anchors=p.panels=null})}else{d.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}this.element[d.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");if(d.cookie){this._cookie(d.selected,d.cookie)}for(var g=0,m;(m=this.lis[g]);g++){a(m)[a.inArray(g,d.disabled)!=-1&&!a(m).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled")}if(d.cache===false){this.anchors.removeData("cache.tabs")}this.lis.add(this.anchors).unbind(".tabs");if(d.event!="mouseover"){var f=function(o,i){if(i.is(":not(.ui-state-disabled)")){i.addClass("ui-state-"+o)}};var j=function(o,i){i.removeClass("ui-state-"+o)};this.lis.bind("mouseover.tabs",function(){f("hover",a(this))});this.lis.bind("mouseout.tabs",function(){j("hover",a(this))});this.anchors.bind("focus.tabs",function(){f("focus",a(this).closest("li"))});this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"))})}var b,h;if(d.fx){if(a.isArray(d.fx)){b=d.fx[0];h=d.fx[1]}else{b=h=d.fx}}function e(i,o){i.css({display:""});if(a.browser.msie&&o.opacity){i[0].style.removeAttribute("filter")}}var k=h?function(i,o){a(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");o.hide().removeClass("ui-tabs-hide").animate(h,h.duration||"normal",function(){e(o,h);p._trigger("show",null,p._ui(i,o[0]))})}:function(i,o){a(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");o.removeClass("ui-tabs-hide");p._trigger("show",null,p._ui(i,o[0]))};var l=b?function(o,i){i.animate(b,b.duration||"normal",function(){p.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");i.addClass("ui-tabs-hide");e(i,b);p.element.dequeue("tabs")})}:function(o,i,q){p.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");i.addClass("ui-tabs-hide");p.element.dequeue("tabs")};this.anchors.bind(d.event+".tabs",function(){var o=this,r=a(this).closest("li"),i=p.panels.filter(":not(.ui-tabs-hide)"),q=a(p._sanitizeSelector(this.hash));if((r.hasClass("ui-tabs-selected")&&!d.collapsible)||r.hasClass("ui-state-disabled")||r.hasClass("ui-state-processing")||p._trigger("select",null,p._ui(this,q[0]))===false){this.blur();return false}d.selected=p.anchors.index(this);p.abort();if(d.collapsible){if(r.hasClass("ui-tabs-selected")){d.selected=-1;if(d.cookie){p._cookie(d.selected,d.cookie)}p.element.queue("tabs",function(){l(o,i)}).dequeue("tabs");this.blur();return false}else{if(!i.length){if(d.cookie){p._cookie(d.selected,d.cookie)}p.element.queue("tabs",function(){k(o,q)});p.load(p.anchors.index(this));this.blur();return false}}}if(d.cookie){p._cookie(d.selected,d.cookie)}if(q.length){if(i.length){p.element.queue("tabs",function(){l(o,i)})}p.element.queue("tabs",function(){k(o,q)});p.load(p.anchors.index(this))}else{throw"jQuery UI Tabs: Mismatching fragment identifier."}if(a.browser.msie){this.blur()}});this.anchors.bind("click.tabs",function(){return false})},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var c=a.data(this,"href.tabs");if(c){this.href=c}var d=a(this).unbind(".tabs");a.each(["href","load","cache"],function(e,f){d.removeData(f+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){if(a.data(this,"destroy.tabs")){a(this).remove()}else{a(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}});if(b.cookie){this._cookie(null,b.cookie)}},add:function(e,d,c){if(c===undefined){c=this.anchors.length}var b=this,g=this.options,i=a(g.tabTemplate.replace(/#\{href\}/g,e).replace(/#\{label\}/g,d)),h=!e.indexOf("#")?e.replace("#",""):this._tabId(a("a",i)[0]);i.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var f=a("#"+h);if(!f.length){f=a(g.panelTemplate).attr("id",h).data("destroy.tabs",true)}f.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(c>=this.lis.length){i.appendTo(this.list);f.appendTo(this.list[0].parentNode)}else{i.insertBefore(this.lis[c]);f.insertBefore(this.panels[c])}g.disabled=a.map(g.disabled,function(k,j){return k>=c?++k:k});this._tabify();if(this.anchors.length==1){i.addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){b._trigger("show",null,b._ui(b.anchors[0],b.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[c],this.panels[c]))},remove:function(b){var d=this.options,e=this.lis.eq(b).remove(),c=this.panels.eq(b).remove();if(e.hasClass("ui-tabs-selected")&&this.anchors.length>1){this.select(b+(b+1<this.anchors.length?1:-1))}d.disabled=a.map(a.grep(d.disabled,function(g,f){return g!=b}),function(g,f){return g>=b?--g:g});this._tabify();this._trigger("remove",null,this._ui(e.find("a")[0],c[0]))},enable:function(b){var c=this.options;if(a.inArray(b,c.disabled)==-1){return}this.lis.eq(b).removeClass("ui-state-disabled");c.disabled=a.grep(c.disabled,function(e,d){return e!=b});this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b]))},disable:function(c){var b=this,d=this.options;if(c!=d.selected){this.lis.eq(c).addClass("ui-state-disabled");d.disabled.push(c);d.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[c],this.panels[c]))}},select:function(b){if(typeof b=="string"){b=this.anchors.index(this.anchors.filter("[href$="+b+"]"))}else{if(b===null){b=-1}}if(b==-1&&this.options.collapsible){b=this.options.selected}this.anchors.eq(b).trigger(this.options.event+".tabs")},load:function(e){var c=this,g=this.options,b=this.anchors.eq(e)[0],d=a.data(b,"load.tabs");this.abort();if(!d||this.element.queue("tabs").length!==0&&a.data(b,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(e).addClass("ui-state-processing");if(g.spinner){var f=a("span",b);f.data("label.tabs",f.html()).html(g.spinner)}this.xhr=a.ajax(a.extend({},g.ajaxOptions,{url:d,success:function(i,h){a(c._sanitizeSelector(b.hash)).html(i);c._cleanup();if(g.cache){a.data(b,"cache.tabs",true)}c._trigger("load",null,c._ui(c.anchors[e],c.panels[e]));try{g.ajaxOptions.success(i,h)}catch(j){}c.element.dequeue("tabs")}}))},abort:function(){this.element.queue([]);this.panels.stop(false,true);if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup()},url:function(c,b){this.anchors.eq(c).removeData("cache.tabs").data("load.tabs",b)},length:function(){return this.anchors.length}});a.extend(a.ui.tabs,{version:"1.7",getter:"length",defaults:{ajaxOptions:null,cache:false,cookie:null,collapsible:false,disabled:[],event:"click",fx:null,idPrefix:"ui-tabs-",panelTemplate:"<div></div>",spinner:"<em>Loading&#8230;</em>",tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>'}});a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(d,f){var b=this,g=this.options;var c=b._rotate||(b._rotate=function(h){clearTimeout(b.rotation);b.rotation=setTimeout(function(){var i=g.selected;b.select(++i<b.anchors.length?i:0)},d);if(h){h.stopPropagation()}});var e=b._unrotate||(b._unrotate=!f?function(h){if(h.clientX){b.rotate(null)}}:function(h){t=g.selected;c()});if(d){this.element.bind("tabsshow",c);this.anchors.bind(g.event+".tabs",e);c()}else{clearTimeout(b.rotation);this.element.unbind("tabsshow",c);this.anchors.unbind(g.event+".tabs",e);delete this._rotate;delete this._unrotate}}})})(jQuery);;/*
* jQuery UI Draggable 1.7.2
*
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Draggables
*
* Depends:
*    ui.core.js
*/
(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,d){this.position=this._generatePosition(b);this.positionAbs=this._convertPositionTo("absolute");if(!d){var c=this._uiHash();this._trigger("drag",b,c);this.position=c.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(c){var d=false;if(a.ui.ddmanager&&!this.options.dropBehaviour){d=a.ui.ddmanager.drop(this,c)}if(this.dropped){d=this.dropped;this.dropped=false}if((this.options.revert=="invalid"&&!d)||(this.options.revert=="valid"&&d)||this.options.revert===true||(a.isFunction(this.options.revert)&&this.options.revert.call(this.element,d))){var b=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){b._trigger("stop",c);b._clear()})}else{this._trigger("stop",c);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(c){var d=this.options;var b=a.isFunction(d.helper)?a(d.helper.apply(this.element[0],[c])):(d.helper=="clone"?this.element.clone():this.element);if(!b.parents("body").length){b.appendTo((d.appendTo=="parent"?this.element[0].parentNode:d.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 e=this.options;if(e.containment=="parent"){e.containment=this.helper[0].parentNode}if(e.containment=="document"||e.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(e.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(e.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(e.containment)&&e.containment.constructor!=Array){var c=a(e.containment)[0];if(!c){return}var d=a(e.containment).offset();var b=(a(c).css("overflow")!="hidden");this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(b?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}else{if(e.containment.constructor==Array){this.containment=e.containment}}},_convertPositionTo:function(f,h){if(!h){h=this.position}var c=f=="absolute"?1:-1;var e=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(b[0].tagName);return{top:(h.top+this.offset.relative.top*c+this.offset.parent.top*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(g?0:b.scrollTop()))*c)),left:(h.left+this.offset.relative.left*c+this.offset.parent.left*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:b.scrollLeft())*c))}},_generatePosition:function(e){var h=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,i=(/(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 d=e.pageX;var c=e.pageY;if(this.originalPosition){if(this.containment){if(e.pageX-this.offset.click.left<this.containment[0]){d=this.containment[0]+this.offset.click.left}if(e.pageY-this.offset.click.top<this.containment[1]){c=this.containment[1]+this.offset.click.top}if(e.pageX-this.offset.click.left>this.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:(!(g-this.offset.click.top<this.containment[1])?g-h.grid[1]:g+h.grid[1])):g;var f=this.originalPageX+Math.round((d-this.originalPageX)/h.grid[0])*h.grid[0];d=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-h.grid[0]:f+h.grid[0])):f}}return{top:(c-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():(i?0:b.scrollTop())))),left:(d-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():i?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,c,d){d=d||this._uiHash();a.ui.plugin.call(this,b,[c,d]);if(b=="drag"){this.positionAbs=this._convertPositionTo("absolute")}return a.widget.prototype._trigger.call(this,b,c,d)},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(c,e){var d=a(this).data("draggable"),f=d.options,b=a.extend({},e,{item:d.element});d.sortables=[];a(f.connectToSortable).each(function(){var g=a.data(this,"sortable");if(g&&!g.options.disabled){d.sortables.push({instance:g,shouldRevert:g.options.revert});g._refreshItems();g._trigger("activate",c,b)}})},stop:function(c,e){var d=a(this).data("draggable"),b=a.extend({},e,{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(c);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",c,b)}})},drag:function(c,f){var e=a(this).data("draggable"),b=this;var d=function(i){var n=this.offset.click.top,m=this.offset.click.left;var g=this.positionAbs.top,k=this.positionAbs.left;var j=i.height,l=i.width;var p=i.top,h=i.left;return a.ui.isOver(g+n,k+m,p,h,j,l)};a.each(e.sortables,function(g){this.instance.positionAbs=e.positionAbs;this.instance.helperProportions=e.helperProportions;this.instance.offset.click=e.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 f.helper[0]};c.target=this.instance.currentItem[0];this.instance._mouseCapture(c,true);this.instance._mouseStart(c,true,true);this.instance.offset.click.top=e.offset.click.top;this.instance.offset.click.left=e.offset.click.left;this.instance.offset.parent.left-=e.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=e.offset.parent.top-this.instance.offset.parent.top;e._trigger("toSortable",c);e.dropped=this.instance.element;e.currentItem=e.element;this.instance.fromOutside=e}if(this.instance.currentItem){this.instance._mouseDrag(c)}}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",c,this.instance._uiHash(this.instance));this.instance._mouseStop(c,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder){this.instance.placeholder.remove()}e._trigger("fromSortable",c);e.dropped=false}}})}});a.ui.plugin.add("draggable","cursor",{start:function(c,d){var b=a("body"),e=a(this).data("draggable").options;if(b.css("cursor")){e._cursor=b.css("cursor")}b.css("cursor",e.cursor)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._cursor){a("body").css("cursor",d._cursor)}}});a.ui.plugin.add("draggable","iframeFix",{start:function(b,c){var d=a(this).data("draggable").options;a(d.iframeFix===true?"iframe":d.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(c,d){var b=a(d.helper),e=a(this).data("draggable").options;if(b.css("opacity")){e._opacity=b.css("opacity")}b.css("opacity",e.opacity)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._opacity){a(c.helper).css("opacity",d._opacity)}}});a.ui.plugin.add("draggable","scroll",{start:function(c,d){var b=a(this).data("draggable");if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){b.overflowOffset=b.scrollParent.offset()}},drag:function(d,e){var c=a(this).data("draggable"),f=c.options,b=false;if(c.scrollParent[0]!=document&&c.scrollParent[0].tagName!="HTML"){if(!f.axis||f.axis!="x"){if((c.overflowOffset.top+c.scrollParent[0].offsetHeight)-d.pageY<f.scrollSensitivity){c.scrollParent[0].scrollTop=b=c.scrollParent[0].scrollTop+f.scrollSpeed}else{if(d.pageY-c.overflowOffset.top<f.scrollSensitivity){c.scrollParent[0].scrollTop=b=c.scrollParent[0].scrollTop-f.scrollSpeed}}}if(!f.axis||f.axis!="y"){if((c.overflowOffset.left+c.scrollParent[0].offsetWidth)-d.pageX<f.scrollSensitivity){c.scrollParent[0].scrollLeft=b=c.scrollParent[0].scrollLeft+f.scrollSpeed}else{if(d.pageX-c.overflowOffset.left<f.scrollSensitivity){c.scrollParent[0].scrollLeft=b=c.scrollParent[0].scrollLeft-f.scrollSpeed}}}}else{if(!f.axis||f.axis!="x"){if(d.pageY-a(document).scrollTop()<f.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()-f.scrollSpeed)}else{if(a(window).height()-(d.pageY-a(document).scrollTop())<f.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()+f.scrollSpeed)}}}if(!f.axis||f.axis!="y"){if(d.pageX-a(document).scrollLeft()<f.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()-f.scrollSpeed)}else{if(a(window).width()-(d.pageX-a(document).scrollLeft())<f.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()+f.scrollSpeed)}}}}if(b!==false&&a.ui.ddmanager&&!f.dropBehaviour){a.ui.ddmanager.prepareOffsets(c,d)}}});a.ui.plugin.add("draggable","snap",{start:function(c,d){var b=a(this).data("draggable"),e=b.options;b.snapElements=[];a(e.snap.constructor!=String?(e.snap.items||":data(draggable)"):e.snap).each(function(){var g=a(this);var f=g.offset();if(this!=b.element[0]){b.snapElements.push({item:this,width:g.outerWidth(),height:g.outerHeight(),top:f.top,left:f.left})}})},drag:function(u,p){var g=a(this).data("draggable"),q=g.options;var y=q.snapTolerance;var x=p.offset.left,w=x+g.helperProportions.width,f=p.offset.top,e=f+g.helperProportions.height;for(var v=g.snapElements.length-1;v>=0;v--){var s=g.snapElements[v].left,n=s+g.snapElements[v].width,m=g.snapElements[v].top,A=m+g.snapElements[v].height;if(!((s-y<x&&x<n+y&&m-y<f&&f<A+y)||(s-y<x&&x<n+y&&m-y<e&&e<A+y)||(s-y<w&&w<n+y&&m-y<f&&f<A+y)||(s-y<w&&w<n+y&&m-y<e&&e<A+y))){if(g.snapElements[v].snapping){(g.options.snap.release&&g.options.snap.release.call(g.element,u,a.extend(g._uiHash(),{snapItem:g.snapElements[v].item})))}g.snapElements[v].snapping=false;continue}if(q.snapMode!="inner"){var c=Math.abs(m-e)<=y;var z=Math.abs(A-f)<=y;var j=Math.abs(s-w)<=y;var k=Math.abs(n-x)<=y;if(c){p.position.top=g._convertPositionTo("relative",{top:m-g.helperProportions.height,left:0}).top-g.margins.top}if(z){p.position.top=g._convertPositionTo("relative",{top:A,left:0}).top-g.margins.top}if(j){p.position.left=g._convertPositionTo("relative",{top:0,left:s-g.helperProportions.width}).left-g.margins.left}if(k){p.position.left=g._convertPositionTo("relative",{top:0,left:n}).left-g.margins.left}}var h=(c||z||j||k);if(q.snapMode!="outer"){var c=Math.abs(m-f)<=y;var z=Math.abs(A-e)<=y;var j=Math.abs(s-x)<=y;var k=Math.abs(n-w)<=y;if(c){p.position.top=g._convertPositionTo("relative",{top:m,left:0}).top-g.margins.top}if(z){p.position.top=g._convertPositionTo("relative",{top:A-g.helperProportions.height,left:0}).top-g.margins.top}if(j){p.position.left=g._convertPositionTo("relative",{top:0,left:s}).left-g.margins.left}if(k){p.position.left=g._convertPositionTo("relative",{top:0,left:n-g.helperProportions.width}).left-g.margins.left}}if(!g.snapElements[v].snapping&&(c||z||j||k||h)){(g.options.snap.snap&&g.options.snap.snap.call(g.element,u,a.extend(g._uiHash(),{snapItem:g.snapElements[v].item})))}g.snapElements[v].snapping=(c||z||j||k||h)}}});a.ui.plugin.add("draggable","stack",{start:function(b,c){var e=a(this).data("draggable").options;var d=a.makeArray(a(e.stack.group)).sort(function(g,f){return(parseInt(a(g).css("zIndex"),10)||e.stack.min)-(parseInt(a(f).css("zIndex"),10)||e.stack.min)});a(d).each(function(f){this.style.zIndex=e.stack.min+f});this[0].style.zIndex=e.stack.min+d.length}});a.ui.plugin.add("draggable","zIndex",{start:function(c,d){var b=a(d.helper),e=a(this).data("draggable").options;if(b.css("zIndex")){e._zIndex=b.css("zIndex")}b.css("zIndex",e.zIndex)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._zIndex){a(c.helper).css("zIndex",d._zIndex)}}})})(jQuery);;/*
* jQuery UI Droppable 1.7.2
*
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Droppables
*
* Depends:
*    ui.core.js
*    ui.draggable.js
*/
(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(e){return e.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(e){return e.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(c,d){var b=d||a.ui.ddmanager.current;if(!b||(b.currentItem||b.element)[0]==this.element[0]){return false}var e=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)){e=true;return false}});if(e){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",c,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(q,j,o){if(!j.offset){return false}var e=(q.positionAbs||q.position.absolute).left,d=e+q.helperProportions.width,n=(q.positionAbs||q.position.absolute).top,m=n+q.helperProportions.height;var g=j.offset.left,c=g+j.proportions.width,p=j.offset.top,k=p+j.proportions.height;switch(o){case"fit":return(g<e&&d<c&&p<n&&m<k);break;case"intersect":return(g<e+(q.helperProportions.width/2)&&d-(q.helperProportions.width/2)<c&&p<n+(q.helperProportions.height/2)&&m-(q.helperProportions.height/2)<k);break;case"pointer":var h=((q.positionAbs||q.position.absolute).left+(q.clickOffset||q.offset.click).left),i=((q.positionAbs||q.position.absolute).top+(q.clickOffset||q.offset.click).top),f=a.ui.isOver(i,h,p,g,j.proportions.height,j.proportions.width);return f;break;case"touch":return((n>=p&&n<=k)||(m>=p&&m<=k)||(n<p&&m>k))&&((e>=g&&e<=c)||(d>=g&&d<=c)||(e<g&&d>c));break;default:return false;break}};a.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,g){var b=a.ui.ddmanager.droppables[e.options.scope];var f=g?g.type:null;var h=(e.currentItem||e.element).find(":data(droppable)").andSelf();droppablesLoop:for(var d=0;d<b.length;d++){if(b[d].options.disabled||(e&&!b[d].options.accept.call(b[d].element[0],(e.currentItem||e.element)))){continue}for(var c=0;c<h.length;c++){if(h[c]==b[d].element[0]){b[d].proportions.height=0;continue droppablesLoop}}b[d].visible=b[d].element.css("display")!="none";if(!b[d].visible){continue}b[d].offset=b[d].element.offset();b[d].proportions={width:b[d].element[0].offsetWidth,height:b[d].element[0].offsetHeight};if(f=="mousedown"){b[d]._activate.call(b[d],g)}}},drop:function(b,c){var d=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)){d=this._drop.call(this,c)}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,c)}});return d},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 e=a.ui.intersect(b,this,this.options.tolerance);var g=!e&&this.isover==1?"isout":(e&&this.isover==0?"isover":null);if(!g){return}var f;if(this.options.greedy){var d=this.element.parents(":data(droppable):eq(0)");if(d.length){f=a.data(d[0],"droppable");f.greedyChild=(g=="isover"?1:0)}}if(f&&g=="isover"){f.isover=0;f.isout=1;f._out.call(f,c)}this[g]=1;this[g=="isout"?"isover":"isout"]=0;this[g=="isover"?"_over":"_out"].call(this,c);if(f&&g=="isout"){f.isout=0;f.isover=1;f._over.call(f,c)}})}}})(jQuery);;/*
* jQuery UI Sortable 1.7.2
*
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Sortables
*
* Depends:
*    ui.core.js
*/
(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,f){if(this.reverting){return false}if(this.options.disabled||this.options.type=="static"){return false}this._refreshItems(e);var d=null,c=this,b=a(e.target).parents().each(function(){if(a.data(this,"sortable-item")==c){d=a(this);return false}});if(a.data(e.target,"sortable-item")==c){d=a(e.target)}if(!d){return false}if(this.options.handle&&!f){var g=false;a(this.options.handle,d).find("*").andSelf().each(function(){if(this==e.target){g=true}});if(!g){return false}}this.currentItem=d;this._removeCurrentsFromItems();return true},_mouseStart:function(e,f,b){var g=this.options,c=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(g.cursorAt){this._adjustOffsetFromHelper(g.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(g.containment){this._setContainment()}if(g.cursor){if(a("body").css("cursor")){this._storedCursor=a("body").css("cursor")}a("body").css("cursor",g.cursor)}if(g.opacity){if(this.helper.css("opacity")){this._storedOpacity=this.helper.css("opacity")}this.helper.css("opacity",g.opacity)}if(g.zIndex){if(this.helper.css("zIndex")){this._storedZIndex=this.helper.css("zIndex")}this.helper.css("zIndex",g.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 d=this.containers.length-1;d>=0;d--){this.containers[d]._trigger("activate",e,c._uiHash(this))}}if(a.ui.ddmanager){a.ui.ddmanager.current=this}if(a.ui.ddmanager&&!g.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,e)}this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(e);return true},_mouseDrag:function(f){this.position=this._generatePosition(f);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs}if(this.options.scroll){var g=this.options,b=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if((this.overflowOffset.top+this.scrollParent[0].offsetHeight)-f.pageY<g.scrollSensitivity){this.scrollParent[0].scrollTop=b=this.scrollParent[0].scrollTop+g.scrollSpeed}else{if(f.pageY-this.overflowOffset.top<g.scrollSensitivity){this.scrollParent[0].scrollTop=b=this.scrollParent[0].scrollTop-g.scrollSpeed}}if((this.overflowOffset.left+this.scrollParent[0].offsetWidth)-f.pageX<g.scrollSensitivity){this.scrollParent[0].scrollLeft=b=this.scrollParent[0].scrollLeft+g.scrollSpeed}else{if(f.pageX-this.overflowOffset.left<g.scrollSensitivity){this.scrollParent[0].scrollLeft=b=this.scrollParent[0].scrollLeft-g.scrollSpeed}}}else{if(f.pageY-a(document).scrollTop()<g.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()-g.scrollSpeed)}else{if(a(window).height()-(f.pageY-a(document).scrollTop())<g.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()+g.scrollSpeed)}}if(f.pageX-a(document).scrollLeft()<g.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()-g.scrollSpeed)}else{if(a(window).width()-(f.pageX-a(document).scrollLeft())<g.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()+g.scrollSpeed)}}}if(b!==false&&a.ui.ddmanager&&!g.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,f)}}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 d=this.items.length-1;d>=0;d--){var e=this.items[d],c=e.item[0],h=this._intersectsWithPointer(e);if(!h){continue}if(c!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=c&&!a.ui.contains(this.placeholder[0],c)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],c):true)){this.direction=h==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(e)){this._rearrange(f,e)}else{break}this._trigger("change",f,this._uiHash());break}}this._contactContainers(f);if(a.ui.ddmanager){a.ui.ddmanager.drag(this,f)}this._trigger("sort",f,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(c,d){if(!c){return}if(a.ui.ddmanager&&!this.options.dropBehaviour){a.ui.ddmanager.drop(this,c)}if(this.options.revert){var b=this;var e=b.placeholder.offset();b.reverting=true;a(this.helper).animate({left:e.left-this.offset.parent.left-b.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.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(c)})}else{this._clear(c,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(d){var b=this._getItemsAsjQuery(d&&d.connected);var c=[];d=d||{};a(b).each(function(){var e=(a(d.item||this).attr(d.attribute||"id")||"").match(d.expression||(/(.+)[-=_](.+)/));if(e){c.push((d.key||e[1]+"[]")+"="+(d.key&&d.expression?e[1]:e[2]))}});return c.join("&")},toArray:function(d){var b=this._getItemsAsjQuery(d&&d.connected);var c=[];d=d||{};b.each(function(){c.push(a(d.item||this).attr(d.attribute||"id")||"")});return c},_intersectsWith:function(m){var e=this.positionAbs.left,d=e+this.helperProportions.width,k=this.positionAbs.top,j=k+this.helperProportions.height;var f=m.left,c=f+m.width,n=m.top,i=n+m.height;var o=this.offset.click.top,h=this.offset.click.left;var g=(k+o)>n&&(k+o)<i&&(e+h)>f&&(e+h)<c;if(this.options.tolerance=="pointer"||this.options.forcePointerForContainers||(this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>m[this.floating?"width":"height"])){return g}else{return(f<e+(this.helperProportions.width/2)&&d-(this.helperProportions.width/2)<c&&n<k+(this.helperProportions.height/2)&&j-(this.helperProportions.height/2)<i)}},_intersectsWithPointer:function(d){var e=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,d.top,d.height),c=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,d.left,d.width),g=e&&c,b=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();if(!g){return false}return this.floating?(((f&&f=="right")||b=="down")?2:1):(b&&(b=="down"?2:1))},_intersectsWithSides:function(e){var c=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+(e.height/2),e.height),d=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+(e.width/2),e.width),b=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();if(this.floating&&f){return((f=="right"&&d)||(f=="left"&&!d))}else{return b&&((b=="down"&&c)||(b=="up"&&!c))}},_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(b){var l=this;var g=[];var e=[];var h=this._connectWith();if(h&&b){for(var d=h.length-1;d>=0;d--){var k=a(h[d]);for(var c=k.length-1;c>=0;c--){var f=a.data(k[c],"sortable");if(f&&f!=this&&!f.options.disabled){e.push([a.isFunction(f.options.items)?f.options.items.call(f.element):a(f.options.items,f.element).not(".ui-sortable-helper"),f])}}}}e.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 d=e.length-1;d>=0;d--){e[d][0].each(function(){g.push(this)})}return a(g)},_removeCurrentsFromItems:function(){var d=this.currentItem.find(":data(sortable-item)");for(var c=0;c<this.items.length;c++){for(var b=0;b<d.length;b++){if(d[b]==this.items[c].item[0]){this.items.splice(c,1)}}}},_refreshItems:function(b){this.items=[];this.containers=[this];var h=this.items;var p=this;var f=[[a.isFunction(this.options.items)?this.options.items.call(this.element[0],b,{item:this.currentItem}):a(this.options.items,this.element),this]];var l=this._connectWith();if(l){for(var e=l.length-1;e>=0;e--){var m=a(l[e]);for(var d=m.length-1;d>=0;d--){var g=a.data(m[d],"sortable");if(g&&g!=this&&!g.options.disabled){f.push([a.isFunction(g.options.items)?g.options.items.call(g.element[0],b,{item:this.currentItem}):a(g.options.items,g.element),g]);this.containers.push(g)}}}}for(var e=f.length-1;e>=0;e--){var k=f[e][1];var c=f[e][0];for(var d=0,n=c.length;d<n;d++){var o=a(c[d]);o.data("sortable-item",k);h.push({item:o,instance:k,width:0,height:0,left:0,top:0})}}},refreshPositions:function(b){if(this.offsetParent&&this.helper){this.offset.parent=this._getParentOffset()}for(var d=this.items.length-1;d>=0;d--){var e=this.items[d];if(e.instance!=this.currentContainer&&this.currentContainer&&e.item[0]!=this.currentItem[0]){continue}var c=this.options.toleranceElement?a(this.options.toleranceElement,e.item):e.item;if(!b){e.width=c.outerWidth();e.height=c.outerHeight()}var f=c.offset();e.left=f.left;e.top=f.top}if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this)}else{for(var d=this.containers.length-1;d>=0;d--){var f=this.containers[d].element.offset();this.containers[d].containerCache.left=f.left;this.containers[d].containerCache.top=f.top;this.containers[d].containerCache.width=this.containers[d].element.outerWidth();this.containers[d].containerCache.height=this.containers[d].element.outerHeight()}}},_createPlaceholder:function(d){var b=d||this,e=b.options;if(!e.placeholder||e.placeholder.constructor==String){var c=e.placeholder;e.placeholder={element:function(){var f=a(document.createElement(b.currentItem[0].nodeName)).addClass(c||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!c){f.style.visibility="hidden"}return f},update:function(f,g){if(c&&!e.forcePlaceholderSize){return}if(!g.height()){g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10))}if(!g.width()){g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10))}}}}b.placeholder=a(e.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);e.placeholder.update(b,b.placeholder)},_contactContainers:function(d){for(var c=this.containers.length-1;c>=0;c--){if(this._intersectsWith(this.containers[c].containerCache)){if(!this.containers[c].containerCache.over){if(this.currentContainer!=this.containers[c]){var h=10000;var g=null;var e=this.positionAbs[this.containers[c].floating?"left":"top"];for(var b=this.items.length-1;b>=0;b--){if(!a.ui.contains(this.containers[c].element[0],this.items[b].item[0])){continue}var f=this.items[b][this.containers[c].floating?"left":"top"];if(Math.abs(f-e)<h){h=Math.abs(f-e);g=this.items[b]}}if(!g&&!this.options.dropOnEmpty){continue}this.currentContainer=this.containers[c];g?this._rearrange(d,g,null,true):this._rearrange(d,null,this.containers[c].element,true);this._trigger("change",d,this._uiHash());this.containers[c]._trigger("change",d,this._uiHash(this));this.options.placeholder.update(this.currentContainer,this.placeholder)}this.containers[c]._trigger("over",d,this._uiHash(this));this.containers[c].containerCache.over=1}}else{if(this.containers[c].containerCache.over){this.containers[c]._trigger("out",d,this._uiHash(this));this.containers[c].containerCache.over=0}}}},_createHelper:function(c){var d=this.options;var b=a.isFunction(d.helper)?a(d.helper.apply(this.element[0],[c,this.currentItem])):(d.helper=="clone"?this.currentItem.clone():this.currentItem);if(!b.parents("body").length){a(d.appendTo!="parent"?d.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==""||d.forceHelperSize){b.width(this.currentItem.width())}if(b[0].style.height==""||d.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 e=this.options;if(e.containment=="parent"){e.containment=this.helper[0].parentNode}if(e.containment=="document"||e.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(e.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(e.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(e.containment)){var c=a(e.containment)[0];var d=a(e.containment).offset();var b=(a(c).css("overflow")!="hidden");this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(b?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(f,h){if(!h){h=this.position}var c=f=="absolute"?1:-1;var e=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(b[0].tagName);return{top:(h.top+this.offset.relative.top*c+this.offset.parent.top*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(g?0:b.scrollTop()))*c)),left:(h.left+this.offset.relative.left*c+this.offset.parent.left*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:b.scrollLeft())*c))}},_generatePosition:function(e){var h=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,i=(/(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 d=e.pageX;var c=e.pageY;if(this.originalPosition){if(this.containment){if(e.pageX-this.offset.click.left<this.containment[0]){d=this.containment[0]+this.offset.click.left}if(e.pageY-this.offset.click.top<this.containment[1]){c=this.containment[1]+this.offset.click.top}if(e.pageX-this.offset.click.left>this.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:(!(g-this.offset.click.top<this.containment[1])?g-h.grid[1]:g+h.grid[1])):g;var f=this.originalPageX+Math.round((d-this.originalPageX)/h.grid[0])*h.grid[0];d=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-h.grid[0]:f+h.grid[0])):f}}return{top:(c-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():(i?0:b.scrollTop())))),left:(d-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():i?0:b.scrollLeft())))}},_rearrange:function(g,f,c,e){c?c[0].appendChild(this.placeholder[0]):f.item[0].parentNode.insertBefore(this.placeholder[0],(this.direction=="down"?f.item[0]:f.item[0].nextSibling));this.counter=this.counter?++this.counter:1;var d=this,b=this.counter;window.setTimeout(function(){if(b==d.counter){d.refreshPositions(!e)}},0)},_clear:function(d,e){this.reverting=false;var f=[],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 c in this._storedCSS){if(this._storedCSS[c]=="auto"||this._storedCSS[c]=="static"){this._storedCSS[c]=""}}this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}if(this.fromOutside&&!e){f.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])&&!e){f.push(function(g){this._trigger("update",g,this._uiHash())})}if(!a.ui.contains(this.element[0],this.currentItem[0])){if(!e){f.push(function(g){this._trigger("remove",g,this._uiHash())})}for(var c=this.containers.length-1;c>=0;c--){if(a.ui.contains(this.containers[c].element[0],this.currentItem[0])&&!e){f.push((function(g){return function(h){g._trigger("receive",h,this._uiHash(this))}}).call(this,this.containers[c]));f.push((function(g){return function(h){g._trigger("update",h,this._uiHash(this))}}).call(this,this.containers[c]))}}}for(var c=this.containers.length-1;c>=0;c--){if(!e){f.push((function(g){return function(h){g._trigger("deactivate",h,this._uiHash(this))}}).call(this,this.containers[c]))}if(this.containers[c].containerCache.over){f.push((function(g){return function(h){g._trigger("out",h,this._uiHash(this))}}).call(this,this.containers[c]));this.containers[c].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(!e){this._trigger("beforeStop",d,this._uiHash());for(var c=0;c<f.length;c++){f[c].call(this,d)}this._trigger("stop",d,this._uiHash())}return false}if(!e){this._trigger("beforeStop",d,this._uiHash())}this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.helper[0]!=this.currentItem[0]){this.helper.remove()}this.helper=null;if(!e){for(var c=0;c<f.length;c++){f[c].call(this,d)}this._trigger("stop",d,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);;/**
* Jcrop v.0.9.8 (minimized)
* (c) 2008 Kelly Hallman and DeepLiquid.com
* More information: http://deepliquid.com/content/Jcrop.html
* Released under MIT License - this header must remain with code
*/
(function($){$.Jcrop=function(obj,opt)
{var obj=obj,opt=opt;if(typeof(obj)!=='object')obj=$(obj)[0];if(typeof(opt)!=='object')opt={};if(!('trackDocument'in opt))
{opt.trackDocument=$.browser.msie?false:true;if($.browser.msie&&$.browser.version.split('.')[0]=='8')
opt.trackDocument=true;}
if(!('keySupport'in opt))
opt.keySupport=$.browser.msie?false:true;var defaults={trackDocument:false,baseClass:'jcrop',addClass:null,bgColor:'black',bgOpacity:.6,borderOpacity:.4,handleOpacity:.5,handlePad:5,handleSize:9,handleOffset:5,edgeMargin:14,aspectRatio:0,keySupport:true,cornerHandles:true,sideHandles:true,drawBorders:true,dragEdges:true,boxWidth:0,boxHeight:0,boundary:8,animationDelay:20,swingSpeed:3,allowSelect:true,allowMove:true,allowResize:true,minSelect:[0,0],maxSize:[0,0],minSize:[0,0],onChange:function(){},onSelect:function(){}};var options=defaults;setOptions(opt);var $origimg=$(obj);var $img=$origimg.clone().removeAttr('id').css({position:'absolute'});$img.width($origimg.width());$img.height($origimg.height());$origimg.after($img).hide();presize($img,options.boxWidth,options.boxHeight);var boundx=$img.width(),boundy=$img.height(),$div=$('<div />').width(boundx).height(boundy).addClass(cssClass('holder')).css({position:'relative',backgroundColor:options.bgColor}).insertAfter($origimg).append($img);;if(options.addClass)$div.addClass(options.addClass);var $img2=$('<img />').attr('src',$img.attr('src')).css('position','absolute').width(boundx).height(boundy);var $img_holder=$('<div />').width(pct(100)).height(pct(100)).css({zIndex:310,position:'absolute',overflow:'hidden'}).append($img2);var $hdl_holder=$('<div />').width(pct(100)).height(pct(100)).css('zIndex',320);var $sel=$('<div />').css({position:'absolute',zIndex:300}).insertBefore($img).append($img_holder,$hdl_holder);var bound=options.boundary;var $trk=newTracker().width(boundx+(bound*2)).height(boundy+(bound*2)).css({position:'absolute',top:px(-bound),left:px(-bound),zIndex:290}).mousedown(newSelection);var xlimit,ylimit,xmin,ymin;var xscale,yscale,enabled=true;var docOffset=getPos($img),btndown,lastcurs,dimmed,animating,shift_down;var Coords=function()
{var x1=0,y1=0,x2=0,y2=0,ox,oy;function setPressed(pos)
{var pos=rebound(pos);x2=x1=pos[0];y2=y1=pos[1];};function setCurrent(pos)
{var pos=rebound(pos);ox=pos[0]-x2;oy=pos[1]-y2;x2=pos[0];y2=pos[1];};function getOffset()
{return[ox,oy];};function moveOffset(offset)
{var ox=offset[0],oy=offset[1];if(0>x1+ox)ox-=ox+x1;if(0>y1+oy)oy-=oy+y1;if(boundy<y2+oy)oy+=boundy-(y2+oy);if(boundx<x2+ox)ox+=boundx-(x2+ox);x1+=ox;x2+=ox;y1+=oy;y2+=oy;};function getCorner(ord)
{var c=getFixed();switch(ord)
{case'ne':return[c.x2,c.y];case'nw':return[c.x,c.y];case'se':return[c.x2,c.y2];case'sw':return[c.x,c.y2];}};function getFixed()
{if(!options.aspectRatio)return getRect();var aspect=options.aspectRatio,min_x=options.minSize[0]/xscale,min_y=options.minSize[1]/yscale,max_x=options.maxSize[0]/xscale,max_y=options.maxSize[1]/yscale,rw=x2-x1,rh=y2-y1,rwa=Math.abs(rw),rha=Math.abs(rh),real_ratio=rwa/rha,xx,yy;if(max_x==0){max_x=boundx*10}
if(max_y==0){max_y=boundy*10}
if(real_ratio<aspect)
{yy=y2;w=rha*aspect;xx=rw<0?x1-w:w+x1;if(xx<0)
{xx=0;h=Math.abs((xx-x1)/aspect);yy=rh<0?y1-h:h+y1;}
else if(xx>boundx)
{xx=boundx;h=Math.abs((xx-x1)/aspect);yy=rh<0?y1-h:h+y1;}}
else
{xx=x2;h=rwa/aspect;yy=rh<0?y1-h:y1+h;if(yy<0)
{yy=0;w=Math.abs((yy-y1)*aspect);xx=rw<0?x1-w:w+x1;}
else if(yy>boundy)
{yy=boundy;w=Math.abs(yy-y1)*aspect;xx=rw<0?x1-w:w+x1;}}
if(xx>x1){if(xx-x1<min_x){xx=x1+min_x;}else if(xx-x1>max_x){xx=x1+max_x;}
if(yy>y1){yy=y1+(xx-x1)/aspect;}else{yy=y1-(xx-x1)/aspect;}}else if(xx<x1){if(x1-xx<min_x){xx=x1-min_x}else if(x1-xx>max_x){xx=x1-max_x;}
if(yy>y1){yy=y1+(x1-xx)/aspect;}else{yy=y1-(x1-xx)/aspect;}}
if(xx<0){x1-=xx;xx=0;}else if(xx>boundx){x1-=xx-boundx;xx=boundx;}
if(yy<0){y1-=yy;yy=0;}else if(yy>boundy){y1-=yy-boundy;yy=boundy;}
return last=makeObj(flipCoords(x1,y1,xx,yy));};function rebound(p)
{if(p[0]<0)p[0]=0;if(p[1]<0)p[1]=0;if(p[0]>boundx)p[0]=boundx;if(p[1]>boundy)p[1]=boundy;return[p[0],p[1]];};function flipCoords(x1,y1,x2,y2)
{var xa=x1,xb=x2,ya=y1,yb=y2;if(x2<x1)
{xa=x2;xb=x1;}
if(y2<y1)
{ya=y2;yb=y1;}
return[Math.round(xa),Math.round(ya),Math.round(xb),Math.round(yb)];};function getRect()
{var xsize=x2-x1;var ysize=y2-y1;if(xlimit&&(Math.abs(xsize)>xlimit))
x2=(xsize>0)?(x1+xlimit):(x1-xlimit);if(ylimit&&(Math.abs(ysize)>ylimit))
y2=(ysize>0)?(y1+ylimit):(y1-ylimit);if(ymin&&(Math.abs(ysize)<ymin))
y2=(ysize>0)?(y1+ymin):(y1-ymin);if(xmin&&(Math.abs(xsize)<xmin))
x2=(xsize>0)?(x1+xmin):(x1-xmin);if(x1<0){x2-=x1;x1-=x1;}
if(y1<0){y2-=y1;y1-=y1;}
if(x2<0){x1-=x2;x2-=x2;}
if(y2<0){y1-=y2;y2-=y2;}
if(x2>boundx){var delta=x2-boundx;x1-=delta;x2-=delta;}
if(y2>boundy){var delta=y2-boundy;y1-=delta;y2-=delta;}
if(x1>boundx){var delta=x1-boundy;y2-=delta;y1-=delta;}
if(y1>boundy){var delta=y1-boundy;y2-=delta;y1-=delta;}
return makeObj(flipCoords(x1,y1,x2,y2));};function makeObj(a)
{return{x:a[0],y:a[1],x2:a[2],y2:a[3],w:a[2]-a[0],h:a[3]-a[1]};};return{flipCoords:flipCoords,setPressed:setPressed,setCurrent:setCurrent,getOffset:getOffset,moveOffset:moveOffset,getCorner:getCorner,getFixed:getFixed};}();var Selection=function()
{var start,end,dragmode,awake,hdep=370;var borders={};var handle={};var seehandles=false;var hhs=options.handleOffset;if(options.drawBorders){borders={top:insertBorder('hline').css('top',$.browser.msie?px(-1):px(0)),bottom:insertBorder('hline'),left:insertBorder('vline'),right:insertBorder('vline')};}
if(options.dragEdges){handle.t=insertDragbar('n');handle.b=insertDragbar('s');handle.r=insertDragbar('e');handle.l=insertDragbar('w');}
options.sideHandles&&createHandles(['n','s','e','w']);options.cornerHandles&&createHandles(['sw','nw','ne','se']);function insertBorder(type)
{var jq=$('<div />').css({position:'absolute',opacity:options.borderOpacity}).addClass(cssClass(type));$img_holder.append(jq);return jq;};function dragDiv(ord,zi)
{var jq=$('<div />').mousedown(createDragger(ord)).css({cursor:ord+'-resize',position:'absolute',zIndex:zi});$hdl_holder.append(jq);return jq;};function insertHandle(ord)
{return dragDiv(ord,hdep++).css({top:px(-hhs+1),left:px(-hhs+1),opacity:options.handleOpacity}).addClass(cssClass('handle'));};function insertDragbar(ord)
{var s=options.handleSize,o=hhs,h=s,w=s,t=o,l=o;switch(ord)
{case'n':case's':w=pct(100);break;case'e':case'w':h=pct(100);break;}
return dragDiv(ord,hdep++).width(w).height(h).css({top:px(-t+1),left:px(-l+1)});};function createHandles(li)
{for(i in li)handle[li[i]]=insertHandle(li[i]);};function moveHandles(c)
{var midvert=Math.round((c.h/2)-hhs),midhoriz=Math.round((c.w/2)-hhs),north=west=-hhs+1,east=c.w-hhs,south=c.h-hhs,x,y;'e'in handle&&handle.e.css({top:px(midvert),left:px(east)})&&handle.w.css({top:px(midvert)})&&handle.s.css({top:px(south),left:px(midhoriz)})&&handle.n.css({left:px(midhoriz)});'ne'in handle&&handle.ne.css({left:px(east)})&&handle.se.css({top:px(south),left:px(east)})&&handle.sw.css({top:px(south)});'b'in handle&&handle.b.css({top:px(south)})&&handle.r.css({left:px(east)});};function moveto(x,y)
{$img2.css({top:px(-y),left:px(-x)});$sel.css({top:px(y),left:px(x)});};function resize(w,h)
{$sel.width(w).height(h);};function refresh()
{var c=Coords.getFixed();Coords.setPressed([c.x,c.y]);Coords.setCurrent([c.x2,c.y2]);updateVisible();};function updateVisible()
{if(awake)return update();};function update()
{var c=Coords.getFixed();resize(c.w,c.h);moveto(c.x,c.y);options.drawBorders&&borders['right'].css({left:px(c.w-1)})&&borders['bottom'].css({top:px(c.h-1)});seehandles&&moveHandles(c);awake||show();options.onChange(unscale(c));};function show()
{$sel.show();$img.css('opacity',options.bgOpacity);awake=true;};function release()
{disableHandles();$sel.hide();$img.css('opacity',1);awake=false;};function showHandles()
{if(seehandles)
{moveHandles(Coords.getFixed());$hdl_holder.show();}};function enableHandles()
{seehandles=true;if(options.allowResize)
{moveHandles(Coords.getFixed());$hdl_holder.show();return true;}};function disableHandles()
{seehandles=false;$hdl_holder.hide();};function animMode(v)
{(animating=v)?disableHandles():enableHandles();};function done()
{animMode(false);refresh();};var $track=newTracker().mousedown(createDragger('move')).css({cursor:'move',position:'absolute',zIndex:360})
$img_holder.append($track);disableHandles();return{updateVisible:updateVisible,update:update,release:release,refresh:refresh,setCursor:function(cursor){$track.css('cursor',cursor);},enableHandles:enableHandles,enableOnly:function(){seehandles=true;},showHandles:showHandles,disableHandles:disableHandles,animMode:animMode,done:done};}();var Tracker=function()
{var onMove=function(){},onDone=function(){},trackDoc=options.trackDocument;if(!trackDoc)
{$trk.mousemove(trackMove).mouseup(trackUp).mouseout(trackUp);}
function toFront()
{$trk.css({zIndex:450});if(trackDoc)
{$(document).mousemove(trackMove).mouseup(trackUp);}}
function toBack()
{$trk.css({zIndex:290});if(trackDoc)
{$(document).unbind('mousemove',trackMove).unbind('mouseup',trackUp);}}
function trackMove(e)
{onMove(mouseAbs(e));};function trackUp(e)
{e.preventDefault();e.stopPropagation();if(btndown)
{btndown=false;onDone(mouseAbs(e));options.onSelect(unscale(Coords.getFixed()));toBack();onMove=function(){};onDone=function(){};}
return false;};function activateHandlers(move,done)
{btndown=true;onMove=move;onDone=done;toFront();return false;};function setCursor(t){$trk.css('cursor',t);};$img.before($trk);return{activateHandlers:activateHandlers,setCursor:setCursor};}();var KeyManager=function()
{var $keymgr=$('<input type="radio" />').css({position:'absolute',left:'-30px'}).keypress(parseKey).blur(onBlur),$keywrap=$('<div />').css({position:'absolute',overflow:'hidden'}).append($keymgr);function watchKeys()
{if(options.keySupport)
{$keymgr.show();$keymgr.focus();}};function onBlur(e)
{$keymgr.hide();};function doNudge(e,x,y)
{if(options.allowMove){Coords.moveOffset([x,y]);Selection.updateVisible();};e.preventDefault();e.stopPropagation();};function parseKey(e)
{if(e.ctrlKey)return true;shift_down=e.shiftKey?true:false;var nudge=shift_down?10:1;switch(e.keyCode)
{case 37:doNudge(e,-nudge,0);break;case 39:doNudge(e,nudge,0);break;case 38:doNudge(e,0,-nudge);break;case 40:doNudge(e,0,nudge);break;case 27:Selection.release();break;case 9:return true;}
return nothing(e);};if(options.keySupport)$keywrap.insertBefore($img);return{watchKeys:watchKeys};}();function px(n){return''+parseInt(n)+'px';};function pct(n){return''+parseInt(n)+'%';};function cssClass(cl){return options.baseClass+'-'+cl;};function getPos(obj)
{var pos=$(obj).offset();return[pos.left,pos.top];};function mouseAbs(e)
{return[(e.pageX-docOffset[0]),(e.pageY-docOffset[1])];};function myCursor(type)
{if(type!=lastcurs)
{Tracker.setCursor(type);lastcurs=type;}};function startDragMode(mode,pos)
{docOffset=getPos($img);Tracker.setCursor(mode=='move'?mode:mode+'-resize');if(mode=='move')
return Tracker.activateHandlers(createMover(pos),doneSelect);var fc=Coords.getFixed();var opp=oppLockCorner(mode);var opc=Coords.getCorner(oppLockCorner(opp));Coords.setPressed(Coords.getCorner(opp));Coords.setCurrent(opc);Tracker.activateHandlers(dragmodeHandler(mode,fc),doneSelect);};function dragmodeHandler(mode,f)
{return function(pos){if(!options.aspectRatio)switch(mode)
{case'e':pos[1]=f.y2;break;case'w':pos[1]=f.y2;break;case'n':pos[0]=f.x2;break;case's':pos[0]=f.x2;break;}
else switch(mode)
{case'e':pos[1]=f.y+1;break;case'w':pos[1]=f.y+1;break;case'n':pos[0]=f.x+1;break;case's':pos[0]=f.x+1;break;}
Coords.setCurrent(pos);Selection.update();};};function createMover(pos)
{var lloc=pos;KeyManager.watchKeys();return function(pos)
{Coords.moveOffset([pos[0]-lloc[0],pos[1]-lloc[1]]);lloc=pos;Selection.update();};};function oppLockCorner(ord)
{switch(ord)
{case'n':return'sw';case's':return'nw';case'e':return'nw';case'w':return'ne';case'ne':return'sw';case'nw':return'se';case'se':return'nw';case'sw':return'ne';};};function createDragger(ord)
{return function(e){if(options.disabled)return false;if((ord=='move')&&!options.allowMove)return false;btndown=true;startDragMode(ord,mouseAbs(e));e.stopPropagation();e.preventDefault();return false;};};function presize($obj,w,h)
{var nw=$obj.width(),nh=$obj.height();if((nw>w)&&w>0)
{nw=w;nh=(w/$obj.width())*$obj.height();}
if((nh>h)&&h>0)
{nh=h;nw=(h/$obj.height())*$obj.width();}
xscale=$obj.width()/nw;yscale=$obj.height()/nh;$obj.width(nw).height(nh);};function unscale(c)
{return{x:parseInt(c.x*xscale),y:parseInt(c.y*yscale),x2:parseInt(c.x2*xscale),y2:parseInt(c.y2*yscale),w:parseInt(c.w*xscale),h:parseInt(c.h*yscale)};};function doneSelect(pos)
{var c=Coords.getFixed();if(c.w>options.minSelect[0]&&c.h>options.minSelect[1])
{Selection.enableHandles();Selection.done();}
else
{Selection.release();}
Tracker.setCursor(options.allowSelect?'crosshair':'default');};function newSelection(e)
{if(options.disabled)return false;if(!options.allowSelect)return false;btndown=true;docOffset=getPos($img);Selection.disableHandles();myCursor('crosshair');var pos=mouseAbs(e);Coords.setPressed(pos);Tracker.activateHandlers(selectDrag,doneSelect);KeyManager.watchKeys();Selection.update();e.stopPropagation();e.preventDefault();return false;};function selectDrag(pos)
{Coords.setCurrent(pos);Selection.update();};function newTracker()
{var trk=$('<div></div>').addClass(cssClass('tracker'));$.browser.msie&&trk.css({opacity:0,backgroundColor:'white'});return trk;};function animateTo(a)
{var x1=a[0]/xscale,y1=a[1]/yscale,x2=a[2]/xscale,y2=a[3]/yscale;if(animating)return;var animto=Coords.flipCoords(x1,y1,x2,y2);var c=Coords.getFixed();var animat=initcr=[c.x,c.y,c.x2,c.y2];var interv=options.animationDelay;var x=animat[0];var y=animat[1];var x2=animat[2];var y2=animat[3];var ix1=animto[0]-initcr[0];var iy1=animto[1]-initcr[1];var ix2=animto[2]-initcr[2];var iy2=animto[3]-initcr[3];var pcent=0;var velocity=options.swingSpeed;Selection.animMode(true);var animator=function()
{return function()
{pcent+=(100-pcent)/velocity;animat[0]=x+((pcent/100)*ix1);animat[1]=y+((pcent/100)*iy1);animat[2]=x2+((pcent/100)*ix2);animat[3]=y2+((pcent/100)*iy2);if(pcent<100)animateStart();else Selection.done();if(pcent>=99.8)pcent=100;setSelectRaw(animat);};}();function animateStart()
{window.setTimeout(animator,interv);};animateStart();};function setSelect(rect)
{setSelectRaw([rect[0]/xscale,rect[1]/yscale,rect[2]/xscale,rect[3]/yscale]);};function setSelectRaw(l)
{Coords.setPressed([l[0],l[1]]);Coords.setCurrent([l[2],l[3]]);Selection.update();};function setOptions(opt)
{if(typeof(opt)!='object')opt={};options=$.extend(options,opt);if(typeof(options.onChange)!=='function')
options.onChange=function(){};if(typeof(options.onSelect)!=='function')
options.onSelect=function(){};};function tellSelect()
{return unscale(Coords.getFixed());};function tellScaled()
{return Coords.getFixed();};function setOptionsNew(opt)
{setOptions(opt);interfaceUpdate();};function disableCrop()
{options.disabled=true;Selection.disableHandles();Selection.setCursor('default');Tracker.setCursor('default');};function enableCrop()
{options.disabled=false;interfaceUpdate();};function cancelCrop()
{Selection.done();Tracker.activateHandlers(null,null);};function destroy()
{$div.remove();$origimg.show();};function interfaceUpdate(alt)
{options.allowResize?alt?Selection.enableOnly():Selection.enableHandles():Selection.disableHandles();Tracker.setCursor(options.allowSelect?'crosshair':'default');Selection.setCursor(options.allowMove?'move':'default');$div.css('backgroundColor',options.bgColor);if('setSelect'in options){setSelect(opt.setSelect);Selection.done();delete(options.setSelect);}
if('trueSize'in options){xscale=options.trueSize[0]/boundx;yscale=options.trueSize[1]/boundy;}
xlimit=options.maxSize[0]||0;ylimit=options.maxSize[1]||0;xmin=options.minSize[0]||0;ymin=options.minSize[1]||0;if('outerImage'in options)
{$img.attr('src',options.outerImage);delete(options.outerImage);}
Selection.refresh();};$hdl_holder.hide();interfaceUpdate(true);var api={animateTo:animateTo,setSelect:setSelect,setOptions:setOptionsNew,tellSelect:tellSelect,tellScaled:tellScaled,disable:disableCrop,enable:enableCrop,cancel:cancelCrop,focus:KeyManager.watchKeys,getBounds:function(){return[boundx*xscale,boundy*yscale];},getWidgetSize:function(){return[boundx,boundy];},release:Selection.release,destroy:destroy};$origimg.data('Jcrop',api);return api;};$.fn.Jcrop=function(options)
{function attachWhenDone(from)
{var loadsrc=options.useImg||from.src;var img=new Image();img.onload=function(){$.Jcrop(from,options);};img.src=loadsrc;};if(typeof(options)!=='object')options={};this.each(function()
{if($(this).data('Jcrop'))
{if(options=='api')return $(this).data('Jcrop');else $(this).data('Jcrop').setOptions(options);}
else attachWhenDone(this);});return this;};})(jQuery);/**
* jQuery lightBox plugin
* This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
* and adapted to me for use like a plugin from jQuery.
* @name jquery-lightbox-0.5.js
* @author Leandro Vieira Pinho - http://leandrovieira.com
* @version 0.5
* @date April 11, 2008
* @category jQuery plugin
* @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com)
* @license CC Attribution-No Derivative Works 2.5 Brazil - http://creativecommons.org/licenses/by-nd/2.5/br/deed.en_US
* @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin
*/
(function($){$.fn.lightBox=function(settings){settings=jQuery.extend({overlayBgColor:'#000',overlayOpacity:0.8,fixedNavigation:false,imageLoading:'images/lightbox-ico-loading.gif',imageBtnPrev:'images/lightbox-btn-prev.gif',imageBtnNext:'images/lightbox-btn-next.gif',imageBtnClose:'images/lightbox-btn-close.gif',imageBlank:'images/lightbox-blank.gif',containerBorderSize:10,containerResizeSpeed:400,txtImage:'Image',txtOf:'of',keyToClose:'c',keyToPrev:'p',keyToNext:'n',imageArray:[],activeImage:0,largeImageAttr:'href'},settings);var jQueryMatchedObj=this;function _initialize(){_start(this,jQueryMatchedObj);return false;}
function _start(objClicked,jQueryMatchedObj){$('embed, object, select').css({'visibility':'hidden'});_set_interface();settings.imageArray.length=0;settings.activeImage=0;if(jQueryMatchedObj.length==1){settings.imageArray.push(new Array(objClicked.getAttribute(settings.largeImageAttr),objClicked.getAttribute('title')));}else{for(var i=0;i<jQueryMatchedObj.length;i++){settings.imageArray.push(new Array(jQueryMatchedObj[i].getAttribute(settings.largeImageAttr),jQueryMatchedObj[i].getAttribute('title')));}}
while(settings.imageArray[settings.activeImage][0]!=objClicked.getAttribute(settings.largeImageAttr)){settings.activeImage++;}
_set_image_to_view();}
function _set_interface(){$('body').append('<div id="jquery-overlay"></div><div id="jquery-lightbox"><div id="lightbox-container-image-box"><div id="lightbox-container-image"><img id="lightbox-image"><div style="" id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="'+settings.imageLoading+'"></a></div></div></div><div id="lightbox-container-image-data-box"><div id="lightbox-container-image-data"><div id="lightbox-image-details"><span id="lightbox-image-details-caption"></span><span id="lightbox-image-details-currentNumber"></span></div><div id="lightbox-secNav"><a href="#" id="lightbox-secNav-btnClose"><img src="'+settings.imageBtnClose+'"></a></div></div></div></div>');var arrPageSizes=___getPageSize();$('#jquery-overlay').css({backgroundColor:settings.overlayBgColor,opacity:settings.overlayOpacity,width:arrPageSizes[0],height:arrPageSizes[1]}).fadeIn();var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]}).show();$('#jquery-overlay,#jquery-lightbox').click(function(){_finish();});$('#lightbox-loading-link,#lightbox-secNav-btnClose').click(function(){_finish();return false;});$(window).resize(function(){var arrPageSizes=___getPageSize();$('#jquery-overlay').css({width:arrPageSizes[0],height:arrPageSizes[1]});var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]});});}
function _set_image_to_view(){$('#lightbox-loading').show();if(settings.fixedNavigation){$('#lightbox-image,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();}else{$('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();}
var objImagePreloader=new Image();objImagePreloader.onload=function(){$('#lightbox-image').attr('src',settings.imageArray[settings.activeImage][0]);_resize_container_image_box(objImagePreloader.width,objImagePreloader.height);objImagePreloader.onload=function(){};};objImagePreloader.src=settings.imageArray[settings.activeImage][0];};function _resize_container_image_box(intImageWidth,intImageHeight){var intCurrentWidth=$('#lightbox-container-image-box').width();var intCurrentHeight=$('#lightbox-container-image-box').height();var intWidth=(intImageWidth+(settings.containerBorderSize*2));var intHeight=(intImageHeight+(settings.containerBorderSize*2));var intDiffW=intCurrentWidth-intWidth;var intDiffH=intCurrentHeight-intHeight;$('#lightbox-container-image-box').animate({width:intWidth,height:intHeight},settings.containerResizeSpeed,function(){_show_image();});if((intDiffW==0)&&(intDiffH==0)){if($.browser.msie){___pause(250);}else{___pause(100);}}
$('#lightbox-container-image-data-box').css({width:intImageWidth});$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({height:intImageHeight+(settings.containerBorderSize*2)});};function _show_image(){$('#lightbox-loading').hide();$('#lightbox-image').fadeIn(function(){_show_image_data();_set_navigation();});_preload_neighbor_images();};function _show_image_data(){$('#lightbox-container-image-data-box').slideDown('fast');$('#lightbox-image-details-caption').hide();if(settings.imageArray[settings.activeImage][1]){$('#lightbox-image-details-caption').html(settings.imageArray[settings.activeImage][1]).show();}
if(settings.imageArray.length>1){$('#lightbox-image-details-currentNumber').html(settings.txtImage+' '+(settings.activeImage+1)+' '+settings.txtOf+' '+settings.imageArray.length).show();}}
function _set_navigation(){$('#lightbox-nav').show();$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({'background':'transparent url('+settings.imageBlank+') no-repeat'});if(settings.activeImage!=0){if(settings.fixedNavigation){$('#lightbox-nav-btnPrev').css({'background':'url('+settings.imageBtnPrev+') left 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});}else{$('#lightbox-nav-btnPrev').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnPrev+') left 15% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});}}
if(settings.activeImage!=(settings.imageArray.length-1)){if(settings.fixedNavigation){$('#lightbox-nav-btnNext').css({'background':'url('+settings.imageBtnNext+') right 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});}else{$('#lightbox-nav-btnNext').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnNext+') right 15% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});}}
_enable_keyboard_navigation();}
function _enable_keyboard_navigation(){$(document).keydown(function(objEvent){_keyboard_action(objEvent);});}
function _disable_keyboard_navigation(){$(document).unbind();}
function _keyboard_action(objEvent){if(objEvent==null){keycode=event.keyCode;escapeKey=27;}else{keycode=objEvent.keyCode;escapeKey=objEvent.DOM_VK_ESCAPE;}
key=String.fromCharCode(keycode).toLowerCase();if((key==settings.keyToClose)||(key=='x')||(keycode==escapeKey)){_finish();}
if((key==settings.keyToPrev)||(keycode==37)){if(settings.activeImage!=0){settings.activeImage=settings.activeImage-1;_set_image_to_view();_disable_keyboard_navigation();}}
if((key==settings.keyToNext)||(keycode==39)){if(settings.activeImage!=(settings.imageArray.length-1)){settings.activeImage=settings.activeImage+1;_set_image_to_view();_disable_keyboard_navigation();}}}
function _preload_neighbor_images(){if((settings.imageArray.length-1)>settings.activeImage){objNext=new Image();objNext.src=settings.imageArray[settings.activeImage+1][0];}
if(settings.activeImage>0){objPrev=new Image();objPrev.src=settings.imageArray[settings.activeImage-1][0];}}
function _finish(){$('#jquery-lightbox').remove();$('#jquery-overlay').fadeOut(function(){$('#jquery-overlay').remove();});$('embed, object, select').css({'visibility':'visible'});}
function ___getPageSize(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=window.innerWidth+window.scrollMaxX;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
var windowWidth,windowHeight;if(self.innerHeight){if(document.documentElement.clientWidth){windowWidth=document.documentElement.clientWidth;}else{windowWidth=self.innerWidth;}
windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
if(xScroll<windowWidth){pageWidth=xScroll;}else{pageWidth=windowWidth;}
arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight);return arrayPageSize;};function ___getPageScroll(){var xScroll,yScroll;if(self.pageYOffset){yScroll=self.pageYOffset;xScroll=self.pageXOffset;}else if(document.documentElement&&document.documentElement.scrollTop){yScroll=document.documentElement.scrollTop;xScroll=document.documentElement.scrollLeft;}else if(document.body){yScroll=document.body.scrollTop;xScroll=document.body.scrollLeft;}
arrayPageScroll=new Array(xScroll,yScroll);return arrayPageScroll;};function ___pause(ms){var date=new Date();curDate=null;do{var curDate=new Date();}
while(curDate-date<ms);};return this.unbind('click').click(_initialize);};})(jQuery);/**
* YOU ARE FREE TO USE THIS CODE IF YOU HOLD THE REFERENCE TO THE AUTHOR
* Plugin for jQuery that delimites the maximum of characteres in inputs and textareas
* @author: Ivn Guardado Castro
* @email: dev.ivangc@gmail.com
* @website: http://yensdesign.com/
*/
jQuery.fn.maxLength = function(max){
this.each(function(){
//Get the type of the matched element
var type = this.tagName.toLowerCase();
//If the type property exists, save it in lower case
var inputType = this.type? this.type.toLowerCase() : null;
//Check if is a input type=text OR type=password
if(type == "input" && inputType == "text" || inputType == "password"){
//Apply the standard maxLength
this.maxLength = max;
}
//Check if the element is a textarea
else if(type == "textarea"){
//Add the key press event
this.onkeypress = function(e){
//Get the event object (for IE)
var ob = e || event;
//Get the code of key pressed
var keyCode = ob.keyCode;
//Check if it has a selected text
var hasSelection = document.selection? document.selection.createRange().text.length > 0 : this.selectionStart != this.selectionEnd;
//return false if can't write more
return !(this.value.length >= max && (keyCode > 50 || keyCode == 32 || keyCode == 0 || keyCode == 13) && !ob.ctrlKey && !ob.altKey && !hasSelection);
};
//Add the key up event
this.onkeyup = function(){
//If the keypress fail and allow write more text that required, this event will remove it 
if(this.value.length > max){
this.value = this.value.substring(0,max);
}
};
}
});
};
/*
Robert Penner's original easing equations modified for JQuery animate method, Jamie Lemon 2009 lemonsanver.com
Below are easing equations based on Robert Penner's work, modified for JQuery
The "In" part of an animation is the start of it, the "Out" part is the end of it
If you apply "easing" at the "In" or the "Out" then the supplied animation curve is most apparent at that point
Enjoy the animation curves!
usage: $(".myImageID").animate({"left": "+=100"},{queue:false, duration:500, easing:"bounceEaseOut"});
function list:
back
bounce
circ
cubic
elastic
expo
quad
quart
quint
sine
Note in JQuey's native animate function the supplied parameters are supplied as follows:
easingAlgorythmEaseType: function( p, n, firstNum, diff )
@param p The time phase between 0 and 1
@param n Not sure what this is :), in any case its not used
@param firstNum The first number in the transform
@param diff The difference in in pixels required
*/
/*
Disclaimer for Robert Penner's Easing Equations license:
TERMS OF USE - EASING EQUATIONS
Open source under the BSD License.
Copyright © 2001 Robert Penner
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
jQuery.extend({
easing:
{
// ******* back
backEaseIn:function(p, n, firstNum, diff) {
var c=firstNum+diff;
var s = 1.70158; // default overshoot value, can be adjusted to suit
return c*(p/=1)*p*((s+1)*p - s) + firstNum;
},
backEaseOut:function(p, n, firstNum, diff) {
var c=firstNum+diff;
var s = 1.70158; // default overshoot value, can be adjusted to suit
return c*((p=p/1-1)*p*((s+1)*p + s) + 1) + firstNum;
},
backEaseInOut:function(p, n, firstNum, diff) {
var c=firstNum+diff;
var s = 1.70158; // default overshoot value, can be adjusted to suit
if ((p/=0.5) < 1)
return c/2*(p*p*(((s*=(1.525))+1)*p - s)) + firstNum;
else
return c/2*((p-=2)*p*(((s*=(1.525))+1)*p + s) + 2) + firstNum;
},
// ******* bounce
bounceEaseIn:function(p, n, firstNum, diff) {
var c=firstNum+diff;
var inv = this.bounceEaseOut (1-p, 1, 0, diff);
return c - inv + firstNum;
},
bounceEaseOut:function(p, n, firstNum, diff) {
var c=firstNum+diff;
if (p < (1/2.75))
{
return c*(7.5625*p*p) + firstNum;
}
else if (p < (2/2.75))
{
return c*(7.5625*(p-=(1.5/2.75))*p + .75) + firstNum;
}
else if (p < (2.5/2.75))
{
return c*(7.5625*(p-=(2.25/2.75))*p + .9375) + firstNum;
}
else
{
return c*(7.5625*(p-=(2.625/2.75))*p + .984375) + firstNum;
}
},
// ******* circ
circEaseIn:function(p, n, firstNum, diff) {
var c=firstNum+diff;
return -c * (Math.sqrt(1 - (p/=1)*p) - 1) + firstNum;
},
circEaseOut:function(p, n, firstNum, diff) {
var c=firstNum+diff;
return c * Math.sqrt(1 - (p=p/1-1)*p) + firstNum;
},
circEaseInOut:function(p, n, firstNum, diff) {
var c=firstNum+diff;
if ((p/=0.5) < 1)
return -c/2 * (Math.sqrt(1 - p*p) - 1) + firstNum;
else
return c/2 * (Math.sqrt(1 - (p-=2)*p) + 1) + firstNum;
},
// ******* cubic
cubicEaseIn:function(p, n, firstNum, diff) {
var c=firstNum+diff;
return c*(p/=1)*p*p + firstNum;
},
cubicEaseOut:function(p, n, firstNum, diff) {
var c=firstNum+diff;
return c*((p=p/1-1)*p*p + 1) + firstNum;
},
cubicEaseInOut:function(p, n, firstNum, diff) {
var c=firstNum+diff;
if ((p/=0.5) < 1)
return c/2*p*p*p + firstNum;
else
return c/2*((p-=2)*p*p + 2) + firstNum;
},
// ******* elastic
elasticEaseIn:function(p, n, firstNum, diff) {
var c=firstNum+diff;
if (p==0) return firstNum;
if (p==1) return c;
var peroid = 0.25;
var s;
var amplitude = c;
if (amplitude < Math.abs(c))
{
amplitude = c;
s = peroid/4;
}
else
{
s = peroid/(2*Math.PI) * Math.asin (c/amplitude);
}
return -(amplitude*Math.pow(2,10*(p-=1)) * Math.sin( (p*1-s)*(2*Math.PI)/peroid )) + firstNum;
},
elasticEaseOut:function(p, n, firstNum, diff) {
var c=firstNum+diff;
if (p==0) return firstNum;
if (p==1) return c;
var peroid = 0.25;
var s;
var amplitude = c;
if (amplitude < Math.abs(c))
{
amplitude = c;
s = peroid/4;
}
else
{
s = peroid/(2*Math.PI) * Math.asin (c/amplitude);
}
return -(amplitude*Math.pow(2,-10*p) * Math.sin( (p*1-s)*(2*Math.PI)/peroid )) + c;
},
// ******* expo
expoEaseIn:function(p, n, firstNum, diff) {
var c=firstNum+diff;
return (p==0) ? firstNum : c * Math.pow(2, 10 * (p - 1)) + firstNum - c * 0.001;
},
expoEaseOut:function(p, n, firstNum, diff) {
var c=firstNum+diff;
return (p==1) ? c : diff * 1.001 * (-Math.pow(2, -10 * p) + 1) + firstNum;
},
expoEaseInOut:function(p, n, firstNum, diff) {
var c=firstNum+diff;
if (p==0) return firstNum;
if (p==1) return c;
if ((p/=0.5) < 1)
return c/2 * Math.pow(2, 10 * (p - 1)) + firstNum - c * 0.0005;
else
return c/2 * 1.0005 * (-Math.pow(2, -10 * --p) + 2) + firstNum;
},
// ******* quad
quadEaseIn:function(p, n, firstNum, diff) {
var c=firstNum+diff;
return c*(p/=1)*p + firstNum;
},
quadEaseOut:function(p, n, firstNum, diff) {
var c=firstNum+diff;
return -c *(p/=1)*(p-2) + firstNum;
},
quadEaseInOut:function(p, n, firstNum, diff) {
var c=firstNum+diff;
if ((p/=0.5) < 1)
return c/2*p*p + firstNum;
else
return -c/2 * ((--p)*(p-2) - 1) + firstNum;
},
// ******* quart
quartEaseIn:function(p, n, firstNum, diff) {
var c=firstNum+diff;
return c*(p/=1)*p*p*p + firstNum;
},
quartEaseOut:function(p, n, firstNum, diff) {
var c=firstNum+diff;
return -c * ((p=p/1-1)*p*p*p - 1) + firstNum;
},
quartEaseInOut:function(p, n, firstNum, diff) {
var c=firstNum+diff;
if ((p/=0.5) < 1)
return c/2*p*p*p*p + firstNum;
else
return -c/2 * ((p-=2)*p*p*p - 2) + firstNum;
},
// ******* quint
quintEaseIn:function(p, n, firstNum, diff) {
var c=firstNum+diff;
return c*(p/=1)*p*p*p*p + firstNum;
},
quintEaseOut:function(p, n, firstNum, diff) {
var c=firstNum+diff;
return c*((p=p/1-1)*p*p*p*p + 1) + firstNum;
},
quintEaseInOut:function(p, n, firstNum, diff) {
var c=firstNum+diff;
if ((p/=0.5) < 1)
return c/2*p*p*p*p*p + firstNum;
else
return c/2*((p-=2)*p*p*p*p + 2) + firstNum;
},
// *******  sine
sineEaseIn:function(p, n, firstNum, diff) {
var c=firstNum+diff;
return -c * Math.cos(p * (Math.PI/2)) +c + firstNum;
},
sineEaseOut:function(p, n, firstNum, diff) {
var c=firstNum+diff;
return c * Math.sin(p * (Math.PI/2)) + firstNum;
},
sineEaseInOut:function(p, n, firstNum, diff) {
var c=firstNum+diff;
return -c/2 * (Math.cos(Math.PI*p) - 1) + firstNum;
},
// ******* quad
swing:function(p, n, firstNum, diff) {
var c=firstNum+diff;
return c*(p/=1)*p + firstNum;
},
linear:function(p, n, firstNum, diff) {
var c=firstNum+diff;
return -c *(p/=1)*(p-2) + firstNum;
}
}
});
(function($){$.toJSON=function(o)
{if(typeof(JSON)=='object'&&JSON.stringify)
return JSON.stringify(o);var type=typeof(o);if(o===null)
return"null";if(type=="undefined")
return undefined;if(type=="number"||type=="boolean")
return o+"";if(type=="string")
return $.quoteString(o);if(type=='object')
{if(typeof o.toJSON=="function")
return $.toJSON(o.toJSON());if(o.constructor===Date)
{var month=o.getUTCMonth()+1;if(month<10)month='0'+month;var day=o.getUTCDate();if(day<10)day='0'+day;var year=o.getUTCFullYear();var hours=o.getUTCHours();if(hours<10)hours='0'+hours;var minutes=o.getUTCMinutes();if(minutes<10)minutes='0'+minutes;var seconds=o.getUTCSeconds();if(seconds<10)seconds='0'+seconds;var milli=o.getUTCMilliseconds();if(milli<100)milli='0'+milli;if(milli<10)milli='0'+milli;return'"'+year+'-'+month+'-'+day+'T'+
hours+':'+minutes+':'+seconds+'.'+milli+'Z"';}
if(o.constructor===Array)
{var ret=[];for(var i=0;i<o.length;i++)
ret.push($.toJSON(o[i])||"null");return"["+ret.join(",")+"]";}
var pairs=[];for(var k in o){var name;var type=typeof k;if(type=="number")
name='"'+k+'"';else if(type=="string")
name=$.quoteString(k);else
continue;if(typeof o[k]=="function")
continue;var val=$.toJSON(o[k]);pairs.push(name+":"+val);}
return"{"+pairs.join(", ")+"}";}};$.evalJSON=function(src)
{if(typeof(JSON)=='object'&&JSON.parse)
return JSON.parse(src);return eval("("+src+")");};$.secureEvalJSON=function(src)
{if(typeof(JSON)=='object'&&JSON.parse)
return JSON.parse(src);var filtered=src;filtered=filtered.replace(/\\["\\\/bfnrtu]/g,'@');filtered=filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']');filtered=filtered.replace(/(?:^|:|,)(?:\s*\[)+/g,'');if(/^[\],:{}\s]*$/.test(filtered))
return eval("("+src+")");else
throw new SyntaxError("Error parsing JSON, source is not valid.");};$.quoteString=function(string)
{if(string.match(_escapeable))
{return'"'+string.replace(_escapeable,function(a)
{var c=_meta[a];if(typeof c==='string')return c;c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);})+'"';}
return'"'+string+'"';};var _escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;var _meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};})(jQuery);/** jsTree */
(function($){$.tree={datastores:{},plugins:{},defaults:{data:{async:false,type:"html",opts:{method:"GET",url:false}},selected:false,opened:[],languages:[],ui:{dots:true,animation:0,scroll_spd:4,theme_path:false,theme_name:"default",selected_parent_close:"select_parent",selected_delete:"select_previous"},types:{"default":{clickable:true,renameable:true,deletable:true,creatable:true,draggable:true,max_children:-1,max_depth:-1,valid_children:"all",icon:{image:false,position:false}}},rules:{multiple:false,multitree:"none",type_attr:"rel",createat:"bottom",drag_copy:"ctrl",drag_button:"left",use_max_children:true,use_max_depth:true,max_children:-1,max_depth:-1,valid_children:"all"},lang:{new_node:"New folder",loading:"Loading ..."},callback:{beforechange:function(NODE,TREE_OBJ){return true},beforeopen:function(NODE,TREE_OBJ){return true},beforeclose:function(NODE,TREE_OBJ){return true},beforemove:function(NODE,REF_NODE,TYPE,TREE_OBJ){return true},beforecreate:function(NODE,REF_NODE,TYPE,TREE_OBJ){return true},beforerename:function(NODE,LANG,TREE_OBJ){return true},beforedelete:function(NODE,TREE_OBJ){return true},beforedata:function(NODE,TREE_OBJ){return{id:$(NODE).attr("id")||0}},ondata:function(DATA,TREE_OBJ){return DATA},onparse:function(STR,TREE_OBJ){return STR},onhover:function(NODE,TREE_OBJ){},onselect:function(NODE,TREE_OBJ){},ondeselect:function(NODE,TREE_OBJ){},onchange:function(NODE,TREE_OBJ){},onrename:function(NODE,TREE_OBJ,RB){},onmove:function(NODE,REF_NODE,TYPE,TREE_OBJ,RB){},oncopy:function(NODE,REF_NODE,TYPE,TREE_OBJ,RB){},oncreate:function(NODE,REF_NODE,TYPE,TREE_OBJ,RB){},ondelete:function(NODE,TREE_OBJ,RB){},onopen:function(NODE,TREE_OBJ){},onopen_all:function(TREE_OBJ){},onclose_all:function(TREE_OBJ){},onclose:function(NODE,TREE_OBJ){},error:function(TEXT,TREE_OBJ){},ondblclk:function(NODE,TREE_OBJ){TREE_OBJ.toggle_branch.call(TREE_OBJ,NODE);TREE_OBJ.select_branch.call(TREE_OBJ,NODE)},onrgtclk:function(NODE,TREE_OBJ,EV){},onload:function(TREE_OBJ){},oninit:function(TREE_OBJ){},onfocus:function(TREE_OBJ){},ondestroy:function(TREE_OBJ){},onsearch:function(NODES,TREE_OBJ){NODES.addClass("search")},ondrop:function(NODE,REF_NODE,TYPE,TREE_OBJ){},check:function(RULE,NODE,VALUE,TREE_OBJ){return VALUE},check_move:function(NODE,REF_NODE,TYPE,TREE_OBJ){return true}},plugins:{}},create:function(){return new tree_component()},focused:function(){return tree_component.inst[tree_component.focused]},reference:function(obj){var o=$(obj);if(!o.size())o=$("#"+obj);if(!o.size())return null;o=(o.is(".tree"))?o.attr("id"):o.parents(".tree:eq(0)").attr("id");return tree_component.inst[o]||null},rollback:function(data){for(var i in data){if(!data.hasOwnProperty(i))continue;var tmp=tree_component.inst[i];var lock=!tmp.locked;if(lock)tmp.lock(true);tmp.inp=false;tmp.container.html(data[i].html).find(".dragged").removeClass("dragged").end().find(".hover").removeClass("hover");if(data[i].selected){tmp.selected=$("#"+data[i].selected);tmp.selected_arr=[];tmp.container.find("a.clicked").each(function(){tmp.selected_arr.push(tmp.get_node(this))})}if(lock)tmp.lock(false);delete lock;delete tmp}},drop_mode:function(opts){opts=$.extend(opts,{show:false,type:"default",str:"Foreign node"});tree_component.drag_drop.foreign=true;tree_component.drag_drop.isdown=true;tree_component.drag_drop.moving=true;tree_component.drag_drop.appended=false;tree_component.drag_drop.f_type=opts.type;tree_component.drag_drop.f_data=opts;if(!opts.show){tree_component.drag_drop.drag_help=false;tree_component.drag_drop.drag_node=false}else{tree_component.drag_drop.drag_help=$("<div id='jstree-dragged' class='tree tree-default'><ul><li class='last dragged foreign'><a href='#'><ins>&nbsp;</ins>"+opts.str+"</a></li></ul></div>");tree_component.drag_drop.drag_node=tree_component.drag_drop.drag_help.find("li:eq(0)")}if($.tree.drag_start!==false)$.tree.drag_start.call(null,false)},drag_start:false,drag:false,drag_end:false};$.fn.tree=function(opts){return this.each(function(){var conf=$.extend({},opts);if(tree_component.inst&&tree_component.inst[$(this).attr('id')])tree_component.inst[$(this).attr('id')].destroy();if(conf!==false)new tree_component().init(this,conf)})};function tree_component(){return{cntr:++tree_component.cntr,settings:$.extend({},$.tree.defaults),init:function(elem,conf){var _this=this;this.container=$(elem);if(this.container.size==0)return false;tree_component.inst[this.cntr]=this;if(!this.container.attr("id"))this.container.attr("id","jstree_"+this.cntr);tree_component.inst[this.container.attr("id")]=tree_component.inst[this.cntr];tree_component.focused=this.cntr;this.settings=$.extend(true,{},this.settings,conf);if(this.settings.languages&&this.settings.languages.length){this.current_lang=this.settings.languages[0];var st=false;var id="#"+this.container.attr("id");for(var ln=0;ln<this.settings.languages.length;ln++){st=tree_component.add_css(id+" ."+this.settings.languages[ln]);if(st!==false)st.style.display=(this.settings.languages[ln]==this.current_lang)?"":"none"}}else this.current_lang=false;this.container.addClass("tree");if(this.settings.ui.theme_name!==false){if(this.settings.ui.theme_path===false){$("script").each(function(){if(this.src.toString().match(/jquery\.tree.*?js$/)){_this.settings.ui.theme_path=this.src.toString().replace(/jquery\.tree.*?js$/,"")+"themes/"+_this.settings.ui.theme_name+"/style.css";return false}})}if(this.settings.ui.theme_path!=""&&$.inArray(this.settings.ui.theme_path,tree_component.themes)==-1){tree_component.add_sheet({url:this.settings.ui.theme_path});tree_component.themes.push(this.settings.ui.theme_path)}this.container.addClass("tree-"+this.settings.ui.theme_name)}var type_icons="";for(var t in this.settings.types){if(!this.settings.types.hasOwnProperty(t))continue;if(!this.settings.types[t].icon)continue;if(this.settings.types[t].icon.image||this.settings.types[t].icon.position){if(t=="default")type_icons+="#"+this.container.attr("id")+" li > a ins { ";else type_icons+="#"+this.container.attr("id")+" li[rel="+t+"] > a ins { ";if(this.settings.types[t].icon.image)type_icons+=" background-image:url("+this.settings.types[t].icon.image+"); ";if(this.settings.types[t].icon.position)type_icons+=" background-position:"+this.settings.types[t].icon.position+"; ";type_icons+="} "}}if(type_icons!="")tree_component.add_sheet({str:type_icons});if(this.settings.rules.multiple)this.selected_arr=[];this.offset=false;this.hovered=false;this.locked=false;if(tree_component.drag_drop.marker===false)tree_component.drag_drop.marker=$("<div>").attr({id:"jstree-marker"}).hide().appendTo("body");this.callback("oninit",[this]);this.refresh();this.attach_events();this.focus()},refresh:function(obj){if(this.locked)return this.error("LOCKED");var _this=this;if(obj&&!this.settings.data.async)obj=false;this.is_partial_refresh=obj?true:false;this.opened=Array();if(this.settings.opened!=false){$.each(this.settings.opened,function(i,item){if(this.replace(/^#/,"").length>0){_this.opened.push("#"+this.replace(/^#/,""))}});this.settings.opened=false}else{this.container.find("li.open").each(function(i){if(this.id){_this.opened.push("#"+this.id)}})}if(this.selected){this.settings.selected=Array();if(obj){$(obj).find("li:has(a.clicked)").each(function(){if(this.id)_this.settings.selected.push("#"+this.id)})}else{if(this.selected_arr){$.each(this.selected_arr,function(){if(this.attr("id"))_this.settings.selected.push("#"+this.attr("id"))})}else{if(this.selected.attr("id"))this.settings.selected.push("#"+this.selected.attr("id"))}}}else if(this.settings.selected!==false){var tmp=Array();if((typeof this.settings.selected).toLowerCase()=="object"){$.each(this.settings.selected,function(){if(this.replace(/^#/,"").length>0)tmp.push("#"+this.replace(/^#/,""))})}else{if(this.settings.selected.replace(/^#/,"").length>0)tmp.push("#"+this.settings.selected.replace(/^#/,""))}this.settings.selected=tmp}if(obj&&this.settings.data.async){this.opened=Array();obj=this.get_node(obj);obj.find("li.open").each(function(i){_this.opened.push("#"+this.id)});if(obj.hasClass("open"))obj.removeClass("open").addClass("closed");if(obj.hasClass("leaf"))obj.removeClass("leaf");obj.children("ul:eq(0)").html("");return this.open_branch(obj,true,function(){_this.reselect.apply(_this)})}var _this=this;var _datastore=new $.tree.datastores[this.settings.data.type]();if(this.container.children("ul").size()==0){this.container.html("<ul class='ltr' style='direction:ltr;'><li class='last'><a class='loading' href='#'><ins>&nbsp;</ins>"+(this.settings.lang.loading||"Loading ...")+"</a></li></ul>")}_datastore.load(this.callback("beforedata",[false,this]),this,this.settings.data.opts,function(data){data=_this.callback("ondata",[data,_this]);_datastore.parse(data,_this,_this.settings.data.opts,function(str){str=_this.callback("onparse",[str,_this]);_this.container.empty().append($("<ul class='ltr'>").html(str));_this.container.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");_this.container.find("li").not(".open").not(".closed").addClass("leaf");_this.reselect()})})},reselect:function(is_callback){var _this=this;if(!is_callback)this.cl_count=0;else this.cl_count--;if(this.opened&&this.opened.length){var opn=false;for(var j=0;this.opened&&j<this.opened.length;j++){if(this.settings.data.async){var tmp=this.get_node(this.opened[j]);if(tmp.size()&&tmp.hasClass("closed")>0){opn=true;var tmp=this.opened[j].toString().replace('/','\\/');delete this.opened[j];this.open_branch(tmp,true,function(){_this.reselect.apply(_this,[true])});this.cl_count++}}else this.open_branch(this.opened[j],true)}if(this.settings.data.async&&opn)return;if(this.cl_count>0)return;delete this.opened}if(this.cl_count>0)return;this.container.css("direction","ltr").children("ul:eq(0)").addClass("ltr");if(this.settings.ui.dots==false)this.container.children("ul:eq(0)").addClass("no_dots");if(this.scrtop){this.container.scrollTop(_this.scrtop);delete this.scrtop}if(this.settings.selected!==false){$.each(this.settings.selected,function(i){if(_this.is_partial_refresh)_this.select_branch($(_this.settings.selected[i].toString().replace('/','\\/'),_this.container),(_this.settings.rules.multiple!==false));else _this.select_branch($(_this.settings.selected[i].toString().replace('/','\\/'),_this.container),(_this.settings.rules.multiple!==false&&i>0))});this.settings.selected=false}this.callback("onload",[_this])},get:function(obj,format,opts){if(!format)format=this.settings.data.type;if(!opts)opts=this.settings.data.opts;return new $.tree.datastores[format]().get(obj,this,opts)},attach_events:function(){var _this=this;this.container.bind("mousedown.jstree",function(event){if(tree_component.drag_drop.isdown){tree_component.drag_drop.move_type=false;event.preventDefault();event.stopPropagation();event.stopImmediatePropagation();return false}}).bind("mouseup.jstree",function(event){setTimeout(function(){_this.focus.apply(_this)},5)}).bind("click.jstree",function(event){return true});$("#"+this.container.attr("id")+" li").live("click",function(event){if(event.target.tagName!="LI")return true;_this.off_height();if(event.pageY-$(event.target).offset().top>_this.li_height)return true;_this.toggle_branch.apply(_this,[event.target]);event.stopPropagation();return false});$("#"+this.container.attr("id")+" li a").live("click.jstree",function(event){if(event.which&&event.which==3)return true;if(_this.locked){event.preventDefault();event.target.blur();return _this.error("LOCKED")}_this.select_branch.apply(_this,[event.target,event.ctrlKey||_this.settings.rules.multiple=="on"]);if(_this.inp){_this.inp.blur()}event.preventDefault();event.target.blur();return false}).live("dblclick.jstree",function(event){if(_this.locked){event.preventDefault();event.stopPropagation();event.target.blur();return _this.error("LOCKED")}_this.callback("ondblclk",[_this.get_node(event.target).get(0),_this]);event.preventDefault();event.stopPropagation();event.target.blur()}).live("contextmenu.jstree",function(event){if(_this.locked){event.target.blur();return _this.error("LOCKED")}return _this.callback("onrgtclk",[_this.get_node(event.target).get(0),_this,event])}).live("mouseover.jstree",function(event){if(_this.locked){event.preventDefault();event.stopPropagation();return _this.error("LOCKED")}if(_this.hovered!==false&&(event.target.tagName=="A"||event.target.tagName=="INS")){_this.hovered.children("a").removeClass("hover");_this.hovered=false}_this.callback("onhover",[_this.get_node(event.target).get(0),_this])}).live("mousedown.jstree",function(event){if(_this.settings.rules.drag_button=="left"&&event.which&&event.which!=1)return true;if(_this.settings.rules.drag_button=="right"&&event.which&&event.which!=3)return true;_this.focus.apply(_this);if(_this.locked)return _this.error("LOCKED");var obj=_this.get_node(event.target);if(_this.settings.rules.multiple!=false&&_this.selected_arr.length>1&&obj.children("a:eq(0)").hasClass("clicked")){var counter=0;for(var i in _this.selected_arr){if(!_this.selected_arr.hasOwnProperty(i))continue;if(_this.check("draggable",_this.selected_arr[i])){_this.selected_arr[i].addClass("dragged");tree_component.drag_drop.origin_tree=_this;counter++}}if(counter>0){if(_this.check("draggable",obj))tree_component.drag_drop.drag_node=obj;else tree_component.drag_drop.drag_node=_this.container.find("li.dragged:eq(0)");tree_component.drag_drop.isdown=true;tree_component.drag_drop.drag_help=$("<div id='jstree-dragged' class='tree "+(_this.settings.ui.theme_name!=""?" tree-"+_this.settings.ui.theme_name:"")+"' />").append("<ul class='"+_this.container.children("ul:eq(0)").get(0).className+"' />");var tmp=tree_component.drag_drop.drag_node.clone();if(_this.settings.languages.length>0)tmp.find("a").not("."+_this.current_lang).hide();tree_component.drag_drop.drag_help.children("ul:eq(0)").append(tmp);tree_component.drag_drop.drag_help.find("li:eq(0)").removeClass("last").addClass("last").children("a").html("<ins>&nbsp;</ins>Multiple selection").end().children("ul").remove();tree_component.drag_drop.dragged=_this.container.find("li.dragged")}}else{if(_this.check("draggable",obj)){tree_component.drag_drop.drag_node=obj;tree_component.drag_drop.drag_help=$("<div id='jstree-dragged' class='tree "+(_this.settings.ui.theme_name!=""?" tree-"+_this.settings.ui.theme_name:"")+"' />").append("<ul class='"+_this.container.children("ul:eq(0)").get(0).className+"' />");var tmp=obj.clone();if(_this.settings.languages.length>0)tmp.find("a").not("."+_this.current_lang).hide();tree_component.drag_drop.drag_help.children("ul:eq(0)").append(tmp);tree_component.drag_drop.drag_help.find("li:eq(0)").removeClass("last").addClass("last");tree_component.drag_drop.isdown=true;tree_component.drag_drop.foreign=false;tree_component.drag_drop.origin_tree=_this;obj.addClass("dragged");tree_component.drag_drop.dragged=_this.container.find("li.dragged")}}tree_component.drag_drop.init_x=event.pageX;tree_component.drag_drop.init_y=event.pageY;obj.blur();event.preventDefault();event.stopPropagation();return false})},focus:function(){if(this.locked)return false;if(tree_component.focused!=this.cntr){tree_component.focused=this.cntr;this.callback("onfocus",[this])}},off_height:function(){if(this.offset===false){this.container.css({position:"relative"});this.offset=this.container.offset();var tmp=0;tmp=parseInt($.curCSS(this.container.get(0),"paddingTop",true),10);if(tmp)this.offset.top+=tmp;tmp=parseInt($.curCSS(this.container.get(0),"borderTopWidth",true),10);if(tmp)this.offset.top+=tmp;this.container.css({position:""})}if(!this.li_height){var tmp=this.container.find("ul li.closed, ul li.leaf").eq(0);this.li_height=tmp.height();if(tmp.children("ul:eq(0)").size())this.li_height-=tmp.children("ul:eq(0)").height();if(!this.li_height)this.li_height=18}},scroll_check:function(x,y){var _this=this;var cnt=_this.container;var off=_this.container.offset();var st=cnt.scrollTop();var sl=cnt.scrollLeft();var h_cor=(cnt.get(0).scrollWidth>cnt.width())?40:20;if(y-off.top<20)cnt.scrollTop(Math.max((st-_this.settings.ui.scroll_spd),0));if(cnt.height()-(y-off.top)<h_cor)cnt.scrollTop(st+_this.settings.ui.scroll_spd);if(x-off.left<20)cnt.scrollLeft(Math.max((sl-_this.settings.ui.scroll_spd),0));if(cnt.width()-(x-off.left)<40)cnt.scrollLeft(sl+_this.settings.ui.scroll_spd);if(cnt.scrollLeft()!=sl||cnt.scrollTop()!=st){tree_component.drag_drop.move_type=false;tree_component.drag_drop.ref_node=false;tree_component.drag_drop.marker.hide()}tree_component.drag_drop.scroll_time=setTimeout(function(){_this.scroll_check(x,y)},50)},scroll_into_view:function(obj){obj=obj?this.get_node(obj):this.selected;if(!obj)return false;var off_t=obj.offset().top;var beg_t=this.container.offset().top;var end_t=beg_t+this.container.height();var h_cor=(this.container.get(0).scrollWidth>this.container.width())?40:20;if(off_t+5<beg_t)this.container.scrollTop(this.container.scrollTop()-(beg_t-off_t+5));if(off_t+h_cor>end_t)this.container.scrollTop(this.container.scrollTop()+(off_t+h_cor-end_t))},get_node:function(obj){return $(obj).closest("li")},get_type:function(obj){obj=!obj?this.selected:this.get_node(obj);if(!obj)return;var tmp=obj.attr(this.settings.rules.type_attr);return tmp||"default"},set_type:function(str,obj){obj=!obj?this.selected:this.get_node(obj);if(!obj||!str)return;obj.attr(this.settings.rules.type_attr,str)},get_text:function(obj,lang){obj=this.get_node(obj);if(!obj||obj.size()==0)return"";if(this.settings.languages&&this.settings.languages.length){lang=lang?lang:this.current_lang;obj=obj.children("a."+lang)}else obj=obj.children("a:visible");var val="";obj.contents().each(function(){if(this.nodeType==3){val=this.data;return false}});return val},check:function(rule,obj){if(this.locked)return false;var v=false;if(obj===-1){if(typeof this.settings.rules[rule]!="undefined")v=this.settings.rules[rule]}else{obj=!obj?this.selected:this.get_node(obj);if(!obj)return;var t=this.get_type(obj);if(typeof this.settings.types[t]!="undefined"&&typeof this.settings.types[t][rule]!="undefined")v=this.settings.types[t][rule];else if(typeof this.settings.types["default"]!="undefined"&&typeof this.settings.types["default"][rule]!="undefined")v=this.settings.types["default"][rule]}if(typeof v=="function")v=v.call(null,obj,this);v=this.callback("check",[rule,obj,v,this]);return v},check_move:function(nod,ref_node,how){if(this.locked)return false;if($(ref_node).closest("li.dragged").size())return false;var tree1=nod.parents(".tree:eq(0)").get(0);var tree2=ref_node.parents(".tree:eq(0)").get(0);if(tree1&&tree1!=tree2){var m=$.tree.reference(tree2.id).settings.rules.multitree;if(m=="none"||($.isArray(m)&&$.inArray(tree1.id,m)==-1))return false}var p=(how!="inside")?this.parent(ref_node):this.get_node(ref_node);nod=this.get_node(nod);if(p==false)return false;var r={max_depth:this.settings.rules.use_max_depth?this.check("max_depth",p):-1,max_children:this.settings.rules.use_max_children?this.check("max_children",p):-1,valid_children:this.check("valid_children",p)};var nod_type=(typeof nod=="string")?nod:this.get_type(nod);if(typeof r.valid_children!="undefined"&&(r.valid_children=="none"||(typeof r.valid_children=="object"&&$.inArray(nod_type,$.makeArray(r.valid_children))==-1)))return false;if(this.settings.rules.use_max_children){if(typeof r.max_children!="undefined"&&r.max_children!=-1){if(r.max_children==0)return false;var c_count=1;if(tree_component.drag_drop.moving==true&&tree_component.drag_drop.foreign==false){c_count=tree_component.drag_drop.dragged.size();c_count=c_count-p.find('> ul > li.dragged').size()}if(r.max_children<p.find('> ul > li').size()+c_count)return false}}if(this.settings.rules.use_max_depth){if(typeof r.max_depth!="undefined"&&r.max_depth===0)return this.error("MOVE: MAX-DEPTH REACHED");var mx=(r.max_depth>0)?r.max_depth:false;var i=0;var t=p;while(t!==-1){t=this.parent(t);i++;var m=this.check("max_depth",t);if(m>=0){mx=(mx===false)?(m-i):Math.min(mx,m-i)}if(mx!==false&&mx<=0)return this.error("MOVE: MAX-DEPTH REACHED")}if(mx!==false&&mx<=0)return this.error("MOVE: MAX-DEPTH REACHED");if(mx!==false){var incr=1;if(typeof nod!="string"){var t=nod;while(t.size()>0){if(mx-incr<0)return this.error("MOVE: MAX-DEPTH REACHED");t=t.children("ul").children("li");incr++}}}}if(this.callback("check_move",[nod,ref_node,how,this])==false)return false;return true},hover_branch:function(obj){if(this.locked)return this.error("LOCKED");var _this=this;var obj=_this.get_node(obj);if(!obj.size())return this.error("HOVER: NOT A VALID NODE");if(!_this.check("clickable",obj))return this.error("SELECT: NODE NOT SELECTABLE");if(this.hovered)this.hovered.children("A").removeClass("hover");this.hovered=obj;this.hovered.children("a").addClass("hover");this.scroll_into_view(this.hovered)},select_branch:function(obj,multiple){if(this.locked)return this.error("LOCKED");if(!obj&&this.hovered!==false)obj=this.hovered;var _this=this;obj=_this.get_node(obj);if(!obj.size())return this.error("SELECT: NOT A VALID NODE");obj.children("a").removeClass("hover");if(!_this.check("clickable",obj))return this.error("SELECT: NODE NOT SELECTABLE");if(_this.callback("beforechange",[obj.get(0),_this])===false)return this.error("SELECT: STOPPED BY USER");if(this.settings.rules.multiple!=false&&multiple&&obj.children("a.clicked").size()>0){return this.deselect_branch(obj)}if(this.settings.rules.multiple!=false&&multiple){this.selected_arr.push(obj)}if(this.settings.rules.multiple!=false&&!multiple){for(var i in this.selected_arr){if(!this.selected_arr.hasOwnProperty(i))continue;this.selected_arr[i].children("A").removeClass("clicked");this.callback("ondeselect",[this.selected_arr[i].get(0),_this])}this.selected_arr=[];this.selected_arr.push(obj);if(this.selected&&this.selected.children("A").hasClass("clicked")){this.selected.children("A").removeClass("clicked");this.callback("ondeselect",[this.selected.get(0),_this])}}if(!this.settings.rules.multiple){if(this.selected){this.selected.children("A").removeClass("clicked");this.callback("ondeselect",[this.selected.get(0),_this])}}this.selected=obj;if(this.hovered!==false){this.hovered.children("A").removeClass("hover");this.hovered=obj}this.selected.children("a").addClass("clicked").end().parents("li.closed").each(function(){_this.open_branch(this,true)});this.scroll_into_view(this.selected);this.callback("onselect",[this.selected.get(0),_this]);this.callback("onchange",[this.selected.get(0),_this])},deselect_branch:function(obj){if(this.locked)return this.error("LOCKED");var _this=this;var obj=this.get_node(obj);if(obj.children("a.clicked").size()==0)return this.error("DESELECT: NODE NOT SELECTED");obj.children("a").removeClass("clicked");this.callback("ondeselect",[obj.get(0),_this]);if(this.settings.rules.multiple!=false&&this.selected_arr.length>1){this.selected_arr=[];this.container.find("a.clicked").filter(":first-child").parent().each(function(){_this.selected_arr.push($(this))});if(obj.get(0)==this.selected.get(0)){this.selected=this.selected_arr[0]}}else{if(this.settings.rules.multiple!=false)this.selected_arr=[];this.selected=false}this.callback("onchange",[obj.get(0),_this])},toggle_branch:function(obj){if(this.locked)return this.error("LOCKED");var obj=this.get_node(obj);if(obj.hasClass("closed"))return this.open_branch(obj);if(obj.hasClass("open"))return this.close_branch(obj)},open_branch:function(obj,disable_animation,callback){var _this=this;if(this.locked)return this.error("LOCKED");var obj=this.get_node(obj);if(!obj.size())return this.error("OPEN: NO SUCH NODE");if(obj.hasClass("leaf"))return this.error("OPEN: OPENING LEAF NODE");if(this.settings.data.async&&obj.find("li").size()==0){if(this.callback("beforeopen",[obj.get(0),this])===false)return this.error("OPEN: STOPPED BY USER");obj.children("ul:eq(0)").remove().end().append("<ul><li class='last'><a class='loading' href='#'><ins>&nbsp;</ins>"+(_this.settings.lang.loading||"Loading ...")+"</a></li></ul>");obj.removeClass("closed").addClass("open");var _datastore=new $.tree.datastores[this.settings.data.type]();_datastore.load(this.callback("beforedata",[obj,this]),this,this.settings.data.opts,function(data){data=_this.callback("ondata",[data,_this]);if(!data||data.length==0){obj.removeClass("closed").removeClass("open").addClass("leaf").children("ul").remove();if(callback)callback.call();return}_datastore.parse(data,_this,_this.settings.data.opts,function(str){str=_this.callback("onparse",[str,_this]);obj.children("ul:eq(0)").replaceWith($("<ul>").html(str));obj.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");obj.find("li").not(".open").not(".closed").addClass("leaf");_this.open_branch.apply(_this,[obj]);if(callback)callback.call()})});return true}else{if(!this.settings.data.async){if(this.callback("beforeopen",[obj.get(0),this])===false)return this.error("OPEN: STOPPED BY USER")}if(parseInt(this.settings.ui.animation)>0&&!disable_animation){obj.children("ul:eq(0)").css("display","none");obj.removeClass("closed").addClass("open");obj.children("ul:eq(0)").slideDown(parseInt(this.settings.ui.animation),function(){$(this).css("display","");if(callback)callback.call()})}else{obj.removeClass("closed").addClass("open");if(callback)callback.call()}this.callback("onopen",[obj.get(0),this]);return true}},close_branch:function(obj,disable_animation){if(this.locked)return this.error("LOCKED");var _this=this;var obj=this.get_node(obj);if(!obj.size())return this.error("CLOSE: NO SUCH NODE");if(_this.callback("beforeclose",[obj.get(0),_this])===false)return this.error("CLOSE: STOPPED BY USER");if(parseInt(this.settings.ui.animation)>0&&!disable_animation&&obj.children("ul:eq(0)").size()==1){obj.children("ul:eq(0)").slideUp(parseInt(this.settings.ui.animation),function(){if(obj.hasClass("open"))obj.removeClass("open").addClass("closed");$(this).css("display","")})}else{if(obj.hasClass("open"))obj.removeClass("open").addClass("closed")}if(this.selected&&this.settings.ui.selected_parent_close!==false&&obj.children("ul:eq(0)").find("a.clicked").size()>0){obj.find("li:has(a.clicked)").each(function(){_this.deselect_branch(this)});if(this.settings.ui.selected_parent_close=="select_parent"&&obj.children("a.clicked").size()==0)this.select_branch(obj,(this.settings.rules.multiple!=false&&this.selected_arr.length>0))}this.callback("onclose",[obj.get(0),this])},open_all:function(obj,callback){if(this.locked)return this.error("LOCKED");var _this=this;obj=obj?this.get_node(obj):this.container;var s=obj.find("li.closed").size();if(!callback)this.cl_count=0;else this.cl_count--;if(s>0){this.cl_count+=s;obj.find("li.closed").each(function(){var __this=this;_this.open_branch.apply(_this,[this,true,function(){_this.open_all.apply(_this,[__this,true])}])})}else if(this.cl_count==0)this.callback("onopen_all",[this])},close_all:function(obj){if(this.locked)return this.error("LOCKED");var _this=this;obj=obj?this.get_node(obj):this.container;obj.find("li.open").each(function(){_this.close_branch(this,true)});this.callback("onclose_all",[this])},set_lang:function(i){if(!$.isArray(this.settings.languages)||this.settings.languages.length==0)return false;if(this.locked)return this.error("LOCKED");if(!$.inArray(i,this.settings.languages)&&typeof this.settings.languages[i]!="undefined")i=this.settings.languages[i];if(typeof i=="undefined")return false;if(i==this.current_lang)return true;var st=false;var id="#"+this.container.attr("id");st=tree_component.get_css(id+" ."+this.current_lang);if(st!==false)st.style.display="none";st=tree_component.get_css(id+" ."+i);if(st!==false)st.style.display="";this.current_lang=i;return true},get_lang:function(){if(!$.isArray(this.settings.languages)||this.settings.languages.length==0)return false;return this.current_lang},create:function(obj,ref_node,position){if(this.locked)return this.error("LOCKED");var root=false;if(ref_node==-1){root=true;ref_node=this.container}else ref_node=ref_node?this.get_node(ref_node):this.selected;if(!root&&(!ref_node||!ref_node.size()))return this.error("CREATE: NO NODE SELECTED");var pos=position;var tmp=ref_node;if(position=="before"){position=ref_node.parent().children().index(ref_node);ref_node=ref_node.parents("li:eq(0)")}if(position=="after"){position=ref_node.parent().children().index(ref_node)+1;ref_node=ref_node.parents("li:eq(0)")}if(!root&&ref_node.size()==0){root=true;ref_node=this.container}if(!root){if(!this.check("creatable",ref_node))return this.error("CREATE: CANNOT CREATE IN NODE");if(ref_node.hasClass("closed")){if(this.settings.data.async&&ref_node.children("ul").size()==0){var _this=this;return this.open_branch(ref_node,true,function(){_this.create.apply(_this,[obj,ref_node,position])})}else this.open_branch(ref_node,true)}}var torename=false;if(!obj)obj={};else obj=$.extend(true,{},obj);if(!obj.attributes)obj.attributes={};if(!obj.attributes[this.settings.rules.type_attr])obj.attributes[this.settings.rules.type_attr]=this.get_type(tmp)||"default";if(this.settings.languages.length){if(!obj.data){obj.data={};torename=true}for(var i=0;i<this.settings.languages.length;i++){if(!obj.data[this.settings.languages[i]])obj.data[this.settings.languages[i]]=((typeof this.settings.lang.new_node).toLowerCase()!="string"&&this.settings.lang.new_node[i])?this.settings.lang.new_node[i]:this.settings.lang.new_node}}else{if(!obj.data){obj.data=this.settings.lang.new_node;torename=true}}obj=this.callback("ondata",[obj,this]);var obj_s=$.tree.datastores.json().parse(obj,this);obj_s=this.callback("onparse",[obj_s,this]);var $li=$(obj_s);if($li.children("ul").size()){if(!$li.is(".open"))$li.addClass("closed")}else $li.addClass("leaf");$li.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");$li.find("li").not(".open").not(".closed").addClass("leaf");var r={max_depth:this.settings.rules.use_max_depth?this.check("max_depth",(root?-1:ref_node)):-1,max_children:this.settings.rules.use_max_children?this.check("max_children",(root?-1:ref_node)):-1,valid_children:this.check("valid_children",(root?-1:ref_node))};var nod_type=this.get_type($li);if(typeof r.valid_children!="undefined"&&(r.valid_children=="none"||($.isArray(r.valid_children)&&$.inArray(nod_type,r.valid_children)==-1)))return this.error("CREATE: NODE NOT A VALID CHILD");if(this.settings.rules.use_max_children){if(typeof r.max_children!="undefined"&&r.max_children!=-1&&r.max_children>=this.children(ref_node).size())return this.error("CREATE: MAX_CHILDREN REACHED")}if(this.settings.rules.use_max_depth){if(typeof r.max_depth!="undefined"&&r.max_depth===0)return this.error("CREATE: MAX-DEPTH REACHED");var mx=(r.max_depth>0)?r.max_depth:false;var i=0;var t=ref_node;while(t!==-1&&!root){t=this.parent(t);i++;var m=this.check("max_depth",t);if(m>=0){mx=(mx===false)?(m-i):Math.min(mx,m-i)}if(mx!==false&&mx<=0)return this.error("CREATE: MAX-DEPTH REACHED")}if(mx!==false&&mx<=0)return this.error("CREATE: MAX-DEPTH REACHED");if(mx!==false){var incr=1;var t=$li;while(t.size()>0){if(mx-incr<0)return this.error("CREATE: MAX-DEPTH REACHED");t=t.children("ul").children("li");incr++}}}if((typeof position).toLowerCase()=="undefined"||position=="inside")position=(this.settings.rules.createat=="top")?0:ref_node.children("ul:eq(0)").children("li").size();if(ref_node.children("ul").size()==0||(root==true&&ref_node.children("ul").children("li").size()==0)){if(!root)var a=this.moved($li,ref_node.children("a:eq(0)"),"inside",true);else var a=this.moved($li,this.container.children("ul:eq(0)"),"inside",true)}else if(pos=="before"&&ref_node.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").size())var a=this.moved($li,ref_node.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").children("a:eq(0)"),"before",true);else if(pos=="after"&&ref_node.children("ul:eq(0)").children("li:nth-child("+(position)+")").size())var a=this.moved($li,ref_node.children("ul:eq(0)").children("li:nth-child("+(position)+")").children("a:eq(0)"),"after",true);else if(ref_node.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").size())var a=this.moved($li,ref_node.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").children("a:eq(0)"),"before",true);else var a=this.moved($li,ref_node.children("ul:eq(0)").children("li:last").children("a:eq(0)"),"after",true);if(a===false)return this.error("CREATE: ABORTED");if(torename){this.select_branch($li.children("a:eq(0)"));this.rename()}return $li},rename:function(obj,new_name){if(this.locked)return this.error("LOCKED");obj=obj?this.get_node(obj):this.selected;var _this=this;if(!obj||!obj.size())return this.error("RENAME: NO NODE SELECTED");if(!this.check("renameable",obj))return this.error("RENAME: NODE NOT RENAMABLE");if(!this.callback("beforerename",[obj.get(0),_this.current_lang,_this]))return this.error("RENAME: STOPPED BY USER");obj.parents("li.closed").each(function(){_this.open_branch(this)});if(this.current_lang)obj=obj.find("a."+this.current_lang);else obj=obj.find("a:first");var rb={};rb[this.container.attr("id")]=this.get_rollback();var icn=obj.children("ins").clone();if((typeof new_name).toLowerCase()=="string"){obj.text(new_name).prepend(icn);_this.callback("onrename",[_this.get_node(obj).get(0),_this,rb])}else{var last_value="";obj.contents().each(function(){if(this.nodeType==3){last_value=this.data;return false}});_this.inp=$("<input type='text' autocomplete='off' />");_this.inp.val(last_value.replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<")).bind("mousedown",function(event){event.stopPropagation()}).bind("mouseup",function(event){event.stopPropagation()}).bind("click",function(event){event.stopPropagation()}).bind("keyup",function(event){var key=event.keyCode||event.which;if(key==27){this.value=last_value;this.blur();return}if(key==13){this.blur();return}});_this.inp.blur(function(event){if(this.value=="")this.value=last_value;obj.text(this.value).prepend(icn);obj.get(0).style.display="";obj.prevAll("span").remove();_this.inp=false;_this.callback("onrename",[_this.get_node(obj).get(0),_this,rb])});var spn=$("<span />").addClass(obj.attr("class")).append(icn).append(_this.inp);obj.get(0).style.display="none";obj.parent().prepend(spn);_this.inp.get(0).focus();_this.inp.get(0).select()}},remove:function(obj){if(this.locked)return this.error("LOCKED");var _this=this;var rb={};rb[this.container.attr("id")]=this.get_rollback();if(obj&&(!this.selected||this.get_node(obj).get(0)!=this.selected.get(0))){obj=this.get_node(obj);if(obj.size()){if(!this.check("deletable",obj))return this.error("DELETE: NODE NOT DELETABLE");if(!this.callback("beforedelete",[obj.get(0),_this]))return this.error("DELETE: STOPPED BY USER");$parent=obj.parent();if(obj.find("a.clicked").size()){var reset_selected=false;_this.selected_arr=[];this.container.find("a.clicked").filter(":first-child").parent().each(function(){if(!reset_selected&&this==_this.selected.get(0))reset_selected=true;if($(this).parents().index(obj)!=-1)return true;_this.selected_arr.push($(this))});if(reset_selected)this.selected=this.selected_arr[0]||false}obj=obj.remove();$parent.children("li:last").addClass("last");if($parent.children("li").size()==0){$li=$parent.parents("li:eq(0)");$li.removeClass("open").removeClass("closed").addClass("leaf").children("ul").remove()}this.callback("ondelete",[obj.get(0),this,rb])}}else if(this.selected){if(!this.check("deletable",this.selected))return this.error("DELETE: NODE NOT DELETABLE");if(!this.callback("beforedelete",[this.selected.get(0),_this]))return this.error("DELETE: STOPPED BY USER");$parent=this.selected.parent();var obj=this.selected;if(this.settings.rules.multiple==false||this.selected_arr.length==1){var stop=true;var tmp=this.settings.ui.selected_delete=="select_previous"?this.prev(this.selected):false}obj=obj.remove();$parent.children("li:last").addClass("last");if($parent.children("li").size()==0){$li=$parent.parents("li:eq(0)");$li.removeClass("open").removeClass("closed").addClass("leaf").children("ul").remove()}if(!stop&&this.settings.rules.multiple!=false){var _this=this;this.selected_arr=[];this.container.find("a.clicked").filter(":first-child").parent().each(function(){_this.selected_arr.push($(this))});if(this.selected_arr.length>0){this.selected=this.selected_arr[0];this.remove()}}if(stop&&tmp)this.select_branch(tmp);this.callback("ondelete",[obj.get(0),this,rb])}else return this.error("DELETE: NO NODE SELECTED")},next:function(obj,strict){obj=this.get_node(obj);if(!obj.size())return false;if(strict)return(obj.nextAll("li").size()>0)?obj.nextAll("li:eq(0)"):false;if(obj.hasClass("open"))return obj.find("li:eq(0)");else if(obj.nextAll("li").size()>0)return obj.nextAll("li:eq(0)");else return obj.parents("li").next("li").eq(0)},prev:function(obj,strict){obj=this.get_node(obj);if(!obj.size())return false;if(strict)return(obj.prevAll("li").size()>0)?obj.prevAll("li:eq(0)"):false;if(obj.prev("li").size()){var obj=obj.prev("li").eq(0);while(obj.hasClass("open"))obj=obj.children("ul:eq(0)").children("li:last");return obj}else return obj.parents("li:eq(0)").size()?obj.parents("li:eq(0)"):false},parent:function(obj){obj=this.get_node(obj);if(!obj.size())return false;return obj.parents("li:eq(0)").size()?obj.parents("li:eq(0)"):-1},children:function(obj){if(obj===-1)return this.container.children("ul:eq(0)").children("li");obj=this.get_node(obj);if(!obj.size())return false;return obj.children("ul:eq(0)").children("li")},toggle_dots:function(){if(this.settings.ui.dots){this.settings.ui.dots=false;this.container.children("ul:eq(0)").addClass("no_dots")}else{this.settings.ui.dots=true;this.container.children("ul:eq(0)").removeClass("no_dots")}},callback:function(cb,args){var p=false;var r=null;for(var i in this.settings.plugins){if(typeof $.tree.plugins[i]!="object")continue;p=$.tree.plugins[i];if(p.callbacks&&typeof p.callbacks[cb]=="function")r=p.callbacks[cb].apply(this,args);if(typeof r!=="undefined"&&r!==null){if(cb=="ondata"||cb=="onparse")args[0]=r;else return r}}p=this.settings.callback[cb];if(typeof p=="function")return p.apply(null,args)},get_rollback:function(){var rb={};rb.html=this.container.html();rb.selected=this.selected?this.selected.attr("id"):false;return rb},moved:function(what,where,how,is_new,is_copy,rb){var what=$(what);var $parent=$(what).parents("ul:eq(0)");var $where=$(where);if($where.is("ins"))$where=$where.parent();if(!rb){var rb={};rb[this.container.attr("id")]=this.get_rollback();if(!is_new){var tmp=what.size()>1?what.eq(0).parents(".tree:eq(0)"):what.parents(".tree:eq(0)");if(tmp.get(0)!=this.container.get(0)){tmp=tree_component.inst[tmp.attr("id")];rb[tmp.container.attr("id")]=tmp.get_rollback()}delete tmp}}if(how=="inside"&&this.settings.data.async){var _this=this;if(this.get_node($where).hasClass("closed")){return this.open_branch(this.get_node($where),true,function(){_this.moved.apply(_this,[what,where,how,is_new,is_copy,rb])})}if(this.get_node($where).find("> ul > li > a.loading").size()==1){setTimeout(function(){_this.moved.apply(_this,[what,where,how,is_new,is_copy])},200);return}}if(what.size()>1){var _this=this;var tmp=this.moved(what.eq(0),where,how,false,is_copy,rb);what.each(function(i){if(i==0)return;if(tmp){tmp=_this.moved(this,tmp.children("a:eq(0)"),"after",false,is_copy,rb)}});return what}if(is_copy){_what=what.clone();_what.each(function(i){this.id=this.id+"_copy";$(this).find("li").each(function(){this.id=this.id+"_copy"});$(this).removeClass("dragged").find("a.clicked").removeClass("clicked").end().find("li.dragged").removeClass("dragged")})}else _what=what;if(is_new){if(!this.callback("beforecreate",[this.get_node(what).get(0),this.get_node(where).get(0),how,this]))return false}else{if(!this.callback("beforemove",[this.get_node(what).get(0),this.get_node(where).get(0),how,this]))return false}if(!is_new){var tmp=what.parents(".tree:eq(0)");if(tmp.get(0)!=this.container.get(0)){tmp=tree_component.inst[tmp.attr("id")];if(tmp.settings.languages.length){var res=[];if(this.settings.languages.length==0)res.push("."+tmp.current_lang);else{for(var i in this.settings.languages){if(!this.settings.languages.hasOwnProperty(i))continue;for(var j in tmp.settings.languages){if(!tmp.settings.languages.hasOwnProperty(j))continue;if(this.settings.languages[i]==tmp.settings.languages[j])res.push("."+this.settings.languages[i])}}}if(res.length==0)return this.error("MOVE: NO COMMON LANGUAGES");_what.find("a").not(res.join(",")).remove()}_what.find("a.clicked").removeClass("clicked")}}what=_what;switch(how){case"before":$where.parents("ul:eq(0)").children("li.last").removeClass("last");$where.parent().before(what.removeClass("last"));$where.parents("ul:eq(0)").children("li:last").addClass("last");break;case"after":$where.parents("ul:eq(0)").children("li.last").removeClass("last");$where.parent().after(what.removeClass("last"));$where.parents("ul:eq(0)").children("li:last").addClass("last");break;case"inside":if($where.parent().children("ul:first").size()){if(this.settings.rules.createat=="top"){$where.parent().children("ul:first").prepend(what.removeClass("last")).children("li:last").addClass("last");var tmp_node=$where.parent().children("ul:first").children("li:first");if(tmp_node.size()){how="before";where=tmp_node}}else{var tmp_node=$where.parent().children("ul:first").children(".last");if(tmp_node.size()){how="after";where=tmp_node}$where.parent().children("ul:first").children(".last").removeClass("last").end().append(what.removeClass("last")).children("li:last").addClass("last")}}else{what.addClass("last");$where.parent().removeClass("leaf").append("<ul/>");if(!$where.parent().hasClass("open"))$where.parent().addClass("closed");$where.parent().children("ul:first").prepend(what)}if($where.parent().hasClass("closed")){this.open_branch($where)}break;default:break}if($parent.find("li").size()==0){var $li=$parent.parent();$li.removeClass("open").removeClass("closed").addClass("leaf");if(!$li.is(".tree"))$li.children("ul").remove();$li.parents("ul:eq(0)").children("li.last").removeClass("last").end().children("li:last").addClass("last")}else{$parent.children("li.last").removeClass("last");$parent.children("li:last").addClass("last")}if(is_copy)this.callback("oncopy",[this.get_node(what).get(0),this.get_node(where).get(0),how,this,rb]);else if(is_new)this.callback("oncreate",[this.get_node(what).get(0),($where.is("ul")?-1:this.get_node(where).get(0)),how,this,rb]);else this.callback("onmove",[this.get_node(what).get(0),this.get_node(where).get(0),how,this,rb]);return what},error:function(code){this.callback("error",[code,this]);return false},lock:function(state){this.locked=state;if(this.locked)this.container.children("ul:eq(0)").addClass("locked");else this.container.children("ul:eq(0)").removeClass("locked")},cut:function(obj){if(this.locked)return this.error("LOCKED");obj=obj?this.get_node(obj):this.container.find("a.clicked").filter(":first-child").parent();if(!obj||!obj.size())return this.error("CUT: NO NODE SELECTED");tree_component.cut_copy.copy_nodes=false;tree_component.cut_copy.cut_nodes=obj},copy:function(obj){if(this.locked)return this.error("LOCKED");obj=obj?this.get_node(obj):this.container.find("a.clicked").filter(":first-child").parent();if(!obj||!obj.size())return this.error("COPY: NO NODE SELECTED");tree_component.cut_copy.copy_nodes=obj;tree_component.cut_copy.cut_nodes=false},paste:function(obj,position){if(this.locked)return this.error("LOCKED");var root=false;if(obj==-1){root=true;obj=this.container}else obj=obj?this.get_node(obj):this.selected;if(!root&&(!obj||!obj.size()))return this.error("PASTE: NO NODE SELECTED");if(!tree_component.cut_copy.copy_nodes&&!tree_component.cut_copy.cut_nodes)return this.error("PASTE: NOTHING TO DO");var _this=this;var pos=position;if(position=="before"){position=obj.parent().children().index(obj);obj=obj.parents("li:eq(0)")}else if(position=="after"){position=obj.parent().children().index(obj)+1;obj=obj.parents("li:eq(0)")}else if((typeof position).toLowerCase()=="undefined"||position=="inside"){position=(this.settings.rules.createat=="top")?0:obj.children("ul:eq(0)").children("li").size()}if(!root&&obj.size()==0){root=true;obj=this.container}if(tree_component.cut_copy.copy_nodes&&tree_component.cut_copy.copy_nodes.size()){var ok=true;if(!root&&!this.check_move(tree_component.cut_copy.copy_nodes,obj.children("a:eq(0)"),"inside"))return false;if(obj.children("ul").size()==0||(root==true&&obj.children("ul").children("li").size()==0)){if(!root)var a=this.moved(tree_component.cut_copy.copy_nodes,obj.children("a:eq(0)"),"inside",false,true);else var a=this.moved(tree_component.cut_copy.copy_nodes,this.container.children("ul:eq(0)"),"inside",false,true)}else if(pos=="before"&&obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").size())var a=this.moved(tree_component.cut_copy.copy_nodes,obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").children("a:eq(0)"),"before",false,true);else if(pos=="after"&&obj.children("ul:eq(0)").children("li:nth-child("+(position)+")").size())var a=this.moved(tree_component.cut_copy.copy_nodes,obj.children("ul:eq(0)").children("li:nth-child("+(position)+")").children("a:eq(0)"),"after",false,true);else if(obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").size())var a=this.moved(tree_component.cut_copy.copy_nodes,obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").children("a:eq(0)"),"before",false,true);else var a=this.moved(tree_component.cut_copy.copy_nodes,obj.children("ul:eq(0)").children("li:last").children("a:eq(0)"),"after",false,true);tree_component.cut_copy.copy_nodes=false}if(tree_component.cut_copy.cut_nodes&&tree_component.cut_copy.cut_nodes.size()){var ok=true;obj.parents().andSelf().each(function(){if(tree_component.cut_copy.cut_nodes.index(this)!=-1){ok=false;return false}});if(!ok)return this.error("Invalid paste");if(!root&&!this.check_move(tree_component.cut_copy.cut_nodes,obj.children("a:eq(0)"),"inside"))return false;if(obj.children("ul").size()==0||(root==true&&obj.children("ul").children("li").size()==0)){if(!root)var a=this.moved(tree_component.cut_copy.cut_nodes,obj.children("a:eq(0)"),"inside");else var a=this.moved(tree_component.cut_copy.cut_nodes,this.container.children("ul:eq(0)"),"inside")}else if(pos=="before"&&obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").size())var a=this.moved(tree_component.cut_copy.cut_nodes,obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").children("a:eq(0)"),"before");else if(pos=="after"&&obj.children("ul:eq(0)").children("li:nth-child("+(position)+")").size())var a=this.moved(tree_component.cut_copy.cut_nodes,obj.children("ul:eq(0)").children("li:nth-child("+(position)+")").children("a:eq(0)"),"after");else if(obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").size())var a=this.moved(tree_component.cut_copy.cut_nodes,obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").children("a:eq(0)"),"before");else var a=this.moved(tree_component.cut_copy.cut_nodes,obj.children("ul:eq(0)").children("li:last").children("a:eq(0)"),"after");tree_component.cut_copy.cut_nodes=false}},search:function(str,func){var _this=this;if(!str||(this.srch&&str!=this.srch)){this.srch="";this.srch_opn=false;this.container.find("a.search").removeClass("search")}this.srch=str;if(!str)return;if(!func)func="contains";if(this.settings.data.async){if(!this.srch_opn){var dd=$.extend({"search":str},this.callback("beforedata",[false,this]));$.ajax({type:this.settings.data.opts.method,url:this.settings.data.opts.url,data:dd,dataType:"text",success:function(data){_this.srch_opn=$.unique(data.split(","));_this.search.apply(_this,[str,func])}})}else if(this.srch_opn.length){if(this.srch_opn&&this.srch_opn.length){var opn=false;for(var j=0;j<this.srch_opn.length;j++){if(this.get_node("#"+this.srch_opn[j]).size()>0){opn=true;var tmp="#"+this.srch_opn[j];delete this.srch_opn[j];this.open_branch(tmp,true,function(){_this.search.apply(_this,[str,func])})}}if(!opn){this.srch_opn=[];_this.search.apply(_this,[str,func])}}}else{this.srch_opn=false;var selector="a";if(this.settings.languages.length)selector+="."+this.current_lang;this.callback("onsearch",[this.container.find(selector+":"+func+"('"+str+"')"),this])}}else{var selector="a";if(this.settings.languages.length)selector+="."+this.current_lang;var nn=this.container.find(selector+":"+func+"('"+str+"')");nn.parents("li.closed").each(function(){_this.open_branch(this,true)});this.callback("onsearch",[nn,this])}},add_sheet:tree_component.add_sheet,destroy:function(){this.callback("ondestroy",[this]);this.container.unbind(".jstree");$("#"+this.container.attr("id")).die("click.jstree").die("dblclick.jstree").die("mouseover.jstree").die("mouseout.jstree").die("mousedown.jstree");this.container.removeClass("tree ui-widget ui-widget-content tree-default tree-"+this.settings.ui.theme_name).children("ul").removeClass("no_dots ltr locked").find("li").removeClass("leaf").removeClass("open").removeClass("closed").removeClass("last").children("a").removeClass("clicked hover search");if(this.cntr==tree_component.focused){for(var i in tree_component.inst){if(i!=this.cntr&&i!=this.container.attr("id")){tree_component.inst[i].focus();break}}}tree_component.inst[this.cntr]=false;tree_component.inst[this.container.attr("id")]=false;delete tree_component.inst[this.cntr];delete tree_component.inst[this.container.attr("id")];tree_component.cntr--}}};tree_component.cntr=0;tree_component.inst={};tree_component.themes=[];tree_component.drag_drop={isdown:false,drag_node:false,drag_help:false,dragged:false,init_x:false,init_y:false,moving:false,origin_tree:false,marker:false,move_type:false,ref_node:false,appended:false,foreign:false,droppable:[],open_time:false,scroll_time:false};tree_component.mouseup=function(event){var tmp=tree_component.drag_drop;if(tmp.open_time)clearTimeout(tmp.open_time);if(tmp.scroll_time)clearTimeout(tmp.scroll_time);if(tmp.moving&&$.tree.drag_end!==false)$.tree.drag_end.call(null,event,tmp);if(tmp.foreign===false&&tmp.drag_node&&tmp.drag_node.size()){tmp.drag_help.remove();if(tmp.move_type){var tree1=tree_component.inst[tmp.ref_node.parents(".tree:eq(0)").attr("id")];if(tree1)tree1.moved(tmp.dragged,tmp.ref_node,tmp.move_type,false,(tmp.origin_tree.settings.rules.drag_copy=="on"||(tmp.origin_tree.settings.rules.drag_copy=="ctrl"&&event.ctrlKey)))}tmp.move_type=false;tmp.ref_node=false}if(tmp.foreign!==false){if(tmp.drag_help)tmp.drag_help.remove();if(tmp.move_type){var tree1=tree_component.inst[tmp.ref_node.parents(".tree:eq(0)").attr("id")];if(tree1)tree1.callback("ondrop",[tmp.f_data,tree1.get_node(tmp.ref_node).get(0),tmp.move_type,tree1])}tmp.foreign=false;tmp.move_type=false;tmp.ref_node=false}if(tree_component.drag_drop.marker)tree_component.drag_drop.marker.hide();if(tmp.dragged&&tmp.dragged.size())tmp.dragged.removeClass("dragged");tmp.dragged=false;tmp.drag_help=false;tmp.drag_node=false;tmp.f_type=false;tmp.f_data=false;tmp.init_x=false;tmp.init_y=false;tmp.moving=false;tmp.appended=false;tmp.origin_tree=false;if(tmp.isdown){tmp.isdown=false;event.preventDefault();event.stopPropagation();return false}};tree_component.mousemove=function(event){var tmp=tree_component.drag_drop;var is_start=false;if(tmp.isdown){if(!tmp.moving&&Math.abs(tmp.init_x-event.pageX)<5&&Math.abs(tmp.init_y-event.pageY)<5){event.preventDefault();event.stopPropagation();return false}else{if(!tmp.moving){tree_component.drag_drop.moving=true;is_start=true}}if(tmp.open_time)clearTimeout(tmp.open_time);if(tmp.drag_help!==false){if(!tmp.appended){if(tmp.foreign!==false)tmp.origin_tree=$.tree.focused();$("body").append(tmp.drag_help);tmp.w=tmp.drag_help.width();tmp.appended=true}tmp.drag_help.css({"left":(event.pageX+5),"top":(event.pageY+15)})}if(is_start&&$.tree.drag_start!==false)$.tree.drag_start.call(null,event,tmp);if($.tree.drag!==false)$.tree.drag.call(null,event,tmp);if(event.target.tagName=="DIV"&&event.target.id=="jstree-marker")return false;var et=$(event.target);if(et.is("ins"))et=et.parent();var cnt=et.is(".tree")?et:et.parents(".tree:eq(0)");if(cnt.size()==0||!tree_component.inst[cnt.attr("id")]){if(tmp.scroll_time)clearTimeout(tmp.scroll_time);if(tmp.drag_help!==false)tmp.drag_help.find("li:eq(0) ins").addClass("forbidden");tmp.move_type=false;tmp.ref_node=false;tree_component.drag_drop.marker.hide();return false}var tree2=tree_component.inst[cnt.attr("id")];tree2.off_height();if(tmp.scroll_time)clearTimeout(tmp.scroll_time);tmp.scroll_time=setTimeout(function(){tree2.scroll_check(event.pageX,event.pageY)},50);var mov=false;var st=cnt.scrollTop();if(event.target.tagName=="A"||event.target.tagName=="INS"){if(et.is("#jstree-dragged"))return false;if(tree2.get_node(event.target).hasClass("closed")){tmp.open_time=setTimeout(function(){tree2.open_branch(et)},500)}var et_off=et.offset();var goTo={x:(et_off.left-1),y:(event.pageY-et_off.top)};var arr=[];if(goTo.y<tree2.li_height/3+1)arr=["before","inside","after"];else if(goTo.y>tree2.li_height*2/3-1)arr=["after","inside","before"];else{if(goTo.y<tree2.li_height/2)arr=["inside","before","after"];else arr=["inside","after","before"]}var ok=false;var nn=(tmp.foreign==false)?tmp.origin_tree.container.find("li.dragged"):tmp.f_type;$.each(arr,function(i,val){if(tree2.check_move(nn,et,val)){mov=val;ok=true;return false}});if(ok){switch(mov){case"before":goTo.y=et_off.top-2;tree_component.drag_drop.marker.attr("class","marker");break;case"after":goTo.y=et_off.top-2+tree2.li_height;tree_component.drag_drop.marker.attr("class","marker");break;case"inside":goTo.x-=2;goTo.y=et_off.top-2+tree2.li_height/2;tree_component.drag_drop.marker.attr("class","marker_plus");break}tmp.move_type=mov;tmp.ref_node=$(event.target);if(tmp.drag_help!==false)tmp.drag_help.find(".forbidden").removeClass("forbidden");tree_component.drag_drop.marker.css({"left":goTo.x,"top":goTo.y}).show()}}if((et.is(".tree")||et.is("ul"))&&et.find("li:eq(0)").size()==0){var et_off=et.offset();tmp.move_type="inside";tmp.ref_node=cnt.children("ul:eq(0)");if(tmp.drag_help!==false)tmp.drag_help.find(".forbidden").removeClass("forbidden");tree_component.drag_drop.marker.attr("class","marker_plus");tree_component.drag_drop.marker.css({"left":(et_off.left+10),"top":et_off.top+15}).show()}else if((event.target.tagName!="A"&&event.target.tagName!="INS")||!ok){if(tmp.drag_help!==false)tmp.drag_help.find("li:eq(0) ins").addClass("forbidden");tmp.move_type=false;tmp.ref_node=false;tree_component.drag_drop.marker.hide()}event.preventDefault();event.stopPropagation();return false}return true};$(function(){$(document).bind("mousemove.jstree",tree_component.mousemove);$(document).bind("mouseup.jstree",tree_component.mouseup)});tree_component.cut_copy={copy_nodes:false,cut_nodes:false};tree_component.css=false;tree_component.get_css=function(rule_name,delete_flag){rule_name=rule_name.toLowerCase();var css_rules=tree_component.css.cssRules||tree_component.css.rules;var j=0;do{if(css_rules.length&&j>css_rules.length+5)return false;if(css_rules[j].selectorText&&css_rules[j].selectorText.toLowerCase()==rule_name){if(delete_flag==true){if(tree_component.css.removeRule)document.styleSheets[i].removeRule(j);if(tree_component.css.deleteRule)document.styleSheets[i].deleteRule(j);return true}else return css_rules[j]}}while(css_rules[++j]);return false};tree_component.add_css=function(rule_name){if(tree_component.get_css(rule_name))return false;(tree_component.css.insertRule)?tree_component.css.insertRule(rule_name+' { }',0):tree_component.css.addRule(rule_name,null,0);return tree_component.get_css(rule_name)};tree_component.remove_css=function(rule_name){return tree_component.get_css(rule_name,true)};tree_component.add_sheet=function(opts){if(opts.str){var tmp=document.createElement("style");tmp.type="text/css";if(tmp.styleSheet)tmp.styleSheet.cssText=opts.str;else tmp.appendChild(document.createTextNode(opts.str));document.getElementsByTagName("head")[0].appendChild(tmp);return tmp.sheet}if(opts.url){if(document.createStyleSheet){try{document.createStyleSheet(opts.url)}catch(e){}}else{var newSS=document.createElement('link');newSS.rel='stylesheet';newSS.type='text/css';newSS.media="all";newSS.href=opts.url;document.getElementsByTagName("head")[0].appendChild(newSS);return newSS.styleSheet}}};$(function(){var u=navigator.userAgent.toLowerCase();var v=(u.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,'0'])[1];var css='/* TREE LAYOUT */ .tree ul { margin:0 0 0 5px; padding:0 0 0 0; list-style-type:none; } .tree li { display:block; min-height:18px; line-height:18px; padding:0 0 0 15px; margin:0 0 0 0; /* Background fix */ clear:both; } .tree li ul { display:none; } .tree li a, .tree li span { display:inline-block;line-height:16px;height:16px;color:black;white-space:nowrap;text-decoration:none;padding:1px 4px 1px 4px;margin:0; } .tree li a:focus { outline: none; } .tree li a input, .tree li span input { margin:0;padding:0 0;display:inline-block;height:12px !important;border:1px solid white;background:white;font-size:10px;font-family:Verdana; } .tree li a input:not([class="xxx"]), .tree li span input:not([class="xxx"]) { padding:1px 0; } /* FOR DOTS */ .tree .ltr li.last { float:left; } .tree > ul li.last { overflow:visible; } /* OPEN OR CLOSE */ .tree li.open ul { display:block; } .tree li.closed ul { display:none !important; } /* FOR DRAGGING */ #jstree-dragged { position:absolute; top:-10px; left:-10px; margin:0; padding:0; } #jstree-dragged ul ul ul { display:none; } #jstree-marker { padding:0; margin:0; line-height:5px; font-size:1px; overflow:hidden; height:5px; position:absolute; left:-45px; top:-30px; z-index:1000; background-color:transparent; background-repeat:no-repeat; display:none; } #jstree-marker.marker { width:45px; background-position:-32px top; } #jstree-marker.marker_plus { width:5px; background-position:right top; } /* BACKGROUND DOTS */ .tree li li { overflow:hidden; } .tree > .ltr > li { display:table; } /* ICONS */ .tree ul ins { display:inline-block; text-decoration:none; width:16px; height:16px; } .tree .ltr ins { margin:0 4px 0 0px; } ';if(/msie/.test(u)&&!/opera/.test(u)){if(parseInt(v)==6)css+='.tree li { zoom:1; } .tree li li { overflow:visible; } .tree .ltr li.last { margin-top: expression( (this.previousSibling && /open/.test(this.previousSibling.className) ) ? "-2px" : "0"); } .marker { width:45px; background-position:-32px top; } .marker_plus { width:5px; background-position:right top; }';if(parseInt(v)==7)css+='.tree li li { overflow:visible; } .tree .ltr li.last { margin-top: expression( (this.previousSibling && /open/.test(this.previousSibling.className) ) ? "-2px" : "0"); }'}if(/opera/.test(u))css+='.tree > ul > li.last:after { content:"."; display: block; height:1px; clear:both; visibility:hidden; }';if(/mozilla/.test(u)&&!/(compatible|webkit)/.test(u)&&v.indexOf("1.8")==0)css+='.tree .ltr li a { display:inline; float:left; } .tree li ul { clear:both; }';tree_component.css=tree_component.add_sheet({str:css})})})(jQuery);(function($){$.extend($.tree.datastores,{"html":function(){return{get:function(obj,tree,opts){return obj&&$(obj).size()?$('<div>').append(tree.get_node(obj).clone()).html():tree.container.children("ul:eq(0)").html()},parse:function(data,tree,opts,callback){if(callback)callback.call(null,data);return data},load:function(data,tree,opts,callback){if(opts.url){$.ajax({'type':opts.method,'url':opts.url,'data':data,'dataType':"html",'success':function(d,textStatus){callback.call(null,d)},'error':function(xhttp,textStatus,errorThrown){callback.call(null,false);tree.error(errorThrown+" "+textStatus)}})}else{callback.call(null,opts.static||tree.container.children("ul:eq(0)").html())}}}},"json":function(){return{get:function(obj,tree,opts){var _this=this;if(!obj||$(obj).size()==0)obj=tree.container.children("ul").children("li");else obj=$(obj);if(!opts)opts={};if(!opts.outer_attrib)opts.outer_attrib=["id","rel","class"];if(!opts.inner_attrib)opts.inner_attrib=[];if(obj.size()>1){var arr=[];obj.each(function(){arr.push(_this.get(this,tree,opts))});return arr}if(obj.size()==0)return[];var json={attributes:{},data:{}};if(obj.hasClass("open"))json.data.state="open";if(obj.hasClass("closed"))json.data.state="closed";for(var i in opts.outer_attrib){if(!opts.outer_attrib.hasOwnProperty(i))continue;var val=(opts.outer_attrib[i]=="class")?obj.attr(opts.outer_attrib[i]).replace(/(^| )last( |$)/ig," ").replace(/(^| )(leaf|closed|open)( |$)/ig," "):obj.attr(opts.outer_attrib[i]);if(typeof val!="undefined"&&val.toString().replace(" ","").length>0)json.attributes[opts.outer_attrib[i]]=val;delete val}if(tree.settings.languages.length){for(var i in tree.settings.languages){if(!tree.settings.languages.hasOwnProperty(i))continue;var a=obj.children("a."+tree.settings.languages[i]);if(opts.force||opts.inner_attrib.length||a.children("ins").get(0).style.backgroundImage.toString().length||a.children("ins").get(0).className.length){json.data[tree.settings.languages[i]]={};json.data[tree.settings.languages[i]].title=tree.get_text(obj,tree.settings.languages[i]);if(a.children("ins").get(0).style.className.length){json.data[tree.settings.languages[i]].icon=a.children("ins").get(0).style.className}if(a.children("ins").get(0).style.backgroundImage.length){json.data[tree.settings.languages[i]].icon=a.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","")}if(opts.inner_attrib.length){json.data[tree.settings.languages[i]].attributes={};for(var j in opts.inner_attrib){if(!opts.inner_attrib.hasOwnProperty(j))continue;var val=a.attr(opts.inner_attrib[j]);if(typeof val!="undefined"&&val.toString().replace(" ","").length>0)json.data[tree.settings.languages[i]].attributes[opts.inner_attrib[j]]=val;delete val}}}else{json.data[tree.settings.languages[i]]=tree.get_text(obj,tree.settings.languages[i])}}}else{var a=obj.children("a");json.data.title=tree.get_text(obj);if(a.children("ins").size()&&a.children("ins").get(0).className.length){json.data.icon=a.children("ins").get(0).className}if(a.children("ins").size()&&a.children("ins").get(0).style.backgroundImage.length){json.data.icon=a.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","")}if(opts.inner_attrib.length){json.data.attributes={};for(var j in opts.inner_attrib){if(!opts.inner_attrib.hasOwnProperty(j))continue;var val=a.attr(opts.inner_attrib[j]);if(typeof val!="undefined"&&val.toString().replace(" ","").length>0)json.data.attributes[opts.inner_attrib[j]]=val;delete val}}}if(obj.children("ul").size()>0){json.children=[];obj.children("ul").children("li").each(function(){json.children.push(_this.get(this,tree,opts))})}return json},parse:function(data,tree,opts,callback){if(Object.prototype.toString.apply(data)==="[object Array]"){var str='';for(var i=0;i<data.length;i++){if(typeof data[i]=="function")continue;str+=this.parse(data[i],tree,opts)}if(callback)callback.call(null,str);return str}if(!data||!data.data){if(callback)callback.call(null,false);return""}var str='';str+="<li ";var cls=false;if(data.attributes){for(var i in data.attributes){if(!data.attributes.hasOwnProperty(i))continue;if(i=="class"){str+=" class='"+data.attributes[i]+" ";if(data.state=="closed"||data.state=="open")str+=" "+data.state+" ";str+="' ";cls=true}else str+=" "+i+"='"+data.attributes[i]+"' "}}if(!cls&&(data.state=="closed"||data.state=="open"))str+=" class='"+data.state+"' ";str+=">";if(tree.settings.languages.length){for(var i=0;i<tree.settings.languages.length;i++){var attr={};attr["href"]="";attr["style"]="";attr["class"]=tree.settings.languages[i];if(data.data[tree.settings.languages[i]]&&(typeof data.data[tree.settings.languages[i]].attributes).toLowerCase()!="undefined"){for(var j in data.data[tree.settings.languages[i]].attributes){if(!data.data[tree.settings.languages[i]].attributes.hasOwnProperty(j))continue;if(j=="style"||j=="class")attr[j]+=" "+data.data[tree.settings.languages[i]].attributes[j];else attr[j]=data.data[tree.settings.languages[i]].attributes[j]}}str+="<a";for(var j in attr){if(!attr.hasOwnProperty(j))continue;str+=' '+j+'="'+attr[j]+'" '}str+=">";if(data.data[tree.settings.languages[i]]&&data.data[tree.settings.languages[i]].icon){str+="<ins "+(data.data[tree.settings.languages[i]].icon.indexOf("/")==-1?" class='"+data.data[tree.settings.languages[i]].icon+"' ":" style='background-image:url(\""+data.data[tree.settings.languages[i]].icon+"\");' ")+">&nbsp;</ins>"}else str+="<ins>&nbsp;</ins>";str+=((typeof data.data[tree.settings.languages[i]].title).toLowerCase()!="undefined"?data.data[tree.settings.languages[i]].title:data.data[tree.settings.languages[i]])+"</a>"}}else{var attr={};attr["href"]="";attr["style"]="";attr["class"]="";if((typeof data.data.attributes).toLowerCase()!="undefined"){for(var i in data.data.attributes){if(!data.data.attributes.hasOwnProperty(i))continue;if(i=="style"||i=="class")attr[i]+=" "+data.data.attributes[i];else attr[i]=data.data.attributes[i]}}str+="<a";for(var i in attr){if(!attr.hasOwnProperty(i))continue;str+=' '+i+'="'+attr[i]+'" '}str+=">";if(data.data.icon){str+="<ins "+(data.data.icon.indexOf("/")==-1?" class='"+data.data.icon+"' ":" style='background-image:url(\""+data.data.icon+"\");' ")+">&nbsp;</ins>"}else str+="<ins>&nbsp;</ins>";str+=((typeof data.data.title).toLowerCase()!="undefined"?data.data.title:data.data)+"</a>"}if(data.children&&data.children.length){str+='<ul>';for(var i=0;i<data.children.length;i++){str+=this.parse(data.children[i],tree,opts)}str+='</ul>'}str+="</li>";if(callback)callback.call(null,str);return str},load:function(data,tree,opts,callback){if(opts.static){callback.call(null,opts.static)}else{$.ajax({'type':opts.method,'url':opts.url,'data':data,'dataType':"json",'success':function(d,textStatus){callback.call(null,d)},'error':function(xhttp,textStatus,errorThrown){callback.call(null,false);tree.error(errorThrown+" "+textStatus)}})}}}}})})(jQuery);var _aImagesToLoad = [];
/**
* This function should be called whenever new html is inserted into DOM
*/
function ProcessNewHTML(oContainer, oOptions)
{
oOptions = $.extend({}, {
groupLightBox: false,
lightBoxOptions: {}
}, oOptions);
$('.ui-tabsdiv', oContainer).tabs();
if (oOptions.groupLightBox) {
$('a.thickbox', oContainer).lightBox($.extend({}, oLightboxDefaultOptions, oOptions.lightBoxOptions));
} else {
$('a.thickbox', oContainer).each(function() {
$(this).lightBox($.extend({}, oLightboxDefaultOptions, oOptions.lightBoxOptions));
});
}
$('.auto_hide', oContainer).each(function(){
iTimeOut = this.id.split('_')[2];
iTimeOut = iTimeOut || 10;
$(this).fadeTo(iTimeOut*1000, 1, function(){$(this).hide('slow')});
});
$("textarea[maxlength]").each(function() { $(this).maxLength(this.getAttribute('maxlength')); });
initializeTitleClouds(oContainer);
$('.transparent', oContainer).each(function() {
var aMatch = $(this).attr('class').match(/opacity_([0-9]{1,2})/);
if (aMatch) {
$(this).css('opacity', parseInt(aMatch[1]) / 100);
}
});
oHelper.Init(oContainer);
if (typeof FB != 'undefined' && FB.XFBML && FB.XFBML.parse) { FB.XFBML.parse(); }
}
if (typeof SITE_LOCALE == 'undefined') {
var SITE_LOCALE = 'pl_PL';
}
$(document).ready(function()
{
ProcessNewHTML(document);
$('#checkboxSelectAll').click(function() {
$('input[@type=checkbox]').attr({ checked: "checked"});
});
$('#checkboxDeselectAll').click(function() {
$('input[@type=checkbox]').removeAttr("checked");
});
$("#communicator .bg-gray").parent(".a1:visible").hide();
$("#communicator .entry .header").click(function() {
$(this).not(".normal").toggleClass("show").next(".bg-gray").slideToggle("slow");
});
$("#companyName1").change(function() {
companyName(1);
});
$("#companyName2").change(function() {
companyName(2);
});
var jImg;
for (var i in _aImagesToLoad) {
jImg = $(new Image());
for (var attrName in _aImagesToLoad[i].attr) { jImg.get(0)[attrName] = _aImagesToLoad[i].attr[attrName]; }
}
if ($('#Promo > *:not(script,:eq(0),#promoCover)').size() > 0) {
$('#promoCover').remove();
}
//oWinter.startSnow(); // uncomment to enable snow :)
/** Facebook API */
window.fbAsyncInit = function()
{
FB.Event.subscribe('auth.login', function(response) {
$(oRegistration).triggerHandler('onFBLogin', response);
});
FB.Event.subscribe('auth.logout', function() {
$(oRegistration).triggerHandler('onFBLogout');
});
FB.Event.subscribe('edge.create', function(sURL) {
$.ajax({ url: '/misc/ajax_add_fb_stats/1/' + encodeURIComponent(encodeURIComponent(sURL)) });
});
$(oRegistration).triggerHandler('onBeforeFBInit');
if (typeof FB_APP_ID != 'undefined') {
FB.init({appId: FB_APP_ID, status: true, cookie: true, xfbml: true});
}
$(oRegistration).triggerHandler('onFBInit');
if (typeof FB != 'undefined' && FB.XFBML && FB.XFBML.parse) { FB.XFBML.parse(); }
};
(function(){
var e = document.createElement('script');
e.type = 'text/javascript';
e.src = document.location.protocol + '//connect.facebook.net/'+SITE_LOCALE+'/all.js';
e.async = true;
$('<div id="fb-root"></div>').appendTo(document.body).append(e);
}());
});
function companyName(val) {
$("#prof_name1").hide();
$("#prof_name2").hide();
$("#prof_name"+val).show();
$("#prof_nip1").hide();
$("#prof_nip"+val).show();
}
var oLightboxDefaultOptions = {
imageBlank: '/_p/images/blank.gif',
imageLoading: '/_p/img/profeo-loader.gif',
imageBtnClose: '/_p/images/shortcuts-delete.gif',
imageBtnPrev: '#',
imageBtnNext: '#',
keyToClose: String.fromCharCode(27),
overlayOpacity: 0.5,
txtImage: '',
txtOf: '/'
};
/**
*
* Color picker
* Author: Stefan Petre www.eyecon.ro
*
* Dual licensed under the MIT and GPL licenses
*
*/
(function ($) {
var ColorPicker = function () {
var
ids = {},
inAction,
charMin = 65,
visible,
tpl = '<div class="colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_submit"></div></div>',
defaults = {
eventName: 'click',
onShow: function () {},
onBeforeShow: function(){},
onHide: function () {},
onChange: function () {},
onSubmit: function () {},
color: 'ff0000',
livePreview: true,
flat: false
},
fillRGBFields = function  (hsb, cal) {
var rgb = HSBToRGB(hsb);
$(cal).data('colorpicker').fields
.eq(1).val(rgb.r).end()
.eq(2).val(rgb.g).end()
.eq(3).val(rgb.b).end();
},
fillHSBFields = function  (hsb, cal) {
$(cal).data('colorpicker').fields
.eq(4).val(hsb.h).end()
.eq(5).val(hsb.s).end()
.eq(6).val(hsb.b).end();
},
fillHexFields = function (hsb, cal) {
$(cal).data('colorpicker').fields
.eq(0).val(HSBToHex(hsb)).end();
},
setSelector = function (hsb, cal) {
$(cal).data('colorpicker').selector.css('backgroundColor', '#' + HSBToHex({h: hsb.h, s: 100, b: 100}));
$(cal).data('colorpicker').selectorIndic.css({
left: parseInt(150 * hsb.s/100, 10),
top: parseInt(150 * (100-hsb.b)/100, 10)
});
},
setHue = function (hsb, cal) {
$(cal).data('colorpicker').hue.css('top', parseInt(150 - 150 * hsb.h/360, 10));
},
setCurrentColor = function (hsb, cal) {
$(cal).data('colorpicker').currentColor.css('backgroundColor', '#' + HSBToHex(hsb));
},
setNewColor = function (hsb, cal) {
$(cal).data('colorpicker').newColor.css('backgroundColor', '#' + HSBToHex(hsb));
},
keyDown = function (ev) {
var pressedKey = ev.charCode || ev.keyCode || -1;
if ((pressedKey > charMin && pressedKey <= 90) || pressedKey == 32) {
return false;
}
var cal = $(this).parent().parent();
if (cal.data('colorpicker').livePreview === true) {
change.apply(this);
}
},
change = function (ev) {
var cal = $(this).parent().parent(), col;
if (this.parentNode.className.indexOf('_hex') > 0) {
cal.data('colorpicker').color = col = HexToHSB(fixHex(this.value));
} else if (this.parentNode.className.indexOf('_hsb') > 0) {
cal.data('colorpicker').color = col = fixHSB({
h: parseInt(cal.data('colorpicker').fields.eq(4).val(), 10),
s: parseInt(cal.data('colorpicker').fields.eq(5).val(), 10),
b: parseInt(cal.data('colorpicker').fields.eq(6).val(), 10)
});
} else {
cal.data('colorpicker').color = col = RGBToHSB(fixRGB({
r: parseInt(cal.data('colorpicker').fields.eq(1).val(), 10),
g: parseInt(cal.data('colorpicker').fields.eq(2).val(), 10),
b: parseInt(cal.data('colorpicker').fields.eq(3).val(), 10)
}));
}
if (ev) {
fillRGBFields(col, cal.get(0));
fillHexFields(col, cal.get(0));
fillHSBFields(col, cal.get(0));
}
setSelector(col, cal.get(0));
setHue(col, cal.get(0));
setNewColor(col, cal.get(0));
cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col), cal.data('colorpicker').el]);
},
blur = function (ev) {
var cal = $(this).parent().parent();
cal.data('colorpicker').fields.parent().removeClass('colorpicker_focus');
},
focus = function () {
charMin = this.parentNode.className.indexOf('_hex') > 0 ? 70 : 65;
$(this).parent().parent().data('colorpicker').fields.parent().removeClass('colorpicker_focus');
$(this).parent().addClass('colorpicker_focus');
},
downIncrement = function (ev) {
var field = $(this).parent().find('input').focus();
var current = {
el: $(this).parent().addClass('colorpicker_slider'),
max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255),
y: ev.pageY,
field: field,
val: parseInt(field.val(), 10),
preview: $(this).parent().parent().data('colorpicker').livePreview
};
$(document).bind('mouseup', current, upIncrement);
$(document).bind('mousemove', current, moveIncrement);
},
moveIncrement = function (ev) {
ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY - ev.data.y, 10))));
if (ev.data.preview) {
change.apply(ev.data.field.get(0), [true]);
}
return false;
},
upIncrement = function (ev) {
change.apply(ev.data.field.get(0), [true]);
ev.data.el.removeClass('colorpicker_slider').find('input').focus();
$(document).unbind('mouseup', upIncrement);
$(document).unbind('mousemove', moveIncrement);
return false;
},
downHue = function (ev) {
var current = {
cal: $(this).parent(),
y: $(this).offset().top
};
current.preview = current.cal.data('colorpicker').livePreview;
$(document).bind('mouseup', current, upHue);
$(document).bind('mousemove', current, moveHue);
},
moveHue = function (ev) {
change.apply(
ev.data.cal.data('colorpicker')
.fields
.eq(4)
.val(parseInt(360*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.y))))/150, 10))
.get(0),
[ev.data.preview]
);
return false;
},
upHue = function (ev) {
fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
$(document).unbind('mouseup', upHue);
$(document).unbind('mousemove', moveHue);
return false;
},
downSelector = function (ev) {
var current = {
cal: $(this).parent(),
pos: $(this).offset()
};
current.preview = current.cal.data('colorpicker').livePreview;
$(document).bind('mouseup', current, upSelector);
$(document).bind('mousemove', current, moveSelector);
},
moveSelector = function (ev) {
change.apply(
ev.data.cal.data('colorpicker')
.fields
.eq(6)
.val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.pos.top))))/150, 10))
.end()
.eq(5)
.val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - ev.data.pos.left))))/150, 10))
.get(0),
[ev.data.preview]
);
return false;
},
upSelector = function (ev) {
fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
$(document).unbind('mouseup', upSelector);
$(document).unbind('mousemove', moveSelector);
return false;
},
enterSubmit = function (ev) {
$(this).addClass('colorpicker_focus');
},
leaveSubmit = function (ev) {
$(this).removeClass('colorpicker_focus');
},
clickSubmit = function (ev) {
var cal = $(this).parent();
var col = cal.data('colorpicker').color;
cal.data('colorpicker').origColor = col;
setCurrentColor(col, cal.get(0));
cal.data('colorpicker').onSubmit(col, HSBToHex(col), HSBToRGB(col), cal.data('colorpicker').el);
},
show = function (ev) {
var cal = $('#' + $(this).data('colorpickerId'));
cal.data('colorpicker').onBeforeShow.apply(this, [cal.get(0)]);
var pos = $(this).offset();
var viewPort = getViewport();
var top = pos.top + this.offsetHeight;
var left = pos.left;
if (top + 176 > viewPort.t + viewPort.h) {
top -= this.offsetHeight + 176;
}
if (left + 356 > viewPort.l + viewPort.w) {
left -= 356;
}
cal.css({left: left + 'px', top: top + 'px'});
if (cal.data('colorpicker').onShow.apply(this, [cal.get(0)]) != false) {
cal.show();
}
$(document).bind('mousedown', {cal: cal}, hide);
return false;
},
hide = function (ev) {
if (!isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) {
if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
ev.data.cal.hide();
}
$(document).unbind('mousedown', hide);
}
},
isChildOf = function(parentEl, el, container) {
if (parentEl == el) {
return true;
}
if (parentEl.contains) {
return parentEl.contains(el);
}
if ( parentEl.compareDocumentPosition ) {
return !!(parentEl.compareDocumentPosition(el) & 16);
}
var prEl = el.parentNode;
while(prEl && prEl != container) {
if (prEl == parentEl)
return true;
prEl = prEl.parentNode;
}
return false;
},
getViewport = function () {
var m = document.compatMode == 'CSS1Compat';
return {
l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop),
w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth),
h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight)
};
},
fixHSB = function (hsb) {
return {
h: Math.min(360, Math.max(0, hsb.h)),
s: Math.min(100, Math.max(0, hsb.s)),
b: Math.min(100, Math.max(0, hsb.b))
};
},
fixRGB = function (rgb) {
return {
r: Math.min(255, Math.max(0, rgb.r)),
g: Math.min(255, Math.max(0, rgb.g)),
b: Math.min(255, Math.max(0, rgb.b))
};
},
fixHex = function (hex) {
var len = 6 - hex.length;
if (len > 0) {
var o = [];
for (var i=0; i<len; i++) {
o.push('0');
}
o.push(hex);
hex = o.join('');
}
return hex;
},
HexToRGB = function (hex) {
var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
},
HexToHSB = function (hex) {
return RGBToHSB(HexToRGB(hex));
},
RGBToHSB = function (rgb) {
var hsb = {
h: 0,
s: 0,
b: 0
};
var min = Math.min(rgb.r, rgb.g, rgb.b);
var max = Math.max(rgb.r, rgb.g, rgb.b);
var delta = max - min;
hsb.b = max;
if (max != 0) {
}
hsb.s = max != 0 ? 255 * delta / max : 0;
if (hsb.s != 0) {
if (rgb.r == max) {
hsb.h = (rgb.g - rgb.b) / delta;
} else if (rgb.g == max) {
hsb.h = 2 + (rgb.b - rgb.r) / delta;
} else {
hsb.h = 4 + (rgb.r - rgb.g) / delta;
}
} else {
hsb.h = -1;
}
hsb.h *= 60;
if (hsb.h < 0) {
hsb.h += 360;
}
hsb.s *= 100/255;
hsb.b *= 100/255;
return hsb;
},
HSBToRGB = function (hsb) {
var rgb = {};
var h = Math.round(hsb.h);
var s = Math.round(hsb.s*255/100);
var v = Math.round(hsb.b*255/100);
if(s == 0) {
rgb.r = rgb.g = rgb.b = v;
} else {
var t1 = v;
var t2 = (255-s)*v/255;
var t3 = (t1-t2)*(h%60)/60;
if(h==360) h = 0;
if(h<60) {rgb.r=t1;	rgb.b=t2; rgb.g=t2+t3}
else if(h<120) {rgb.g=t1; rgb.b=t2;	rgb.r=t1-t3}
else if(h<180) {rgb.g=t1; rgb.r=t2;	rgb.b=t2+t3}
else if(h<240) {rgb.b=t1; rgb.r=t2;	rgb.g=t1-t3}
else if(h<300) {rgb.b=t1; rgb.g=t2;	rgb.r=t2+t3}
else if(h<360) {rgb.r=t1; rgb.g=t2;	rgb.b=t1-t3}
else {rgb.r=0; rgb.g=0;	rgb.b=0}
}
return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)};
},
RGBToHex = function (rgb) {
var hex = [
rgb.r.toString(16),
rgb.g.toString(16),
rgb.b.toString(16)
];
$.each(hex, function (nr, val) {
if (val.length == 1) {
hex[nr] = '0' + val;
}
});
return hex.join('');
},
HSBToHex = function (hsb) {
return RGBToHex(HSBToRGB(hsb));
},
restoreOriginal = function () {
var cal = $(this).parent();
var col = cal.data('colorpicker').origColor;
cal.data('colorpicker').color = col;
fillRGBFields(col, cal.get(0));
fillHexFields(col, cal.get(0));
fillHSBFields(col, cal.get(0));
setSelector(col, cal.get(0));
setHue(col, cal.get(0));
setNewColor(col, cal.get(0));
};
return {
init: function (opt) {
opt = $.extend({}, defaults, opt||{});
if (typeof opt.color == 'string') {
opt.color = HexToHSB(opt.color);
} else if (opt.color.r != undefined && opt.color.g != undefined && opt.color.b != undefined) {
opt.color = RGBToHSB(opt.color);
} else if (opt.color.h != undefined && opt.color.s != undefined && opt.color.b != undefined) {
opt.color = fixHSB(opt.color);
} else {
return this;
}
return this.each(function () {
if (!$(this).data('colorpickerId')) {
var options = $.extend({}, opt);
options.origColor = opt.color;
var id = 'collorpicker_' + parseInt(Math.random() * 1000);
$(this).data('colorpickerId', id);
var cal = $(tpl).attr('id', id);
if (options.flat) {
cal.appendTo(this).show();
} else {
cal.appendTo(document.body);
}
options.fields = cal
.find('input')
.bind('keyup', keyDown)
.bind('change', change)
.bind('blur', blur)
.bind('focus', focus);
cal
.find('span').bind('mousedown', downIncrement).end()
.find('>div.colorpicker_current_color').bind('click', restoreOriginal);
options.selector = cal.find('div.colorpicker_color').bind('mousedown', downSelector);
options.selectorIndic = options.selector.find('div div');
options.el = this;
options.hue = cal.find('div.colorpicker_hue div');
cal.find('div.colorpicker_hue').bind('mousedown', downHue);
options.newColor = cal.find('div.colorpicker_new_color');
options.currentColor = cal.find('div.colorpicker_current_color');
cal.data('colorpicker', options);
cal.find('div.colorpicker_submit')
.bind('mouseenter', enterSubmit)
.bind('mouseleave', leaveSubmit)
.bind('click', clickSubmit);
fillRGBFields(options.color, cal.get(0));
fillHSBFields(options.color, cal.get(0));
fillHexFields(options.color, cal.get(0));
setHue(options.color, cal.get(0));
setSelector(options.color, cal.get(0));
setCurrentColor(options.color, cal.get(0));
setNewColor(options.color, cal.get(0));
if (options.flat) {
cal.css({
position: 'relative',
display: 'block'
});
} else {
$(this).bind(options.eventName, show);
}
}
});
},
showPicker: function() {
return this.each( function () {
if ($(this).data('colorpickerId')) {
show.apply(this);
}
});
},
hidePicker: function() {
return this.each( function () {
if ($(this).data('colorpickerId')) {
$('#' + $(this).data('colorpickerId')).hide();
}
});
},
setColor: function(col) {
if (typeof col == 'string') {
col = HexToHSB(col);
} else if (col.r != undefined && col.g != undefined && col.b != undefined) {
col = RGBToHSB(col);
} else if (col.h != undefined && col.s != undefined && col.b != undefined) {
col = fixHSB(col);
} else {
return this;
}
return this.each(function(){
if ($(this).data('colorpickerId')) {
var cal = $('#' + $(this).data('colorpickerId'));
cal.data('colorpicker').color = col;
cal.data('colorpicker').origColor = col;
fillRGBFields(col, cal.get(0));
fillHSBFields(col, cal.get(0));
fillHexFields(col, cal.get(0));
setHue(col, cal.get(0));
setSelector(col, cal.get(0));
setCurrentColor(col, cal.get(0));
setNewColor(col, cal.get(0));
}
});
}
};
}();
$.fn.extend({
ColorPicker: ColorPicker.init,
ColorPickerHide: ColorPicker.hidePicker,
ColorPickerShow: ColorPicker.showPicker,
ColorPickerSetColor: ColorPicker.setColor
});
})(jQuery);var oShortcuts = new function()
{
this._sBoxId = 'user-shortcuts';
this._isLoaded = false;
this._iHideTimer = false;
this._iShowTimer = false;
this._oElements = false;
this._bHideDisabled = false;
this._iBlogId = false;
this._iCurrentTab = false;
this._getBoxElements = function() {
if (oShortcuts._oElements)
return oShortcuts._oElements;
var oContainer = ById(this._sBoxId);
return oShortcuts._oElements = {
"oContainer" : oContainer,
"oLink" : oContainer.getElementsByTagName('a')[0],
"oContentContainer" : ById('shortcuts-box'),
"oLoader" : ById('shortcuts-loader'),
"oTabsContainer" : ById('shortcuts-tabs')
}
}
this._setHideHandler = function() {
var oElements = oShortcuts._getBoxElements();
if (!oElements.oContainer.onmouseout)
{
oElements.oContainer.onmouseout = function(oEvent) {
oShortcuts._iHideTimer = setTimeout('oShortcuts.hideBox()', 500);
}
}
}
this._unsetHideHandler = function() {
var oElements = oShortcuts._getBoxElements();
try { oElements.oContainer.onmouseout = false; } catch (e) {}
}
this.hideBox = function() {
if (oShortcuts._bHideDisabled)
return;
var oElements = oShortcuts._getBoxElements();
//oTransformations.transformElementAlpha(oElements.oContentContainer, 0.1, 0, 30, function(aThread) {
//var oElements = oShortcuts._getBoxElements();
//oElements.oLink.className = 'user-shortcuts_disabled';
oElements.oContentContainer.className = 'user-shortcuts_disabled';
oShortcuts._unsetHideHandler();
oShortcuts.hideNewForm();
//});
}
this.showBox = function(iDelay) {
if (iDelay > 0) {
clearTimeout(oShortcuts._iShowTimer);
oShortcuts._iShowTimer = setTimeout('oShortcuts.showBox()', iDelay);
return;
} else if (iDelay < 0 && oShortcuts._iShowTimer) {
return;
}
clearTimeout(oShortcuts._iHideTimer);
oShortcuts._setHideHandler();
var oElements = oShortcuts._getBoxElements();
if (oElements.oContentContainer.className == 'user-shortcuts')
return;
//oUtils.setOpacity(oElements.oContentContainer, 0);
oElements.oContentContainer.className = 'user-shortcuts';
//oTransformations.transformElementAlpha(oElements.oContentContainer, 0.1, 1, 30);
if (!oShortcuts._isLoaded) {
oShortcuts._ajaxGet({
url : '/misc/ajax_shortcut_tabs/',
onComplete : function(xhrObj) { ById('shortcuts-tabs-container').innerHTML = xhrObj.responseText; }
});
var oElements = oShortcuts._getBoxElements();
oElements.oContainer.onmouseover = function() { oShortcuts.showBox(-1) };
oShortcuts._isLoaded = true;
}
}
this._ajaxPost = function(oParams) {
oParams.onInitialization = oShortcuts.setBusyOn;
oParams.onFinalization = oShortcuts.setBusyOff;
oParams.disableForm = false;
advAJAX.post(oParams);
}
this._ajaxGet = function(oParams) {
oParams.onInitialization = oShortcuts.setBusyOn;
oParams.onFinalization = oShortcuts.setBusyOff;
oParams.disableForm = false;
advAJAX.get(oParams);
}
this._ajaxSubmit = function(oForm, oParams) {
oParams.onInitialization = oShortcuts.setBusyOn;
oParams.onFinalization = oShortcuts.setBusyOff;
oParams.disableForm = false;
advAJAX.submit(oForm, oParams);
}
this.addCurrentSite = function() {
var newForm = ById('shortcuts-new-form');
this.showTab(SHORTCUT_TYPE_LINK);
oShortcuts._ajaxPost({
url : '/misc/ajax_shortcut_add/' + encodeURIComponent(encodeURIComponent(newForm.title.value)),
onComplete : function(xhrObj) {
oShortcuts.setTabContent(SHORTCUT_TYPE_LINK, xhrObj.responseText);
}
});
oShortcuts.hideNewForm();
}
this.hideNewForm = function() {
ById('shortcuts-new-form').style.display = 'none';
ById('shortcuts-new-form').title.value = 'Nowy skrót';
oShortcuts._bHideDisabled = false;
}
this.showNewForm = function() {
var newForm = ById('shortcuts-new-form');
newForm.title.value = oShortcuts.getCurrentSiteTitle();
newForm.style.display = 'block';
newForm.title.focus();
oShortcuts._bHideDisabled = true;
newForm.title.onfocus = function() {
oShortcuts._bHideDisabled = true;
}
newForm.title.onblur = function() {
oShortcuts._bHideDisabled = false;
}
}
this.setTabContent = function(iType, sContent) {
ById('shortcuts-tab-' + iType).innerHTML = sContent;
}
this.loadTab = function(iType, iShortcutId) {
var iType = iType;
oShortcuts._ajaxPost({
url : '/misc/ajax_shortcut_tab/' + parseInt(iType) + '/' + (parseInt(iShortcutId) ? parseInt(iShortcutId) : ''),
onComplete : function(xhrObj) {
oShortcuts.setTabContent(iType, xhrObj.responseText);
}
});
}
this.showOptions = function(iShortcutId) {
/*var oEdit = ById('shortcut-options-edit-' + iShortcutId),
oDelete = ById('shortcut-options-delete-' + iShortcutId);
if (oEdit) oEdit.style.display = 'block';
if (oDelete) oDelete.style.display = 'block';*/
}
this.hideOptions = function(iShortcutId) {
/*var oEdit = ById('shortcut-options-edit-' + iShortcutId),
oDelete = ById('shortcut-options-delete-' + iShortcutId);
if (oEdit) oEdit.style.display = 'none';
if (oDelete) oDelete.style.display = 'none';*/
}
this.save = function(iType) {
var iType = iType;
oShortcuts._ajaxSubmit(ById('shortcut-form'), {
url : '/misc/ajax_shortcut_save/' + iType,
onComplete : function(xhrObj) {
oShortcuts.setTabContent(iType, xhrObj.responseText);
}
});
}
this.addBlog = function() {
if (oShortcuts._iBlogId)
{
this.showTab(SHORTCUT_TYPE_BLOG);
oShortcuts._ajaxPost({
url : '/misc/ajax_shortcut_addblog/' + oShortcuts._iBlogId,
onComplete : function(xhrObj) {
oShortcuts.setTabContent(SHORTCUT_TYPE_BLOG, xhrObj.responseText);
}
});
}
}
this.setBusyOn = function() {
var oElements = oShortcuts._getBoxElements(),
w = oElements.oContentContainer.offsetWidth,
h = oElements.oContentContainer.offsetHeight;
oElements.oLoader.style.display = 'block';
oElements.oLoader.style.width = (w-1) + 'px';
oElements.oLoader.style.height = (h-1) + 'px';
}
this.setBusyOff = function(){
var oElements = oShortcuts._getBoxElements();
oElements.oLoader.style.display = 'none';
}
this.showTab = function(iType) {
if (oShortcuts._iCurrentTab == iType)
return;
var oLastTab = ById('shortcuts-tab-' + oShortcuts._iCurrentTab),
oCurrentTab = ById('shortcuts-tab-' + iType);
ById('shortcuts-tablink-' + iType).className = 'shortcuts-tab-on';
ById('shortcuts-tablink-' + oShortcuts._iCurrentTab).className = 'shortcuts-tab';
oLastTab.style.display = 'none';
oCurrentTab.style.display = 'block';
oShortcuts._iCurrentTab = iType;
}
this.getCurrentSiteTitle = function() {
try {
var oBreadCrumbs = $('#navi')[0],
oLinks = (oBreadCrumbs.textContent || oBreadCrumbs.innerText).split('»'),
sLink, aElements = [],
iMinIndex = oLinks.length - 2;
for (var i = oLinks.length - 1; i >= 0; i--) {
sLink = oLinks[i].trim();
if (!sLink.length) continue;
aElements.push(sLink);
if (i <= iMinIndex) break;
}
if (aElements.length) {
aElements.reverse();
return aElements.join(' » ');
}
return document.title;
}
catch (e) {
return document.title;
}
}
this.cancelShow = function() {
clearTimeout(oShortcuts._iShowTimer);
oShortcuts._iShowTimer = false;
};
};function createXmlHttpRequestObject()
{
var xmlHttp;
try {
xmlHttp = new XMLHttpRequest();
} catch (e) {
var XmlHttpVersions = new Array("MSXML2.XMLHTTP.6.0", "MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP");
for (var i = 0; i < XmlHttpVersions.length && !xmlHttp; i++) {
try {
xmlHttp = new ActiveXObject(XmlHttpVersions[i]);
} catch (e) {}
}
}
if (xmlHttp) {
return xmlHttp;
} else {
alert('Bł±d podczas tworzenia obiektu XMLHttpRequest.');
}
}
function ById(id)
{
return (typeof id == "object" && id !== null) ? id : document.getElementById(id);
}
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.br2nl = function() {
return this.replace(/<br.*?>/gi,"\r\n");
}
String.prototype.strip_tags = function() {
return this.replace(/<.*?>/ig,"");
}
String.prototype.deleteMultipleNL = function() {
return this.replace(/(\s){2,}/g,"\r\n");
}
String.prototype.htmlspecialchars = function() {
return this.replace('&','&amp;').replace('<', '&lt;').replace('>','&gt;').replace('"','&guot;');
}
function PopupChat(receiver_id,chatsession_id)
{
var path = '/chat/,' + receiver_id + '';
if (chatsession_id) {
path += ',' + chatsession_id + '';
}
window.open(path, 'chatWindow_'+receiver_id+'', 'width=800,height=400,resizable=yes');
}
function PopupGroupChat(group_id,chatsession_id)
{
var path = '/groupchat/,' + group_id + '';
if (chatsession_id) {
path += ',' + chatsession_id + '';
}
window.open(path, 'chatWindow_'+group_id+'', 'width=800,height=400,resizable=yes');
}
function PopupTopicPreview()
{
window.open('/board/preview_topic/', 'preview_topic', 'width=1000,height=400,resizable=yes,scrollbars=yes');
}
function PopupPostPreview()
{
window.open('/board/preview_post/', 'preview_post', 'width=1000,height=400,resizable=yes,scrollbars=yes');
}
function isNumeric(sText)
{
var ValidChars = "-0123456789.,";
var IsNumber=true;
var Char;
for (var i = 0; i < sText.length && IsNumber == true; i++) {
Char = sText.charAt(i);
if (ValidChars.indexOf(Char) == -1) {
IsNumber = false;
}
}
return IsNumber;
}
function postCodeCompletion(obj) {
for (var x = 0; x < obj.value.length; x++) {
if (isNaN(obj.value.charAt(x)) && (x != 2 && obj.value.charAt(x) != '-')) {
before = obj.value.substr(0, x);
after = obj.value.substr(x+1, 20);
obj.value = before + after;
postCodeCompletion(obj);
}
}
if (obj.value.length > 2 && obj.value.charAt(2) != '-') {
after = obj.value.substr(2, 6);
obj.value = "" + obj.value.substr(0, 2) + '-';
obj.value = obj.value + after;
}
if (obj.value.length > 6) {
obj.value = obj.value.substr(0, 6);
}
}
function showHide(warstwa)
{
if (ById(warstwa).style.display == 'none') visibleornot = 'block';
else visibleornot = 'none'
ById(warstwa).style.display = visibleornot;
}
var show_objects = new Array();
function show(obj, display)
{
if( ById(obj) ) obj = ById(obj);
if( !display || display == undefined ) display = 'block';
if( obj ) {
if( show_objects[obj.id] != undefined && show_objects[obj.id] != '' ) {
obj.style.display = show_objects[obj.id];
show_objects[obj.id] = '';
} else {
show_objects[obj.id] = obj.style.display;
obj.style.display = display;
}
}
}
function hide(obj)
{
ById(obj).style.display = 'none';
};
/* Funkcja do pobierania miast na podstawie kodu pocztowego */
postCodeCache = new Array();
function CheckPostCodeJS(postcode_field_id, city_field_id, postcode_id_field_id, region_field_id) {
postcode 	= ById(postcode_field_id).value;
city		= ById(city_field_id).value;
if( postCodeCache['city'] && postCodeCache['city'] == city ) {
city = ' ';
}
advAJAX.post({
url: '/register/ajax/postcodecheck/',
uniqueParameter: "custom_unique_param",
parameters : {
"postcodecheck[postcode]"	:	postcode,
"postcodecheck[city]"		:	city
},
onInitialization : function() {
},
onSuccess : function(obj) {
},
onError : function(obj) {
alert("Error: " + obj.status);
},
onFinalization : function(obj) {
pc = obj.responseText;
if( pc=='' ) {
return false;
}
data = pc.split(';');
if( !data[0] || data[0] == 'false' || data[0] == '0' || data[0] == '' ) {
if( data[0] == '0' ) {
alert('Proszę sprawdzić wpisany kod pocztowy.\nJeśli jest on wpisany poprawnie prosimy jeszcze uzupełnić miejscowość i wojewótdzwo.');
data[2] = '';
} else {
alert('Proszę sprawdzić wpisany kod pocztowy.');
}
} else {
}
postCodeCache['postcode_id'] = ById(postcode_id_field_id).value 	= data[0];
postCodeCache['postcode']															= data[1];
postCodeCache['city'] 		 = ById(city_field_id).value 		= data[2];
arrSelect = ById(region_field_id);
for (i = 0; i < arrSelect.length; i++) {
if(arrSelect.options[i].text == data[3]) {
ById(region_field_id).options.selectedIndex = i;
break;
} else {
ById(region_field_id).options.selectedIndex = 0;
}
}
if( data[0] == 0 ) {
return false;
}
}
});
check = ById(postcode_id_field_id).value;
if( !check || check == 'false' || check == '0' || check == '' ) {
return false;
}
}
function tillNow(obj, id_part, prefix){
if( prefix ) prefix += "_";
else prefix = "";
if(obj.checked) {
show(prefix+"date_to_"+id_part+"_month",'none');
show(prefix+"date_to_"+id_part+"_year",'none');
} else {
show(prefix+"date_to_"+id_part+"_month",'inline');
show(prefix+"date_to_"+id_part+"_year",'inline');
}
}
var erased = new Array();
function eraseOnce(obj){
if(erased[obj.id]!=true) {
obj.value="";
erased[obj.id]=true;
}
}
function eraseIf(obj, condition){
if(obj.value==condition) {
obj.value = '';
}
}
function reWrite(id1, id2) {
obj1 = ById(id1);
obj2 = ById(id2);
if( obj1.value != undefined ) {
text1 = obj1.value;
} else if (obj1.innerHTML != undefined) {
text1 = obj1.innerHTML;
}
if( obj2.value != undefined ) {
obj2.value = text1;
} else if (obj2.innerHTML != undefined) {
obj2.innerHTML = text1;
}
}
function Loading(obj)
{
if( typeof(obj) == 'string' ) obj = ById(obj);
obj.innerHTML = '<img src="/_p/img/ajax-loader.gif" alt="Ładowanie" />';
return true;
}
var wizardSwitch;
function wizardSetting(obj)
{
if (obj.checked == true) {
var on_off = 't';
} else {
var on_off = 'f';
}
advAJAX.post({
url: '/content/wizard/',
uniqueParameter: "custom_unique_param",
parameters : {
"wizard_settings[on_off]"		:	on_off
},
onInitialization : function() {
},
onSuccess : function(obj) {
},
onError : function(obj) {
alert("Error: " + obj.status);
},
onFinalization : function(obj) {
}
});
}
function InsertBBCode(u,v,textareaName)
{
var oT = ById(textareaName);
try {
if (document.selection) {
var str = document.selection.createRange().text;
oT.focus();
var sel = document.selection.createRange();
sel.text = u + str + v;
} else {
var selLength = oT.textLength;
var selStart = oT.selectionStart;
var selEnd = oT.selectionEnd;
var s1 = (oT.value).substring(0,selStart);
var s2 = (oT.value).substring(selStart, selEnd);
var s3 = (oT.value).substring(selEnd, selLength);
oT.value = s1 + u + s2 + v + s3;
oT.selectionStart = s1.length;
oT.selectionEnd = s1.length + u.length + s2.length + v.length;
}
oT.value = ClearBBCodeDuplicates(oT.value);
oT.focus();
return;
} catch(e) {}
}
function ClearBBCodeDuplicates(text)
{
// usuwanie znacznikow bbcode o takiej samej nazwie
// wystepujacych w bezposrednim sasiedztwie
text = text.replace(/(\[([\w]*?)(=[\w\s]*?)\])\[\2.*?\]/g,'$1');
text = text.replace(/\[(\/?[\w]*?)\]\[\1]/g,'[\$1]');
return text;
}
function HideIfAllUnchk(to_hide_id, id_prefix, bIgnoreHidden) {
inputs = document.getElementsByTagName('input');
noInputs = inputs.length;
hide = true;
for(x=0; x<noInputs; x++) {
input = inputs[x];
if( !input.getAttribute('id') ) continue;
if( input.getAttribute('type') == 'checkbox' && input.getAttribute('id').substr(0, id_prefix.length) == id_prefix && input.checked &&
(input.style.display != 'none' || !bIgnoreHidden)) {
hide = false;
break;
}
}
ById(to_hide_id).style.display = hide ? 'none' : '';
//if( hide ) show(to_hide_id, 'none');
//else show(to_hide_id, 'block');
}
function addAcceptEncodingToForms(forms) {
for(i=0;i<forms.length;i++) {
forms[i].setAttribute('accept-encoding', 'UTF-8');
}
}
function getCookie(sName) {
var sRE = "(?:; )?" + sName + "=([^;]*);?";
var oRE = new RegExp(sRE);
if (oRE.test(document.cookie)) {
return decodeURIComponent(RegExp["$1"]);
} else {
return null;
}
}
function setCookie(sName, sValue, oExpires, sPath, sDomain, bSecure)
{
var sCookie = sName + "=" + encodeURIComponent(sValue);
if (oExpires) {
sCookie += "; expires=" + oExpires.toGMTString();
}
if (sPath) {
sCookie += "; path=" + sPath;
}
if (sDomain) {
sCookie += "; domain=" + sDomain;
}
if (bSecure) {
sCookie += "; secure";
}
document.cookie = sCookie;
}
function deleteCookie(sName, sPath, sDomain)
{
setCookie(sName,'',new Date(0), sPath, sDomain);
}
function TabRemember(tab_id) {
tab_id = tab_id.replace(/.*?#(.*?)/,'$1');
document.cookie = 'LastActiveTab=' + encodeURIComponent(tab_id);
}
function TabRemind() {
var tab_id = getCookie('LastActiveTab');
if (tab_id) {
var oTab = ById(tab_id);
if (oTab) {
location.href = '#' + tab_id;
deleteCookie('LastActiveTab');
}
}
}
function CheckboxAll(prefix) {
inputs = document.getElementsByTagName('input');
for(i=0; i<inputs.length; i++) {
input = inputs[i];
if( input.type == 'checkbox' ) {
if( !prefix || input.id.substr(0,prefix.length)==prefix ) {
if( input.checked != true ) {
input.checked = true;
} else {
input.checked = false;
}
}
}
}
}
function SetMainCheckBox(formName, fieldName) {
if(!document.forms[formName])
return;
var objCheckBox = eval('document.forms[formName].'+fieldName);
if(!objCheckBox)
return;
if( objCheckBox.type == 'checkbox' ) {
if( objCheckBox.checked == true ) {
objCheckBox.checked= false;
}
}
}
function SelectUnselectAllCheckBoxes(prefixName, formName, fieldName) {
var objCheckBox = eval('document.forms[formName].'+fieldName);
objInputs = document.getElementsByTagName('input');
for(i=0; i < objInputs.length; i++) {
objInput = objInputs[i];
if( objInput.type == 'checkbox' ) {
if( !prefixName || objInput.id.substr(0,prefixName.length)==prefixName ) {
if(objCheckBox.checked != false) {
if( objInput.checked != true ) {
objInput.checked = true;
}
}
if(objCheckBox.checked == false) {
if( objInput.checked == true ) {
objInput.checked = false;
}
}
}
}
}
}
function GetCursorPosition(e)
{
if (!e) {
var e = window.event
}
var oCursor = new Object();
if (e.PageX || e.PageY) {
oCursor.x = e.pageX;
oCursor.y = e.pageY;
} else {
oCursor.x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft - 90;
oCursor.y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop + 10;
}
// zatrzymanie przepływu zdarzenia
e.cancelBubble = true;
if (e.stopPropagation) {
e.stopPropagation();
}
return oCursor;
}
// obsługa helpów w treści
var aOpenHelp = new Array(); // tablica id otwartych helpów
function CreateHelp(id)
{
var oHelp = new Object();
oHelp.Init = function(id)
{
var thisHelp = this;
this.faq_item_id = id;
// inicjuję obiekt xmlhttp
this.XMLHTTP = createXmlHttpRequestObject();
// dołączam słuchacza zdarzeń do guzika aktywującego helpa
var element = ById('help_activator_' + id);
element.onclick = function(e) {
thisHelp.oCursor = GetCursorPosition(e);
thisHelp.AO_Fetch();
}
if (element.captureEvents) {
element.captureEvents(Event.CLICK);
}
}
oHelp.AO_Fetch = function() {
// zabezpieczenie przed wielokrotnym otwieraniem helpów
if (aOpenHelp[id]) {
return false;
} else {
aOpenHelp[id] = true;
}
// automatyczne zamknięcie
window.setTimeout(CloseHelp, 30000);
var state = this.XMLHTTP.readyState;
var bReady = (state == 4) || (state == 0);
if (bReady) {
var thisHelp = this;
var path = '/content/faq_item/' + this.faq_item_id + '/';
this.XMLHTTP.open('GET', path, true);
this.XMLHTTP.onreadystatechange = function() {
thisHelp.AH_Fetch();
}
this.XMLHTTP.send(null);
}
}
oHelp.AH_Fetch = function() {
var XMLHTTP = this.XMLHTTP;
if (XMLHTTP.readyState == 4) {
if (XMLHTTP.status == 200) {
this.Show(XMLHTTP.responseXML);
document.body.style.cursor = 'default';
}
} else {
document.body.style.cursor = 'progress';
}
}
oHelp.Show = function(xml) {
var root = xml.documentElement;
var question = root.getElementsByTagName('question')[0].firstChild.nodeValue;
var answer = root.getElementsByTagName('answer')[0].firstChild.nodeValue;
answer = answer.replace(/\[url\=(.*?)\](.*?)\[\/url\]/g, '<a href="$1">$2</a>');
answer = answer.replace(/\n/g, '<br />');
var eHelpWrap = ById('help-wrap');
var eHelpContainer = document.createElement('div');
eHelpContainer.className = 'help-container';
eHelpContainer.style.left = '' + this.oCursor.x + 'px';
eHelpContainer.style.top = '' + this.oCursor.y + 'px';
var eHelpExitButton = document.createElement('div');
eHelpExitButton.className = 'help-exit-button';
var eHelpTxt = document.createElement('div');
eHelpTxt.className = 'help-txt';
var help_template = '<span class="help-question">' + question + '</span>';
help_template += '<span class="help-answer">' + answer + '</span>';
eHelpTxt.innerHTML = help_template;
var eHelpBottom = document.createElement('div');
eHelpBottom.className = 'help-bottom';
eHelpContainer.appendChild(eHelpExitButton);
eHelpContainer.appendChild(eHelpTxt);
eHelpContainer.appendChild(eHelpBottom);
eHelpWrap.appendChild(eHelpContainer);
var thisHelp = this;
// dołączam słuchacza zdarzeń do guzika zamykającego helpa
eHelpExitButton.onclick = function(e) {
var oCursor = GetCursorPosition(e);
eHelpContainer.parentNode.removeChild(eHelpContainer);
aOpenHelp[thisHelp.faq_item_id] = false;
}
if (eHelpExitButton.captureEvents) {
eHelpExitButton.captureEvents(Event.CLICK);
}
}
oHelp.Init(id);
return oHelp;
}
var oHelper = new function() {
var _that = this;
var _timeoutId = null;
var _div = $('<div></div>').addClass('help-container');
this.HelpContent = [];
this.Init = function(oContainer) {
if (oContainer) {
$("a.help_activator", oContainer).bind("mouseenter", _that.Start);
$("a.help_activator_click", oContainer).bind("click", _that.Start);
} else {
$("a.help_activator").bind("mouseenter", _that.Start);
$("a.help_activator_click").bind("click", _that.Start);
}
}
this.Start = function() {
var iHelpId = $(this).attr('id').split('_')[2];
var oOffset = $(this).offset();
if(!_that.HelpContent[iHelpId]) {
_that.GetHelpContent(iHelpId);
}
_that.ShowHelp(iHelpId, oOffset);
}
this.GetHelpContent = function(iHelpId) {
$.ajax({
async: false,
type: "GET",
url: '/content/faq_html/' + iHelpId + '/',
dataType: "html",
success: function(html){
_that.HelpContent[iHelpId] = html;
}
});
};
this.ShowHelp = function(iHelpId, oOffset) {
_div.html(_that.HelpContent[iHelpId]).css({'top' : oOffset.top+10, 'left' : oOffset.left-90}).show();
$('.help-exit-button', _div).click(_that.CloseHelp);
window.clearTimeout(_timeoutId);
_timeoutId = window.setTimeout("oHelper.CloseHelp()", 30000);
toggleComboBoxes(false);
};
this.CloseHelp = function() {
if ($(_div).is(':visible')) {
toggleComboBoxes(true);
}
_div.hide();
window.clearTimeout(_timeoutId);
};
$(document).ready(function(){
$(document).bind('mousedown', oHelper.CloseHelp);
_div.mousedown(function(e){oUtils.bubbleEvent(e, false);}).hide().appendTo('body');
_that.Init();
});
};
function CloseHelp()
{
ById('help-wrap').innerHTML = '<div style="position:absolute"></div>';
aOpenHelp = new Array();
}
function ViewEvents(div_id)
{
var div_id = document.getElementById(div_id);
if (div_id.style.display == 'none') {
div_id.style.display = 'block';
} else if (div_id.style.display == 'block') {
div_id.style.display = 'none';
}
}
function ViewLayer(div_id)
{
var div_id = document.getElementById(div_id);
if (div_id.style.display == 'none') {
div_id.style.display = 'block';
} else if (div_id.style.display == 'block') {
div_id.style.display = 'none';
}
}
history_rec_id = new Array();
forms = new Array();
function addBlankHistoryRecord(container_id) {
if( history_rec_id[container_id] == undefined ) {
history_rec_id[container_id] = 0;
}
container = ById(container_id);
if( forms[container_id] == undefined ) {
forms[container_id] = container.innerHTML;
}
formSchema = forms[container_id];
if( container.style.display == 'none' ) {
container.style.display = 'block';
return true;
}
regexp = new RegExp('rec-id-[0-9]+', 'gim');
//	regexp2 = new RegExp('display: none', 'gim');
history_rec_id[container_id]++;
replaced = formSchema.replace(regexp, "rec-id-" + history_rec_id[container_id]);
//    replaced = replaced.replace(regexp2, "");
container.innerHTML = container.innerHTML + replaced;
}
function GetProportionalSize(width, height, size, find)
{
if (find == 'width') {
return Math.floor((size * width) / height);
} else {
return Math.floor((size * height) / width);
}
}
function ConfirmAction(text, url)
{
if (typeof oDialogBox != 'undefined') {
oDialogBox.show(oDialogBox.CONFIRM, text, function(v) {
if (v) location.href = url;
});
} else {
if (confirm(text)) {
document.location = url;
}
}
}
function SpyCommentsSwitch(element_id, element_type)
{
var oR = createXmlHttpRequestObject();
var state = oR.readyState;
var bReady = (state == 4) || (state == 0);
if (bReady) {
var path = '/community/spy_comments/' + element_id + '/' + element_type + '/';
oR.open('GET', path, false);
oR.send(null);
}
}
function TrackedContentSwitch(content_type, content_id)
{
var path = '/community/tracked_content/' + content_type + '/' + content_id + '/ajaxmode/';
$.ajax({ url : path, type : 'get' });
}
/**
* @desc Klasa zawierająca trochę przydatnych ogólnych funkcji.
*/
var oUtils = new function() {
this.isObject = function (x) { return typeof x == "object" && x !== null; }
this.isNumber = function (x) { return typeof x == "number"; }
this.isArray = function (x) { return oUtils.isObject(x) && x.constructor == Array; }
this.isBool = function (x) { return typeof x == "boolean"; }
this.isString = function (x) { return typeof x == "string"; }
this.isStringEmpty = function (x) { return (typeof x == "string") && (x == ""); }
this.isUndefined = function (x) { return typeof x == "undefined"; }
this.isUndefOrNull = function (x) { return typeof x == "undefined" || x === null; }
this.isFunction = function (x) { return typeof x == "function"; }
this.hide = function(obj) { ById(obj).style.display = 'none'; };
this.show = function(obj) { alert(obj);ById(obj).style.display = 'block'; };
this.setOpacity = function (aElement, aOpacity) {
try { with (ById(aElement)) {
aOpacity = parseFloat(parseInt(aOpacity * 100) / 100);
if (window.ActiveXObject)
style.filter = "alpha(opacity="+(aOpacity * 100)+")";
else style.opacity = aOpacity;
}
} catch (e) {}
}
this.getOpacity = function (aElement) {
try {
if (window.ActiveXObject)
return parseInt(ById(aElement).style.filter.match(/.*alpha\s*\(opacity\s*\=\s*([0-9]*).*/i)[1]) / 100;
return parseFloat(oUtils.getStyleProp(ById(aElement), 'opacity'));
} catch (e) { return 1; }
}
this.getStyleProp = function (element, property) {
var el = ById(element), value;
if (el.currentStyle)
var value = el.currentStyle[property];
else if (window.getComputedStyle)
var value = document.defaultView.getComputedStyle(el, null).getPropertyValue(property);
return value;
}
this.centerObject = function (wnd, bFixed, bReturnCoords, oAnimation) {
wnd = ById(wnd);
if (!wnd) return;
return {
x : oUtils.centerObjectV(wnd, bFixed, bReturnCoords, oAnimation),
y : oUtils.centerObjectH(wnd, bFixed, bReturnCoords, oAnimation)
};
};
this.centerObjectV = function (wnd, bFixed, bReturnCoords, oAnimation){
wnd = ById(wnd); if (!wnd) return;
var x = Math.floor((oUtils.getDocumentDims().w  - wnd.offsetWidth)  / 2);
x = ((x < 0) ? 0 : x) + (bFixed ? 0 : oUtils.getDocumentScroll().x);
if (!bReturnCoords) {
if (oAnimation) {
$(wnd).animate({ left: x }, oAnimation.duration, oAnimation.easing, oAnimation.callback);
} else {
wnd.style.left = x + "px";
}
}
return x;
};
this.centerObjectH = function (wnd, bFixed, bReturnCoords, oAnimation) {
wnd = ById(wnd); if (!wnd) return;
var y = Math.floor((oUtils.getDocumentDims().h - wnd.offsetHeight) / 2);
y = ((y < 0) ? 0 : y) + (bFixed ? 0 : oUtils.getDocumentScroll().y);
if (!bReturnCoords) {
if (oAnimation) {
$(wnd).animate({ top: y }, oAnimation.duration, oAnimation.easing, oAnimation.callback);
} else {
wnd.style.top = y + "px";
}
}
return y;
};
this.getDocumentDims = function () {
if (self.innerWidth) {
return { w : self.innerWidth, h : self.innerHeight }
} else if (document.documentElement && document.documentElement.clientWidth) {
return { w : document.documentElement.clientWidth, h : document.documentElement.clientHeight }
} else if (document.body) {
return { w : document.body.clientWidth, h : document.body.clientHeight }
} return { w : 0, h : 0 }
};
this.getDocumentScroll = function (){
var scrOfX = 0, scrOfY = 0;
if( typeof( window.pageYOffset ) == 'number' ) {
return { y : window.pageYOffset, x : window.pageXOffset }
} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
return { y : document.body.scrollTop, x : document.body.scrollLeft }
} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
return { y : document.documentElement.scrollTop, x : document.documentElement.scrollLeft }
} return { x : 0, y : 0 }
};
this.moveSelectedOptions = function(oSource, oDestination, oCallbackOnMove) {
for (var i = oSource.options.length-1; i >= 0; i--) {
if (oSource.options[i].selected) {
if (typeof oCallbackOnMove == 'function')
if (!oCallbackOnMove(i, oSource, oDestination)) continue;
oDestination.options[oDestination.options.length] = new Option(oSource.options[i].text, oSource.options[i].value);
oSource.options[i] = null;
}
}
};
this.dockToObject = function(oDockedObject, oTarget, iDockedObjectCorner, iTargetCorner, iDeltaX, iDeltaY) {
oDockedObject = $(oDockedObject).get(0);
oTarget = ById(oTarget);
if (iDockedObjectCorner < 1 || iDockedObjectCorner > 4)
iDockedObjectCorner = 1;
if (iTargetCorner < 1 || iTargetCorner > 4)
iTargetCorner = 1;
var iTargetX = this.getElementX(oTarget),
iTargetY = this.getElementY(oTarget),
iDX = (iDockedObjectCorner % 2) ? 0 : -oDockedObject.offsetWidth,
iDY = (iDockedObjectCorner <= 2) ? 0 : -oDockedObject.offsetHeight;
iTargetX += (iTargetCorner % 2) ? 0 : oTarget.offsetWidth;
iTargetY += (iTargetCorner <= 2) ? 0 : oTarget.offsetHeight;
oDockedObject.style.left = (iTargetX + iDX + (isNaN(iDeltaX) ? 0 : iDeltaX)) + 'px';
oDockedObject.style.top = (iTargetY + iDY + (isNaN(iDeltaY) ? 0 : iDeltaY)) + 'px';
};
this.getElementX = function (obj, endObject, considerPosition) {
var curleft = 0, sPosition;
if (obj.offsetParent) {
while (obj.offsetParent && obj != endObject) {
curleft += obj.offsetLeft;
obj = obj.offsetParent;
if (considerPosition) {
sPosition = oUtils.getStyleProp(obj, 'position');
if (sPosition == 'relative' || sPosition == 'absolute') break;
}
}
}
else if (typeof obj.x != "undefined") curleft += obj.x;
return curleft;
};
this.getElementY = function (obj, endObject, considerPosition) {
var curtop = 0, sPosition;
if (obj.offsetParent) {
while (obj.offsetParent && obj != endObject) {
curtop += obj.offsetTop;
obj = obj.offsetParent;
if (considerPosition) {
sPosition = oUtils.getStyleProp(obj, 'position');
if (sPosition == 'relative' || sPosition == 'absolute') break;
}
}
}
else if (typeof obj.y != "undefined") curtop += obj.y;
return curtop;
};
this.createXMLDoc = function(sXML) {
try {
if (window.ActiveXObject) {
var oXMLDoc = new ActiveXObject("Microsoft.XMLDOM");
oXMLDoc.async = "false";
oXMLDoc.loadXML(sXML);
return oXMLDoc;
}
else return (new DOMParser()).parseFromString(sXML, "text/xml");
}
catch (e) { return false; }
};
this.xpath = function(sXPath, oXMLDocument) {
if (typeof oXMLDocument == 'string')
oXMLDocument = this.createXMLDoc(oXMLDocument);
if (document.evaluate) {
var oResult = oXMLDocument.evaluate(sXPath, oXMLDocument, null, XPathResult.TYPE_ANY, null);
} else {
oXMLDocument.setProperty("SelectionLanguage", "XPath");
var oResult = oXMLDocument.selectNodes(sXPath);
}
try {
var aResult = [];
if (document.evaluate) {
var oNode = oResult.iterateNext();
while (oNode) {
aResult.push(oNode);
oNode = oResult.iterateNext();
}
}
else {
for (var i = 0; i < oResult.length; i++) {
aResult.push(oResult[i]);
}
}
} finally { return aResult; }
};
this.bubbleEvent = function (aEvent, aBubble) {
if (!aEvent) if (!(aEvent = window.event)) return;
aEvent.cancelBubble = !aBubble;
if (aEvent.stopPropagation && !aBubble) aEvent.stopPropagation();
};
this.getXMLNodeText = function(node) {
var text = node.textContent || node.text || node.innerText; return text ? text : '';
};
this.getWindowInnerH = function () { return window.innerHeight ? window.innerHeight : window.document.documentElement.clientHeight; };
this.getWindowInnerW = function () { return window.innerWidth ? window.innerWidth : window.document.documentElement.clientWidth; };
this.getSiteH = function () { return Math.max(Math.max(window.document.body.offsetHeight, window.innerHeight ? window.innerHeight : window.document.documentElement.clientHeight), window.document.documentElement.scrollHeight); };
this.getSiteW = function () { return Math.max(window.innerWidth ? window.innerWidth : window.document.documentElement.clientWidth, window.document.documentElement.scrollWidth); };
this.clearDocumentSelection = function () {
if (document.selection && document.selection.clear) document.selection.clear();
if (window.getSelection) {
if (window.getSelection().removeAllRanges) window.getSelection().removeAllRanges();
} else {
if (document.getSelection && document.getSelection().removeAllRanges) document.getSelection().removeAllRanges();
}
if (document.clearSelection) document.clearSelection();
};
this.decodeHtmlSpecialChars = function(sString) {
return sString.replace(/&amp;/gi, "&").replace(/&lt;/gi, '<').replace(/&gt;/gi, '>').replace(/&quot;/gi, "\"").replace(/&apos;/gi, "'");
};
this.makeHTTP = function(sString) {
if (typeof sString == 'string') { return (/^\s*http:\/\//i.test(sString)) ? sString : 'http://' + sString; } return 'http://';
};
}
function getElementsByClass( searchClass, domNode, tagName) {
if (domNode == null) domNode = document;
if (tagName == null) tagName = '*';
var el = new Array();
var tags = domNode.getElementsByTagName(tagName);
var tcl = " "+searchClass+" ";
for(i=0,j=0; i<tags.length; i++) {
var test = " " + tags[i].className + " ";
if (test.indexOf(tcl) != -1)
el[j++] = tags[i];
}
return el;
}
var oInvitations = new function() {
this._iTypes = {CONTACT_INNER: 1, CONTACT_OUTER: 2, GROUP_INNER: 3, GROUP_OUTER: 4, EVENT_INNER: 5};
this._bInitialized = false;
this._oPreLoader = false;
this._prepareAjaxParams = function(oParams) {oParams.onInitialization = oInvitations.setBusyOn; oParams.onFinalization = oInvitations.setBusyOff; oParams.disableForm = false;};
this._ajaxPost = function(oParams) { this._prepareAjaxParams(oParams); return advAJAX.post(oParams); };
this._ajaxGet = function(oParams) { this._prepareAjaxParams(oParams); return advAJAX.get(oParams); };
this._ajaxSubmit = function(oForm, oParams){ this._prepareAjaxParams(oParams); return advAJAX.submit(oForm, oParams); };
this._staticContent = '';
this.setBusyOn = function() {
if (!oPopupWindow.isVisible()) {
oPopupWindow.showLoader();
return;
}
if (jQuery.browser.msie) return;
$('#invite_window_loader', oPopupWindow.getWindowNode()).show().css({
width: (oInvitations._oWindow.offsetWidth > 1 ? oInvitations._oWindow.offsetWidth-2 : 0),
height: (oInvitations._oWindow.offsetHeight > 1 ? oInvitations._oWindow.offsetHeight-2 : 0),
top: oInvitations._oWindow.offsetTop,
left: oInvitations._oWindow.offsetLeft
});
};
this.setBusyOff = function(){
$('#invite_window_loader', oPopupWindow.getWindowNode()).hide();
};
this._init = function(oContainer) {
if (this._bInitialized) return true;
if (!oContainer) {
this._ajaxPost({
url: '/inv/ajax_invite/',
async: false
});
oPopupWindow.setWindowContent(window.advajax_obj.xmlHttpRequest.responseText);
}
this._oWindow = ById('invite_window');
oInvitations._bInitialized = oUtils.isUndefOrNull(this._oWindow) ? false : true;
this.setBusyOff();
return this._bInitialized;
};
this.inviteContactInner = function(iReceiverId) {
this.setBusyOn();
if (!this._init()) return;
this._loadForm(this._iTypes.CONTACT_INNER, { 'r_profile_id' : iReceiverId });
this.setBusyOff();
this._showWindow();
};
this.inviteContactOuter = function() {
this.setBusyOn();
if (!this._init()) return;
this._loadForm(this._iTypes.CONTACT_OUTER, {});
this.setBusyOff();
this._showWindow();
};
this.inviteGroupInner = function(iGroupId, iReceiverId) {
this.setBusyOn();
if (!this._init()) return;
this._loadForm(this._iTypes.GROUP_INNER, { 'target_id' : iGroupId, "r_profile_id": (iReceiverId ? iReceiverId : 0) });
this.setBusyOff();
this._showWindow();
};
this.inviteGroupOuter = function(iGroupId) {
this.setBusyOn();
if (!this._init()) return;
this._loadForm(this._iTypes.GROUP_OUTER, { 'target_id' : iGroupId });
this.setBusyOff();
this._showWindow();
};
this.inviteEventInner = function(iEventId, iReceiverId) {
this.setBusyOn();
if (!this._init()) return;
this._loadForm(this._iTypes.EVENT_INNER, { 'target_id' : iEventId, "r_profile_id": (iReceiverId ? iReceiverId : 0) });
this.setBusyOff();
this._showWindow();
};
this.setStaticContent = function(sContent) {
if (typeof sContent == 'string') this._staticContent = sContent;
if (ById('invite_window_static_content')) ById('invite_window_static_content').innerHTML = this._staticContent;
};
};
function switchOctopusAdvert(iStatus, oAdvertContainer)
{
if (oAdvertContainer && !iStatus)
oAdvertContainer.parentNode.removeChild(oAdvertContainer);
advAJAX.get({ url: '/misc/switch_octopus_advert/' + parseInt(iStatus) });
}
var oIFrameAjax = new function() {
var _fCallback = false, _bIsLoading = false, _xUserData = null, _oFrameData = {
sId : 'iframe-ajax', oContainer : false, oFrame : false, oFrameDoc : false
};
var _initialize = function()
{
_oFrameData.oContainer = ById(_oFrameData.sId) ? ById(_oFrameData.sId) : document.createElement("div");
_oFrameData.oContainer.id = _oFrameData.sId;
with (_oFrameData.oContainer.style) {
position = "absolute";
top = left = "-9999px";
width = height = "0px";
}
if (_oFrameData.oContainer.parentNode != document.body) {
document.body.appendChild(_oFrameData.oContainer);
_oFrameData.oContainer.innerHTML =
'<iframe src="about:blank" onload="oIFrameAjax._onLoad(false);" onreadystatechange="oIFrameAjax._onLoad(true)"'+
' name="' + _oFrameData.sId + '_frame" id="' + _oFrameData.sId + '_frame"'+
'></iframe>';
}
// a fix for opera
_oFrameData.oFrame = ById(_oFrameData.sId + "_frame");
var oFrameDoc = _oFrameData.oFrame.contentDocument ? _oFrameData.oFrame.contentDocument  : (_oFrameData.oFrame.contentWindow ? _oFrameData.oFrame.contentWindow.document : _oFrameData.oFrame.document);
if (oFrameDoc.body)
oFrameDoc.body.innerHTML = '__content__not__loaded__yet__';
return true;
};
this.sendForm = function(aForm, aURL, aMethod, aCallback, aUserData) {
var oSrcForm = $(aForm);
if (_bIsLoading || !oSrcForm.size() || !_initialize())
return false;
_bIsLoading = true;
if (aURL.indexOf('__iframe__=1') < 0) {
aURL += aURL.indexOf('?') >= 0 ? '&__iframe__=1' : '?__iframe__=1';
}
oSrcForm.attr({
target : _oFrameData.sId + "_frame",
action : aURL,
enctype : "multipart/form-data",
method : aMethod == "get" ? "get" : "post"
});
_xUserData = aUserData;
_fCallback = aCallback;
oSrcForm.submit();
return true;
};
this.send = function(aURL, aMethod, aCallback, aUserData) {
if (_bIsLoading || !_initialize())
return false;
_bIsLoading = true;
_xUserData = aUserData;
_fCallback = aCallback;
_oFrameData.oFrame.src = aURL;
return true;
};
this._onLoad = function(aIsStateEvent) {
if (!_bIsLoading || aIsStateEvent) return; //|| _oFrameData.oFrame.readyState != "complete"
var oFrameDoc = _oFrameData.oFrame.contentDocument ? _oFrameData.oFrame.contentDocument  : (_oFrameData.oFrame.contentWindow ? _oFrameData.oFrame.contentWindow.document : _oFrameData.oFrame.document),
responseText = (oFrameDoc.body.hasChildNodes() ? (oFrameDoc.body.textContent || oFrameDoc.body.text || oFrameDoc.body.innerText || '') : '');
// opera fix
if (responseText == "__content__not__loaded__yet__") {
setTimeout("oIFrameAjax._onLoad(false)", 250);
return;
}
_bIsLoading = false;
if (typeof _fCallback == 'function') {
_fCallback((responseText), _xUserData);
}
};
};
function isParentOf(oParent, oElement) {
var oElementParent = oElement.parentNode;
while (oElementParent) {
if (oElementParent === oParent) return true;
oElementParent = oElementParent.parentNode;
}
return false;
}
function toggleComboBoxes(bShow, oExcludedContainer) {
if (window.XMLHttpRequest) return; /** enabled only for old browsers like IE6 */
/*var iIEVersion = parseFloat(navigator.appVersion.split("MSIE")[1]);
if (iIEVersion > 6) return;*/
$('select').each(function() {
if (oExcludedContainer && isParentOf(oExcludedContainer, this)) return;
if (typeof this._defaultVisibility == 'undefined') {
this._defaultVisibility = this.style.visibility;
this._defaultVisibilityOnShow = bShow;
this.style.visibility = bShow ? 'visible' : 'hidden';
} else {
this.style.visibility = (this._defaultVisibilityOnShow != bShow) ? this._defaultVisibility : (bShow ? 'visible' : 'hidden');
}
});
}
function sprintf(sFormat) {
for (i = 1; i < arguments.length; i++)
sFormat = sFormat.replace('%s', arguments[i]);
return sFormat;
};
var oPopupWindow = new function()
{
var _that = this,
_oComponents = {
container : false,
blocker : false,
wnd_blocker : false,
loader : false,
window : false,
blockerTimer : 0,
wndBlockerTimer : 0
},
_oCssDefault = {
opacity : 0.5,
background: '#000'
},
_jDragElement = false;
this.oCssSettings = {};
this.oWndBlockerCssSettings = {};
this.onbeforeshow = false;
this.onaftershow = false;
this.onbeforehide = false;
this.onafterhide = false;
var _initialize = function()
{
if (_oComponents.window) return true;
_oComponents.container = document.createElement('div');
_oComponents.window = document.createElement('div');
_oComponents.blocker = document.createElement('div');
_oComponents.loader = document.createElement('div');
_oComponents.wnd_blocker = document.createElement('div');
_oComponents.container.className = 'popup-container';
_oComponents.window.className = 'popup-window';
_oComponents.blocker.className = 'popup-blocker';
_oComponents.wnd_blocker.className = 'popup-wnd-blocker';
_oComponents.loader.className = 'popup-loader';
_oComponents.loader.innerHTML = '<div class="centerTxt"><img src="/_p/img/ajax-loader.gif" /></div>';
_oComponents.loaderMessage = document.createElement('div');
_oComponents.loaderMessage.className = 'mt';
_oComponents.loader.appendChild(_oComponents.loaderMessage);
_oComponents.container.appendChild(_oComponents.blocker);
_oComponents.container.appendChild(_oComponents.wnd_blocker);
_oComponents.container.appendChild(_oComponents.window);
_oComponents.container.appendChild(_oComponents.loader);
document.body.appendChild(_oComponents.container);
return true;
};
this.showBlocker = function(oCss)
{
if (!_initialize()) return;
if (!$(_oComponents.blocker).is(':visible')) {
toggleComboBoxes(false, _oComponents.window);
}
with (_oComponents.blocker.style) {
display = "block";
width = "100%";
height = oUtils.getSiteH() + "px";
}
$('#Promo').css('visibility', 'hidden');
this.oCssSettings = $.extend({}, _oCssDefault, oCss || {});
$(_oComponents.blocker).css(this.oCssSettings);
clearInterval(_oComponents.blockerTimer);
_oComponents.blockerTimer = setInterval('oPopupWindow.showBlocker(oPopupWindow.oCssSettings)', 400);
};
this.hideBlocker = function()
{
if (!_initialize()) return;
_oComponents.blocker.style.display = "none";
toggleComboBoxes(true, _oComponents.window);
$('#Promo').css('visibility', 'visible');
clearInterval(_oComponents.blockerTimer);
};
this.showWndBlocker = function(oCss)
{
if (!_initialize()) return;
$(_oComponents.wnd_blocker).css({
display: "block",
width: $(_oComponents.window).width(),
height: $(_oComponents.window).height(),
left: $(_oComponents.window).css('left'),
top: $(_oComponents.window).css('top')
});
this.oWndBlockerCssSettings = $.extend({}, oCss || {});
$(_oComponents.wndBlocker).css(this.oWndBlockerCssSettings);
clearInterval(_oComponents.wndBlockerTimer);
_oComponents.wndBlockerTimer = setInterval('oPopupWindow.showWndBlocker(oPopupWindow.oWndBlockerCssSettings)', 300);
};
this.hideWndBlocker = function()
{
if (!_initialize()) return;
_oComponents.wnd_blocker.style.display = "none";
clearInterval(_oComponents.wndBlockerTimer);
};
this.showLoader = function(bNoBlocker, sMessage, iOpacity)
{
if (!_initialize()) return;
if (!bNoBlocker) _that.showBlocker(iOpacity);
if (sMessage) {
$(_oComponents.loaderMessage).html(sMessage).show();
} else {
$(_oComponents.loaderMessage).hide();
}
$(_oComponents.loader).show();
oUtils.centerObject(_oComponents.loader);
};
this.hideLoader = function(bWithBlocker)
{
if (!_initialize()) return;
_oComponents.loader.style.display = "none";
if (bWithBlocker) {
this.hideBlocker();
}
};
this.showWindow = function(iWidth, sContent, bNoBlocker, sDragSelector, bNoHTMLProcessing)
{
if (typeof this.onbeforeshow == 'function' && this.onbeforeshow()) return;
if (!_initialize()) return;
if (_oComponents.blocker.style.display != 'block' && !bNoBlocker)
_that.showBlocker();
_oComponents.window.style.width = iWidth;
_oComponents.window.style.display = "block";
if (sContent !== null) oPopupWindow.setWindowContent(sContent, bNoHTMLProcessing);
oUtils.centerObject(_oComponents.window);
if (typeof this.onaftershow == 'function') this.onaftershow();
this._initMoving(sDragSelector);
};
this.hideWindow = function(bLeaveBlocker)
{
if (typeof this.onbeforehide == 'function' && this.onbeforehide()) return;
if (!_initialize()) return;
if (!bLeaveBlocker)
_that.hideBlocker();
_that.hideWndBlocker();
_oComponents.window.style.display = "none";
if (typeof this.onafterhide == 'function') this.onafterhide();
this._initMoving();
};
this.setWindowContent = function(sContent, bNoHTMLProcessing)
{
if (!_initialize()) return;
this._initMoving(_jDragElement);
$(_oComponents.window).html(sContent);
if (!bNoHTMLProcessing) {
ProcessNewHTML(_oComponents.window);
}
};
this.getWindowNode = function()
{
if (!_initialize()) return false;
return _oComponents.window;
};
this.centerWindow = function(oAnimation)
{
if (!_initialize()) return false;
if (this.isVisible()) {
oUtils.centerObject(_oComponents.window, false, false, oAnimation ? oAnimation : { duration: 200 });
} else {
oUtils.centerObject(_oComponents.window);
}
};
this.isVisible = function()
{
if (!_initialize()) return false;
return _oComponents.window.style.display == "block" ? true : false;
};
this._initMoving = function(sDragSelector)
{
if (sDragSelector) {
_jDragElement = $(sDragSelector, _oComponents.window);
if (_jDragElement.length) {
_jDragElement.bind('mousedown', _jDragElement, _onMouseDown);
$(document).bind('mouseup', _jDragElement, _onMouseUp);
_jDragElement.css({cursor:'move'});
}
} else if (_jDragElement && _jDragElement.length) {
_jDragElement.unbind('mousedown', _onMouseDown);
$(document).unbind('mouseup', _onMouseUp);
$(document).unbind('mousemove', _onMouseUp);
_jDragElement.css({cursor:null});
}
};
var _onMouseMove = function(e)
{
var y = e.pageY - e.data.yd,
x = e.pageX - e.data.xd;
x = x > 0 ? x : 0;
y = y > 0 ? y : 0;
$(_oComponents.window).css({ top: y, left: x });
};
var _onMouseDown = function(e)
{
$(document).bind('mousemove', { drag: e.data, xd: e.pageX - $(_oComponents.window).offset().left, yd: e.pageY - $(_oComponents.window).offset().top }, _onMouseMove);
};
var _onMouseUp = function(e)
{
$(document).unbind('mousemove', _onMouseMove);
};
};
var Pages = function(oConfig)
{
var _that = this,
_oContainer = $(oConfig.container).get(0),
_oConfig = {
bSwitchByClass : oConfig.switchByClass ? true : false,
aClasses : oUtils.isArray(oConfig.classes) ? oConfig.classes : [],
fOnBeforeSwitch : oConfig.onBeforeSwitch,
fOnAfterSwitch : oConfig.onAfterSwitch
},
_aPages = [],
_iCurrentPage = 0;
this._getPages = function() {
var aPages = [];
for (var i = 0; i < _oContainer.childNodes.length; i++) {
if (_oContainer.childNodes.item(i).nodeType == 1)
aPages.push({ node : _oContainer.childNodes.item(i), index : i, number : i+1 });
}
return aPages;
};
this._getCurrentPageIndex = function() {
for (var i in _aPages) {
if (_oConfig.bSwitchByClass)
if (_aPages[i].node.className == _oConfig.aClasses[0]) return i;
else if (_aPages[i].node.style.display != 'none') return i;
}
return 0;
};
this._togglePage = function(iPage, bShow) {
if (_aPages[iPage]) {
if (_oConfig.bSwitchByClass)
_aPages[iPage].node.className = _oConfig.classes[bShow ? 0 : 1];
else _aPages[iPage].node.style.display = bShow ? 'block' : 'none';
}
};
this._validatePageIndex = function(iPageIndex) {
if (iPageIndex < 0) iPageIndex = 0;
if (iPageIndex > _aPages.length - 1) iPageIndex = _aPages.length - 1;
return iPageIndex;
};
this.goTo = function(iPageIndex) {
iPageIndex = this._validatePageIndex(iPageIndex);
if (typeof _oConfig.fOnBeforeSwitch == 'function') {
var iNewPage = _oConfig.fOnBeforeSwitch(iPageIndex, _iCurrentPage, _aPages);
if (iNewPage == -1) return;
iPageIndex = this._validatePageIndex(iNewPage);
}
this._togglePage(_iCurrentPage, false);
this._togglePage(iPageIndex, true);
if (typeof _oConfig.fOnAfterSwitch == 'function')
_oConfig.fOnAfterSwitch(iPageIndex, _iCurrentPage, _aPages);
_iCurrentPage = iPageIndex;
};
this.next = function() {
this.goTo(_iCurrentPage + 1);
};
this.prev = function() {
this.goTo(_iCurrentPage - 1);
};
this.currentPage = function() {
return _iCurrentPage;
};
this.pageContent = function(iPageIndex, sContent) {
if (iPageIndex >= 0 && iPageIndex < _aPages.length) {
if (typeof sContent != 'undefined') {
$(_aPages[iPageIndex].node).html(sContent);
}
return _aPages[iPageIndex].node.innerHTML;
}
return '';
};
this.getPageNode = function(iPageIndex) {
return (typeof _aPages[iPageIndex] != 'undefined') ? _aPages[iPageIndex].node : false;
};
_aPages = this._getPages();
_iCurrentPage = this._getCurrentPageIndex();
};
var oProfeoValidator = new function() {
this.ValidLength = function(text, min, max) {
text = text.trim();
var textLength = text.length;
if(min) {
if(textLength < min)
return false;
}
if(max) {
if(textLength > max)
return false;
}
return true;
};
this.isEmpty = function(text) {
return (text.trim() == '') ?  true : false;
};
this.isNumber = function(number) {
return /^([-]?)(0|([1-9]{1}[0-9]*))([\.,]{1}[0-9]+)?$/.test(number);
};
this.isNumeric = function(number) {
return /^[0-9]+$/.test(number);
};
this.isPositiveNumber = function(number) {
return oProfeoValidator.isNumber(number) && number > 0;
};
this.isEmail = function(email) {
return /^[0-9a-z]([+-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\.[a-z]{2,10}$/i.test(email);
};
this.isURL = function(url, noProtocolValidation) {
if (noProtocolValidation)
return /^(?:(?:((?:%[0-9a-f]{2}|[-a-z0-9_.!~*\'\(\);:\&=+$,])*)@)?(?:((?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])?\.)*[a-z](?:[a-z0-9]+)?\.?)|([0-9]{1,3}(?:\.[0-9]{1,3}){3}))(?::([0-9]*))?)((?:\/(?:%[0-9a-f]{2}|[-a-z0-9_.!~*\'():@\&=+$,;])*)*\/?)?(?:\?([^#]*))?(?:\#((?:%[0-9a-f]{2}|[-a-z0-9_.!~*\'();\/?:@\&=+$,])*))?$/i.test(url);
return /^(?:([a-z][-+.a-z0-9]*):)?(?:\/\/(?:((?:%[0-9a-f]{2}|[-a-z0-9_.!~*\'();:\&=+$,])*)@)?(?:((?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])?\.)*[a-z](?:[a-z0-9]+)?\.?)|([0-9]{1,3}(?:\.[0-9]{1,3}){3}))(?::([0-9]*))?)((?:\/(?:%[0-9a-f]{2}|[-a-z0-9_.!~*\'():@\&=+$,;])*)*\/?)?(?:\?([^#]*))?(?:\#((?:%[0-9a-f]{2}|[-a-z0-9_.!~*\'();\/?:@\&=+$,])*))?$/i.test(url);
};
this.isPhoneNumber = function(phone) {
return /^\+?[\d\s]+$/.test(phone);
};
this.isNIP = function(nip) {
if ((nip = nip.trim()).length)
{
var weights = [6, 5, 7, 2, 3, 4, 5, 6, 7],
nip = nip.replace(/[\s-]/g, '', nip),
sum = 0;
if (nip.length != 10 || !this.isNumeric(nip))
return false;
for (var x = 0; x <= 8; x++) {
sum += parseInt(nip.charAt(x)) * weights[x];
}
return (sum % 11) == nip.charAt(9);
}
return false;
};
this.isREGON = function(regon) {
if ((regon = regon.trim()).length != 9 || !this.isNumeric(regon))
return false;
var aSteps = [8, 9, 2, 3, 4, 5, 6, 7],
iSum = 0;
for (var i = 0; i < 8; i++) {
iSum += aSteps[i] * parseInt(regon.charAt(i));
}
if ((((iSum % 11) == 10) ? 0 : (iSum % 11)) == regon.charAt(8))
return true;
return false;
};
this.isAlphanumeric = function(string, addutionalChars) {
return (new RegExp('^[A-Z0-9\u00A1-\uFFFF'+(addutionalChars ? addutionalChars : '')+']+$', 'i')).test(string);
};
this.isAlpha = function(string, addutionalChars) {
return (new RegExp('^[A-Z\u00A1-\uFFFF'+(addutionalChars ? addutionalChars : '')+']+$', 'i')).test(string);
};
};
function initializeTitleClouds(oContainer) {
var jContainer = $(oContainer ? oContainer : document);
if (!document.body._cloud_hint)
{
document.body._cloud_hint = $(document.createElement('div'));
document.body._cloud_hint.addClass('cloud_hint').appendTo(document.body);
}
$(".cloud_hint[title!='']", jContainer).each(function() {
$(this)
.bind('mouseover', function(event) {
$(this).triggerHandler('mousemove', event);
this.title = (!this.title && this._title) ? this._title : this.title;
document.body._cloud_hint.html(this._title = this.title).show();
this.title = '';
})
.bind('mouseout', function() {
this.title = this._title;
document.body._cloud_hint.hide();
})
.bind('mousemove', function(event, e) {
event = e || event;
document.body._cloud_hint.css({
left: event.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft),
top: event.clientY + (document.documentElement.scrollTop || document.body.scrollTop)
});
});
});
}
function addEvent(O, E, F, x) {
return (x=O.addEventListener)? x(E,F,1):(x=O.attachEvent) ? x('on'+E,F) :! 1;
}
function FCKeditor_OnComplete( aInstance )
{
aInstance.AttachToOnSelectionChange(function(aEditorInstance) { aEditorInstance.UpdateLinkedField(); } );
if (typeof aInstance.LinkedField._fckOnComplete == 'function') {
aInstance.LinkedField._fckOnComplete(aInstance);
}
}
if (!_aTranslations) {
var _aTranslations = [];
}
function GetTranslation(sText)
{
return (typeof _aTranslations[sText] == 'undefined') ? sText : _aTranslations[sText];
}
function OnBranchSelect(sContainerPrefix, iCurrentIndex, iMaxSelections)
{
var jContainer = $('#' + sContainerPrefix + iCurrentIndex),
jSelect = jContainer.find('select:first');
if (iCurrentIndex < iMaxSelections && jSelect.val() > 0) {
$('#' + sContainerPrefix + (iCurrentIndex + 1)).show();
}
}
function ResizeSledzikExternalImage(e)
{
if (this.width && this.height)
{
$(this).css({ top: 100, left: 100 }).appendTo('#' + this.id + '_link');
var jContainer = $(this).parents('.externalPhoto').eq(0),
iMaxW = jContainer.width(),
iMaxH = jContainer.height(),
iRatio = Math.max(iMaxW / this.width, iMaxH / this.height),
iW = iRatio * this.width,
iH = iRatio * this.height,
iX = Math.ceil((iMaxW - iW) / 2),
iY = Math.ceil((iMaxH - iH) / 2);
$(this).css({ width: iW, height: iH, top: iY, left: iX });
}
}
var oWinter = new function()
{
var _jSnowflakeImage = $(new Image()),
_aFlakes = [],
_iFlakesIndex = 0,
_iFlakesCount = 0,
_iSiteH = 100,
_iFlakeXAmplitude = 50,
_iGenerationIntervalScope = 800,
_iGenerationMinInterval = 200,
_iFlakeStep = 7,
_iFlakeFallIntervalScope = 50,
_iFlakeFallMinInterval = 50;
var oSnowflake = function(iID)
{
var _jFlake = _jSnowflakeImage.clone(),
_iID = iID,
_oAnimationData = {
interval: 20,
xPos: 0,
xPosDelta: 0.05,
xBase: 0,
timer: 0
};
_jFlake.appendTo(document.body);
//console.log('New snowflake created #'+iID);
this.animate = function(iInterval)
{
//console.log('Animating snowflake with interval: '+iInterval);
_oAnimationData.interval = iInterval;
_jFlake.css({ left: _oAnimationData.xBase = (Math.random() * (oUtils.getSiteW() - 100)) });
this._step();
};
this._step = function()
{
var iTop = parseInt(_jFlake.css('top'));
_jFlake.css({
left: (_oAnimationData.xBase + Math.round((Math.sin(_oAnimationData.xPos * Math.PI/180) * _iFlakeXAmplitude))) + 'px',
top: (iTop + 10) + 'px'
});
//console.log('Snowflake #'+_iID+' position: '+parseInt(_jFlake.css('left'))+'x'+parseInt(_jFlake.css('top')));
if (parseInt(_jFlake.css('top')) > _iSiteH) {
oWinter.removeFlake(_iID);
return;
}
if (_oAnimationData.xPos >= 360) {
_oAnimationData.xPos = 0;
_oAnimationData.xPosDelta = 7;
} else if (_oAnimationData.xPos <= 0) {
_oAnimationData.xPos = 360;
_oAnimationData.xPosDelta = -7;
}
_oAnimationData.xPos = _oAnimationData.xPos + _oAnimationData.xPosDelta;
if (iTop + 10 >= _iSiteH - 100) {
_jFlake.fadeOut(1000);
}
_oAnimationData.timer = setTimeout('oWinter.getFlake('+ _iID +')._step()', _oAnimationData.interval);
};
this.remove = function()
{
clearTimeout(_oAnimationData.timer);
_jFlake.remove();
};
};
this._createSnowflake = function()
{
var oSF = new oSnowflake(_iFlakesIndex);
_aFlakes[_iFlakesIndex] = oSF;
oSF.animate((Math.random() * _iFlakeFallIntervalScope) + _iFlakeFallMinInterval);
_iFlakesIndex++;
_iFlakesCount++;
setTimeout('oWinter._createSnowflake()', Math.random() * _iGenerationIntervalScope + _iGenerationMinInterval);
};
this.startSnow = function()
{
if (!_jSnowflakeImage.attr('src')) {
_jSnowflakeImage.attr('src', '/_p/images/snowflake.gif').css({ position: 'absolute', left: -100, top: -100, 'z-index': 1000 });
}
_iSiteH = _iSiteH ? _iSiteH : oUtils.getSiteH() - 20;
setTimeout('oWinter._createSnowflake()', Math.random() * _iGenerationIntervalScope + _iGenerationMinInterval);
};
this.getFlake = function(iID)
{
return _aFlakes[iID];
};
this.removeFlake = function(iID)
{
//console.log('Deleting snowflake #' + iID);
_aFlakes[iID].remove();
delete _aFlakes[iID];
_iFlakesCount--;
};
};
function GetGoogleMapTypeName(oMapType)
{
var aMapTypes = {
'Map': 'G_NORMAL_MAP',
'Satellite': 'G_SATELLITE_MAP',
'Hybrid': 'G_HYBRID_MAP',
'Terrain': 'G_PHYSICAL_MAP',
'Mapa': 'G_NORMAL_MAP',
'Satelita': 'G_SATELLITE_MAP',
'Hybrydowa': 'G_HYBRID_MAP',
'Teren': 'G_PHYSICAL_MAP'
};
if (aMapTypes[oMapType.getName()])  {
return aMapTypes[oMapType.getName()];
}
return 'G_NORMAL_MAP';
}
function ParseTemplate(sTemplate, aData)
{
for (var sVarName in aData) {
if (aData[sVarName] === null) {
aData[sVarName] = '';
}
}
window.__templateVars = aData;
var parse = function(sTpl)
{
var jTemplate = $('<div></div>').html(sTpl);
$('span.if', jTemplate).each(function()
{
var jIf = $(this), bResult;
bResult = window.eval('bResult = (window.__templateVars.' + jIf.attr('a') + jIf.attr('sign')  + jIf.attr('b') + ') ? true : false');
if (!bResult) {
jIf.remove();
} else {
jIf.replaceWith(parse(jIf.html()));
}
});
return jTemplate.html();
};
sTemplate = unescape(parse(sTemplate));
var aMatches, token, value;
for (var sVarName in aData)
{
aMatches = sTemplate.match(new RegExp('\\{\\w*?\\$' + sVarName + '\\}', 'g'));
if (oUtils.isArray(aMatches))
{
for (var i = 0; i < aMatches.length; i++)
{
token = aMatches[i].replace(/\{|\}/g, '').split('$');
if (token[0]) {
value = eval('value = ' + token[0] + '(window.__templateVars["' + sVarName + '"])');
sTemplate = sTemplate.replace(new RegExp('\\{'+token[0]+'\\$' + sVarName + '\\}', 'g'), value);
} else {
sTemplate = sTemplate.replace(new RegExp('\\{\\$' + sVarName + '\\}', 'g'), aData[sVarName]);
}
}
}
}
return sTemplate;
}
function htmlspecialchars(sString) {
return sString ? sString.htmlspecialchars() : '';
}
/**
* Wyświtla errory
* Przykład:
*   Otrzymana tablica z błędami:
*       [aErrors] => (
*           [lista1] => (
*               [blad1] => 4
*           )
*           [lista2] => (
*               [blad2] => 3
*           )
*       )
* Pokaże elementy z klasami:
*   errorId_lista1
*       errorId_lista1_blad1
*           errorId_lista1_blad1_4
*   errorId_lista2
*       errorId_lista2_blad2
*           errorId_lista2_blad2_3
*
* Każda klasa błędu musi rozpoczynać sie od errorId_* + nazwy kluczy oddzielone _ + wartość
*/
function DisplayErrors(aErrors, oContainer, sPrefix, noHide)
{
if (typeof sPrefix == 'string') {
sPrefix += '_';
}
else
{
sPrefix = '';
if (!noHide) {
$('.error', $(oContainer)).hide();
}
}
if (oUtils.isObject(aErrors)) {
for (var i in aErrors) {
if (oUtils.isObject(aErrors[i])) {
$('.errorId_' + sPrefix + i, oContainer).show('fast');
DisplayErrors(aErrors[i], oContainer, sPrefix + i);
} else {
$('.errorId_' + sPrefix + i, oContainer).show('fast');
$('.errorId_' + sPrefix + i + '_' + aErrors[i], oContainer).show('fast');
}
}
}
};
/**
* Klasa obsługująca ajaxowy formularz rejestracji
*/
var oRegistration = new function()
{
var _jForm,
_jRegisterContainer,
_jLoginContainer,
_jWndContainer;
this.validateInvitationContent = function()
{
var jValue = $(':input[name="invitation\[content\]"]', _jForm), sValue = jValue.val().trim();
if (!oProfeoValidator.ValidLength(sValue, 1)) {
return DisplayErrors({ invitation_content: 1 }, _jForm, false, true);
}
$('.error', jValue.parent()).hide();
return true;
};
this.validateName = function()
{
var jValue = $(':input[name="register\[name\]"]', _jForm), sValue = jValue.val().trim();
if (!oProfeoValidator.isAlpha(sValue, ' \-')) {
return DisplayErrors({ name: 1 }, _jForm, false, true);
}
$('.error', jValue.parent()).hide();
this.generateFriendlyUrl(this.validateFriendlyUrl);
return true;
};
this.validateSurname = function()
{
var jValue = $(':input[name="register\[surname\]"]', _jForm), sValue = jValue.val().trim();
if (!oProfeoValidator.isAlpha(sValue, ' \-')) {
return DisplayErrors({ surname: 1 }, _jForm, false, true);
}
$('.error', jValue.parent()).hide();
this.generateFriendlyUrl(this.validateFriendlyUrl);
return true;
};
this.validateEmail = function()
{
var jValue = $(':input[name="register\[email\]"]', _jForm), sValue = jValue.val().trim();
if (!oProfeoValidator.isEmail(sValue)) {
return DisplayErrors({ email: 1 }, _jForm, false, true);
}
$('.error', jValue.parent()).hide();
return true;
};
this.validatePassword = function(bValidateSecond)
{
var jValue = $(':input[name="register\[password\]"]', _jForm), sValue = jValue.val().trim();
if (!oProfeoValidator.ValidLength(sValue, 6)) {
return DisplayErrors({ password: 1 }, _jForm, false, true);
}
if (bValidateSecond)
{
var jValue2 = $(':input[name="register\[password_confirmation\]"]', _jForm), sValue2 = jValue2.val().trim();
if (sValue != sValue2) {
return DisplayErrors({ password_confirmation: 1 }, _jForm, false, true);
}
$('.error', jValue2.parent()).hide();
} else {
$('.error', jValue.parent()).hide();
}
return true;
};
this.validateCity = function()
{
var jValue = $(':input[name="register\[city\]"]', _jForm), sValue = jValue.val().trim();
if (!oProfeoValidator.ValidLength(sValue, 2)) {
return DisplayErrors({ city: 1 }, _jForm, false, true);
}
$('.error', jValue.parent()).hide();
return true;
};
this.validateProvince = function()
{
var jValue = $(':input[name="register\[province\]"]', _jForm), sValue = jValue.val().trim();
if (!oProfeoValidator.ValidLength(sValue, 2)) {
return DisplayErrors({ province: 1 }, _jForm, false, true);
}
$('.error', jValue.parent()).hide();
return true;
};
this.validateApprovement1 = function()
{
var jValue = $(':input[name="register\[approvement1\]"]', _jForm);
if (!jValue.is(':checked')) {
return DisplayErrors({ approvement1: 1 }, _jForm, false, true);
}
$('.error', jValue.parent()).hide();
return true;
};
this.validateApprovement2 = function()
{
var jValue = $(':input[name="register\[approvement2\]"]', _jForm);
if (!jValue.is(':checked')) {
return DisplayErrors({ approvement2: 1 }, _jForm, false, true);
}
$('.error', jValue.parent()).hide();
return true;
};
this.validateBranches = function()
{
var iSelectedCount = 0;
$('select[name="register\[branches\]\[\]"]:visible').each(function() {
if (this.value) {
iSelectedCount++
}
});
if (iSelectedCount) {
$('#branches .error').hide();
return true;
}
return DisplayErrors({ branches: 1 }, _jForm, false, true);
};
this.validateFriendlyUrl = function(fCallback)
{
$('#friendly_url_loader').show();
$.ajax({
url: '/register/ajax_validate_furl/'
+ encodeURIComponent($(':input[name="register\[friendly_url\]"]', _jForm).val()) + '/'
+ encodeURIComponent($(':input[name="register\[name\]"]', _jForm).val()) + '/'
+ encodeURIComponent($(':input[name="register\[surname\]"]', _jForm).val()),
dataType: 'json',
success: function(oResponse)
{
$('#friendly_url_loader').hide();
$('.error', $(':input[name="register\[friendly_url\]"]', _jForm).parent()).hide();
if (typeof fCallback == 'function') {
fCallback(oResponse);
} else {
if (oResponse.aErrors) {
if (oResponse.aErrors.furl == 2) {
oRegistration.showSuggestedFurls(oResponse.suggested_furls);
}
return DisplayErrors(oResponse.aErrors, _jForm, false, true);
}
}
}
});
};
this.showSuggestedFurls = function(aFurls)
{
if (!aFurls || !aFurls[0]) return;
var jSuggested = $('.suggested_furls'),
jList = $('ul:first', jSuggested).html(''),
sTemplate = $('#suggested_furl_template').html();
for (var i in aFurls) {
jList.append($('<li>').html(ParseTemplate(sTemplate, { furl: aFurls[i] })));
}
jSuggested.show();
};
this.setFriendlyUrl = function(sURL)
{
$(':input[name="register\[friendly_url\]"]', _jForm).val(sURL);
$('.suggested_furls', _jForm).hide('fast');
$('.error', $(':input[name="register\[friendly_url\]"]', _jForm).parent()).hide();
};
this.generateFriendlyUrl = function(fCallback)
{
var jFURL = $(':input[name="register\[friendly_url\]"]', _jRegisterContainer);
if (!jFURL.val().trim().length) {
jFURL.get(0)._custom = false;
}
if (!jFURL.get(0)._custom)
{
$.ajax({
url: '/misc/ajax_to_asci/' + encodeURIComponent($(':input[name="register\[name\]"]', _jRegisterContainer).val().toLowerCase() + '-' + $(':input[name="register\[surname\]"]', _jRegisterContainer).val().toLowerCase()),
dataType: 'text',
success: function(sResponse) {
jFURL.val(sResponse);
if (typeof fCallback == 'function') {
fCallback(sResponse);
}
}
});
}
};
this.register = function(oOptions)
{
oOptions = typeof oOptions == 'undefined' ? {} : oOptions;
oPopupWindow.showLoader();
oPopupWindow.showWndBlocker();
var bOk = false;
$.ajax({
url: '/register/ajax_register/',
dataType: 'json',
type: 'post',
data: oOptions.data ? oOptions.data : _jForm.serialize(),
success: function(oResponse) {
if (typeof oOptions.success == 'function') {
if (oOptions.success(oResponse)) {
return;
}
}
if (oResponse.aErrors && (!oUtils.isArray(oResponse.aErrors) || oResponse.aErrors.length))
{
oRegistration.showSuggestedFurls(oResponse.suggested_furls);
DisplayErrors(oResponse.aErrors, _jForm, false, true);
}
else
{
bOk = true;
if (oResponse.aActionResult && oResponse.aActionResult.redirect) {
document.location = oResponse.aActionResult.redirect;
} else {
document.location = document.location.toString().replace('#', '');
}
}
},
complete: oOptions.complete ? oOptions.complete : function() {
if (!bOk) {
oPopupWindow.hideLoader();
oPopupWindow.hideWndBlocker();
}
}
});
};
var _init = function()
{
_jForm = $('#registrationForm');
_jRegisterContainer = $('#registrationFormContainer');
_jLoginContainer = $('#loginFormContainer');
_jWndContainer = $(oPopupWindow.getWindowNode());
_updateFacebookButton();
_updateSendButton();
};
var _showForm = function(sURL, fCallback, bDontHideLoader)
{
oPopupWindow.showLoader();
$.ajax({
url: sURL,
type: 'get',
dataType: 'html',
success: function(html)
{
oPopupWindow.showWindow('750px', html, false, '.box-title');
_init();
if (typeof fCallback == 'function') {
fCallback();
}
},
complete: function() {
if (!bDontHideLoader) {
oPopupWindow.hideLoader();
}
}
});
};
this.joinToGroup = function(iGroupId)
{
_showForm('/register/ajax_registration_form/join_to_group/' + iGroupId);
};
this.joinToEvent = function(iEventId)
{
_showForm('/register/ajax_registration_form/join_to_event/' + iEventId);
};
this.inviteContactInner = function(iProfileId, iType)
{
_showForm('/register/ajax_registration_form/invite/' + iProfileId + '/' + iType);
};
this.loginOrRegister = function(iTab, bAutoFBLogin, response)
{
_showForm('/register/ajax_registration_form/login_or_register/', function() {
if (!iTab) {
oRegistration.showLoginForm();
} else {
oRegistration.showRegistrationForm();
}
if (response) {
oRegistration.refreshFBLoginStatus(response);
}
}, response ? true : false);
};
this.tryLogin = function(response)
{
oPopupWindow.showLoader(true);
$.ajax(
{
url: '/register/ajax_register/',
dataType: 'json',
type: 'post',
data: { "login[use_facebook]": 1, "login[facebook_id]": response.session.uid, "login[email]": null, "login[password]": null, "login[rememberme]": null, "action": "" },
success: function(oResponse)
{
if (oResponse.aErrors && (!oUtils.isArray(oResponse.aErrors) || oResponse.aErrors.length)) {
oRegistration.loginOrRegister(0, null, response);
}
else
{
if (oResponse.aActionResult && oResponse.aActionResult.redirect) {
document.location = oResponse.aActionResult.redirect;
} else {
document.location = document.location.toString().replace('#', '');
}
}
}
});
};
var _updateSendButton = function()
{
var currentAction = $('input[name="action"]:first', _jWndContainer).val(),
currentTab = _jRegisterContainer.is(':visible') ? 'register' : 'login';
$('.sendButton', _jWndContainer).hide();
$('.sendButton_' + currentAction, _jWndContainer).show();
$('.sendButton_' + currentAction + '_' + currentTab, _jWndContainer).show();
};
this.showLoginForm = function(fCallback)
{
_jRegisterContainer.hide('fast', function()
{
$('.error', $(this).appendTo($('#registrationHiddenTabs'))).hide();
_jLoginContainer.appendTo('#registrationTabs').show('fast', function() {
oPopupWindow.centerWindow();
_updateSendButton();
if (typeof fCallback == 'function') {
fCallback();
}
});
});
};
this.showRegistrationForm = function(fCallback)
{
_jLoginContainer.hide('fast', function()
{
$('.error', $(this).appendTo($('#registrationHiddenTabs'))).hide();
_jRegisterContainer.appendTo('#registrationTabs').show('fast', function() {
oPopupWindow.centerWindow();
_updateSendButton();
if (typeof fCallback == 'function') {
fCallback();
}
});
});
};
var _fbProfile = false,
_fbCurrentAppId;
var _updateFacebookButton = function()
{
$('.fb_login_button').each(function()
{
var jButton = $(this);
if (jButton.hasClass('fb_button_icon') || jButton.hasClass('no_change')) return;
if (!_fbProfile) {
jButton.find('.fb_button_text').html(jButton.attr('logintext'));
} else {
jButton.find('.fb_button_text').html(jButton.attr('logouttext'));
}
});
};
this.refreshFBLoginStatus = function(oResponse, bSilent)
{
var bHideBlocker = true,
bInWindow = oPopupWindow.isVisible();
var _jInlineContainer = $('#left');
if (bInWindow) {
if (!bSilent) {
oPopupWindow.showWndBlocker();
oPopupWindow.showLoader();
}
} else {
_jRegisterContainer = _jLoginContainer = _jInlineContainer;
$('#fbLoader').show();
}
if (oResponse && oResponse.status == 'connected')
{
FB.api('/me', function(oFBProfile)
{
_fbProfile = oFBProfile;
_updateFacebookButton();
oFBProfile.picture = 'https://graph.facebook.com/' + oFBProfile.id + '/picture?access_token=' + oResponse.session.access_token;
$('.fb-account-card').html(ParseTemplate($('#fb-account-card-template:first').html(), oFBProfile));
$('.fb-account .avatar img').attr('src', oFBProfile.picture);
$('.fb-account').show();
if ($('input[name$="\[facebook_id\]"]').val(oFBProfile.id).size())
{
$.ajax(
{
url: '/register/ajax_validate_fb_user/',
dataType: 'json',
success: function(oData)
{
$(oRegistration).triggerHandler('onValidateFBUser', oData);
var bRegistration = _jRegisterContainer.is(':visible');
if (oData && oData.oProfile)
{
// inline
$('.fb-account .info', _jInlineContainer).show();
if (bInWindow)
{
//$('input[name="login\[use_facebook\]"]', _jRegisterContainer).val('0');
$('input[name="login\[use_facebook\]"]', _jLoginContainer).val('1');
$('.fb-account .info', _jRegisterContainer).show();
$('.fb-account .info', _jLoginContainer).hide();
$('fieldset.registrationData', _jLoginContainer).hide();
}
}
else
{
// inline
$('.fb-account .info', _jInlineContainer).hide();
//$('input[name="register\[name\]"]').val(oFBProfile.first_name);
//$('input[name="register\[surname\]"]').val(oFBProfile.last_name);
if (oFBProfile.email) {
//$('input[name="register\[email\]"]').val(oFBProfile.email);
}
if (bInWindow)
{
//$('input[name="login\[use_facebook\]"]', _jRegisterContainer).val('1');
$('input[name="login\[use_facebook\]"]', _jLoginContainer).val('0');
$('.fb-account .info', _jRegisterContainer).hide();
$('.fb-account .info', _jLoginContainer).show();
$('fieldset.registrationData', _jLoginContainer).show();
oRegistration.generateFriendlyUrl();
}
}
},
complete: function()
{
if (bInWindow) {
if (bHideBlocker) {
oPopupWindow.hideLoader();
oPopupWindow.hideWndBlocker();
}
} else {
$('#fbLoader').hide();
}
}
});
}
});
}
else {
if (bInWindow) {
oPopupWindow.hideLoader();
oPopupWindow.hideWndBlocker();
} else {
$('#fbLoader').hide();
}
}
};
$(this).bind('onFBLogin', function(event, oResponse, bSilent)
{
if ($('.fb-account-card').size()) {
oRegistration.refreshFBLoginStatus(oResponse, bSilent);
}
_updateFacebookButton();
});
$(this).bind('onFBLogout', function()
{
var bInWindow = oPopupWindow.isVisible();
if (bInWindow) {
oPopupWindow.showWndBlocker();
oPopupWindow.showLoader();
}
_fbProfile = false;
$('.fb-account').hide();
if (bInWindow) {
$('fieldset.registrationData', _jLoginContainer).show();
oPopupWindow.hideLoader();
oPopupWindow.hideWndBlocker();
}
$('input[name$="\[facebook_id\]"]').val('');
_updateFacebookButton();
});
};
function WordAlternation(iNumber, sWord1, sWord2, sWord3, sLang)
{
var iMod10 = iNumber % 10,
iMod100 = iNumber % 100;
if (sLang == 'pl' || sLang == 'Pl' || sLang == 'PL') {
if (iNumber == 1) {
// 1 kontakt
return sWord1;
} else if (iNumber > 100 && iMod100 >= 12 && iMod100 <= 14) {
// 112,113,114... kontaktów
return sWord3;
} else if (iMod10 >= 2 && iMod10 <= 4 && (iNumber < 10 || iNumber > 20)) {
// 2,3,4 kontakty, 22,23,24 kontakty itd
return sWord2;
} else {
// 5,6,7,8,9,10... kontaktów
return sWord3;
}
} else {
if (iMod10 >= 2 && iMod10 <= 4) {
// 2, 3, 4 контакти
return sWord2;
} else if (iMod10 == 1) {
// 1 контакт
return sWord1;
} else {
// 5, 6, 7 контактів
return sWord3;
}
}
};
function ClosePredefinedBox(type)
{
$("#lastInfoPredefinedBox").hide();
$.ajax({ url: "/profile_extension/close_box/"+type});
};/*
* AdvancedAJAX 1.1.2
* (c) 2005-2006 Lukasz Lach
*  mail: anakin@php5.pl
*  www:  http://advajax.anakin.us/
*        http://anakin.us/
* http://creativecommons.org/licenses/LGPL/2.1/
*
*/
function advAJAX() {
var obj = new Object();
obj.url = window.location.href;
obj.method = "GET";
obj.parameters = new Object();
obj.jsonParameters = new Object();
obj.headers = new Object();
obj.async = true;
obj.mimeType = "text/xml";
obj.username = null;
obj.password = null;
obj.form = null;
obj.disableForm = true;
obj.unique = true;
obj.uniqueParameter = "_uniqid";
obj.requestDone = false;
obj.queryString = "";
obj.responseText = null;
obj.responseXML = null;
obj.status = null;
obj.statusText = null;
obj.aborted = false;
obj.timeout = 0;
obj.retryCount = 0;
obj.retryDelay = 1000;
obj.tag = null;
obj.group = null;
obj.progressTimerInterval = 50;
obj.xmlHttpRequest = null;
obj.onInitialization = null;
obj.onFinalization = null;
obj.onReadyStateChange = null;
obj.onLoading = null;
obj.onLoaded = null;
obj.onInteractive = null;
obj.onComplete = null;
obj.onProgress = null;
obj.onSuccess = null;
obj.onFatalError = null;
obj.onError = null;
obj.onTimeout = null;
obj.onRetryDelay = null;
obj.onRetry = null;
obj.onGroupEnter = null;
obj.onGroupLeave = null;
obj.createXmlHttpRequest = function() {
if (typeof XMLHttpRequest != "undefined")
return new XMLHttpRequest();
var xhrVersion = [ "MSXML2.XMLHttp.5.0", "MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0",
"MSXML2.XMLHttp","Microsoft.XMLHttp" ];
for (var i = 0; i < xhrVersion.length; i++) {
try {
var xhrObj = new ActiveXObject(xhrVersion[i]);
return xhrObj;
} catch (e) { }
}
obj.raiseEvent("FatalError");
return null;
};
obj._oldResponseLength = null;
obj._progressTimer = null;
obj._progressStarted = navigator.userAgent.indexOf('Opera') == -1;
obj._onProgress = function() {
if (typeof obj.onProgress == "function" &&
typeof obj.xmlHttpRequest.getResponseHeader == "function") {
var contentLength = obj.xmlHttpRequest.getResponseHeader("Content-length");
if (contentLength != null && contentLength != '') {
var responseLength = obj.xmlHttpRequest.responseText.length;
if (responseLength != obj._oldResponseLength) {
obj.raiseEvent("Progress", obj, responseLength, contentLength);
obj._oldResponseLength = obj.xmlHttpRequest.responseText.length;
}
}
}
if (obj._progressStarted) return;
obj._progressStarted = true;
var _obj = this;
this.__onProgress = function() {
obj._onProgress();
obj._progressTimer = window.setTimeout(_obj.__onProgress, obj.progressTimerInterval);
}
_obj.__onProgress();
}
obj._onInitializationHandled = false;
obj._initObject = function() {
if (obj.xmlHttpRequest != null) {
delete obj.xmlHttpRequest["onreadystatechange"];
obj.xmlHttpRequest = null;
}
if ((obj.xmlHttpRequest = obj.createXmlHttpRequest()) == null)
return null;
if (typeof obj.xmlHttpRequest.overrideMimeType != "undefined")
obj.xmlHttpRequest.overrideMimeType(obj.mimeType);
obj.xmlHttpRequest.onreadystatechange = ((!obj.async) ? function(){} : function() {
if (obj == null || obj.xmlHttpRequest == null)
return;
obj.raiseEvent("ReadyStateChange", obj, obj.xmlHttpRequest.readyState);
obj._onProgress();
switch (obj.xmlHttpRequest.readyState) {
case 1: obj._onLoading(); break;
case 2: obj._onLoaded(); break;
case 3: obj._onInteractive(); break;
case 4: obj._onComplete(); break;
}
});
obj._onLoadingHandled =
obj._onLoadedHandled =
obj._onInteractiveHandled =
obj._onCompleteHandled = false;
};
obj._onLoading = function() {
if (obj._onLoadingHandled)
return;
if (!obj._retry && obj.group != null) {
if (typeof advAJAX._groupData[obj.group] == "undefined")
advAJAX._groupData[obj.group] = 0;
advAJAX._groupData[obj.group]++;
if (typeof obj.onGroupEnter == "function" && advAJAX._groupData[obj.group] == 1)
obj.onGroupEnter(obj);
}
obj.raiseEvent("Loading", obj);
obj._onLoadingHandled = true;
};
obj._onLoaded = function() {
if (obj._onLoadedHandled)
return;
obj.raiseEvent("Loaded", obj);
obj._onLoadedHandled = true;
};
obj._onInteractive = function() {
if (obj._onInteractiveHandled)
return;
obj.raiseEvent("Interactive", obj);
obj._onInteractiveHandled = true;
if (!obj._progressStarted)
obj._onProgress();
};
obj._onComplete = function() {
if (obj._onCompleteHandled || obj.aborted)
return;
if (obj._progressStarted) {
window.clearInterval(obj._progressTimer);
obj._progressStarted = false;
}
obj.requestDone = true;
with (obj.xmlHttpRequest) {
obj.responseText = responseText;
obj.responseXML = responseXML;
if (typeof status != "undefined")
obj.status = status;
if (typeof statusText != "undefined")
obj.statusText = statusText;
}
obj.raiseEvent("Complete", obj);
obj._onCompleteHandled = true;
if (obj.status == 200)
obj.raiseEvent("Success", obj); else
obj.raiseEvent("Error", obj);
delete obj.xmlHttpRequest['onreadystatechange'];
obj.xmlHttpRequest = null;
if (obj.disableForm)
obj.switchForm(true);
obj._groupLeave();
obj.raiseEvent("Finalization", obj);
};
obj._groupLeave = function() {
if (obj.group != null) {
advAJAX._groupData[obj.group]--;
if (advAJAX._groupData[obj.group] == 0)
obj.raiseEvent("GroupLeave", obj);
}
};
obj._retry = false;
obj._retryNo = 0;
obj._onTimeout = function() {
if (obj == null || obj.xmlHttpRequest == null || obj._onCompleteHandled)
return;
obj.aborted = true;
obj.xmlHttpRequest.abort();
obj.raiseEvent("Timeout", obj);
obj._retry = true;
if (obj._retryNo != obj.retryCount) {
obj._initObject();
if (obj.retryDelay > 0) {
obj.raiseEvent("RetryDelay", obj);
startTime = new Date().getTime();
while (new Date().getTime() - startTime < obj.retryDelay);
}
obj._retryNo++;
obj.raiseEvent("Retry", obj, obj._retryNo);
obj.run();
} else {
delete obj.xmlHttpRequest["onreadystatechange"];
obj.xmlHttpRequest = null;
if (obj.disableForm)
obj.switchForm(true);
obj._groupLeave();
obj.raiseEvent("Finalization", obj);
}
};
obj.run = function() {
obj._initObject();
if (obj.xmlHttpRequest == null)
return false;
obj.aborted = false;
if (!obj._onInitializationHandled) {
obj.raiseEvent("Initialization", obj);
obj._onInitializationHandled = true;
}
if (obj.method == "GET" && obj.unique)
obj.parameters[encodeURIComponent(obj.uniqueParameter)] =
new Date().getTime().toString().substr(5) + Math.floor(Math.random() * 100).toString();
if (!obj._retry) {
for (var a in obj.parameters) {
if (obj.queryString.length > 0)
obj.queryString += "&";
if (typeof obj.parameters[a] != "object")
obj.queryString += encodeURIComponent(a) + "=" + encodeURIComponent(obj.parameters[a]); else {
for (var i = 0; i < obj.parameters[a].length; i++)
obj.queryString += encodeURIComponent(a) + "=" + encodeURIComponent(obj.parameters[a][i]) + "&";
obj.queryString = obj.queryString.slice(0, -1);
}
}
for (var a in obj.jsonParameters) {
var useJson = typeof [].toJSONString == 'function';
if (obj.queryString.length > 0)
obj.queryString += "&";
obj.queryString += encodeURIComponent(a) + "=";
if (useJson)
obj.queryString += encodeURIComponent(obj.jsonParameters[a].toJSONString()); else
obj.queryString += encodeURIComponent(obj.jsonParameters[a]);
}
if (obj.method == "GET" && obj.queryString.length > 0)
obj.url += (obj.url.indexOf("?") != -1 ? "&" : "?") + obj.queryString;
}
if (obj.disableForm)
obj.switchForm(false);
try {
obj.xmlHttpRequest.open(obj.method, obj.url, obj.async, obj.username || '', obj.password || '');
} catch (e) {
obj.raiseEvent("FatalError", obj, e);
return;
}
if (obj.timeout > 0)
setTimeout(obj._onTimeout, obj.timeout);
if (typeof obj.xmlHttpRequest.setRequestHeader != "undefined")
for (var a in obj.headers)
obj.xmlHttpRequest.setRequestHeader(encodeURIComponent(a), encodeURIComponent(obj.headers[a]));
if (obj.method == "POST" && typeof obj.xmlHttpRequest.setRequestHeader != "undefined") {
obj.xmlHttpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
obj.xmlHttpRequest.send(obj.queryString);
} else if (obj.method == "GET")
obj.xmlHttpRequest.send('');
return obj.xmlHttpRequest;
};
obj.handleArguments = function(args) {
if (typeof args.form == "object" && args.form != null) {
obj.form = args.form;
obj.appendForm();
}
for (a in args) {
if (typeof obj[a] == "undefined")
obj.parameters[a] = args[a]; else {
if (a != "parameters" && a != "headers")
obj[a] = args[a]; else
for (b in args[a])
obj[a][b] = args[a][b];
}
}
obj.method = obj.method.toUpperCase();
};
obj.switchForm = function(enable) {
if (typeof obj.form != "object" || obj.form == null)
return;
with (obj.form)
for (var nr = 0; nr < elements.length; nr++)
if (!enable) {
if (elements[nr]["disabled"])
elements[nr]["_disabled"] = true; else
elements[nr]["disabled"] = "disabled";
} else
if (typeof elements[nr]["_disabled"] == "undefined")
elements[nr].removeAttribute("disabled");
};
obj.appendForm = function() {
with (obj.form) {
obj.method = getAttribute("method").toUpperCase();
obj.url = getAttribute("action");
for (var nr = 0; nr < elements.length; nr++) {
var e = elements[nr];
if (e.disabled)
continue;
switch (e.type) {
case "text":
case "password":
case "hidden":
case "textarea":
obj.addParameter(e.name, e.value);
break;
case "select-one":
if (e.selectedIndex >= 0)
obj.addParameter(e.name, e.options[e.selectedIndex].value);
break;
case "select-multiple":
for (var nr2 = 0; nr2 < e.options.length; nr2++)
if (e.options[nr2].selected)
obj.addParameter(e.name, e.options[nr2].value);
break;
case "checkbox":
case "radio":
if (e.checked)
obj.addParameter(e.name, e.value);
break;
}
}
}
};
obj.addParameter = function(name, value) {
if (typeof obj.parameters[name] == "undefined")
obj.parameters[name] = value; else
if (typeof obj.parameters[name] != "object")
obj.parameters[name] = [ obj.parameters[name], value ]; else
obj.parameters[name][obj.parameters[name].length] = value;
};
obj.delParameter = function(name) {
delete obj.parameters[name];
};
obj.raiseEvent = function(name) {
var args = [];
for (var i = 1; i < arguments.length; i++)
args.push(arguments[i]);
if (typeof obj["on" + name] == "function")
obj["on" + name].apply(null, args);
if (name == "FatalError")
obj.raiseEvent("Finalization", obj);
}
if (typeof advAJAX._defaultParameters != "undefined")
obj.handleArguments(advAJAX._defaultParameters);
return obj;
}
advAJAX.get = function(args) {
return advAJAX.handleRequest("GET", args);
};
advAJAX.post = function(args) {
return advAJAX.handleRequest("POST", args);
};
advAJAX.head = function(args) {
return advAJAX.handleRequest("HEAD", args);
};
advAJAX.submit = function(form, args) {
if (typeof args == "undefined" || args == null)
return -1;
if (typeof form != "object" || form == null)
return -2;
var request = new advAJAX();
args["form"] = form;
request.handleArguments(args);
return request.run();
};
advAJAX.assign = function(form, args) {
if (typeof args == "undefined" || args == null)
return -1;
if (typeof form != "object" || form == null)
return -2;
if (typeof form["onsubmit"] == "function")
form["_onsubmit"] = form["onsubmit"];
form["advajax_args"] = args;
form["onsubmit"] = function() {
if (typeof this["_onsubmit"] != "undefined" && this["_onsubmit"]() === false)
return false;
if (advAJAX.submit(this, this["advajax_args"]) == false)
return true;
return false;
}
return true;
};
advAJAX.download = function(targetObj, url) {
if (typeof targetObj == "string")
targetObj = document.getElementById(targetObj);
if (!targetObj)
return -1;
advAJAX.get({
url: url,
onSuccess : function(obj) {
targetObj.innerHTML = obj.responseText;
}
});
};
advAJAX.scan = function() {
var obj = document.getElementsByTagName("a");
for (var i = 0; i < obj.length;) {
if (obj[i].getAttribute("rel") == "advancedajax" && obj[i].getAttribute("href") !== null) {
var url = obj[i].getAttribute("href");
var div = document.createElement("div");
div.innerHTML = obj[i].innerHTML;
div.className = obj[i].className;
var parent = obj[i].parentNode;
parent.insertBefore(div, obj[i]);
parent.removeChild(obj[i]);
advAJAX.download(div, url);
} else i++;
}
};
advAJAX.handleRequest = function(requestType, args) {
if (typeof args == "undefined" || args == null)
return -1;
var request = new advAJAX();
window.advajax_obj = request;
request.method = requestType;
request.handleArguments(args);
return request.run();
};
advAJAX._defaultParameters = new Object();
advAJAX.setDefaultParameters = function(args) {
advAJAX._defaultParameters = new Object();
for (a in args)
advAJAX._defaultParameters[a] = args[a];
};
advAJAX._groupData = new Object();var oVacancyEditor = new Object();
oVacancyEditor.Init = function() {
this.XMLHTTP = createXmlHttpRequestObject();
this.ProfeoLoader = '<img src="/_p/img/profeo-loader.gif" alt="Ładowanie..." />';
}
/* VACANCY */
// NAZWA FIRMY
oVacancyEditor.vacancyEditCompanyName = function() {
this.id = 'companyname';
var oR = createXmlHttpRequestObject();
var state = oR.readyState;
var bReady = (state == 0) || (state == 4);
if (bReady) {
var thisObject = this;
oR.open('GET', '/vacancy/e_company_name/', true);
oR.onreadystatechange = function() {
thisObject.vacancyEditCompanyName2(oR);
}
oR.send(null);
}
}
oVacancyEditor.vacancyEditCompanyName2 = function(oR) {
if (oR.readyState == 4) {
if (oR.status == 200) {
var div_id = 'companyname';
document.getElementById(div_id).innerHTML = oR.responseText;
}
}
}
oVacancyEditor.vacancySaveCompanyName = function() {
this.id = 'companyname';
var oR = createXmlHttpRequestObject();
var state = oR.readyState;
var bReady = (state == 0) || (state == 4);
if (bReady) {
var params = $('#company-name').serialize();
var thisObject = this;
oR.open('POST', '/vacancy/e_company_name/', true);
oR.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
oR.onreadystatechange = function() {
thisObject.vacancySaveCompanyName2(oR);
}
oR.send(params);
}
}
oVacancyEditor.vacancySaveCompanyName2 = function(oR) {
if (oR.readyState == 4) {
if (oR.status == 200) {
var div_id = 'companyname';
document.getElementById(div_id).innerHTML = oR.responseText;
}
} else {
var div_id = 'companyname';
document.getElementById(div_id).innerHTML = this.ProfeoLoader;
}
}
// ADRES FIRMY
oVacancyEditor.vacancyEditCompanyAdr = function() {
this.id = "companyadr";
var oR = createXmlHttpRequestObject();
var state = oR.readyState;
var bReady = (state == 0) || (state == 4);
if (bReady) {
var thisObject = this;
oR.open('GET', '/vacancy/e_company_adr/', true);
oR.onreadystatechange = function() {
thisObject.vacancyEditCompanyAdr2(oR);
}
oR.send(null);
}
}
oVacancyEditor.vacancyEditCompanyAdr2 = function(oR) {
if (oR.readyState == 4) {
if (oR.status == 200) {
var div_id = 'companyadr';
document.getElementById(div_id).innerHTML = oR.responseText;
}
}
}
oVacancyEditor.vacancySaveCompanyAdr = function(id) {
this.id = "companyadr";
var oR = createXmlHttpRequestObject();
var state = oR.readyState;
var bReady = (state == 0) || (state == 4);
if (bReady) {
var params = $('#company-adr').serialize();
var thisObject = this;
oR.open('POST', '/vacancy/e_company_adr/', true);
oR.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
oR.onreadystatechange = function() {
thisObject.vacancySaveCompanyAdr2(oR);
}
oR.send(params);
}
}
oVacancyEditor.vacancySaveCompanyAdr2 = function(oR) {
if (oR.readyState == 4) {
if (oR.status == 200) {
var div_id = 'companyadr';
document.getElementById(div_id).innerHTML = oR.responseText;
}
} else {
var div_id = 'companyadr';
document.getElementById(div_id).innerHTML = this.ProfeoLoader;
}
}
// NIP
oVacancyEditor.vacancyEditCompanyNip = function() {
this.id = "companynip";
var oR = createXmlHttpRequestObject();
var state = oR.readyState;
var bReady = (state == 0) || (state == 4);
if (bReady) {
var thisObject = this;
oR.open('GET', '/vacancy/e_company_nip/', true);
oR.onreadystatechange = function() {
thisObject.vacancyEditCompanyNip2(oR);
}
oR.send(null);
}
}
oVacancyEditor.vacancyEditCompanyNip2 = function(oR) {
if (oR.readyState == 4) {
if (oR.status == 200) {
var div_id = 'companynip';
document.getElementById(div_id).innerHTML = oR.responseText;
}
}
}
oVacancyEditor.vacancySaveCompanyNip = function() {
this.id = "companynip";
var oR = createXmlHttpRequestObject();
var state = oR.readyState;
var bReady = (state == 0) || (state == 4);
if (bReady) {
var params = $('#company-nip').serialize();
var thisObject = this;
oR.open('POST', '/vacancy/e_company_nip/', true);
oR.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
oR.onreadystatechange = function() {
thisObject.vacancySaveCompanyNip2(oR);
}
oR.send(params);
}
}
oVacancyEditor.vacancySaveCompanyNip2 = function(oR) {
if (oR.readyState == 4) {
if (oR.status == 200) {
var div_id = 'companynip';
document.getElementById(div_id).innerHTML = oR.responseText;
}
} else {
var div_id = 'companynip';
document.getElementById(div_id).innerHTML = this.ProfeoLoader;
}
}
// opis firmy
oVacancyEditor.vacancyEditCompanyDescription = function() {
this.id = 'companydescription';
var oR = createXmlHttpRequestObject();
var state = oR.readyState;
var bReady = (state == 0) || (state == 4);
if (bReady) {
var thisObject = this;
oR.open('GET', '/vacancy/e_company_description/', true);
oR.onreadystatechange = function() {
thisObject.vacancyEditCompanyDescription2(oR);
}
oR.send(null);
}
}
oVacancyEditor.vacancyEditCompanyDescription2 = function(oR) {
if (oR.readyState == 4) {
if (oR.status == 200) {
var div_id = 'companydescription';
document.getElementById(div_id).innerHTML = oR.responseText;
}
}
}
oVacancyEditor.vacancySaveCompanyDescription = function() {
this.id = 'companydescription';
var oR = createXmlHttpRequestObject();
var state = oR.readyState;
var bReady = (state == 0) || (state == 4);
if (bReady) {
var params = $('#company-desc').serialize();
var thisObject = this;
oR.open('POST', '/vacancy/e_company_description/', true);
oR.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
oR.onreadystatechange = function() {
thisObject.vacancySaveCompanyDescription2(oR);
}
oR.send(params);
}
}
oVacancyEditor.vacancySaveCompanyDescription2 = function(oR) {
if (oR.readyState == 4) {
if (oR.status == 200) {
var div_id = 'companydescription';
document.getElementById(div_id).innerHTML = oR.responseText;
}
} else {
var div_id = 'companydescription';
document.getElementById(div_id).innerHTML = this.ProfeoLoader;
}
}
// EDYCJA KLIENTA
oVacancyEditor.vacancyClientForm = function(id) {
this.id = id;
var oR = createXmlHttpRequestObject();
var state = oR.readyState;
var bReady = (state == 0) || (state == 4);
if (bReady) {
var thisObject = this;
oR.open('GET', '/vacancy/ajax_client', true);
oR.onreadystatechange = function() {
thisObject.r_vacancyClientForm(oR);
}
oR.send(null);
}
}
oVacancyEditor.r_vacancyClientForm = function(oR) {
if (oR.readyState == 4) {
if (oR.status == 200) {
var div_id = 'client_form';
document.getElementById(div_id).innerHTML = oR.responseText;
}
}
}
oVacancyEditor.vacancyClient = function(id) {
this.id = id;
var oR = createXmlHttpRequestObject();
var state = oR.readyState;
var bReady = (state == 0) || (state == 4);
if (bReady) {
var params = $('#ovc_client').serialize();
var thisObject = this;
oR.open('POST', '/vacancy/ajax_client/', true);
oR.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
oR.onreadystatechange = function() {
thisObject.vacancyClient2(oR);
}
oR.send(params);
}
}
oVacancyEditor.vacancyClient2 = function(oR) {
if (oR.readyState == 4) {
if (oR.status == 200) {
var div_id = 'client_form';
document.getElementById(div_id).innerHTML = oR.responseText;
}
} else {
var div_id = 'client_form';
document.getElementById(div_id).innerHTML = this.ProfeoLoader;
}
}
/* END VACANCY */
oVacancyEditor.Init();
function makeFile(obj) {
if(document.getElementById('logofileform').value != null) {
var obj2 = document.getElementById('logofile');
if(obj2.checked == false) {
obj2.checked = true;
}
}
}var oPUP = new function()
{
var _aPUPData = false;
var _ajax = function(oOptions, fCallback)
{
oOptions.dataType = oOptions.dataType || 'json';
oOptions.type = oOptions.type || 'GET';
oOptions.beforeSend = _onBeforeSend;
oOptions.error = _onError;
oOptions.dataFilter = _onDataFilter;
oOptions.success = function(oData) {
if (typeof fCallback == 'function') {
fCallback(oData);
}
$('.ui-tabsdiv').tabs();
$("textarea[maxlength]").each(function() { $(this).maxLength(this.getAttribute('maxlength')); });
$('a.thickbox').lightBox(oLightboxDefaultOptions);
oPopupWindow.hideLoader();
}
$.ajax(oOptions);
};
var _ajaxForm = function(oForm, oOptions, fCallback)
{
if (typeof oOptions == 'function') {
fCallback = oOptions;
oOptions = {};
}
oOptions.url = $(oForm).attr('action');
oOptions.data = $(oForm).serialize();
oOptions.type = $(oForm).attr('method');
_ajax(oOptions, fCallback);
};
var _onDataFilter = function(sData)
{
if (sData === '') { sData = '{}'; }
return sData;
};
var _onBeforeSend = function()
{
oPopupWindow.showLoader(true);
};
var _onError = function(x,y,z)
{
oPopupWindow.hideLoader();
};
var _ajaxWithFiles = function(oForm, fCallback)
{
_onBeforeSend();
oIFrameAjax.sendForm(oForm, $(oForm).attr('action'), $(oForm).attr('method'), function(sResponse){
try {
sResponse = eval('sResponse = ' + sResponse);
if (typeof fCallback == 'function') {
fCallback(sResponse);
}
$('.ui-tabsdiv').tabs();
$("textarea[maxlength]").each(function() { $(this).maxLength(this.getAttribute('maxlength')); });
$('a.thickbox').lightBox(oLightboxDefaultOptions);
}
finally {
oPopupWindow.hideLoader();
}
});
};
this.initialize = function(aPUPData)
{
if (oPopupWindow.isVisible() || !aPUPData.notification) {
return;
}
_aPUPData = aPUPData;
var sData = [];
for (var i in _aPUPData.params) {
sData.push(encodeURIComponent(i) + '=' + encodeURIComponent(_aPUPData.params[i]));
}
sData = sData.join('&');
_ajax({
url: '/profile_update_prompter/ajax_notification/' + aPUPData.section + '/' + aPUPData.notification,
type: 'POST',
data: sData
},
function(oData) {
var jWnd = $(oPopupWindow.getWindowNode());
oPopupWindow.showWindow(oData.popupWindowWidth ? oData.popupWindowWidth : '600px', oData.content, true);
jWnd.css({ left: -jWnd.outerWidth()-5 }).stop().animate({ left: 0 }, 1000, 'bounceEaseOut');
}
);
};
this.hide = function()
{
var jWnd = $(oPopupWindow.getWindowNode());
jWnd.stop().animate({ left: -jWnd.outerWidth()-5 }, 700, 'quadEaseInOut', function(){ oPopupWindow.hideWindow(); });
oPopupWindow.hideLoader();
};
this.disableNotification = function(bGlobal)
{
bGlobal = bGlobal ? '1' : '';
_ajax({ url: '/profile_update_prompter/ajax_disable_notification/' + _aPUPData.section + '/' + _aPUPData.notification + '/' + bGlobal, beforeSend: false });
this.hide();
};
this.saveForm = function(sFormId)
{
_ajaxForm(sFormId, function(oData) {
if (oData.content) {
oPopupWindow.setWindowContent(oData.content);
} else {
oPUP.hide();
}
});
};
this.saveFormWithFiles = function(sFormId)
{
_ajaxWithFiles($(sFormId).get(0), function(oData) {
if (oData.content) {
oPopupWindow.setWindowContent(oData.content);
} else {
oPUP.hide();
}
});
};
this.sendInvitations = function()
{
var oReceivers = ById('receivers');
if (!oReceivers.options.length) {
alert($("#no_receivers").html());
return;
}
oInvitations._iCurrentType = 2;
oInvitations._generateDynamicFields();
_ajaxForm('#invite_form', function(oData) {
if (oData.content) {
oPopupWindow.setWindowContent(oData.content);
oInvitations._afterFormLoaded();
} else {
oPUP.hide();
}
}
);
oInvitations._clearDynamicFields();
};
};var oResource = new function()
{
var
_that = this,
_iRequestCount = 0,
_oResponse = false,
_jBlocker,
_jBlockerLoader,
_aThreads = [];
var _prepareAjaxOptions = function(oOptions)
{
oOptions.async = typeof oOptions.async == 'undefined' ? true : oOptions.async;
oOptions.beforeSend = _onRequestBegin;
oOptions.complete = _onRequestEnd;
oOptions.success = _onRequestSuccess;
oOptions.error = oOptions.timeout = _onRequestError;
oOptions.dataType = typeof oOptions.dataType == 'undefined' ? 'json' : oOptions.dataType;
oOptions.type = typeof oOptions.type == 'undefined' ? 'GET' : oOptions.type;
return oOptions;
};
var _onRequestBegin = function(oXHR)
{
_oResponse = false;
if (_iRequestCount == 0 ) {
if (oPopupWindow.isVisible()) {
//oPopupWindow.showWndBlocker();
} else {
//oPopupWindow.showLoader();
}
//_jContent.slideUp();
}
_iRequestCount++;
};
var _onRequestEnd = function()
{
_iRequestCount--;
if (_iRequestCount == 0) {
//oPopupWindow.hideWndBlocker();
//if (oPopupWindow.isVisible()) {
//oPopupWindow.hideLoader();
//}
//_jContent.slideDown();
} else {
_jBlocker.height(_jBlocker.parent().outerHeight() + 'px');
}
};
var _onRequestSuccess = function(oData)
{
_oResponse = oData;
};
var _onRequestError = function()
{
};
var _sliceArguments = function(aArguments, iStart, iLength)
{
iLength = ((!iLength || iLength > aArguments.length) ? aArguments.length - iStart : iLength) + iStart;
aResult = [];
for (var i = iStart; i < iLength; i++) {
aResult.push(aArguments[i]);
}
return aResult;
};
var _ajax = function(oOptions, fCallback, aArguments)
{
if (_iRequestCount) return;
oOptions = _prepareAjaxOptions(oOptions);
oOptions.complete = function(oData) {
if (typeof fCallback == 'function') {
fCallback(oData, aArguments);
}
$('.ui-tabsdiv').tabs();
$("textarea[maxlength]").each(function() { $(this).maxLength(this.getAttribute('maxlength')); });
$('a.thickbox').lightBox(oLightboxDefaultOptions);
_onRequestEnd();
}
$.ajax(oOptions);
};
var _ajaxForm = function(oForm, fCallback)
{
var aArguments = _sliceArguments(arguments, 2);
_ajax({
url : $(oForm).attr('action'),
data : $(oForm).serialize(),
type : $(oForm).attr('method')
},
fCallback, aArguments);
};
var _ajaxFormWithFiles = function(oForm, fCallback, jTarget)
{
var aArguments = _sliceArguments(arguments, 2);
_onRequestBegin();
oIFrameAjax.sendForm(oForm, $(oForm).attr('action'), $(oForm).attr('method'), function(sResponse){
try {
_oResponse = $.secureEvalJSON(sResponse);
}
finally {
try {
if (typeof fCallback == 'function') {
fCallback();
}
_setContent(jTarget);
$('.ui-tabsdiv').tabs();
$("textarea[maxlength]").each(function() { $(this).maxLength(this.getAttribute('maxlength')); });
$('a.thickbox').lightBox(oLightboxDefaultOptions);
}
finally {
_onRequestEnd();
}
}
}, aArguments);
};
var _setContent = function(jTarget)
{
if (_oResponse) {
if (jTarget) {
$(jTarget).html(_oResponse.content);
} else {
oPopupWindow.setWindowContent(_oResponse.content);
}
}
};
var _loadContent = function(oOptions, fCallback, jTarget)
{
var aArguments = _sliceArguments(arguments, 2);
_ajax(oOptions, function(oResponse, aArguments) {
_setContent(jTarget);
if (typeof fCallback == 'function') {
fCallback();
}
}, aArguments);
};
this.loadPage = function(sURL, jTarget)
{
_loadContent({ url : sURL }, function() {
oPopupWindow.showWindow('400px', null);
}, jTarget);
};
var _showInlineLoader = function(jTarget)
{
$(jTarget).html('<div id="_resourceInlineLoader" class="centerTxt clear" style="padding: 20px;"><img src="/_p/images/loader.gif" /></div>');
};
var _hideInlineLoader = function()
{
$('#_resourceInlineLoader').remove();
};
/** Images */
var _oBBCToolbar = false;
this.hideUserImages = function()
{
$(_oBBCToolbar._userImageWindow).hide('fast');
};
this.assignObjects = function(oElem)
{
_oBBCToolbar = $(oElem).parents('.bbCodeToolbar').get(0)._oBBCT;
_oBBCToolbar._userImageWindow = _oBBCToolbar.oContainer.find('.userImagesWindow');
_oBBCToolbar._userImageList = _oBBCToolbar._userImageWindow.find('.userImageLoadedList');
};
this.showUserImages = function(oElem)
{
_that.assignObjects(oElem);
if (_oBBCToolbar._userImageList.is(':visible')) {
_oBBCToolbar._userImageList.hide('fast');
return;
}
_showInlineLoader(_oBBCToolbar._userImageList);
_oBBCToolbar._userImageList.show('fast');
_loadContent({url: '/resource/ajax_user_images/1'}, function() {
_afterUserImageLoad();
}, _oBBCToolbar._userImageWindow);
};
this.uploadUserImage = function(oFileInput)
{
_that.assignObjects(oFileInput);
var jForm = $('<form class="userImageInvisibleForm" action="/resource/ajax_upload_user_image/'+(_oBBCToolbar._userImageList.is(':visible') ? '1' : '')+'" method="post" enctype="multipart/form-data"></form>').appendTo(document.body);
jForm.append(oFileInput);
_showInlineLoader(_oBBCToolbar._userImageWindow);
_ajaxFormWithFiles(jForm.get(0), function()
{
_afterUserImageLoad();
_hideInlineLoader();
jForm.remove();
if (_oResponse) {
if (_oResponse.filename) {
_that.insertUserImageBBCode(_oResponse.filename);
}
}
}, _oBBCToolbar._userImageWindow);
};
this.deleteUserImage = function(iImageId)
{
if (confirm(GetTranslation("Czy na pewno usunąć to zdjęcie? Zdjęcie zostanie całkowicie usunięte z serwera Profeo!")))
{
var bUserImageListVisible = _oBBCToolbar._userImageList.is(':visible');
_showInlineLoader(_oBBCToolbar._userImageList);
_loadContent({url: '/resource/ajax_delete_user_image/' + iImageId}, function()
{
_afterUserImageLoad();
_hideInlineLoader();
}, _oBBCToolbar._userImageWindow);
}
};
this.insertUserImageBBCode = function(sFileName)
{
if (!_oBBCToolbar) return;
_oBBCToolbar.insertImage(sFileName, true);
};
var _afterUserImageLoad = function()
{
_oBBCToolbar._userImageList = _oBBCToolbar.oContainer.find('userImageLoadedList');
};
/** End of Images */
};;
var DBOX_TYPE_INFO    = 1;
var DBOX_TYPE_WARNING = 2;
var DBOX_TYPE_ERROR   = 3;
var DBOX_TYPE_CONFIRM = 4;
var oDialogBox = new function()
{
this.ALERT_INFO = {
type: DBOX_TYPE_INFO,
buttons: [{ caption: 'Ok', def: true }]
};
this.ALERT_WARNING = {
type: DBOX_TYPE_WARNING,
buttons: [{ caption: 'Ok', def: true }]
};
this.ALERT_ERROR = {
type: DBOX_TYPE_ERROR,
buttons: [{ caption: 'Ok', def: true }]
};
this.CONFIRM = {
type: DBOX_TYPE_CONFIRM,
buttons: [
{ caption: GetTranslation('Nie'), value: 0 },
{ caption: GetTranslation('Tak'), value: 1, def: true }
]
};
var _that = this,
_oConfig =
{
content: null,
contentSource: null,
buttons: [], /*
e.g.:
[
{ caption: "Ok", value: 1, callback: function(){}, addClass: "orangeButton right", def: true },
{ caption: "Cancel", value: 0 }
]
*/
callback: null,
type: DBOX_TYPE_INFO,
template: 'default',
modal: true,
width: '550px'
},
_jWindow,
_jBlocker,
_jTemplate,
_oDialogTypeConfig = {},
_activeButton = false;
// dialog types configuration
_oDialogTypeConfig[DBOX_TYPE_INFO] = {
icon: '/_p/images/dialogInfo.png'
};
_oDialogTypeConfig[DBOX_TYPE_WARNING] = {
icon: '/_p/images/dialogWarning.png'
};
_oDialogTypeConfig[DBOX_TYPE_ERROR] = {
icon: '/_p/images/dialogError.png'
};
_oDialogTypeConfig[DBOX_TYPE_CONFIRM] = {
icon: '/_p/images/dialogQuestion.png'
};
// initialization
$(function()
{
_jWindow = $('<div></div>')
.css({
position: 'absolute',
display: 'none',
'z-index': 99999999
})
.appendTo(document.body);
_jBlocker = $('<div>').appendTo(document.body).addClass('dialogBoxBlocker').css('opacity', 0.6);
$(document).bind('keydown', function(event)
{
if (event.keyCode == 13 && _activeButton)
{
_activeButton.triggerHandler('click');
return false;
}
});
});
this.show = function(/* [config1, config2, ...] */)
{
if (!_jWindow) {
return alert('DialogBox not initialized! Ehh... dont show it until the document is loaded!');
}
_jTemplate = $('<div>').html(DBOX_TEMPLATE);
var oCFG = $.extend({}, _oConfig);
// merge all given configs
for (var iIdx = 0; iIdx < arguments.length; iIdx++)
{
if (typeof arguments[iIdx] == 'string') {
oCFG.content = arguments[iIdx];
} else if (typeof arguments[iIdx] == 'function') {
oCFG.callback = arguments[iIdx];
} else {
oCFG = $.extend({}, oCFG, arguments[iIdx]);
}
}
var sMessage = oCFG.contentSource !== null ? $(oCFG.contentSource).html() : oCFG.content, // get message content
sElementSelector = '.db_' + oCFG.template + '_', // set template elements selector prefix
jButtonTemplate = $(sElementSelector + 'button:first', _jTemplate), // get button template object
jButton, // button template copy (for inserting new buttons)
jButtons, // buttons container
jIcon; // icon container
_jWindow.html($(sElementSelector + 'window:first',  _jTemplate)); // insert window template into dialog container
$('.dbContent', _jWindow).html(sMessage);
jButtons = $('.dbButtons', _jWindow); // find buttons container
jIcon = $('.dbIcon', _jWindow);
if (jIcon.tagName != 'img') {
jIcon.css('background-image', 'url(' + _oDialogTypeConfig[oCFG.type].icon + ')'); // set dialog icon as background
} else {
jIcon.attr('src', _oDialogTypeConfig[oCFG.type].icon); // set dialog icon as image
}
var oButtonConfig, jClicker;
for (var iIndex in oCFG.buttons)
{
oButtonConfig = oCFG.buttons[iIndex]; // shortcut to button config
jButton = jButtonTemplate.clone(true);  // clone button template
jButton.wrap('<div></div>');
jButton
.addClass('dbButton dbButtonIndex' + iIndex + (oButtonConfig.addClass ? ' ' + oButtonConfig.addClass : '')) // set additional class with identification class + custom classes
.data('caption', $('.dbButtonCaption', jButton.parent()).html(oButtonConfig.caption)) // set caption
.data('value', (typeof oButtonConfig.value != 'undefined') ? oButtonConfig.value : iIndex) // set callback value
.data('index', iIndex) // set button index
.data('dialog', _that) // set dialog box reference
.data('callback', oButtonConfig.callback ? oButtonConfig.callback : null); // set button callback
(jClicker = $('.dbButtonClicker', jButton.parent())).bind('click', function() // set callback function
{
var jClickedButton = $(this), xResult = false;
if (typeof jClickedButton.data('callback') == 'function') {
xResult = jClickedButton.data('callback')(jClickedButton);
}
if (typeof oCFG.callback == 'function') {
xResult = oCFG.callback(jClickedButton.data('value'), jClickedButton);
}
if (!xResult) {
jClickedButton.data('dialog').hide(); // if callback returns false|null, then hide the dialog box window
}
return false;
})
.appendTo(jButtons); // append button to buttons container in dialog window;
if (oButtonConfig.def) {
jButton.focus();
_activeButton = $('.dbButtonIndex' + iIndex, jButtons);
}
}
if (oCFG.modal) {
_jBlocker.height(oUtils.getSiteH()).show();
}
_jWindow.width(oCFG.width);
oUtils.centerObject(_jWindow.css('opacity', 0).show().stop().animate({ opacity: 1 }, 300).get(0));
};
this.hide = function()
{
if (!_jWindow) return;
_activeButton = false;
_jWindow.stop().animate({ opacity: 0 }, 150, function(){ _jWindow.hide(); });
_jBlocker.hide();
};
};;function Prompter(oConfig)
{
var _CSS = {
'window_class' : 'prompter-results',
'container_class' : '',
'list_class' : 'prompter-results-list border-bot',
'list_element_class' : 'prompter-results-item',
'list_selected_element_class' : 'prompter-results-item-highlighted',
'nav_class' : 'navigation'
};
var _oConfig = {},
_that = this,
_iPreviousQueryLength = 0,
_oData = false,
_aFilteredData = false,
_bIsBusy = false,
_oResultsWindow = {
'window' : false,
'container' : false,
'list' : false,
'nav' : false
},
_xhrRequest = false;
var _bEnabled = true;
_oConfig.field = ById(oConfig.field);
_oConfig.url = oConfig.url;
_oConfig.searchColumn = oConfig.searchColumn;
_oConfig.displayColumn = oConfig.displayColumn ? oConfig.displayColumn : _oConfig.searchColumn;
_oConfig.displayItemsCount = oConfig.displayItemsCount ? oConfig.displayItemsCount : 10;
_oConfig.minQueryLength = oConfig.minQueryLength ? oConfig.minQueryLength : 2;
_oConfig.searchAnywhere = oConfig.searchAnywhere ? true : false;
_oConfig.json = oConfig.json ? true : false;
_oConfig.onselect = oConfig.onselect;
_oConfig.onbeforefetch = oConfig.onbeforefetch || false;
_oConfig.onafterfetch = oConfig.onafterfetch || false;
_oConfig.onfocus = oConfig.onfocus || false;
_oConfig.onseturl = oConfig.onseturl || false;
_oConfig.onnoresults = oConfig.onnoresults || false;
_oConfig.onrefresh = oConfig.onrefresh || false;
_oConfig.onbeforetemplatefetch = oConfig.onbeforetemplatefetch || false;
_oConfig.onaftertemplatefetch = oConfig.onaftertemplatefetch || false;
_oConfig.ongetvalue = oConfig.ongetvalue || false;
_oConfig.showPaging = oConfig.showPaging || false;
_oConfig.itemTemplate = oConfig.itemTemplate || false;
_oConfig.width = oConfig.width || false;
this._getFieldValue = function(bNoTruncate)
{
if (typeof _oConfig.ongetvalue == 'function')
{
var sValue = _oConfig.ongetvalue(_oConfig.field, bNoTruncate);
if (sValue !== null) {
return sValue;
}
}
if (bNoTruncate) {
return _oConfig.field.value;
}
return _oConfig.field.value.substring(0, _oConfig.minQueryLength);
}
this._onMouseDown = function(oEvent)
{
_that.hide();
}
this._isResultsWindowVisible = function()
{
return (_oResultsWindow.window && _oResultsWindow.window.style.display != 'none') ? true : false;
}
this._onKeyUp = function(oEvent)
{
oEvent = oEvent || window.event;
var iKeyCode = oEvent.keyCode ? oEvent.keyCode : oEvent.which;
switch (iKeyCode)
{
case 38: _that._moveSelectionUp(oEvent); break;
case 40: _that._moveSelectionDown(oEvent); break;
case 39: _that._acceptSelected(); break;
case 13: oEvent.preventDefault(); break;
default: _that._refreshList();
}
}
this._onKeyDown = function(oEvent)
{
oEvent = oEvent || window.event;
var iKeyCode = oEvent.keyCode ? oEvent.keyCode : oEvent.which;
if (iKeyCode == 13) { // enter
_that._acceptSelected();
oEvent.preventDefault();
} else if (iKeyCode == 9) { // tabulator
_that.hide();
}
}
this._abort = function()
{
if (_xhrRequest)
{
_xhrRequest.abort();
_xhrRequest = false;
if (typeof _oConfig.onafterfetch == 'function') {
_oConfig.onafterfetch();
}
}
_bIsBusy = false;
_oData = false;
this.hide();
}
this._refreshList = function()
{
var sFieldValue = _that._getFieldValue(true),
iQueryLength = sFieldValue.length;
if (iQueryLength == _iPreviousQueryLength)
return;
if (_iPreviousQueryLength < _oConfig.minQueryLength && iQueryLength >= _oConfig.minQueryLength)
{
this._abort();
_that._fetchData();
}
else if (_iPreviousQueryLength >= _oConfig.minQueryLength && iQueryLength < _oConfig.minQueryLength)
{
this._abort();
}
else if (iQueryLength < _oConfig.minQueryLength)
{
this._abort();
}
else if (_iPreviousQueryLength != iQueryLength)
{
_that._showResults();
}
_iPreviousQueryLength = iQueryLength;
if (typeof _oConfig.onrefresh == 'function') {
_oConfig.onrefresh(this);
}
}
this._fetchData = function()
{
if (_bIsBusy) return;
var sURL, sFieldValue = _that._getFieldValue();
if (typeof _oConfig.onseturl == 'function') {
sURL = _oConfig.onseturl(this);
}
if (!sURL) {
sURL = _oConfig.url;
}
sURL = sURL + '';
sURL = sprintf(sURL, encodeURIComponent(sFieldValue));
_xhrRequest = $.ajax({
url : sURL,
type: 'get',
beforeSend : function() {
_bIsBusy = true;
if (typeof _oConfig.onbeforefetch == 'function') {
_oConfig.onbeforefetch();
}
},
complete : function(oXHR)
{
_xhrRequest = false;
if (_oConfig.json) {
_oData = window.eval('_oData = ' + oXHR.responseText);
}
else {
_oData = [];
_oData.records = [];
var aResults = oUtils.xpath('/records/record', oXHR.responseXML),
aRecord;
for (i in aResults) {
aRecord = [];
for (j = 0; j < aResults[i].childNodes.length; j++) {
aRecord[aResults[i].childNodes[j].nodeName] = oUtils.getXMLNodeText(aResults[i].childNodes[j]);
}
_oData.records.push(aRecord);
}
delete aResults;
}
if (typeof _oConfig.onafterfetch == 'function') {
_oConfig.onafterfetch();
}
_that._showResults();
_bIsBusy = false;
}
});
}
this._showResults = function(iPageNo)
{
if (!_oData) return;
iPageNo = isNaN(parseInt(iPageNo)) ? 0 : parseInt(iPageNo);
iPageNo = iPageNo < 0 ? 0 : iPageNo;
_oResultsWindow.window = ById("prompter-results-window");
if (!_oResultsWindow.window) {
_oResultsWindow.window = document.createElement('div');
_oResultsWindow.window.id = "prompter-results-window";
document.body.appendChild(_oResultsWindow.window);
}
_oResultsWindow.window.innerHTML = '';
_oResultsWindow.container = document.createElement('div');
_oResultsWindow.window.appendChild(_oResultsWindow.container);
_oResultsWindow.window.className = _CSS.window_class;
_oResultsWindow.container.className = _CSS.container_class;
_oResultsWindow.window.style.display = 'none';
_oResultsWindow.window._elements = _oResultsWindow;
$(_oResultsWindow.window).css('width', _oConfig.width !== false ? _oConfig.width : null);
_oResultsWindow.nav = document.createElement('div');
_oResultsWindow.nav.className = _CSS.nav_class;
_oResultsWindow.nav._oPrompter = _that;
$(_oResultsWindow.nav).prependTo(_oResultsWindow.window);
_aFilteredData = [];
var sFieldValue = _that._getFieldValue(true),
oRegExpQuery = new RegExp((_oConfig.searchAnywhere ? '' : '^') + sFieldValue, 'i'),
aAllMatches = [];
for (var i in _oData.records)
{
if (oRegExpQuery.test(_oData.records[i][_oConfig.searchColumn])) {
aAllMatches.push(_oData.records[i]);
}
}
if (aAllMatches.length == 0) {
_oResultsWindow.window.style.display = 'none';
if (typeof _oConfig.onnoresults == 'function') {
_oConfig.onnoresults(this);
}
return;
}
var iPageCount = Math.floor((aAllMatches.length - 1) / _oConfig.displayItemsCount) + 1,
iCurrentPage = (iPageNo >= iPageCount) ? iPageCount - 1 : (iPageNo < 0 ? 0 : iPageNo);
_aFilteredData = aAllMatches.slice(iCurrentPage * _oConfig.displayItemsCount, iCurrentPage * _oConfig.displayItemsCount + _oConfig.displayItemsCount);
delete aAllMatches;
if (_oConfig.showPaging) {
$(_oResultsWindow.nav).html(
(iCurrentPage+1)+' / '+iPageCount+
'<a class="nav-prev" href="#" onclick="this.parentNode._oPrompter._showResults('+(iCurrentPage-1)+'); return false;" onmousedown="oUtils.bubbleEvent(event, false);">&laquo;</a>'+
'<a class="nav-next" href="#" onclick="this.parentNode._oPrompter._showResults('+(iCurrentPage+1)+'); return false;" onmousedown="oUtils.bubbleEvent(event, false);">&raquo;</a><div class="clear"></div>');
} else {
$(_oResultsWindow.nav).hide();
}
_oResultsWindow.container.innerHTML = '';
_oResultsWindow.list = document.createElement('ul');
_oResultsWindow.list.onmousedown = _oConfig.field.onmousedown;
_oResultsWindow.list.className = _CSS.list_class;
var oElement,
oRegExpDisplayQuery = new RegExp((_oConfig.searchAnywhere ? '' : '^') + '('+ sFieldValue +')', 'i'),
sItemTemplate, sNewTemplate;
for (var iIndex in _aFilteredData)
{
var aItemData = _aFilteredData[iIndex];
_oResultsWindow.list.appendChild(oElement = document.createElement('li'));
oElement._data = aItemData;
oElement._prompter = _that;
oElement.onclick = function() { this._prompter._onElementClick(this) };
oElement.onmouseover = function() { this._prompter._onElementMouseOver(this) };
if (_oConfig.itemTemplate)
{
sItemTemplate = _oConfig.itemTemplate;
sNewTemplate = false;
if (typeof _oConfig.onbeforetemplatefetch == 'function')
{
sNewTemplate = _oConfig.onbeforetemplatefetch(this, oElement, aItemData, sItemTemplate);
if (sNewTemplate) {
sItemTemplate = sNewTemplate;
}
}
if (!sNewTemplate)
{
for (var sKey in aItemData) {
sItemTemplate = sItemTemplate.replace(new RegExp("\\{\\$" + sKey + "\\}", 'g'), aItemData[sKey]);
}
}
if (typeof _oConfig.onaftertemplatefetch == 'function') {
_oConfig.onaftertemplatefetch(this, oElement, aItemData);
}
}
else {
sItemTemplate = aItemData[_oConfig.displayColumn].replace(oRegExpDisplayQuery, '<b>$1</b>');
}
oElement.innerHTML = sItemTemplate;
oElement.className = iIndex ? _CSS.list_element_class : _CSS.list_selected_element_class;
}
_oResultsWindow.container.appendChild(_oResultsWindow.list);
_oResultsWindow.window.style.display = 'block';
oUtils.dockToObject(_oResultsWindow.window, _oConfig.field, 1, 3);
}
this.hide = function()
{
if (_oResultsWindow.window)
_oResultsWindow.window.style.display = 'none';
}
this._getSelectedNode = function()
{
return $('> .'+_CSS.list_selected_element_class+':first', _oResultsWindow.list);
}
this._moveSelectionUp = function(oEvent)
{
if (!_that._isResultsWindowVisible()) return;
var jNode = _that._getSelectedNode();
if (!jNode.length) {
$('> :first', _oResultsWindow.list).addClass(_CSS.list_selected_element_class);
} else if (jNode.prev().length) {
jNode.removeClass(_CSS.list_selected_element_class)
.prev().addClass(_CSS.list_selected_element_class);
}
}
this._moveSelectionDown = function(oEvent)
{
if (!_that._isResultsWindowVisible()) {
_that._showResults();
return;
}
var jNode = _that._getSelectedNode();
if (!jNode.length) {
$('> :first', _oResultsWindow.list).addClass(_CSS.list_selected_element_class);
} else if (jNode.next().length) {
jNode.removeClass(_CSS.list_selected_element_class)
.next().addClass(_CSS.list_selected_element_class);
}
}
this._onElementClick = function(oClickedNode)
{
if (!_that._isResultsWindowVisible()) return;
var jCurrentNode;
if (!oClickedNode)
jCurrentNode = oClickedNode = _that._getSelectedNode();
else jCurrentNode = _that._getSelectedNode();
if (!oClickedNode) return;
jCurrentNode.removeClass(_CSS.list_selected_element_class);
$(oClickedNode).addClass(_CSS.list_selected_element_class);
_that._acceptSelected();
}
this._acceptSelected = function()
{
if (!_that._isResultsWindowVisible()) return;
var jCurrentNode = _that._getSelectedNode();
if (!jCurrentNode.length) return;
if (typeof _oConfig.onselect == 'function') {
if (_oConfig.onselect(jCurrentNode.get(0)._data, _that, _oResultsWindow)) {
_that.hide();
}
}
else _that.hide();
}
this._onElementMouseOver = function(oNode)
{
if (!_that._isResultsWindowVisible()) return;
_that._getSelectedNode().removeClass(_CSS.list_selected_element_class);
$(oNode).addClass(_CSS.list_selected_element_class);
};
this.enabled = function(bEnabled)
{
if (_bEnabled = (bEnabled ? true : false))
{
$(_oConfig.field).bind('keyup', this._onKeyUp);
$(_oConfig.field).bind('keydown', this._onKeyDown);
//_oConfig.field.onblur = this.hide;
_oConfig.field.onmousedown = function(event) { oUtils.bubbleEvent(event, false); };
//_oConfig.field.onkeyup = this._onKeyUp;
//_oConfig.field.onkeydown = this._onKeyDown;
//_oConfig.field.onblur = this.hide;
//_oConfig.field.onmousedown = function(event) { oUtils.bubbleEvent(event, false); };
}
else
{
$(_oConfig.field).unbind('keyup', this._onKeyUp);
$(_oConfig.field).unbind('keydown', this._onKeyDown);
_oConfig.field.onmousedown = function(){};
//_oConfig.field.onkeyup = _oConfig.field.onkeydown = /*_oConfig.field.onblur = */ _oConfig.field.onmousedown = function(){};
}
};
this._onFieldFocus = function(oEvent)
{
if (typeof _oConfig.onfocus == 'function') {
if (_oConfig.onfocus(oEvent, this)) {
return;
}
}
this._oPrompter._showResults();
};
_oConfig.field._oPrompter = this;
this.enabled(true);
_oConfig.field.onfocus = this._onFieldFocus;
$(document).bind('mousedown', this._onMouseDown);
};
var oAlertbox = new Object();
oAlertbox.init = function(profile_id, bWithSound) {
this.iRequestCounter = 0; // licznik żądań
this.iRunFrameworkAfter = 10; // po ilu żądaniach sprawdzić alertboxa poprzez frameworka
this.iCheckingInterval = 30000;
this.iLoadingInterval = 15000;
this.profile_id = profile_id;
this.bWithSound = bWithSound;
this.XMLHTTP1 = createXmlHttpRequestObject();
this.XMLHTTP2 = createXmlHttpRequestObject();
this.AO_Check();
}
oAlertbox.AO_Check = function() {
var oR = this.XMLHTTP1;
if (oR.readyState == 0 || oR.readyState == 4) {
if (this.iRequestCounter == this.iRunFrameworkAfter) {
var path = '/misc/check_alertbox/' + this.profile_id + '?x=' + Math.random() + '';
this.iRequestCounter = 0;
} else {
var path = '/checkalertbox.php?pid=' + this.profile_id + '&x=' + Math.random() + '';
this.iRequestCounter++;
}
oR.open('GET', path, true);
oR.onreadystatechange = function() {
oAlertbox.AH_Check();
}
oR.send(null);
} else {
window.setTimeout('oAlertbox.AO_Check()', 1000);
}
}
oAlertbox.AH_Check = function() {
var oR = this.XMLHTTP1;
if ((oR.readyState == 4) && (oR.status == 200)) {
var profile_id = this.profile_id;
var xml = oR.responseXML;
var responseCode = parseInt(xml.documentElement.firstChild.data);
if (responseCode == 2) {
oAlertbox.Hide();
window.setTimeout('oAlertbox.AO_Check()', oAlertbox.iCheckingInterval);
} else {
this.AO_Load();
}
}
}
oAlertbox.AO_Load = function() {
if (!oConfig.bInitAlertbox) return;
var oR = this.XMLHTTP2;
if (oR.readyState == 0 || oR.readyState == 4) {
this.iRequestCounter = 0;
var path = '/misc/alertbox/,' + Math.random() + '';
oR.open('GET', path, true);
oR.onreadystatechange = function() {
oAlertbox.AH_Load();
}
oR.send(null);
} else {
window.setTimeout('oAlertbox.AO_Load()', 1000);
}
}
oAlertbox.AH_Load = function() {
var oR = this.XMLHTTP2;
if ((oR.readyState == 4) && (oR.status == 200)) {
var oAlert = ById('alertbox');
var xhtml = oR.responseText;
var regexp = /<\!-- alertbox\((\d)\) -->/i;
var matches = regexp.exec(xhtml);
var bCorrectResponse = xhtml && matches;
if (bCorrectResponse) {
if (this.bWithSound) {
ById('alertbox_sound').Play();
}
oAlertbox.Show();
if (xhtml != this.archival_xhtml) {
oAlert.innerHTML = xhtml;
}
this.archival_xhtml = xhtml;
if (parseInt(matches[1]) == 2) {
oAlert.className = 'alert_red';
} else {
oAlert.className = 'alert_orange';
}
} else {
oAlertbox.Hide();
}
if (this.timeout_id) {
window.clearTimeout(this.timeout_id);
}
this.timeout_id = window.setTimeout('oAlertbox.AO_Check()', oAlertbox.iLoadingInterval);
}
}
oAlertbox.Hide = function() {
$('#alertbox').hide();
$('#menu li:first').hide().show(); // Fixes IE bug with main menu
}
oAlertbox.Show = function() {
$('#alertbox').show();
$('#menu li:first').hide().show(); // Fixes IE bug with main menu
}
oAlertbox.Close = function() {
oConfig.bInitAlertbox = false;
oAlertbox.Hide();
}
oAlertbox.SoundSwitch = function() {
$.ajax({ url: '/profile_editor/alertbox_sound_switch/', type: 'get' });
if (oConfig.bAlertboxWithSound) {
ById('alertboxLabelEnable').style.display = 'inline';
ById('alertboxLabelDisable').style.display = 'none';
} else {
ById('alertboxLabelEnable').style.display = 'none';
ById('alertboxLabelDisable').style.display = 'inline';
}
oConfig.bAlertboxWithSound = !oConfig.bAlertboxWithSound;
oAlertbox.bWithSound = oConfig.bAlertboxWithSound;
}
// alertbox initialization
$(document).ready(function() {
if (typeof oConfig != 'undefined' && oConfig.bInitAlertbox) {
oAlertbox.init(oConfig.iProfileId, oConfig.bAlertboxWithSound);
}
});
