(function(){var a=this,d,j=a.jQuery,b=a.$,c=a.jQuery=a.$=function(l,q){return new c.fn.init(l,q)},m=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,o=/^.[^:#\[\.,]*$/;c.fn=c.prototype={init:function(l,q){l=l||document;if(l.nodeType){this[0]=l;this.length=1;this.context=l;return this}if(typeof l==="string"){var v=m.exec(l);if(v&&(v[1]||!q))if(v[1])l=c.clean([v[1]],q);else{if((q=document.getElementById(v[3]))&&q.id!=v[3])return c().find(l);v=c(q||[]);v.context=document;v.selector=l;return v}else return c(q).find(l)}else if(c.isFunction(l))return c(document).ready(l);if(l.selector&&l.context){this.selector=l.selector;this.context=l.context}return this.setArray(c.isArray(l)?l:c.makeArray(l))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(l){return l===d?Array.prototype.slice.call(this):this[l]},pushStack:function(l,q,v){l=c(l);l.prevObject=this;l.context=this.context;if(q==="find")l.selector=this.selector+(this.selector?" ":"")+v;else if(q)l.selector=this.selector+"."+q+"("+v+")";return l},setArray:function(l){this.length=0;Array.prototype.push.apply(this,l);return this},each:function(l,q){return c.each(this,l,q)},index:function(l){return c.inArray(l&&l.jquery?l[0]:l,this)},attr:function(l,q,v){var A=l;if(typeof l==="string")if(q===d)return this[0]&&c[v||"attr"](this[0],l);else{A={};A[l]=q}return this.each(function(E){for(l in A)c.attr(v?this.style:this,l,c.prop(this,A[l],v,E,l))})},css:function(l,q){if((l=="width"||l=="height")&&parseFloat(q)<0)q=d;return this.attr(l,q,"curCSS")},text:function(l){if(typeof l!=="object"&&l!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(l));var q="";c.each(l||this,function(){c.each(this.childNodes,function(){if(this.nodeType!=8)q+=this.nodeType!=1?this.nodeValue:c.fn.text([this])})});return q},wrapAll:function(l){if(this[0]){l=c(l,this[0].ownerDocument).clone();this[0].parentNode&&l.insertBefore(this[0]);l.map(function(){for(var q=this;q.firstChild;)q=q.firstChild;return q}).append(this)}return this},wrapInner:function(l){return this.each(function(){c(this).contents().wrapAll(l)})},wrap:function(l){return this.each(function(){c(this).wrapAll(l)})},append:function(){return this.domManip(arguments,true,function(l){this.nodeType==1&&this.appendChild(l)})},prepend:function(){return this.domManip(arguments,true,function(l){this.nodeType==1&&this.insertBefore(l,this.firstChild)})},before:function(){return this.domManip(arguments,false,function(l){this.parentNode.insertBefore(l,this)})},after:function(){return this.domManip(arguments,false,function(l){this.parentNode.insertBefore(l,this.nextSibling)})},end:function(){return this.prevObject||c([])},push:[].push,sort:[].sort,splice:[].splice,find:function(l){if(this.length===1){var q=this.pushStack([],"find",l);q.length=0;c.find(l,this[0],q);return q}else return this.pushStack(c.unique(c.map(this,function(v){return c.find(l,v)})),"find",l)},clone:function(l){var q=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var E=this.outerHTML;if(!E){E=this.ownerDocument.createElement("div");E.appendChild(this.cloneNode(true));E=E.innerHTML}return c.clean([E.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else return this.cloneNode(true)});if(l===true){var v=this.find("*").andSelf(),A=0;q.find("*").andSelf().each(function(){if(this.nodeName===v[A].nodeName){var E=c.data(v[A],"events");for(var L in E)for(var S in E[L])c.event.add(this,L,E[L][S],E[L][S].data);A++}})}return q},filter:function(l){return this.pushStack(c.isFunction(l)&&c.grep(this,function(q,v){return l.call(q,v)})||c.multiFilter(l,c.grep(this,function(q){return q.nodeType===1})),"filter",l)},closest:function(l){var q=c.expr.match.POS.test(l)?c(l):null,v=0;return this.map(function(){for(var A=this;A&&A.ownerDocument;){if(q?q.index(A)>-1:c(A).is(l)){c.data(A,"closest",v);return A}A=A.parentNode;v++}})},not:function(l){if(typeof l==="string")if(o.test(l))return this.pushStack(c.multiFilter(l,this,true),"not",l);else l=c.multiFilter(l,this);var q=l.length&&l[l.length-1]!==d&&!l.nodeType;return this.filter(function(){return q?c.inArray(this,l)<0:this!=l})},add:function(l){return this.pushStack(c.unique(c.merge(this.get(),typeof l==="string"?c(l):c.makeArray(l))))},is:function(l){return!!l&&c.multiFilter(l,this).length>0},hasClass:function(l){return!!l&&this.is("."+l)},val:function(l){if(l===d){var q=this[0];if(q){if(c.nodeName(q,"option"))return(q.attributes.value||{}).specified?q.value:q.text;if(c.nodeName(q,"select")){var v=q.selectedIndex,A=[],E=q.options;q=q.type=="select-one";if(v<0)return null;var L=q?v:0;for(v=q?v+1:E.length;L<v;L++){var S=E[L];if(S.selected){l=c(S).val();if(q)return l;A.push(l)}}return A}return(q.value||"").replace(/\r/g,"")}}else{if(typeof l==="number")l+="";return this.each(function(){if(this.nodeType==1)if(c.isArray(l)&&/radio|checkbox/.test(this.type))this.checked=c.inArray(this.value,l)>=0||c.inArray(this.name,l)>=0;else if(c.nodeName(this,"select")){var P=c.makeArray(l);c("option",this).each(function(){this.selected=c.inArray(this.value,P)>=0||c.inArray(this.text,P)>=0});if(!P.length)this.selectedIndex=-1}else this.value=l})}},html:function(l){return l===d?this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null:this.empty().append(l)},replaceWith:function(l){return this.after(l).remove()},eq:function(l){return this.slice(l,+l+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(l){return this.pushStack(c.map(this,function(q,v){return l.call(q,v,q)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(l,q,v){if(this[0]){var A=(this[0].ownerDocument||this[0]).createDocumentFragment();l=c.clean(l,this[0].ownerDocument||this[0],A);var E=A.firstChild;if(E)for(var L=0,S=this.length;L<S;L++)v.call(P(this[L],E),this.length>1||L>0?A.cloneNode(true):A);l&&c.each(l,k)}return this;function P(ea,na){return q&&c.nodeName(ea,"table")&&c.nodeName(na,"tr")?ea.getElementsByTagName("tbody")[0]||ea.appendChild(ea.ownerDocument.createElement("tbody")):ea}}};c.fn.init.prototype=c.fn;function k(l,q){q.src?c.ajax({url:q.src,async:false,dataType:"script"}):c.globalEval(q.text||q.textContent||q.innerHTML||"");q.parentNode&&q.parentNode.removeChild(q)}function g(){return+new Date}c.extend=c.fn.extend=function(){var l=arguments[0]||{},q=1,v=arguments.length,A=false,E;if(typeof l==="boolean"){A=l;l=arguments[1]||{};q=2}if(typeof l!=="object"&&!c.isFunction(l))l={};if(v==q){l=this;--q}for(;q<v;q++)if((E=arguments[q])!=null)for(var L in E){var S=l[L],P=E[L];if(l!==P)if(A&&P&&typeof P==="object"&&!P.nodeType)l[L]=c.extend(A,S||(P.length!=null?[]:{}),P);else if(P!==d)l[L]=P}return l};var f=/z-?index|font-?weight|opacity|zoom|line-?height/i,n=document.defaultView||{},p=Object.prototype.toString;c.extend({noConflict:function(l){a.$=b;if(l)a.jQuery=j;return c},isFunction:function(l){return p.call(l)==="[object Function]"},isArray:function(l){return p.call(l)==="[object Array]"},isXMLDoc:function(l){return l.nodeType===9&&l.documentElement.nodeName!=="HTML"||!!l.ownerDocument&&c.isXMLDoc(l.ownerDocument)},globalEval:function(l){if(l&&/\S/.test(l)){var q=document.getElementsByTagName("head")[0]||document.documentElement,v=document.createElement("script");v.type="text/javascript";if(c.support.scriptEval)v.appendChild(document.createTextNode(l));else v.text=l;q.insertBefore(v,q.firstChild);q.removeChild(v)}},nodeName:function(l,q){return l.nodeName&&l.nodeName.toUpperCase()==q.toUpperCase()},each:function(l,q,v){var A,E=0,L=l.length;if(v)if(L===d)for(A in l){if(q.apply(l[A],v)===false)break}else for(;E<L;){if(q.apply(l[E++],v)===false)break}else if(L===d)for(A in l){if(q.call(l[A],A,l[A])===false)break}else for(v=l[0];E<L&&q.call(v,E,v)!==false;v=l[++E]);return l},prop:function(l,q,v,A,E){if(c.isFunction(q))q=q.call(l,A);return typeof q==="number"&&v=="curCSS"&&!f.test(E)?q+"px":q},className:{add:function(l,q){c.each((q||"").split(/\s+/),function(v,A){if(l.nodeType==1&&!c.className.has(l.className,A))l.className+=(l.className?" ":"")+A})},remove:function(l,q){if(l.nodeType==1)l.className=q!==d?c.grep(l.className.split(/\s+/),function(v){return!c.className.has(q,v)}).join(" "):""},has:function(l,q){return l&&c.inArray(q,(l.className||l).toString().split(/\s+/))>-1}},swap:function(l,q,v){var A={};for(var E in q){A[E]=l.style[E];l.style[E]=q[E]}v.call(l);for(E in q)l.style[E]=A[E]},css:function(l,q,v,A){if(q=="width"||q=="height"){var E;v={position:"absolute",visibility:"hidden",display:"block"};var L=q=="width"?["Left","Right"]:["Top","Bottom"];function S(){E=q=="width"?l.offsetWidth:l.offsetHeight;A!=="border"&&c.each(L,function(){A||(E-=parseFloat(c.curCSS(l,"padding"+this,true))||0);if(A==="margin")E+=parseFloat(c.curCSS(l,"margin"+this,true))||0;else E-=parseFloat(c.curCSS(l,"border"+this+"Width",true))||0})}l.offsetWidth!==0?S():c.swap(l,v,S);return Math.max(0,Math.round(E))}return c.curCSS(l,q,v)},curCSS:function(l,q,v){var A,E=l.style;if(q=="opacity"&&!c.support.opacity){A=c.attr(E,"opacity");return A==""?"1":A}if(q.match(/float/i))q=W;if(!v&&E&&E[q])A=E[q];else if(n.getComputedStyle){if(q.match(/float/i))q="float";q=q.replace(/([A-Z])/g,"-$1").toLowerCase();if(l=n.getComputedStyle(l,null))A=l.getPropertyValue(q);if(q=="opacity"&&A=="")A="1"}else if(l.currentStyle){A=q.replace(/\-(\w)/g,function(L,S){return S.toUpperCase()});A=l.currentStyle[q]||l.currentStyle[A];if(!/^\d+(px)?$/i.test(A)&&/^\d/.test(A)){q=E.left;v=l.runtimeStyle.left;l.runtimeStyle.left=l.currentStyle.left;E.left=A||0;A=E.pixelLeft+"px";E.left=q;l.runtimeStyle.left=v}}return A},clean:function(l,q,v){q=q||document;if(typeof q.createElement==="undefined")q=q.ownerDocument||q[0]&&q[0].ownerDocument||document;if(!v&&l.length===1&&typeof l[0]==="string"){var A=/^<(\w+)\s*\/?>$/.exec(l[0]);if(A)return[q.createElement(A[1])]}var E=[];A=[];var L=q.createElement("div");c.each(l,function(S,P){if(typeof P==="number")P+="";if(P){if(typeof P==="string"){P=P.replace(/(<(\w+)[^>]*?)\/>/g,function(pa,va,sa){return sa.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?pa:va+"></"+sa+">"});S=P.replace(/^\s+/,"").substring(0,10).toLowerCase();var ea=!S.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!S.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||S.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!S.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!S.indexOf("<td")||!S.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!S.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!c.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];for(L.innerHTML=ea[1]+P+ea[2];ea[0]--;)L=L.lastChild;if(!c.support.tbody){var na=/<tbody/i.test(P);S=!S.indexOf("<table")&&!na?L.firstChild&&L.firstChild.childNodes:ea[1]=="<table>"&&!na?L.childNodes:[];for(ea=S.length-1;ea>=0;--ea)c.nodeName(S[ea],"tbody")&&!S[ea].childNodes.length&&S[ea].parentNode.removeChild(S[ea])}!c.support.leadingWhitespace&&/^\s/.test(P)&&L.insertBefore(q.createTextNode(P.match(/^\s*/)[0]),L.firstChild);P=c.makeArray(L.childNodes)}if(P.nodeType)E.push(P);else E=c.merge(E,P)}});if(v){for(l=0;E[l];l++)if(c.nodeName(E[l],"script")&&(!E[l].type||E[l].type.toLowerCase()==="text/javascript"))A.push(E[l].parentNode?E[l].parentNode.removeChild(E[l]):E[l]);else{E[l].nodeType===1&&E.splice.apply(E,[l+1,0].concat(c.makeArray(E[l].getElementsByTagName("script"))));v.appendChild(E[l])}return A}return E},attr:function(l,q,v){if(!(!l||l.nodeType==3||l.nodeType==8)){var A=!c.isXMLDoc(l),E=v!==d;q=A&&c.props[q]||q;if(l.tagName){var L=/href|src|style/.test(q);if(q in l&&A&&!L){if(E){if(q=="type"&&c.nodeName(l,"input")&&l.parentNode)throw"type property can't be changed";l[q]=v}if(c.nodeName(l,"form")&&l.getAttributeNode(q))return l.getAttributeNode(q).nodeValue;if(q=="tabIndex")return(q=l.getAttributeNode("tabIndex"))&&q.specified?q.value:l.nodeName.match(/(button|input|object|select|textarea)/i)?0:l.nodeName.match(/^(a|area)$/i)&&l.href?0:d;return l[q]}if(!c.support.style&&A&&q=="style")return c.attr(l.style,"cssText",v);E&&l.setAttribute(q,""+v);l=!c.support.hrefNormalized&&A&&L?l.getAttribute(q,2):l.getAttribute(q);return l===null?d:l}if(!c.support.opacity&&q=="opacity"){if(E){l.zoom=1;l.filter=(l.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(v)+""=="NaN"?"":"alpha(opacity="+v*100+")")}return l.filter&&l.filter.indexOf("opacity=")>=0?parseFloat(l.filter.match(/opacity=([^)]*)/)[1])/100+"":""}q=q.replace(/-([a-z])/ig,function(S,P){return P.toUpperCase()});if(E)l[q]=v;return l[q]}},trim:function(l){return(l||"").replace(/^\s+|\s+$/g,"")},makeArray:function(l){var q=[];if(l!=null){var v=l.length;if(v==null||typeof l==="string"||c.isFunction(l)||l.setInterval)q[0]=l;else for(;v;)q[--v]=l[v]}return q},inArray:function(l,q){for(var v=0,A=q.length;v<A;v++)if(q[v]===l)return v;return-1},merge:function(l,q){var v=0,A,E=l.length;if(c.support.getAll)for(;(A=q[v++])!=null;)l[E++]=A;else for(;(A=q[v++])!=null;)if(A.nodeType!=8)l[E++]=A;return l},unique:function(l){var q=[],v={};try{for(var A=0,E=l.length;A<E;A++){var L=c.data(l[A]);if(!v[L]){v[L]=true;q.push(l[A])}}}catch(S){q=l}return q},grep:function(l,q,v){for(var A=[],E=0,L=l.length;E<L;E++)!v!=!q(l[E],E)&&A.push(l[E]);return A},map:function(l,q){for(var v=[],A=0,E=l.length;A<E;A++){var L=q(l[A],A);if(L!=null)v[v.length]=L}return v.concat.apply([],v)}});var y=navigator.userAgent.toLowerCase();c.browser={version:(y.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(y),opera:/opera/.test(y),msie:/msie/.test(y)&&!/opera/.test(y),mozilla:/mozilla/.test(y)&&!/(compatible|webkit)/.test(y)};c.each({parent:function(l){return l.parentNode},parents:function(l){return c.dir(l,"parentNode")},next:function(l){return c.nth(l,2,"nextSibling")},prev:function(l){return c.nth(l,2,"previousSibling")},nextAll:function(l){return c.dir(l,"nextSibling")},prevAll:function(l){return c.dir(l,"previousSibling")},siblings:function(l){return c.sibling(l.parentNode.firstChild,l)},children:function(l){return c.sibling(l.firstChild)},contents:function(l){return c.nodeName(l,"iframe")?l.contentDocument||l.contentWindow.document:c.makeArray(l.childNodes)}},function(l,q){c.fn[l]=function(v){var A=c.map(this,q);if(v&&typeof v=="string")A=c.multiFilter(v,A);return this.pushStack(c.unique(A),l,v)}});c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(l,q){c.fn[l]=function(v){for(var A=[],E=c(v),L=0,S=E.length;L<S;L++){var P=(L>0?this.clone(true):this).get();c.fn[q].apply(c(E[L]),P);A=A.concat(P)}return this.pushStack(A,l,v)}});c.each({removeAttr:function(l){c.attr(this,l,"");this.nodeType==1&&this.removeAttribute(l)},addClass:function(l){c.className.add(this,l)},removeClass:function(l){c.className.remove(this,l)},toggleClass:function(l,q){if(typeof q!=="boolean")q=!c.className.has(this,l);c.className[q?"add":"remove"](this,l)},remove:function(l){if(!l||c.filter(l,[this]).length){c("*",this).add([this]).each(function(){c.event.remove(this);c.removeData(this)});this.parentNode&&this.parentNode.removeChild(this)}},empty:function(){for(c(this).children().remove();this.firstChild;)this.removeChild(this.firstChild)}},function(l,q){c.fn[l]=function(){return this.each(q,arguments)}});function u(l,q){return l[0]&&parseInt(c.curCSS(l[0],q,true),10)||0}var s="jQuery"+g(),B=0,G={};c.extend({cache:{},data:function(l,q,v){l=l==a?G:l;var A=l[s];A||(A=l[s]=++B);if(q&&!c.cache[A])c.cache[A]={};if(v!==d)c.cache[A][q]=v;return q?c.cache[A][q]:A},removeData:function(l,q){l=l==a?G:l;var v=l[s];if(q){if(c.cache[v]){delete c.cache[v][q];q="";for(q in c.cache[v])break;q||c.removeData(l)}}else{try{delete l[s]}catch(A){l.removeAttribute&&l.removeAttribute(s)}delete c.cache[v]}},queue:function(l,q,v){if(l){q=(q||"fx")+"queue";var A=c.data(l,q);if(!A||c.isArray(v))A=c.data(l,q,c.makeArray(v));else v&&A.push(v)}return A},dequeue:function(l,q){var v=c.queue(l,q),A=v.shift();if(!q||q==="fx")A=v[0];A!==d&&A.call(l)}});c.fn.extend({data:function(l,q){var v=l.split(".");v[1]=v[1]?"."+v[1]:"";if(q===d){var A=this.triggerHandler("getData"+v[1]+"!",[v[0]]);if(A===d&&this.length)A=c.data(this[0],l);return A===d&&v[1]?this.data(v[0]):A}else return this.trigger("setData"+v[1]+"!",[v[0],q]).each(function(){c.data(this,l,q)})},removeData:function(l){return this.each(function(){c.removeData(this,l)})},queue:function(l,q){if(typeof l!=="string"){q=l;l="fx"}if(q===d)return c.queue(this[0],l);return this.each(function(){var v=c.queue(this,l,q);l=="fx"&&v.length==1&&v[0].call(this)})},dequeue:function(l){return this.each(function(){c.dequeue(this,l)})}});(function(){var l=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,q=0,v=Object.prototype.toString;function A(z,C,I,M){I=I||[];C=C||document;if(C.nodeType!==1&&C.nodeType!==9)return[];if(!z||typeof z!=="string")return I;var Q=[],T,ba,qa,da=true;for(l.lastIndex=0;(T=l.exec(z))!==null;){Q.push(T[1]);if(T[2]){qa=RegExp.rightContext;break}}if(Q.length>1&&L.exec(z))if(Q.length===2&&E.relative[Q[0]])T=Ca(Q[0]+Q[1],C);else for(T=E.relative[Q[0]]?[C]:A(Q.shift(),C);Q.length;){z=Q.shift();if(E.relative[z])z+=Q.shift();T=Ca(z,T)}else{T=M?{expr:Q.pop(),set:P(M)}:A.find(Q.pop(),Q.length===1&&C.parentNode?C.parentNode:C,ga(C));T=A.filter(T.expr,T.set);if(Q.length>0)ba=P(T);else da=false;for(;Q.length;){var ta=Q.pop(),Aa=ta;if(E.relative[ta])Aa=Q.pop();else ta="";if(Aa==null)Aa=C;E.relative[ta](ba,Aa,ga(C))}}ba||(ba=T);if(!ba)throw"Syntax error, unrecognized expression: "+(ta||z);if(v.call(ba)==="[object Array]")if(da)if(C.nodeType===1)for(z=0;ba[z]!=null;z++){if(ba[z]&&(ba[z]===true||ba[z].nodeType===1&&sa(C,ba[z])))I.push(T[z])}else for(z=0;ba[z]!=null;z++)ba[z]&&ba[z].nodeType===1&&I.push(T[z]);else I.push.apply(I,ba);else P(ba,I);if(qa){A(qa,C,I,M);if(na){hasDuplicate=false;I.sort(na);if(hasDuplicate)for(z=1;z<I.length;z++)I[z]===I[z-1]&&I.splice(z--,1)}}return I}A.matches=function(z,C){return A(z,null,null,C)};A.find=function(z,C,I){var M,Q;if(!z)return[];for(var T=0,ba=E.order.length;T<ba;T++){var qa=E.order[T];if(Q=E.match[qa].exec(z)){var da=RegExp.leftContext;if(da.substr(da.length-1)!=="\\"){Q[1]=(Q[1]||"").replace(/\\/g,"");M=E.find[qa](Q,C,I);if(M!=null){z=z.replace(E.match[qa],"");break}}}}M||(M=C.getElementsByTagName("*"));return{set:M,expr:z}};A.filter=function(z,C,I,M){for(var Q=z,T=[],ba=C,qa,da,ta=C&&C[0]&&ga(C[0]);z&&C.length;){for(var Aa in E.filter)if((qa=E.match[Aa].exec(z))!=null){var Qa=E.filter[Aa],Ja,Ga;da=false;if(ba==T)T=[];if(E.preFilter[Aa])if(qa=E.preFilter[Aa](qa,ba,I,T,M,ta)){if(qa===true)continue}else da=Ja=true;if(qa)for(var J=0;(Ga=ba[J])!=null;J++)if(Ga){Ja=Qa(Ga,qa,J,ba);var R=M^!!Ja;if(I&&Ja!=null)if(R)da=true;else ba[J]=false;else if(R){T.push(Ga);da=true}}if(Ja!==d){I||(ba=T);z=z.replace(E.match[Aa],"");if(!da)return[];break}}if(z==Q)if(da==null)throw"Syntax error, unrecognized expression: "+z;else break;Q=z}return ba};var E=A.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(z){return z.getAttribute("href")}},relative:{"+":function(z,C,I){var M=typeof C==="string",Q=M&&!/\W/.test(C);M=M&&!Q;if(Q&&!I)C=C.toUpperCase();I=0;Q=z.length;for(var T;I<Q;I++)if(T=z[I]){for(;(T=T.previousSibling)&&T.nodeType!==1;);z[I]=M||T&&T.nodeName===C?T||false:T===C}M&&A.filter(C,z,true)},">":function(z,C,I){var M=typeof C==="string";if(M&&!/\W/.test(C)){C=I?C:C.toUpperCase();I=0;for(var Q=z.length;I<Q;I++){var T=z[I];if(T){M=T.parentNode;z[I]=M.nodeName===C?M:false}}}else{I=0;for(Q=z.length;I<Q;I++)if(T=z[I])z[I]=M?T.parentNode:T.parentNode===C;M&&A.filter(C,z,true)}},"":function(z,C,I){var M=q++,Q=va;if(!C.match(/\W/)){var T=C=I?C:C.toUpperCase();Q=pa}Q("parentNode",C,M,z,T,I)},"~":function(z,C,I){var M=q++,Q=va;if(typeof C==="string"&&!C.match(/\W/)){var T=C=I?C:C.toUpperCase();Q=pa}Q("previousSibling",C,M,z,T,I)}},find:{ID:function(z,C,I){if(typeof C.getElementById!=="undefined"&&!I)return(z=C.getElementById(z[1]))?[z]:[]},NAME:function(z,C){if(typeof C.getElementsByName!=="undefined"){var I=[];C=C.getElementsByName(z[1]);for(var M=0,Q=C.length;M<Q;M++)C[M].getAttribute("name")===z[1]&&I.push(C[M]);return I.length===0?null:I}},TAG:function(z,C){return C.getElementsByTagName(z[1])}},preFilter:{CLASS:function(z,C,I,M,Q,T){z=" "+z[1].replace(/\\/g,"")+" ";if(T)return z;T=0;for(var ba;(ba=C[T])!=null;T++)if(ba)if(Q^(ba.className&&(" "+ba.className+" ").indexOf(z)>=0))I||M.push(ba);else if(I)C[T]=false;return false},ID:function(z){return z[1].replace(/\\/g,"")},TAG:function(z,C){for(var I=0;C[I]===false;I++);return C[I]&&ga(C[I])?z[1]:z[1].toUpperCase()},CHILD:function(z){if(z[1]=="nth"){var C=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(z[2]=="even"&&"2n"||z[2]=="odd"&&"2n+1"||!/\D/.test(z[2])&&"0n+"+z[2]||z[2]);z[2]=C[1]+(C[2]||1)-0;z[3]=C[3]-0}z[0]=q++;return z},ATTR:function(z,C,I,M,Q,T){C=z[1].replace(/\\/g,"");if(!T&&E.attrMap[C])z[1]=E.attrMap[C];if(z[2]==="~=")z[4]=" "+z[4]+" ";return z},PSEUDO:function(z,C,I,M,Q){if(z[1]==="not")if(z[3].match(l).length>1||/^\w/.test(z[3]))z[3]=A(z[3],null,null,C);else{z=A.filter(z[3],C,I,true^Q);I||M.push.apply(M,z);return false}else if(E.match.POS.test(z[0])||E.match.CHILD.test(z[0]))return true;return z},POS:function(z){z.unshift(true);return z}},filters:{enabled:function(z){return z.disabled===false&&z.type!=="hidden"},disabled:function(z){return z.disabled===true},checked:function(z){return z.checked===true},selected:function(z){return z.selected===true},parent:function(z){return!!z.firstChild},empty:function(z){return!z.firstChild},has:function(z,C,I){return!!A(I[3],z).length},header:function(z){return/h\d/i.test(z.nodeName)},text:function(z){return"text"===z.type},radio:function(z){return"radio"===z.type},checkbox:function(z){return"checkbox"===z.type},file:function(z){return"file"===z.type},password:function(z){return"password"===z.type},submit:function(z){return"submit"===z.type},image:function(z){return"image"===z.type},reset:function(z){return"reset"===z.type},button:function(z){return"button"===z.type||z.nodeName.toUpperCase()==="BUTTON"},input:function(z){return/input|select|textarea|button/i.test(z.nodeName)}},setFilters:{first:function(z,C){return C===0},last:function(z,C,I,M){return C===M.length-1},even:function(z,C){return C%2===0},odd:function(z,C){return C%2===1},lt:function(z,C,I){return C<I[3]-0},gt:function(z,C,I){return C>I[3]-0},nth:function(z,C,I){return I[3]-0==C},eq:function(z,C,I){return I[3]-0==C}},filter:{PSEUDO:function(z,C,I,M){var Q=C[1],T=E.filters[Q];if(T)return T(z,I,C,M);else if(Q==="contains")return(z.textContent||z.innerText||"").indexOf(C[3])>=0;else if(Q==="not"){C=C[3];I=0;for(M=C.length;I<M;I++)if(C[I]===z)return false;return true}},CHILD:function(z,C){var I=C[1],M=z;switch(I){case"only":case"first":for(;M=M.previousSibling;)if(M.nodeType===1)return false;if(I=="first")return true;M=z;case"last":for(;M=M.nextSibling;)if(M.nodeType===1)return false;return true;case"nth":I=C[2];var Q=C[3];if(I==1&&Q==0)return true;C=C[0];var T=z.parentNode;if(T&&(T.sizcache!==C||!z.nodeIndex)){var ba=0;for(M=T.firstChild;M;M=M.nextSibling)if(M.nodeType===1)M.nodeIndex=++ba;T.sizcache=C}z=z.nodeIndex-Q;return I==0?z==0:z%I==0&&z/I>=0}},ID:function(z,C){return z.nodeType===1&&z.getAttribute("id")===C},TAG:function(z,C){return C==="*"&&z.nodeType===1||z.nodeName===C},CLASS:function(z,C){return(" "+
(z.className||z.getAttribute("class"))+" ").indexOf(C)>-1},ATTR:function(z,C){var I=C[1];z=E.attrHandle[I]?E.attrHandle[I](z):z[I]!=null?z[I]:z.getAttribute(I);I=z+"";var M=C[2];C=C[4];return z==null?M==="!=":M==="="?I===C:M==="*="?I.indexOf(C)>=0:M==="~="?(" "+I+" ").indexOf(C)>=0:!C?I&&z!==false:M==="!="?I!=C:M==="^="?I.indexOf(C)===0:M==="$="?I.substr(I.length-C.length)===C:M==="|="?I===C||I.substr(0,C.length+1)===C+"-":false},POS:function(z,C,I,M){var Q=C[2];if(Q=E.setFilters[Q])return Q(z,I,C,M)}}},L=E.match.POS;for(var S in E.match)E.match[S]=RegExp(E.match[S].source+/(?![^\[]*\])(?![^\(]*\))/.source);function P(z,C){z=Array.prototype.slice.call(z);if(C){C.push.apply(C,z);return C}return z}try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(ea){P=function(z,C){C=C||[];if(v.call(z)==="[object Array]")Array.prototype.push.apply(C,z);else if(typeof z.length==="number")for(var I=0,M=z.length;I<M;I++)C.push(z[I]);else for(I=0;z[I];I++)C.push(z[I]);return C}}var na;if(document.documentElement.compareDocumentPosition)na=function(z,C){z=z.compareDocumentPosition(C)&4?-1:z===C?0:1;if(z===0)hasDuplicate=true;return z};else if("sourceIndex"in document.documentElement)na=function(z,C){z=z.sourceIndex-C.sourceIndex;if(z===0)hasDuplicate=true;return z};else if(document.createRange)na=function(z,C){var I=z.ownerDocument.createRange(),M=C.ownerDocument.createRange();I.selectNode(z);I.collapse(true);M.selectNode(C);M.collapse(true);z=I.compareBoundaryPoints(Range.START_TO_END,M);if(z===0)hasDuplicate=true;return z};(function(){var z=document.createElement("form"),C="script"+(new Date).getTime();z.innerHTML="<input name='"+C+"'/>";var I=document.documentElement;I.insertBefore(z,I.firstChild);if(document.getElementById(C)){E.find.ID=function(M,Q,T){if(typeof Q.getElementById!=="undefined"&&!T)return(Q=Q.getElementById(M[1]))?Q.id===M[1]||typeof Q.getAttributeNode!=="undefined"&&Q.getAttributeNode("id").nodeValue===M[1]?[Q]:d:[]};E.filter.ID=function(M,Q){var T=typeof M.getAttributeNode!=="undefined"&&M.getAttributeNode("id");return M.nodeType===1&&T&&T.nodeValue===Q}}I.removeChild(z)})();(function(){var z=document.createElement("div");z.appendChild(document.createComment(""));if(z.getElementsByTagName("*").length>0)E.find.TAG=function(C,I){I=I.getElementsByTagName(C[1]);if(C[1]==="*"){C=[];for(var M=0;I[M];M++)I[M].nodeType===1&&C.push(I[M]);I=C}return I};z.innerHTML="<a href='#'></a>";if(z.firstChild&&typeof z.firstChild.getAttribute!=="undefined"&&z.firstChild.getAttribute("href")!=="#")E.attrHandle.href=function(C){return C.getAttribute("href",2)}})();document.querySelectorAll&&function(){var z=A,C=document.createElement("div");C.innerHTML="<p class='TEST'></p>";if(!(C.querySelectorAll&&C.querySelectorAll(".TEST").length===0)){A=function(I,M,Q,T){M=M||document;if(!T&&M.nodeType===9&&!ga(M))try{return P(M.querySelectorAll(I),Q)}catch(ba){}return z(I,M,Q,T)};A.find=z.find;A.filter=z.filter;A.selectors=z.selectors;A.matches=z.matches}}();document.getElementsByClassName&&document.documentElement.getElementsByClassName&&function(){var z=document.createElement("div");z.innerHTML="<div class='test e'></div><div class='test'></div>";if(z.getElementsByClassName("e").length!==0){z.lastChild.className="e";if(z.getElementsByClassName("e").length!==1){E.order.splice(1,0,"CLASS");E.find.CLASS=function(C,I,M){if(typeof I.getElementsByClassName!=="undefined"&&!M)return I.getElementsByClassName(C[1])}}}}();function pa(z,C,I,M,Q,T){Q=z=="previousSibling"&&!T;for(var ba=0,qa=M.length;ba<qa;ba++){var da=M[ba];if(da){if(Q&&da.nodeType===1){da.sizcache=I;da.sizset=ba}da=da[z];for(var ta=false;da;){if(da.sizcache===I){ta=M[da.sizset];break}if(da.nodeType===1&&!T){da.sizcache=I;da.sizset=ba}if(da.nodeName===C){ta=da;break}da=da[z]}M[ba]=ta}}}function va(z,C,I,M,Q,T){Q=z=="previousSibling"&&!T;for(var ba=0,qa=M.length;ba<qa;ba++){var da=M[ba];if(da){if(Q&&da.nodeType===1){da.sizcache=I;da.sizset=ba}da=da[z];for(var ta=false;da;){if(da.sizcache===I){ta=M[da.sizset];break}if(da.nodeType===1){if(!T){da.sizcache=I;da.sizset=ba}if(typeof C!=="string"){if(da===C){ta=true;break}}else if(A.filter(C,[da]).length>0){ta=da;break}}da=da[z]}M[ba]=ta}}}var sa=document.compareDocumentPosition?function(z,C){return z.compareDocumentPosition(C)&16}:function(z,C){return z!==C&&(z.contains?z.contains(C):true)};function ga(z){return z.nodeType===9&&z.documentElement.nodeName!=="HTML"||!!z.ownerDocument&&ga(z.ownerDocument)}function Ca(z,C){var I=[],M="",Q;for(C=C.nodeType?[C]:C;Q=E.match.PSEUDO.exec(z);){M+=Q[0];z=z.replace(E.match.PSEUDO,"")}z=E.relative[z]?z+"*":z;Q=0;for(var T=C.length;Q<T;Q++)A(z,C[Q],I);return A.filter(M,I)}c.find=A;c.filter=A.filter;c.expr=A.selectors;c.expr[":"]=c.expr.filters;A.selectors.filters.hidden=function(z){return z.offsetWidth===0||z.offsetHeight===0};A.selectors.filters.visible=function(z){return z.offsetWidth>0||z.offsetHeight>0};A.selectors.filters.animated=function(z){return c.grep(c.timers,function(C){return z===C.elem}).length};c.multiFilter=function(z,C,I){if(I)z=":not("+z+")";return A.matches(z,C)};c.dir=function(z,C){var I=[];for(z=z[C];z&&z!=document;){z.nodeType==1&&I.push(z);z=z[C]}return I};c.nth=function(z,C,I){C=C||1;for(var M=0;z;z=z[I])if(z.nodeType==1&&++M==C)break;return z};c.sibling=function(z,C){for(var I=[];z;z=z.nextSibling)z.nodeType==1&&z!=C&&I.push(z);return I}})();c.event={add:function(l,q,v,A){if(!(l.nodeType==3||l.nodeType==8)){if(l.setInterval&&l!=a)l=a;if(!v.guid)v.guid=this.guid++;if(A!==d){var E=v;v=this.proxy(E);v.data=A}var L=c.data(l,"events")||c.data(l,"events",{}),S=c.data(l,"handle")||c.data(l,"handle",function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(arguments.callee.elem,arguments):d});S.elem=l;c.each(q.split(/\s+/),function(P,ea){P=ea.split(".");ea=P.shift();v.type=P.slice().sort().join(".");var na=L[ea];c.event.specialAll[ea]&&c.event.specialAll[ea].setup.call(l,A,P);if(!na){na=L[ea]={};if(!c.event.special[ea]||c.event.special[ea].setup.call(l,A,P)===false)if(l.addEventListener)l.addEventListener(ea,S,false);else l.attachEvent&&l.attachEvent("on"+
ea,S)}na[v.guid]=v;c.event.global[ea]=true});l=null}},guid:1,global:{},remove:function(l,q,v){if(!(l.nodeType==3||l.nodeType==8)){var A=c.data(l,"events"),E;if(A){if(q===d||typeof q==="string"&&q.charAt(0)==".")for(var L in A)this.remove(l,L+(q||""));else{if(q.type){v=q.handler;q=q.type}c.each(q.split(/\s+/),function(S,P){S=P.split(".");P=S.shift();var ea=RegExp("(^|\\.)"+S.slice().sort().join(".*\\.")+"(\\.|$)");if(A[P]){if(v)delete A[P][v.guid];else for(var na in A[P])ea.test(A[P][na].type)&&delete A[P][na];c.event.specialAll[P]&&c.event.specialAll[P].teardown.call(l,S);for(E in A[P])break;if(!E){if(!c.event.special[P]||c.event.special[P].teardown.call(l,S)===false)if(l.removeEventListener)l.removeEventListener(P,c.data(l,"handle"),false);else l.detachEvent&&l.detachEvent("on"+P,c.data(l,"handle"));E=null;delete A[P]}}})}for(E in A)break;if(!E){if(q=c.data(l,"handle"))q.elem=null;c.removeData(l,"events");c.removeData(l,"handle")}}}},trigger:function(l,q,v,A){var E=l.type||l;if(!A){l=typeof l==="object"?l[s]?l:c.extend(c.Event(E),l):c.Event(E);if(E.indexOf("!")>=0){l.type=E=E.slice(0,-1);l.exclusive=true}if(!v){l.stopPropagation();this.global[E]&&c.each(c.cache,function(){this.events&&this.events[E]&&c.event.trigger(l,q,this.handle.elem)})}if(!v||v.nodeType==3||v.nodeType==8)return;l.result=d;l.target=v;q=c.makeArray(q);q.unshift(l)}l.currentTarget=v;var L=c.data(v,"handle");L&&L.apply(v,q);if((!v[E]||c.nodeName(v,"a")&&E=="click")&&v["on"+E]&&v["on"+E].apply(v,q)===false)l.result=false;if(!A&&v[E]&&!l.isDefaultPrevented()&&!(c.nodeName(v,"a")&&E=="click")){this.triggered=true;try{v[E]()}catch(S){}}this.triggered=false;if(!l.isPropagationStopped())(v=v.parentNode||v.ownerDocument)&&c.event.trigger(l,q,v,true)},handle:function(l){var q,v;l=arguments[0]=c.event.fix(l||a.event);l.currentTarget=this;v=l.type.split(".");l.type=v.shift();q=!v.length&&!l.exclusive;var A=RegExp("(^|\\.)"+v.slice().sort().join(".*\\.")+"(\\.|$)");v=(c.data(this,"events")||{})[l.type];for(var E in v){var L=v[E];if(q||A.test(L.type)){l.handler=L;l.data=L.data;L=L.apply(this,arguments);if(L!==d){l.result=L;if(L===false){l.preventDefault();l.stopPropagation()}}if(l.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(l){if(l[s])return l;var q=l;l=c.Event(q);for(var v=this.props.length,A;v;){A=this.props[--v];l[A]=q[A]}if(!l.target)l.target=l.srcElement||document;if(l.target.nodeType==3)l.target=l.target.parentNode;if(!l.relatedTarget&&l.fromElement)l.relatedTarget=l.fromElement==l.target?l.toElement:l.fromElement;if(l.pageX==null&&l.clientX!=null){q=document.documentElement;v=document.body;l.pageX=l.clientX+(q&&q.scrollLeft||v&&v.scrollLeft||0)-(q.clientLeft||0);l.pageY=l.clientY+(q&&q.scrollTop||v&&v.scrollTop||0)-(q.clientTop||0)}if(!l.which&&(l.charCode||l.charCode===0?l.charCode:l.keyCode))l.which=l.charCode||l.keyCode;if(!l.metaKey&&l.ctrlKey)l.metaKey=l.ctrlKey;if(!l.which&&l.button)l.which=l.button&1?1:l.button&2?3:l.button&4?2:0;return l},proxy:function(l,q){q=q||function(){return l.apply(this,arguments)};q.guid=l.guid=l.guid||q.guid||this.guid++;return q},special:{ready:{setup:Z,teardown:function(){}}},specialAll:{live:{setup:function(l,q){c.event.add(this,q[0],K)},teardown:function(l){if(l.length){var q=0,v=RegExp("(^|\\.)"+l[0]+"(\\.|$)");c.each(c.data(this,"events").live||{},function(){v.test(this.type)&&q++});q<1&&c.event.remove(this,l[0],K)}}}}};c.Event=function(l){if(!this.preventDefault)return new c.Event(l);if(l&&l.type){this.originalEvent=l;this.type=l.type}else this.type=l;this.timeStamp=g();this[s]=true};function F(){return false}function D(){return true}c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=D;var l=this.originalEvent;if(l){l.preventDefault&&l.preventDefault();l.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=D;var l=this.originalEvent;if(l){l.stopPropagation&&l.stopPropagation();l.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=D;this.stopPropagation()},isDefaultPrevented:F,isPropagationStopped:F,isImmediatePropagationStopped:F};function H(l){for(var q=l.relatedTarget;q&&q!=this;)try{q=q.parentNode}catch(v){q=this}if(q!=this){l.type=l.data;c.event.handle.apply(this,arguments)}}c.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(l,q){c.event.special[q]={setup:function(){c.event.add(this,l,H,q)},teardown:function(){c.event.remove(this,l,H)}}});c.fn.extend({bind:function(l,q,v){return l=="unload"?this.one(l,q,v):this.each(function(){c.event.add(this,l,v||q,v&&q)})},one:function(l,q,v){var A=c.event.proxy(v||q,function(E){c(this).unbind(E,A);return(v||q).apply(this,arguments)});return this.each(function(){c.event.add(this,l,A,v&&q)})},unbind:function(l,q){return this.each(function(){c.event.remove(this,l,q)})},trigger:function(l,q){return this.each(function(){c.event.trigger(l,q,this)})},triggerHandler:function(l,q){if(this[0]){l=c.Event(l);l.preventDefault();l.stopPropagation();c.event.trigger(l,q,this[0]);return l.result}},toggle:function(l){for(var q=arguments,v=1;v<q.length;)c.event.proxy(l,q[v++]);return this.click(c.event.proxy(l,function(A){this.lastToggle=(this.lastToggle||0)%v;A.preventDefault();return q[this.lastToggle++].apply(this,arguments)||false}))},hover:function(l,q){return this.mouseenter(l).mouseleave(q)},ready:function(l){Z();c.isReady?l.call(document,c):c.readyList.push(l);return this},live:function(l,q){q=c.event.proxy(q);q.guid+=this.selector+l;c(document).bind(N(l,this.selector),this.selector,q);return this},die:function(l,q){c(document).unbind(N(l,this.selector),q?{guid:q.guid+this.selector+l}:null);return this}});function K(l){var q=RegExp("(^|\\.)"+l.type+"(\\.|$)"),v=true,A=[];c.each(c.data(this,"events").live||[],function(E,L){if(q.test(L.type))(E=c(l.target).closest(L.data)[0])&&A.push({elem:E,fn:L})});A.sort(function(E,L){return c.data(E.elem,"closest")-c.data(L.elem,"closest")});c.each(A,function(){if(this.fn.call(this.elem,l,this.fn.data)===false)return v=false});return v}function N(l,q){return["live",l,q.replace(/\./g,"`").replace(/ /g,"|")].join(".")}c.extend({isReady:false,readyList:[],ready:function(){if(!c.isReady){c.isReady=true;if(c.readyList){c.each(c.readyList,function(){this.call(document,c)});c.readyList=null}c(document).triggerHandler("ready")}}});var O=false;function Z(){if(!O){O=true;if(document.addEventListener)document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);c.ready()},false);else if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);c.ready()}});document.documentElement.doScroll&&a==a.top&&function(){if(!c.isReady){try{document.documentElement.doScroll("left")}catch(l){setTimeout(arguments.callee,0);return}c.ready()}}()}c.event.add(a,"load",c.ready)}}c.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(l,q){c.fn[q]=function(v){return v?this.bind(q,v):this.trigger(q)}});c(a).bind("unload",function(){for(var l in c.cache)l!=1&&c.cache[l].handle&&c.event.remove(c.cache[l].handle.elem)});(function(){c.support={};var l=document.documentElement,q=document.createElement("script"),v=document.createElement("div"),A="script"+(new Date).getTime();v.style.display="none";v.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 E=v.getElementsByTagName("*"),L=v.getElementsByTagName("a")[0];if(!(!E||!E.length||!L)){c.support={leadingWhitespace:v.firstChild.nodeType==3,tbody:!v.getElementsByTagName("tbody").length,objectAll:!!v.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!v.getElementsByTagName("link").length,style:/red/.test(L.getAttribute("style")),hrefNormalized:L.getAttribute("href")==="/a",opacity:L.style.opacity==="0.5",cssFloat:!!L.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};q.type="text/javascript";try{q.appendChild(document.createTextNode("window."+A+"=1;"))}catch(S){}l.insertBefore(q,l.firstChild);if(a[A]){c.support.scriptEval=true;delete a[A]}l.removeChild(q);if(v.attachEvent&&v.fireEvent){v.attachEvent("onclick",function(){c.support.noCloneEvent=false;v.detachEvent("onclick",arguments.callee)});v.cloneNode(true).fireEvent("onclick")}c(function(){var P=document.createElement("div");P.style.width=P.style.paddingLeft="1px";document.body.appendChild(P);c.boxModel=c.support.boxModel=P.offsetWidth===2;document.body.removeChild(P).style.display="none"})}})();var W=c.support.cssFloat?"cssFloat":"styleFloat";c.props={"for":"htmlFor","class":"className","float":W,cssFloat:W,styleFloat:W,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};c.fn.extend({_load:c.fn.load,load:function(l,q,v){if(typeof l!=="string")return this._load(l);var A=l.indexOf(" ");if(A>=0){var E=l.slice(A,l.length);l=l.slice(0,A)}A="GET";if(q)if(c.isFunction(q)){v=q;q=null}else if(typeof q==="object"){q=c.param(q);A="POST"}var L=this;c.ajax({url:l,type:A,dataType:"html",data:q,complete:function(S,P){if(P=="success"||P=="notmodified")L.html(E?c("<div/>").append(S.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):S.responseText);v&&L.each(v,[S.responseText,P,S])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.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(l,q){l=c(this).val();return l==null?null:c.isArray(l)?c.map(l,function(v){return{name:q.name,value:v}}):{name:q.name,value:l}}).get()}});c.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(l,q){c.fn[q]=function(v){return this.bind(q,v)}});var ma=g();c.extend({get:function(l,q,v,A){if(c.isFunction(q)){v=q;q=null}return c.ajax({type:"GET",url:l,data:q,success:v,dataType:A})},getScript:function(l,q){return c.get(l,null,q,"script")},getJSON:function(l,q,v){return c.get(l,q,v,"json")},post:function(l,q,v,A){if(c.isFunction(q)){v=q;q={}}return c.ajax({type:"POST",url:l,data:q,success:v,dataType:A})},ajaxSetup:function(l){c.extend(c.ajaxSettings,l)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return a.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(l){l=c.extend(true,l,c.extend(true,{},c.ajaxSettings,l));var q,v=/=\?(&|$)/g,A,E,L=l.type.toUpperCase();if(l.data&&l.processData&&typeof l.data!=="string")l.data=c.param(l.data);if(l.dataType=="jsonp"){if(L=="GET")l.url.match(v)||(l.url+=(l.url.match(/\?/)?"&":"?")+(l.jsonp||"callback")+"=?");else if(!l.data||!l.data.match(v))l.data=(l.data?l.data+"&":"")+(l.jsonp||"callback")+"=?";l.dataType="json"}if(l.dataType=="json"&&(l.data&&l.data.match(v)||l.url.match(v))){q="jsonp"+ma++;if(l.data)l.data=(l.data+"").replace(v,"="+q+"$1");l.url=l.url.replace(v,"="+q+"$1");l.dataType="script";a[q]=function(M){E=M;va();pa();a[q]=d;try{delete a[q]}catch(Q){}P&&P.removeChild(ea)}}if(l.dataType=="script"&&l.cache==null)l.cache=false;if(l.cache===false&&L=="GET"){v=g();var S=l.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+v+"$2");l.url=S+(S==l.url?(l.url.match(/\?/)?"&":"?")+"_="+v:"")}if(l.data&&L=="GET"){l.url+=(l.url.match(/\?/)?"&":"?")+l.data;l.data=null}l.global&&!c.active++&&c.event.trigger("ajaxStart");v=/^(\w+:)?\/\/([^\/?#]+)/.exec(l.url);if(l.dataType=="script"&&L=="GET"&&v&&(v[1]&&v[1]!=location.protocol||v[2]!=location.host)){var P=document.getElementsByTagName("head")[0],ea=document.createElement("script");ea.src=l.url;if(l.scriptCharset)ea.charset=l.scriptCharset;if(!q){var na=false;ea.onload=ea.onreadystatechange=function(){if(!na&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){na=true;va();pa();ea.onload=ea.onreadystatechange=null;P.removeChild(ea)}}}P.appendChild(ea)}else{function pa(){l.complete&&l.complete(ga,A);l.global&&c.event.trigger("ajaxComplete",[ga,l]);l.global&&!--c.active&&c.event.trigger("ajaxStop")}function va(){l.success&&l.success(E,A);l.global&&c.event.trigger("ajaxSuccess",[ga,l])}var sa=false,ga=l.xhr();l.username?ga.open(L,l.url,l.async,l.username,l.password):ga.open(L,l.url,l.async);try{l.data&&ga.setRequestHeader("Content-Type",l.contentType);if(l.ifModified)ga.setRequestHeader("If-Modified-Since",c.lastModified[l.url]||"Thu, 01 Jan 1970 00:00:00 GMT");ga.setRequestHeader("X-Requested-With","XMLHttpRequest");ga.setRequestHeader("Accept",l.dataType&&l.accepts[l.dataType]?l.accepts[l.dataType]+", */*":l.accepts._default)}catch(Ca){}if(l.beforeSend&&l.beforeSend(ga,l)===false){l.global&&!--c.active&&c.event.trigger("ajaxStop");ga.abort();return false}l.global&&c.event.trigger("ajaxSend",[ga,l]);var z=function(M){if(ga.readyState==0){if(C){clearInterval(C);C=null;l.global&&!--c.active&&c.event.trigger("ajaxStop")}}else if(!sa&&ga&&(ga.readyState==4||M=="timeout")){sa=true;if(C){clearInterval(C);C=null}A=M=="timeout"?"timeout":!c.httpSuccess(ga)?"error":l.ifModified&&c.httpNotModified(ga,l.url)?"notmodified":"success";if(A=="success")try{E=c.httpData(ga,l.dataType,l)}catch(Q){A="parsererror"}if(A=="success"){var T;try{T=ga.getResponseHeader("Last-Modified")}catch(ba){}if(l.ifModified&&T)c.lastModified[l.url]=T;q||va()}else c.handleError(l,ga,A);pa();M&&ga.abort();if(l.async)ga=null}};if(l.async){var C=setInterval(z,13);l.timeout>0&&setTimeout(function(){ga&&!sa&&z("timeout")},l.timeout)}try{ga.send(l.data)}catch(I){c.handleError(l,ga,null,I)}l.async||z();return ga}},handleError:function(l,q,v,A){l.error&&l.error(q,v,A);l.global&&c.event.trigger("ajaxError",[q,l,A])},active:0,httpSuccess:function(l){try{return!l.status&&location.protocol=="file:"||l.status>=200&&l.status<300||l.status==304||l.status==1223}catch(q){}return false},httpNotModified:function(l,q){try{var v=l.getResponseHeader("Last-Modified");return l.status==304||v==c.lastModified[q]}catch(A){}return false},httpData:function(l,q,v){var A=l.getResponseHeader("content-type");l=(A=q=="xml"||!q&&A&&A.indexOf("xml")>=0)?l.responseXML:l.responseText;if(A&&l.documentElement.tagName=="parsererror")throw"parsererror";if(v&&v.dataFilter)l=v.dataFilter(l,q);if(typeof l==="string"){q=="script"&&c.globalEval(l);if(q=="json")l=a.eval("("+l+")")}return l},param:function(l){var q=[];function v(E,L){q[q.length]=encodeURIComponent(E)+"="+encodeURIComponent(L)}if(c.isArray(l)||l.jquery)c.each(l,function(){v(this.name,this.value)});else for(var A in l)c.isArray(l[A])?c.each(l[A],function(){v(A,this)}):v(A,c.isFunction(l[A])?l[A]():l[A]);return q.join("&").replace(/%20/g,"+")}});var V={},fa,la=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function ya(l,q){var v={};c.each(la.concat.apply([],la.slice(0,q)),function(){v[this]=l});return v}c.fn.extend({show:function(l,q){if(l)return this.animate(ya("show",3),l,q);else{l=0;for(q=this.length;l<q;l++){var v=c.data(this[l],"olddisplay");this[l].style.display=v||"";if(c.css(this[l],"display")==="none"){v=this[l].tagName;var A;if(V[v])A=V[v];else{var E=c("<"+v+" />").appendTo("body");A=E.css("display");if(A==="none")A="block";E.remove();V[v]=A}c.data(this[l],"olddisplay",A)}}l=0;for(q=this.length;l<q;l++)this[l].style.display=c.data(this[l],"olddisplay")||"";return this}},hide:function(l,q){if(l)return this.animate(ya("hide",3),l,q);else{l=0;for(q=this.length;l<q;l++){var v=c.data(this[l],"olddisplay");!v&&v!=="none"&&c.data(this[l],"olddisplay",c.css(this[l],"display"))}l=0;for(q=this.length;l<q;l++)this[l].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(l,q){var v=typeof l==="boolean";return c.isFunction(l)&&c.isFunction(q)?this._toggle.apply(this,arguments):l==null||v?this.each(function(){var A=v?l:c(this).is(":hidden");c(this)[A?"show":"hide"]()}):this.animate(ya("toggle",3),l,q)},fadeTo:function(l,q,v){return this.animate({opacity:q},l,v)},animate:function(l,q,v,A){var E=c.speed(q,v,A);return this[E.queue===false?"each":"queue"](function(){var L=c.extend({},E),S,P=this.nodeType==1&&c(this).is(":hidden"),ea=this;for(S in l){if(l[S]=="hide"&&P||l[S]=="show"&&!P)return L.complete.call(this);if((S=="height"||S=="width")&&this.style){L.display=c.css(this,"display");L.overflow=this.style.overflow}}if(L.overflow!=null)this.style.overflow="hidden";L.curAnim=c.extend({},l);c.each(l,function(na,pa){var va=new c.fx(ea,L,na);if(/toggle|show|hide/.test(pa))va[pa=="toggle"?P?"show":"hide":pa](l);else{var sa=pa.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),ga=va.cur(true)||0;if(sa){pa=parseFloat(sa[2]);var Ca=sa[3]||"px";if(Ca!="px"){ea.style[na]=(pa||1)+Ca;ga=(pa||1)/va.cur(true)*ga;ea.style[na]=ga+Ca}if(sa[1])pa=(sa[1]=="-="?-1:1)*pa+ga;va.custom(ga,pa,Ca)}else va.custom(ga,pa,"")}});return true})},stop:function(l,q){var v=c.timers;l&&this.queue([]);this.each(function(){for(var A=v.length-1;A>=0;A--)if(v[A].elem==this){q&&v[A](true);v.splice(A,1)}});q||this.dequeue();return this}});c.each({slideDown:ya("show",1),slideUp:ya("hide",1),slideToggle:ya("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(l,q){c.fn[l]=function(v,A){return this.animate(q,v,A)}});c.extend({speed:function(l,q,v){var A=typeof l==="object"?l:{complete:v||!v&&q||c.isFunction(l)&&l,duration:l,easing:v&&q||q&&!c.isFunction(q)&&q};A.duration=c.fx.off?0:typeof A.duration==="number"?A.duration:c.fx.speeds[A.duration]||c.fx.speeds._default;A.old=A.complete;A.complete=function(){A.queue!==false&&c(this).dequeue();c.isFunction(A.old)&&A.old.call(this)};return A},easing:{linear:function(l,q,v,A){return v+A*l},swing:function(l,q,v,A){return(-Math.cos(l*Math.PI)/2+0.5)*A+v}},timers:[],fx:function(l,q,v){this.options=q;this.elem=l;this.prop=v;if(!q.orig)q.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style)this.elem.style.display="block"},cur:function(l){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(l=parseFloat(c.css(this.elem,this.prop,l)))&&l>-10000?l:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(l,q,v){this.startTime=g();this.start=l;this.end=q;this.unit=v||this.unit||"px";this.now=this.start;this.pos=this.state=0;var A=this;function E(L){return A.step(L)}E.elem=this.elem;if(E()&&c.timers.push(E)&&!fa)fa=setInterval(function(){for(var L=c.timers,S=0;S<L.length;S++)L[S]()||L.splice(S--,1);if(!L.length){clearInterval(fa);fa=d}},13)},show:function(){this.options.orig[this.prop]=c.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(l){var q=g();if(l||q>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();l=this.options.curAnim[this.prop]=true;for(var v in this.options.curAnim)if(this.options.curAnim[v]!==true)l=false;if(l){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(c.css(this.elem,"display")=="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var A in this.options.curAnim)c.attr(this.elem.style,A,this.options.orig[A]);this.options.complete.call(this.elem)}return false}else{v=q-this.startTime;this.state=v/this.options.duration;this.pos=c.easing[this.options.easing||(c.easing.swing?"swing":"linear")](this.state,v,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(l){c.attr(l.elem.style,"opacity",l.now)},_default:function(l){if(l.elem.style&&l.elem.style[l.prop]!=null)l.elem.style[l.prop]=l.now+l.unit;else l.elem[l.prop]=l.now}}});c.fn.offset=document.documentElement.getBoundingClientRect?function(){if(!this[0])return{top:0,left:0};if(this[0]===this[0].ownerDocument.body)return c.offset.bodyOffset(this[0]);var l=this[0].getBoundingClientRect(),q=this[0].ownerDocument,v=q.body;q=q.documentElement;var A=q.clientTop||v.clientTop||0,E=q.clientLeft||v.clientLeft||0;A=l.top+(self.pageYOffset||c.boxModel&&q.scrollTop||v.scrollTop)-A;l=l.left+(self.pageXOffset||c.boxModel&&q.scrollLeft||v.scrollLeft)-E;return{top:A,left:l}}:function(){if(!this[0])return{top:0,left:0};if(this[0]===this[0].ownerDocument.body)return c.offset.bodyOffset(this[0]);c.offset.initialized||c.offset.initialize();var l=this[0],q=l.offsetParent,v=l.ownerDocument,A,E=v.documentElement,L=v.body;v=v.defaultView;A=v.getComputedStyle(l,null);for(var S=l.offsetTop,P=l.offsetLeft;(l=l.parentNode)&&l!==L&&l!==E;){A=v.getComputedStyle(l,null);S-=l.scrollTop;P-=l.scrollLeft;if(l===q){S+=l.offsetTop;P+=l.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(l.tagName))){S+=parseInt(A.borderTopWidth,10)||0;P+=parseInt(A.borderLeftWidth,10)||0}q=l.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&A.overflow!=="visible"){S+=parseInt(A.borderTopWidth,10)||0;P+=parseInt(A.borderLeftWidth,10)||0}A=A}if(A.position==="relative"||A.position==="static"){S+=L.offsetTop;P+=L.offsetLeft}if(A.position==="fixed"){S+=Math.max(E.scrollTop,L.scrollTop);P+=Math.max(E.scrollLeft,L.scrollLeft)}return{top:S,left:P}};c.offset={initialize:function(){if(!this.initialized){var l=document.body,q=document.createElement("div"),v,A,E,L=l.style.marginTop;E='<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>';v={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(A in v)q.style[A]=v[A];q.innerHTML=E;l.insertBefore(q,l.firstChild);v=q.firstChild;A=v.firstChild;E=v.nextSibling.firstChild.firstChild;this.doesNotAddBorder=A.offsetTop!==5;this.doesAddBorderForTableAndCells=E.offsetTop===5;v.style.overflow="hidden";v.style.position="relative";this.subtractsBorderForOverflowNotVisible=A.offsetTop===-5;l.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=l.offsetTop===0;l.style.marginTop=L;l.removeChild(q);this.initialized=true}},bodyOffset:function(l){c.offset.initialized||c.offset.initialize();var q=l.offsetTop,v=l.offsetLeft;if(c.offset.doesNotIncludeMarginInBodyOffset){q+=parseInt(c.curCSS(l,"marginTop",true),10)||0;v+=parseInt(c.curCSS(l,"marginLeft",true),10)||0}return{top:q,left:v}}};c.fn.extend({position:function(){var l;if(this[0]){l=this.offsetParent();var q=this.offset(),v=/^body|html$/i.test(l[0].tagName)?{top:0,left:0}:l.offset();q.top-=u(this,"marginTop");q.left-=u(this,"marginLeft");v.top+=u(l,"borderTopWidth");v.left+=u(l,"borderLeftWidth");l={top:q.top-v.top,left:q.left-v.left}}return l},offsetParent:function(){for(var l=this[0].offsetParent||document.body;l&&!/^body|html$/i.test(l.tagName)&&c.css(l,"position")=="static";)l=l.offsetParent;return c(l)}});c.each(["Left","Top"],function(l,q){var v="scroll"+q;c.fn[v]=function(A){if(!this[0])return null;return A!==d?this.each(function(){this==a||this==document?a.scrollTo(!l?A:c(a).scrollLeft(),l?A:c(a).scrollTop()):(this[v]=A)}):this[0]==a||this[0]==document?self[l?"pageYOffset":"pageXOffset"]||c.boxModel&&document.documentElement[v]||document.body[v]:this[0][v]}});c.each(["Height","Width"],function(l,q){var v=q.toLowerCase();c.fn["inner"+
q]=function(){return this[0]?c.css(this[0],v,false,"padding"):null};c.fn["outer"+q]=function(E){return this[0]?c.css(this[0],v,false,E?"margin":"border"):null};var A=q.toLowerCase();c.fn[A]=function(E){return this[0]==a?document.compatMode=="CSS1Compat"&&document.documentElement["client"+q]||document.body["client"+q]:this[0]==document?Math.max(document.documentElement["client"+q],document.body["scroll"+q],document.documentElement["scroll"+q],document.body["offset"+q],document.documentElement["offset"+
q]):E===d?this.length?c.css(this[0],A):null:this.css(A,typeof E==="string"?E:E+"px")}})})();jQuery.ui||function(a){var d=a.fn.remove,j=a.browser.mozilla&&parseFloat(a.browser.version)<1.9;a.ui={version:"1.7.2",plugin:{add:function(f,n,p){f=a.ui[f].prototype;for(var y in p){f.plugins[y]=f.plugins[y]||[];f.plugins[y].push([n,p[y]])}},call:function(f,n,p){if((n=f.plugins[n])&&f.element[0].parentNode)for(var y=0;y<n.length;y++)f.options[n[y][0]]&&n[y][1].apply(f.element,p)}},contains:function(f,n){return document.compareDocumentPosition?f.compareDocumentPosition(n)&16:f!==n&&f.contains(n)},hasScroll:function(f,n){if(a(f).css("overflow")=="hidden")return false;n=n&&n=="left"?"scrollLeft":"scrollTop";var p=false;if(f[n]>0)return true;f[n]=1;p=f[n]>0;f[n]=0;return p},isOverAxis:function(f,n,p){return f>n&&f<n+p},isOver:function(f,n,p,y,u,s){return a.ui.isOverAxis(f,p,u)&&a.ui.isOverAxis(n,y,s)},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(j){var b=a.attr,c=a.fn.removeAttr,m="http://www.w3.org/2005/07/aaa",o=/^aria-/,k=/^wairole:/;a.attr=function(f,n,p){var y=p!==undefined;return n=="role"?y?b.call(this,f,n,"wairole:"+p):(b.apply(this,arguments)||"").replace(k,""):o.test(n)?y?f.setAttributeNS(m,n.replace(o,"aaa:"),p):b.call(this,f,n.replace(o,"aaa:")):b.apply(this,arguments)};a.fn.removeAttr=function(f){return o.test(f)?this.each(function(){this.removeAttributeNS(m,f.replace(o,""))}):c.call(this,f)}}a.fn.extend({remove:function(){a("*",this).add(this).each(function(){a(this).triggerHandler("remove")});return d.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 f;f=a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!f.length?a(document):f}});a.extend(a.expr[":"],{data:function(f,n,p){return!!a.data(f,p[3])},focusable:function(f){var n=f.nodeName.toLowerCase(),p=a.attr(f,"tabindex");return(/input|select|textarea|button|object/.test(n)?!f.disabled:"a"==n||"area"==n?f.href||!isNaN(p):!isNaN(p))&&!a(f)["area"==n?"parents":"closest"](":hidden").length},tabbable:function(f){var n=a.attr(f,"tabindex");return(isNaN(n)||n>=0)&&a(f).is(":focusable")}});function g(f,n,p,y){function u(B){B=a[f][n][B]||[];return typeof B=="string"?B.split(/,?\s+/):B}var s=u("getter");if(y.length==1&&typeof y[0]=="string")s=s.concat(u("getterSetter"));return a.inArray(p,s)!=-1}a.widget=function(f,n){var p=f.split(".")[0];f=f.split(".")[1];a.fn[f]=function(y){var u=typeof y=="string",s=Array.prototype.slice.call(arguments,1);if(u&&y.substring(0,1)=="_")return this;if(u&&g(p,f,y,s)){var B=a.data(this[0],f);return B?B[y].apply(B,s):undefined}return this.each(function(){var G=a.data(this,f);!G&&!u&&a.data(this,f,new a[p][f](this,y))._init();G&&u&&a.isFunction(G[y])&&G[y].apply(G,s)})};a[p]=a[p]||{};a[p][f]=function(y,u){var s=this;this.namespace=p;this.widgetName=f;this.widgetEventPrefix=a[p][f].eventPrefix||f;this.widgetBaseClass=p+"-"+f;this.options=a.extend({},a.widget.defaults,a[p][f].defaults,a.metadata&&a.metadata.get(y)[f],u);this.element=a(y).bind("setData."+f,function(B,G,F){if(B.target==y)return s._setData(G,F)}).bind("getData."+f,function(B,G){if(B.target==y)return s._getData(G)}).bind("remove",function(){return s.destroy()})};a[p][f].prototype=a.extend({},a.widget.prototype,n);a[p][f].getterSetter="option"};a.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(f,n){var p=f,y=this;if(typeof f=="string"){if(n===undefined)return this._getData(f);p={};p[f]=n}a.each(p,function(u,s){y._setData(u,s)})},_getData:function(f){return this.options[f]},_setData:function(f,n){this.options[f]=n;if(f=="disabled")this.element[n?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",n)},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(f,n,p){var y=this.options[f];f=f==this.widgetEventPrefix?f:this.widgetEventPrefix+f;n=a.Event(n);n.type=f;if(n.originalEvent){f=a.event.props.length;for(var u;f;){u=a.event.props[--f];n[u]=n.originalEvent[u]}}this.element.trigger(n,p);return!(a.isFunction(y)&&y.call(this.element[0],n,p)===false||n.isDefaultPrevented())}};a.widget.defaults={disabled:false};a.ui.mouse={_mouseInit:function(){var f=this;this.element.bind("mousedown."+this.widgetName,function(n){return f._mouseDown(n)}).bind("click."+this.widgetName,function(n){if(f._preventClickEvent){f._preventClickEvent=false;n.stopImmediatePropagation();return false}});if(a.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);a.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable)},_mouseDown:function(f){f.originalEvent=f.originalEvent||{};if(!f.originalEvent.mouseHandled){this._mouseStarted&&this._mouseUp(f);this._mouseDownEvent=f;var n=this,p=f.which==1,y=typeof this.options.cancel=="string"?a(f.target).parents().add(f.target).filter(this.options.cancel).length:false;if(!p||y||!this._mouseCapture(f))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){n.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(f)&&this._mouseDelayMet(f)){this._mouseStarted=this._mouseStart(f)!==false;if(!this._mouseStarted){f.preventDefault();return true}}this._mouseMoveDelegate=function(u){return n._mouseMove(u)};this._mouseUpDelegate=function(u){return n._mouseUp(u)};a(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+
this.widgetName,this._mouseUpDelegate);a.browser.safari||f.preventDefault();return f.originalEvent.mouseHandled=true}},_mouseMove:function(f){if(a.browser.msie&&!f.button)return this._mouseUp(f);if(this._mouseStarted){this._mouseDrag(f);return f.preventDefault()}if(this._mouseDistanceMet(f)&&this._mouseDelayMet(f))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,f)!==false)?this._mouseDrag(f):this._mouseUp(f);return!this._mouseStarted},_mouseUp:function(f){a(document).unbind("mousemove."+
this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=f.target==this._mouseDownEvent.target;this._mouseStop(f)}return false},_mouseDistanceMet:function(f){return Math.max(Math.abs(this._mouseDownEvent.pageX-f.pageX),Math.abs(this._mouseDownEvent.pageY-f.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}};a.ui.mouse.defaults={cancel:null,distance:1,delay:0}}(jQuery);(function(a){a.widget("ui.draggable",a.extend({},a.ui.mouse,{_init:function(){if(this.options.helper=="original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy()}},_mouseCapture:function(d){var j=this.options;if(this.helper||j.disabled||a(d.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(d);if(!this.handle)return false;return true},_mouseStart:function(d){var j=this.options;this.helper=this._createHelper(d);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:d.pageX-this.offset.left,top:d.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(d);this.originalPageX=d.pageX;this.originalPageY=d.pageY;j.cursorAt&&this._adjustOffsetFromHelper(j.cursorAt);j.containment&&this._setContainment();this._trigger("start",d);this._cacheHelperProportions();a.ui.ddmanager&&!j.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,d);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(d,true);return true},_mouseDrag:function(d,j){this.position=this._generatePosition(d);this.positionAbs=this._convertPositionTo("absolute");if(!j){j=this._uiHash();this._trigger("drag",d,j);this.position=j.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";a.ui.ddmanager&&a.ui.ddmanager.drag(this,d);return false},_mouseStop:function(d){var j=false;if(a.ui.ddmanager&&!this.options.dropBehaviour)j=a.ui.ddmanager.drop(this,d);if(this.dropped){j=this.dropped;this.dropped=false}if(this.options.revert=="invalid"&&!j||this.options.revert=="valid"&&j||this.options.revert===true||a.isFunction(this.options.revert)&&this.options.revert.call(this.element,j)){var b=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){b._trigger("stop",d);b._clear()})}else{this._trigger("stop",d);this._clear()}return false},_getHandle:function(d){var j=!this.options.handle||!a(this.options.handle,this.element).length?true:false;a(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==d.target)j=true});return j},_createHelper:function(d){var j=this.options;d=a.isFunction(j.helper)?a(j.helper.apply(this.element[0],[d])):j.helper=="clone"?this.element.clone():this.element;d.parents("body").length||d.appendTo(j.appendTo=="parent"?this.element[0].parentNode:j.appendTo);d[0]!=this.element[0]&&!/(fixed|absolute)/.test(d.css("position"))&&d.css("position","absolute");return d},_adjustOffsetFromHelper:function(d){if(d.left!=undefined)this.offset.click.left=d.left+this.margins.left;if(d.right!=undefined)this.offset.click.left=this.helperProportions.width-d.right+this.margins.left;if(d.top!=undefined)this.offset.click.top=d.top+this.margins.top;if(d.bottom!=undefined)this.offset.click.top=this.helperProportions.height-d.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var d=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])){d.left+=this.scrollParent.scrollLeft();d.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)d={top:0,left:0};return{top:d.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:d.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var d=this.element.position();return{top:d.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:d.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 d=this.options;if(d.containment=="parent")d.containment=this.helper[0].parentNode;if(d.containment=="document"||d.containment=="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(d.containment=="document"?document:window).width()-this.helperProportions.width-
this.margins.left,(a(d.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(d.containment)&&d.containment.constructor!=Array){var j=a(d.containment)[0];if(j){d=a(d.containment).offset();var b=a(j).css("overflow")!="hidden";this.containment=[d.left+(parseInt(a(j).css("borderLeftWidth"),10)||0)+(parseInt(a(j).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(j).css("borderTopWidth"),10)||0)+(parseInt(a(j).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(j.scrollWidth,j.offsetWidth):j.offsetWidth)-(parseInt(a(j).css("borderLeftWidth"),10)||0)-(parseInt(a(j).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(b?Math.max(j.scrollHeight,j.offsetHeight):j.offsetHeight)-(parseInt(a(j).css("borderTopWidth"),10)||0)-(parseInt(a(j).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}}else if(d.containment.constructor==Array)this.containment=d.containment},_convertPositionTo:function(d,j){if(!j)j=this.position;d=d=="absolute"?1:-1;var b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,c=/(html|body)/i.test(b[0].tagName);return{top:j.top+this.offset.relative.top*d+this.offset.parent.top*d-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():c?0:b.scrollTop())*d),left:j.left+this.offset.relative.left*d+this.offset.parent.left*d-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():c?0:b.scrollLeft())*d)}},_generatePosition:function(d){var j=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,c=/(html|body)/i.test(b[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0]))this.offset.relative=this._getRelativeOffset();var m=d.pageX,o=d.pageY;if(this.originalPosition){if(this.containment){if(d.pageX-this.offset.click.left<this.containment[0])m=this.containment[0]+this.offset.click.left;if(d.pageY-this.offset.click.top<this.containment[1])o=this.containment[1]+this.offset.click.top;if(d.pageX-this.offset.click.left>this.containment[2])m=this.containment[2]+this.offset.click.left;if(d.pageY-this.offset.click.top>this.containment[3])o=this.containment[3]+this.offset.click.top}if(j.grid){o=this.originalPageY+Math.round((o-this.originalPageY)/j.grid[1])*j.grid[1];o=this.containment?!(o-this.offset.click.top<this.containment[1]||o-this.offset.click.top>this.containment[3])?o:!(o-this.offset.click.top<this.containment[1])?o-j.grid[1]:o+j.grid[1]:o;m=this.originalPageX+Math.round((m-this.originalPageX)/j.grid[0])*j.grid[0];m=this.containment?!(m-this.offset.click.left<this.containment[0]||m-this.offset.click.left>this.containment[2])?m:!(m-this.offset.click.left<this.containment[0])?m-j.grid[0]:m+j.grid[0]:m}}return{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():c?0:b.scrollTop()),left:m-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():c?0:b.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove();this.helper=null;this.cancelHelperRemoval=false},_trigger:function(d,j,b){b=b||this._uiHash();a.ui.plugin.call(this,d,[j,b]);if(d=="drag")this.positionAbs=this._convertPositionTo("absolute");return a.widget.prototype._trigger.call(this,d,j,b)},plugins:{},_uiHash:function(){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(d,j){var b=a(this).data("draggable"),c=b.options,m=a.extend({},j,{item:b.element});b.sortables=[];a(c.connectToSortable).each(function(){var o=a.data(this,"sortable");if(o&&!o.options.disabled){b.sortables.push({instance:o,shouldRevert:o.options.revert});o._refreshItems();o._trigger("activate",d,m)}})},stop:function(d,j){var b=a(this).data("draggable"),c=a.extend({},j,{item:b.element});a.each(b.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;b.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert)this.instance.options.revert=true;this.instance._mouseStop(d);this.instance.options.helper=this.instance.options._helper;b.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",d,c)}})},drag:function(d,j){var b=a(this).data("draggable"),c=this;a.each(b.sortables,function(){this.instance.positionAbs=b.positionAbs;this.instance.helperProportions=b.helperProportions;this.instance.offset.click=b.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=a(c).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return j.helper[0]};d.target=this.instance.currentItem[0];this.instance._mouseCapture(d,true);this.instance._mouseStart(d,true,true);this.instance.offset.click.top=b.offset.click.top;this.instance.offset.click.left=b.offset.click.left;this.instance.offset.parent.left-=b.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=b.offset.parent.top-this.instance.offset.parent.top;b._trigger("toSortable",d);b.dropped=this.instance.element;b.currentItem=b.element;this.instance.fromOutside=b}this.instance.currentItem&&this.instance._mouseDrag(d)}else if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",d,this.instance._uiHash(this.instance));this.instance._mouseStop(d,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();this.instance.placeholder&&this.instance.placeholder.remove();b._trigger("fromSortable",d);b.dropped=false}})}});a.ui.plugin.add("draggable","cursor",{start:function(){var d=a("body"),j=a(this).data("draggable").options;if(d.css("cursor"))j._cursor=d.css("cursor");d.css("cursor",j.cursor)},stop:function(){var d=a(this).data("draggable").options;d._cursor&&a("body").css("cursor",d._cursor)}});a.ui.plugin.add("draggable","iframeFix",{start:function(){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(){a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});a.ui.plugin.add("draggable","opacity",{start:function(d,j){d=a(j.helper);j=a(this).data("draggable").options;if(d.css("opacity"))j._opacity=d.css("opacity");d.css("opacity",j.opacity)},stop:function(d,j){d=a(this).data("draggable").options;d._opacity&&a(j.helper).css("opacity",d._opacity)}});a.ui.plugin.add("draggable","scroll",{start:function(){var d=a(this).data("draggable");if(d.scrollParent[0]!=document&&d.scrollParent[0].tagName!="HTML")d.overflowOffset=d.scrollParent.offset()},drag:function(d){var j=a(this).data("draggable"),b=j.options,c=false;if(j.scrollParent[0]!=document&&j.scrollParent[0].tagName!="HTML"){if(!b.axis||b.axis!="x")if(j.overflowOffset.top+j.scrollParent[0].offsetHeight-d.pageY<b.scrollSensitivity)j.scrollParent[0].scrollTop=c=j.scrollParent[0].scrollTop+b.scrollSpeed;else if(d.pageY-j.overflowOffset.top<b.scrollSensitivity)j.scrollParent[0].scrollTop=c=j.scrollParent[0].scrollTop-
b.scrollSpeed;if(!b.axis||b.axis!="y")if(j.overflowOffset.left+j.scrollParent[0].offsetWidth-d.pageX<b.scrollSensitivity)j.scrollParent[0].scrollLeft=c=j.scrollParent[0].scrollLeft+b.scrollSpeed;else if(d.pageX-j.overflowOffset.left<b.scrollSensitivity)j.scrollParent[0].scrollLeft=c=j.scrollParent[0].scrollLeft-b.scrollSpeed}else{if(!b.axis||b.axis!="x")if(d.pageY-a(document).scrollTop()<b.scrollSensitivity)c=a(document).scrollTop(a(document).scrollTop()-b.scrollSpeed);else if(a(window).height()-
(d.pageY-a(document).scrollTop())<b.scrollSensitivity)c=a(document).scrollTop(a(document).scrollTop()+b.scrollSpeed);if(!b.axis||b.axis!="y")if(d.pageX-a(document).scrollLeft()<b.scrollSensitivity)c=a(document).scrollLeft(a(document).scrollLeft()-b.scrollSpeed);else if(a(window).width()-(d.pageX-a(document).scrollLeft())<b.scrollSensitivity)c=a(document).scrollLeft(a(document).scrollLeft()+b.scrollSpeed)}c!==false&&a.ui.ddmanager&&!b.dropBehaviour&&a.ui.ddmanager.prepareOffsets(j,d)}});a.ui.plugin.add("draggable","snap",{start:function(){var d=a(this).data("draggable"),j=d.options;d.snapElements=[];a(j.snap.constructor!=String?j.snap.items||":data(draggable)":j.snap).each(function(){var b=a(this),c=b.offset();this!=d.element[0]&&d.snapElements.push({item:this,width:b.outerWidth(),height:b.outerHeight(),top:c.top,left:c.left})})},drag:function(d,j){for(var b=a(this).data("draggable"),c=b.options,m=c.snapTolerance,o=j.offset.left,k=o+b.helperProportions.width,g=j.offset.top,f=g+b.helperProportions.height,n=b.snapElements.length-1;n>=0;n--){var p=b.snapElements[n].left,y=p+b.snapElements[n].width,u=b.snapElements[n].top,s=u+b.snapElements[n].height;if(p-m<o&&o<y+m&&u-m<g&&g<s+m||p-m<o&&o<y+m&&u-m<f&&f<s+m||p-m<k&&k<y+m&&u-m<g&&g<s+m||p-m<k&&k<y+m&&u-m<f&&f<s+m){if(c.snapMode!="inner"){var B=Math.abs(u-f)<=m,G=Math.abs(s-g)<=m,F=Math.abs(p-k)<=m,D=Math.abs(y-o)<=m;if(B)j.position.top=b._convertPositionTo("relative",{top:u-b.helperProportions.height,left:0}).top-b.margins.top;if(G)j.position.top=b._convertPositionTo("relative",{top:s,left:0}).top-b.margins.top;if(F)j.position.left=b._convertPositionTo("relative",{top:0,left:p-b.helperProportions.width}).left-b.margins.left;if(D)j.position.left=b._convertPositionTo("relative",{top:0,left:y}).left-b.margins.left}var H=B||G||F||D;if(c.snapMode!="outer"){B=Math.abs(u-g)<=m;G=Math.abs(s-f)<=m;F=Math.abs(p-o)<=m;D=Math.abs(y-k)<=m;if(B)j.position.top=b._convertPositionTo("relative",{top:u,left:0}).top-b.margins.top;if(G)j.position.top=b._convertPositionTo("relative",{top:s-b.helperProportions.height,left:0}).top-b.margins.top;if(F)j.position.left=b._convertPositionTo("relative",{top:0,left:p}).left-b.margins.left;if(D)j.position.left=b._convertPositionTo("relative",{top:0,left:y-b.helperProportions.width}).left-b.margins.left}if(!b.snapElements[n].snapping&&(B||G||F||D||H))b.options.snap.snap&&b.options.snap.snap.call(b.element,d,a.extend(b._uiHash(),{snapItem:b.snapElements[n].item}));b.snapElements[n].snapping=B||G||F||D||H}else{b.snapElements[n].snapping&&b.options.snap.release&&b.options.snap.release.call(b.element,d,a.extend(b._uiHash(),{snapItem:b.snapElements[n].item}));b.snapElements[n].snapping=false}}}});a.ui.plugin.add("draggable","stack",{start:function(){var d=a(this).data("draggable").options,j=a.makeArray(a(d.stack.group)).sort(function(b,c){return(parseInt(a(b).css("zIndex"),10)||d.stack.min)-(parseInt(a(c).css("zIndex"),10)||d.stack.min)});a(j).each(function(b){this.style.zIndex=d.stack.min+b});this[0].style.zIndex=d.stack.min+j.length}});a.ui.plugin.add("draggable","zIndex",{start:function(d,j){d=a(j.helper);j=a(this).data("draggable").options;if(d.css("zIndex"))j._zIndex=d.css("zIndex");d.css("zIndex",j.zIndex)},stop:function(d,j){d=a(this).data("draggable").options;d._zIndex&&a(j.helper).css("zIndex",d._zIndex)}})})(jQuery);(function(a){a.widget("ui.droppable",{_init:function(){var d=this.options,j=d.accept;this.isover=0;this.isout=1;this.options.accept=this.options.accept&&a.isFunction(this.options.accept)?this.options.accept:function(b){return b.is(j)};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(){for(var d=a.ui.ddmanager.droppables[this.options.scope],j=0;j<d.length;j++)d[j]==this&&d.splice(j,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable")},_setData:function(d,j){if(d=="accept")this.options.accept=j&&a.isFunction(j)?j:function(b){return b.is(j)};else a.widget.prototype._setData.apply(this,arguments)},_activate:function(d){var j=a.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass);j&&this._trigger("activate",d,this.ui(j))},_deactivate:function(d){var j=a.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass);j&&this._trigger("deactivate",d,this.ui(j))},_over:function(d){var j=a.ui.ddmanager.current;if(!(!j||(j.currentItem||j.element)[0]==this.element[0]))if(this.options.accept.call(this.element[0],j.currentItem||j.element)){this.options.hoverClass&&this.element.addClass(this.options.hoverClass);this._trigger("over",d,this.ui(j))}},_out:function(d){var j=a.ui.ddmanager.current;if(!(!j||(j.currentItem||j.element)[0]==this.element[0]))if(this.options.accept.call(this.element[0],j.currentItem||j.element)){this.options.hoverClass&&this.element.removeClass(this.options.hoverClass);this._trigger("out",d,this.ui(j))}},_drop:function(d,j){var b=j||a.ui.ddmanager.current;if(!b||(b.currentItem||b.element)[0]==this.element[0])return false;var c=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var m=a.data(this,"droppable");if(m.options.greedy&&a.ui.intersect(b,a.extend(m,{offset:m.element.offset()}),m.options.tolerance)){c=true;return false}});if(c)return false;if(this.options.accept.call(this.element[0],b.currentItem||b.element)){this.options.activeClass&&this.element.removeClass(this.options.activeClass);this.options.hoverClass&&this.element.removeClass(this.options.hoverClass);this._trigger("drop",d,this.ui(b));return this.element}return false},ui:function(d){return{draggable:d.currentItem||d.element,helper:d.helper,position:d.position,absolutePosition:d.positionAbs,offset:d.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(d,j,b){if(!j.offset)return false;var c=(d.positionAbs||d.position.absolute).left,m=c+d.helperProportions.width,o=(d.positionAbs||d.position.absolute).top,k=o+d.helperProportions.height,g=j.offset.left,f=g+j.proportions.width,n=j.offset.top,p=n+j.proportions.height;switch(b){case"fit":return g<c&&m<f&&n<o&&k<p;case"intersect":return g<c+d.helperProportions.width/2&&m-d.helperProportions.width/2<f&&n<o+d.helperProportions.height/2&&k-d.helperProportions.height/2<p;case"pointer":b=(d.positionAbs||d.position.absolute).left+(d.clickOffset||d.offset.click).left;d=(d.positionAbs||d.position.absolute).top+(d.clickOffset||d.offset.click).top;return j=a.ui.isOver(d,b,n,g,j.proportions.height,j.proportions.width);case"touch":return(o>=n&&o<=p||k>=n&&k<=p||o<n&&k>p)&&(c>=g&&c<=f||m>=g&&m<=f||c<g&&m>f);default:return false}};a.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(d,j){var b=a.ui.ddmanager.droppables[d.options.scope],c=j?j.type:null,m=(d.currentItem||d.element).find(":data(droppable)").andSelf(),o=0;a:for(;o<b.length;o++)if(!(b[o].options.disabled||d&&!b[o].options.accept.call(b[o].element[0],d.currentItem||d.element))){for(var k=0;k<m.length;k++)if(m[k]==b[o].element[0]){b[o].proportions.height=0;continue a}b[o].visible=b[o].element.css("display")!="none";if(b[o].visible){b[o].offset=b[o].element.offset();b[o].proportions={width:b[o].element[0].offsetWidth,height:b[o].element[0].offsetHeight};c=="mousedown"&&b[o]._activate.call(b[o],j)}}},drop:function(d,j){var b=false;a.each(a.ui.ddmanager.droppables[d.options.scope],function(){if(this.options){if(!this.options.disabled&&this.visible&&a.ui.intersect(d,this,this.options.tolerance))b=this._drop.call(this,j);if(!this.options.disabled&&this.visible&&this.options.accept.call(this.element[0],d.currentItem||d.element)){this.isout=1;this.isover=0;this._deactivate.call(this,j)}}});return b},drag:function(d,j){d.options.refreshPositions&&a.ui.ddmanager.prepareOffsets(d,j);a.each(a.ui.ddmanager.droppables[d.options.scope],function(){if(!(this.options.disabled||this.greedyChild||!this.visible)){var b=a.ui.intersect(d,this,this.options.tolerance);if(b=!b&&this.isover==1?"isout":b&&this.isover==0?"isover":null){var c;if(this.options.greedy){var m=this.element.parents(":data(droppable):eq(0)");if(m.length){c=a.data(m[0],"droppable");c.greedyChild=b=="isover"?1:0}}if(c&&b=="isover"){c.isover=0;c.isout=1;c._out.call(c,j)}this[b]=1;this[b=="isout"?"isover":"isout"]=0;this[b=="isover"?"_over":"_out"].call(this,j);if(c&&b=="isout"){c.isout=0;c.isover=1;c._over.call(c,j)}}}})}}})(jQuery);(function(a){a.widget("ui.resizable",a.extend({},a.ui.mouse,{_init:function(){var b=this,c=this.options;this.element.addClass("ui-resizable");a.extend(this,{_aspectRatio:!!c.aspectRatio,aspectRatio:c.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:c.helper||c.ghost||c.animate?c.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){/relative/.test(this.element.css("position"))&&a.browser.opera&&this.element.css({position:"relative",top:"auto",left:"auto"});this.element.wrap(a('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=c.handles||(!a(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all")this.handles="n,e,s,w,se,sw,ne,nw";var m=this.handles.split(",");this.handles={};for(var o=0;o<m.length;o++){var k=a.trim(m[o]),g="ui-resizable-"+k;g=a('<div class="ui-resizable-handle '+g+'"></div>');/sw|se|ne|nw/.test(k)&&g.css({zIndex:++c.zIndex});"se"==k&&g.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[k]=".ui-resizable-"+k;this.element.append(g)}}this._renderAxis=function(f){f=f||this.element;for(var n in this.handles){if(this.handles[n].constructor==String)this.handles[n]=a(this.handles[n],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var p=a(this.handles[n],this.element),y=0;y=/sw|ne|nw|se|n|s/.test(n)?p.outerHeight():p.outerWidth();p=["padding",/ne|nw|n/.test(n)?"Top":/se|sw|s/.test(n)?"Bottom":/^e$/.test(n)?"Right":"Left"].join("");f.css(p,y);this._proportionallyResize()}a(this.handles[n])}};this._renderAxis(this.element);this._handles=a(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!b.resizing){if(this.className)var f=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=f&&f[1]?f[1]:"se"}});if(c.autoHide){this._handles.hide();a(this.element).addClass("ui-resizable-autohide").hover(function(){a(this).removeClass("ui-resizable-autohide");b._handles.show()},function(){if(!b.resizing){a(this).addClass("ui-resizable-autohide");b._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();function b(m){a(m).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()}if(this.elementIsWrapper){b(this.element);var c=this.element;c.parent().append(this.originalElement.css({position:c.css("position"),width:c.outerWidth(),height:c.outerHeight(),top:c.css("top"),left:c.css("left")})).end().remove()}this.originalElement.css("resize",this.originalResizeStyle);b(this.originalElement)},_mouseCapture:function(b){var c=false;for(var m in this.handles)if(a(this.handles[m])[0]==b.target)c=true;return this.options.disabled||!!c},_mouseStart:function(b){var c=this.options,m=this.element.position(),o=this.element;this.resizing=true;this.documentScroll={top:a(document).scrollTop(),left:a(document).scrollLeft()};if(o.is(".ui-draggable")||/absolute/.test(o.css("position")))o.css({position:"absolute",top:m.top,left:m.left});a.browser.opera&&/relative/.test(o.css("position"))&&o.css({position:"relative",top:"auto",left:"auto"});this._renderProxy();m=d(this.helper.css("left"));var k=d(this.helper.css("top"));if(c.containment){m+=a(c.containment).scrollLeft()||0;k+=a(c.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:m,top:k};this.size=this._helper?{width:o.outerWidth(),height:o.outerHeight()}:{width:o.width(),height:o.height()};this.originalSize=this._helper?{width:o.outerWidth(),height:o.outerHeight()}:{width:o.width(),height:o.height()};this.originalPosition={left:m,top:k};this.sizeDiff={width:o.outerWidth()-o.width(),height:o.outerHeight()-o.height()};this.originalMousePosition={left:b.pageX,top:b.pageY};this.aspectRatio=typeof c.aspectRatio=="number"?c.aspectRatio:this.originalSize.width/this.originalSize.height||1;c=a(".ui-resizable-"+this.axis).css("cursor");a("body").css("cursor",c=="auto"?this.axis+"-resize":c);o.addClass("ui-resizable-resizing");this._propagate("start",b);return true},_mouseDrag:function(b){var c=this.helper,m=this.originalMousePosition,o=this.axis,k=b.pageX-m.left||0;m=b.pageY-m.top||0;o=this._change[o];if(!o)return false;k=o.apply(this,[b,k,m]);if(this._aspectRatio||b.shiftKey)k=this._updateRatio(k,b);k=this._respectSize(k,b);this._propagate("resize",b);c.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize();this._updateCache(k);this._trigger("resize",b,this.ui());return false},_mouseStop:function(b){this.resizing=false;var c=this.options,m=this;if(this._helper){var o=this._proportionallyResizeElements,k=o.length&&/textarea/i.test(o[0].nodeName);o=k&&a.ui.hasScroll(o[0],"left")?0:m.sizeDiff.height;k=k?0:m.sizeDiff.width;k={width:m.size.width-k,height:m.size.height-o};o=parseInt(m.element.css("left"),10)+(m.position.left-m.originalPosition.left)||null;var g=parseInt(m.element.css("top"),10)+(m.position.top-
m.originalPosition.top)||null;c.animate||this.element.css(a.extend(k,{top:g,left:o}));m.helper.height(m.size.height);m.helper.width(m.size.width);this._helper&&!c.animate&&this._proportionallyResize()}a("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",b);this._helper&&this.helper.remove();return false},_updateCache:function(b){this.offset=this.helper.offset();if(j(b.left))this.position.left=b.left;if(j(b.top))this.position.top=b.top;if(j(b.height))this.size.height=b.height;if(j(b.width))this.size.width=b.width},_updateRatio:function(b){var c=this.position,m=this.size,o=this.axis;if(b.height)b.width=m.height*this.aspectRatio;else if(b.width)b.height=m.width/this.aspectRatio;if(o=="sw"){b.left=c.left+(m.width-b.width);b.top=null}if(o=="nw"){b.top=c.top+(m.height-b.height);b.left=c.left+(m.width-b.width)}return b},_respectSize:function(b){var c=this.options,m=this.axis,o=j(b.width)&&c.maxWidth&&c.maxWidth<b.width,k=j(b.height)&&c.maxHeight&&c.maxHeight<b.height,g=j(b.width)&&c.minWidth&&c.minWidth>b.width,f=j(b.height)&&c.minHeight&&c.minHeight>b.height;if(g)b.width=c.minWidth;if(f)b.height=c.minHeight;if(o)b.width=c.maxWidth;if(k)b.height=c.maxHeight;var n=this.originalPosition.left+this.originalSize.width,p=this.position.top+this.size.height,y=/sw|nw|w/.test(m);m=/nw|ne|n/.test(m);if(g&&y)b.left=n-c.minWidth;if(o&&y)b.left=n-c.maxWidth;if(f&&m)b.top=p-c.minHeight;if(k&&m)b.top=p-c.maxHeight;if((c=!b.width&&!b.height)&&!b.left&&b.top)b.top=null;else if(c&&!b.top&&b.left)b.left=null;return b},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var b=this.helper||this.element,c=0;c<this._proportionallyResizeElements.length;c++){var m=this._proportionallyResizeElements[c];if(!this.borderDif){var o=[m.css("borderTopWidth"),m.css("borderRightWidth"),m.css("borderBottomWidth"),m.css("borderLeftWidth")],k=[m.css("paddingTop"),m.css("paddingRight"),m.css("paddingBottom"),m.css("paddingLeft")];this.borderDif=a.map(o,function(g,f){g=parseInt(g,10)||0;f=parseInt(k[f],10)||0;return g+f})}a.browser.msie&&(a(b).is(":hidden")||a(b).parents(":hidden").length)||m.css({height:b.height()-this.borderDif[0]-this.borderDif[2]||0,width:b.width()-this.borderDif[1]-this.borderDif[3]||0})}},_renderProxy:function(){var b=this.element,c=this.options;this.elementOffset=b.offset();if(this._helper){this.helper=this.helper||a('<div style="overflow:hidden;"></div>');var m=a.browser.msie&&a.browser.version<7;b=m?1:0;m=m?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+
m,height:this.element.outerHeight()+m,position:"absolute",left:this.elementOffset.left-b+"px",top:this.elementOffset.top-b+"px",zIndex:++c.zIndex});this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(b,c){return{width:this.originalSize.width+c}},w:function(b,c){b=this.originalSize;var m=this.originalPosition;return{left:m.left+c,width:b.width-c}},n:function(b,c,m){b=this.originalSize;c=this.originalPosition;return{top:c.top+m,height:b.height-m}},s:function(b,c,m){return{height:this.originalSize.height+m}},se:function(b,c,m){return a.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,c,m]))},sw:function(b,c,m){return a.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,c,m]))},ne:function(b,c,m){return a.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,c,m]))},nw:function(b,c,m){return a.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,c,m]))}},_propagate:function(b,c){a.ui.plugin.call(this,b,[c,this.ui()]);b!="resize"&&this._trigger(b,c,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}));a.extend(a.ui.resizable,{version:"1.7.2",eventPrefix:"resize",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input,option",containment:false,delay:0,distance:1,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000}});a.ui.plugin.add("resizable","alsoResize",{start:function(){var b=a(this).data("resizable");b=b.options;_store=function(c){a(c).each(function(){a(this).data("resizable-alsoresize",{width:parseInt(a(this).width(),10),height:parseInt(a(this).height(),10),left:parseInt(a(this).css("left"),10),top:parseInt(a(this).css("top"),10)})})};if(typeof b.alsoResize=="object"&&!b.alsoResize.parentNode)if(b.alsoResize.length){b.alsoResize=b.alsoResize[0];_store(b.alsoResize)}else a.each(b.alsoResize,function(c){_store(c)});else _store(b.alsoResize)},resize:function(){var b=a(this).data("resizable"),c=b.options,m=b.originalSize,o=b.originalPosition,k={height:b.size.height-m.height||0,width:b.size.width-m.width||0,top:b.position.top-o.top||0,left:b.position.left-o.left||0};function g(f,n){a(f).each(function(){var p=a(this),y=a(this).data("resizable-alsoresize"),u={},s=n&&n.length?n:["width","height","top","left"];a.each(s||["width","height","top","left"],function(B,G){if((B=(y[G]||0)+(k[G]||0))&&B>=0)u[G]=B||null});if(/relative/.test(p.css("position"))&&a.browser.opera){b._revertToRelativePosition=true;p.css({position:"absolute",top:"auto",left:"auto"})}p.css(u)})}typeof c.alsoResize=="object"&&!c.alsoResize.nodeType?a.each(c.alsoResize,function(f,n){g(f,n)}):g(c.alsoResize)},stop:function(){var b=a(this).data("resizable");if(b._revertToRelativePosition&&a.browser.opera){b._revertToRelativePosition=false;el.css({position:"relative"})}a(this).removeData("resizable-alsoresize-start")}});a.ui.plugin.add("resizable","animate",{stop:function(b){var c=a(this).data("resizable"),m=c.options,o=c._proportionallyResizeElements,k=o.length&&/textarea/i.test(o[0].nodeName),g=k&&a.ui.hasScroll(o[0],"left")?0:c.sizeDiff.height;k=k?0:c.sizeDiff.width;g={width:c.size.width-k,height:c.size.height-g};k=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null;var f=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null;c.element.animate(a.extend(g,f&&k?{top:f,left:k}:{}),{duration:m.animateDuration,easing:m.animateEasing,step:function(){var n={width:parseInt(c.element.css("width"),10),height:parseInt(c.element.css("height"),10),top:parseInt(c.element.css("top"),10),left:parseInt(c.element.css("left"),10)};o&&o.length&&a(o[0]).css({width:n.width,height:n.height});c._updateCache(n);c._propagate("resize",b)}})}});a.ui.plugin.add("resizable","containment",{start:function(){var b=a(this).data("resizable"),c=b.options,m=b.element;c=c.containment;if(m=c instanceof a?c.get(0):/parent/.test(c)?m.parent().get(0):c){b.containerElement=a(m);if(/document/.test(c)||c==document){b.containerOffset={left:0,top:0};b.containerPosition={left:0,top:0};b.parentData={element:a(document),left:0,top:0,width:a(document).width(),height:a(document).height()||document.body.parentNode.scrollHeight}}else{var o=a(m),k=[];a(["Top","Right","Left","Bottom"]).each(function(n,p){k[n]=d(o.css("padding"+p))});b.containerOffset=o.offset();b.containerPosition=o.position();b.containerSize={height:o.innerHeight()-k[3],width:o.innerWidth()-k[1]};c=b.containerOffset;var g=b.containerSize.height,f=b.containerSize.width;f=a.ui.hasScroll(m,"left")?m.scrollWidth:f;g=a.ui.hasScroll(m)?m.scrollHeight:g;b.parentData={element:m,left:c.left,top:c.top,width:f,height:g}}}},resize:function(b){var c=a(this).data("resizable"),m=c.options,o=c.containerOffset,k=c.position;b=c._aspectRatio||b.shiftKey;var g={top:0,left:0},f=c.containerElement;if(f[0]!=document&&/static/.test(f.css("position")))g=o;if(k.left<(c._helper?o.left:0)){c.size.width+=c._helper?c.position.left-o.left:c.position.left-g.left;if(b)c.size.height=c.size.width/m.aspectRatio;c.position.left=m.helper?o.left:0}if(k.top<(c._helper?o.top:0)){c.size.height+=c._helper?c.position.top-o.top:c.position.top;if(b)c.size.width=c.size.height*m.aspectRatio;c.position.top=c._helper?o.top:0}c.offset.left=c.parentData.left+c.position.left;c.offset.top=c.parentData.top+c.position.top;m=Math.abs((c._helper?c.offset.left-g.left:c.offset.left-g.left)+c.sizeDiff.width);o=Math.abs((c._helper?c.offset.top-g.top:c.offset.top-o.top)+c.sizeDiff.height);k=c.containerElement.get(0)==c.element.parent().get(0);g=/relative|absolute/.test(c.containerElement.css("position"));if(k&&g)m-=c.parentData.left;if(m+c.size.width>=c.parentData.width){c.size.width=c.parentData.width-m;if(b)c.size.height=c.size.width/c.aspectRatio}if(o+c.size.height>=c.parentData.height){c.size.height=c.parentData.height-o;if(b)c.size.width=c.size.height*c.aspectRatio}},stop:function(){var b=a(this).data("resizable"),c=b.options,m=b.containerOffset,o=b.containerPosition,k=b.containerElement,g=a(b.helper),f=g.offset(),n=g.outerWidth()-b.sizeDiff.width;g=g.outerHeight()-b.sizeDiff.height;b._helper&&!c.animate&&/relative/.test(k.css("position"))&&a(this).css({left:f.left-o.left-m.left,width:n,height:g});b._helper&&!c.animate&&/static/.test(k.css("position"))&&a(this).css({left:f.left-o.left-m.left,width:n,height:g})}});a.ui.plugin.add("resizable","ghost",{start:function(){var b=a(this).data("resizable"),c=b.options,m=b.size;b.ghost=b.originalElement.clone();b.ghost.css({opacity:0.25,display:"block",position:"relative",height:m.height,width:m.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof c.ghost=="string"?c.ghost:"");b.ghost.appendTo(b.helper)},resize:function(){var b=a(this).data("resizable");b.ghost&&b.ghost.css({position:"relative",height:b.size.height,width:b.size.width})},stop:function(){var b=a(this).data("resizable");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}});a.ui.plugin.add("resizable","grid",{resize:function(){var b=a(this).data("resizable"),c=b.options,m=b.size,o=b.originalSize,k=b.originalPosition,g=b.axis;c.grid=typeof c.grid=="number"?[c.grid,c.grid]:c.grid;var f=Math.round((m.width-o.width)/(c.grid[0]||1))*(c.grid[0]||1);c=Math.round((m.height-o.height)/(c.grid[1]||1))*(c.grid[1]||1);if(/^(se|s|e)$/.test(g)){b.size.width=o.width+f;b.size.height=o.height+c}else if(/^(ne)$/.test(g)){b.size.width=o.width+f;b.size.height=o.height+c;b.position.top=k.top-c}else{if(/^(sw)$/.test(g)){b.size.width=o.width+f;b.size.height=o.height+c}else{b.size.width=o.width+f;b.size.height=o.height+c;b.position.top=k.top-c}b.position.left=k.left-f}}});function d(b){return parseInt(b,10)||0}function j(b){return!isNaN(parseInt(b,10))}})(jQuery);(function(a){a.widget("ui.tabs",{_init:function(){if(this.options.deselectable!==undefined)this.options.collapsible=this.options.deselectable;this._tabify(true)},_setData:function(d,j){if(d=="selected")this.options.collapsible&&j==this.options.selected||this.select(j);else{this.options[d]=j;if(d=="deselectable")this.options.collapsible=j;this._tabify()}},_tabId:function(d){return d.title&&d.title.replace(/\s/g,"_").replace(/[^A-Za-z0-9\-_:\.]/g,"")||this.options.idPrefix+a.data(d)},_sanitizeSelector:function(d){return d.replace(/:/g,"\\:")},_cookie:function(){var d=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+a.data(this.list[0]));return a.cookie.apply(null,[d].concat(a.makeArray(arguments)))},_ui:function(d,j){return{tab:d,panel:j,index:this.anchors.index(d)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var d=a(this);d.html(d.data("label.tabs")).removeData("label.tabs")})},_tabify:function(d){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 j=this,b=this.options,c=/^#.+/;this.anchors.each(function(u,s){var B=a(s).attr("href"),G=B.split("#")[0],F;if(G&&(G===location.toString().split("#")[0]||(F=a("base")[0])&&G===F.href)){B=s.hash;s.href=B}if(c.test(B))j.panels=j.panels.add(j._sanitizeSelector(B));else if(B!="#"){a.data(s,"href.tabs",B);a.data(s,"load.tabs",B.replace(/#.*$/,""));B=j._tabId(s);s.href="#"+B;s=a("#"+
B);if(!s.length){s=a(b.panelTemplate).attr("id",B).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(j.panels[u-1]||j.list);s.data("destroy.tabs",true)}j.panels=j.panels.add(s)}else b.disabled.push(u)});if(d){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(b.selected===undefined){location.hash&&this.anchors.each(function(u,s){if(s.hash==location.hash){b.selected=u;return false}});if(typeof b.selected!="number"&&b.cookie)b.selected=parseInt(j._cookie(),10);if(typeof b.selected!="number"&&this.lis.filter(".ui-tabs-selected").length)b.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"));b.selected=b.selected||0}else if(b.selected===null)b.selected=-1;b.selected=b.selected>=0&&this.anchors[b.selected]||b.selected<0?b.selected:0;b.disabled=a.unique(b.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(u){return j.lis.index(u)}))).sort();a.inArray(b.selected,b.disabled)!=-1&&b.disabled.splice(a.inArray(b.selected,b.disabled),1);this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");if(b.selected>=0&&this.anchors.length){this.panels.eq(b.selected).removeClass("ui-tabs-hide");this.lis.eq(b.selected).addClass("ui-tabs-selected ui-state-active");j.element.queue("tabs",function(){j._trigger("show",null,j._ui(j.anchors[b.selected],j.panels[b.selected]))});this.load(b.selected)}a(window).bind("unload",function(){j.lis.add(j.anchors).unbind(".tabs");j.lis=j.anchors=j.panels=null})}else b.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"));this.element[b.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");b.cookie&&this._cookie(b.selected,b.cookie);d=0;for(var m;m=this.lis[d];d++)a(m)[a.inArray(d,b.disabled)!=-1&&!a(m).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");b.cache===false&&this.anchors.removeData("cache.tabs");this.lis.add(this.anchors).unbind(".tabs");if(b.event!="mouseover"){var o=function(u,s){s.is(":not(.ui-state-disabled)")&&s.addClass("ui-state-"+u)},k=function(u,s){s.removeClass("ui-state-"+u)};this.lis.bind("mouseover.tabs",function(){o("hover",a(this))});this.lis.bind("mouseout.tabs",function(){k("hover",a(this))});this.anchors.bind("focus.tabs",function(){o("focus",a(this).closest("li"))});this.anchors.bind("blur.tabs",function(){k("focus",a(this).closest("li"))})}var g,f;if(b.fx)if(a.isArray(b.fx)){g=b.fx[0];f=b.fx[1]}else g=f=b.fx;function n(u,s){u.css({display:""});a.browser.msie&&s.opacity&&u[0].style.removeAttribute("filter")}var p=f?function(u,s){a(u).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");s.hide().removeClass("ui-tabs-hide").animate(f,f.duration||"normal",function(){n(s,f);j._trigger("show",null,j._ui(u,s[0]))})}:function(u,s){a(u).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");s.removeClass("ui-tabs-hide");j._trigger("show",null,j._ui(u,s[0]))},y=g?function(u,s){s.animate(g,g.duration||"normal",function(){j.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");s.addClass("ui-tabs-hide");n(s,g);j.element.dequeue("tabs")})}:function(u,s){j.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");s.addClass("ui-tabs-hide");j.element.dequeue("tabs")};this.anchors.bind(b.event+".tabs",function(){var u=this,s=a(this).closest("li"),B=j.panels.filter(":not(.ui-tabs-hide)"),G=a(j._sanitizeSelector(this.hash));if(s.hasClass("ui-tabs-selected")&&!b.collapsible||s.hasClass("ui-state-disabled")||s.hasClass("ui-state-processing")||j._trigger("select",null,j._ui(this,G[0]))===false){this.blur();return false}b.selected=j.anchors.index(this);j.abort();if(b.collapsible)if(s.hasClass("ui-tabs-selected")){b.selected=-1;b.cookie&&j._cookie(b.selected,b.cookie);j.element.queue("tabs",function(){y(u,B)}).dequeue("tabs");this.blur();return false}else if(!B.length){b.cookie&&j._cookie(b.selected,b.cookie);j.element.queue("tabs",function(){p(u,G)});j.load(j.anchors.index(this));this.blur();return false}b.cookie&&j._cookie(b.selected,b.cookie);if(G.length){B.length&&j.element.queue("tabs",function(){y(u,B)});j.element.queue("tabs",function(){p(u,G)});j.load(j.anchors.index(this))}else throw"jQuery UI Tabs: Mismatching fragment identifier.";a.browser.msie&&this.blur()});this.anchors.bind("click.tabs",function(){return false})},destroy:function(){var d=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 j=a.data(this,"href.tabs");if(j)this.href=j;var b=a(this).unbind(".tabs");a.each(["href","load","cache"],function(c,m){b.removeData(m+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){a.data(this,"destroy.tabs")?a(this).remove():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")});d.cookie&&this._cookie(null,d.cookie)},add:function(d,j,b){if(b===undefined)b=this.anchors.length;var c=this,m=this.options;j=a(m.tabTemplate.replace(/#\{href\}/g,d).replace(/#\{label\}/g,j));d=!d.indexOf("#")?d.replace("#",""):this._tabId(a("a",j)[0]);j.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var o=a("#"+d);o.length||(o=a(m.panelTemplate).attr("id",d).data("destroy.tabs",true));o.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(b>=this.lis.length){j.appendTo(this.list);o.appendTo(this.list[0].parentNode)}else{j.insertBefore(this.lis[b]);o.insertBefore(this.panels[b])}m.disabled=a.map(m.disabled,function(k){return k>=b?++k:k});this._tabify();if(this.anchors.length==1){j.addClass("ui-tabs-selected ui-state-active");o.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){c._trigger("show",null,c._ui(c.anchors[0],c.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[b],this.panels[b]))},remove:function(d){var j=this.options,b=this.lis.eq(d).remove(),c=this.panels.eq(d).remove();if(b.hasClass("ui-tabs-selected")&&this.anchors.length>1)this.select(d+(d+1<this.anchors.length?1:-1));j.disabled=a.map(a.grep(j.disabled,function(m){return m!=d}),function(m){return m>=d?--m:m});this._tabify();this._trigger("remove",null,this._ui(b.find("a")[0],c[0]))},enable:function(d){var j=this.options;if(a.inArray(d,j.disabled)!=-1){this.lis.eq(d).removeClass("ui-state-disabled");j.disabled=a.grep(j.disabled,function(b){return b!=d});this._trigger("enable",null,this._ui(this.anchors[d],this.panels[d]))}},disable:function(d){var j=this.options;if(d!=j.selected){this.lis.eq(d).addClass("ui-state-disabled");j.disabled.push(d);j.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[d],this.panels[d]))}},select:function(d){if(typeof d=="string")d=this.anchors.index(this.anchors.filter("[href$="+d+"]"));else if(d===null)d=-1;if(d==-1&&this.options.collapsible)d=this.options.selected;this.anchors.eq(d).trigger(this.options.event+".tabs")},load:function(d){var j=this,b=this.options,c=this.anchors.eq(d)[0],m=a.data(c,"load.tabs");this.abort();if(!m||this.element.queue("tabs").length!==0&&a.data(c,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(d).addClass("ui-state-processing");if(b.spinner){var o=a("span",c);o.data("label.tabs",o.html()).html(b.spinner)}this.xhr=a.ajax(a.extend({},b.ajaxOptions,{url:m,success:function(k,g){a(j._sanitizeSelector(c.hash)).html(k);j._cleanup();b.cache&&a.data(c,"cache.tabs",true);j._trigger("load",null,j._ui(j.anchors[d],j.panels[d]));try{b.ajaxOptions.success(k,g)}catch(f){}j.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(d,j){this.anchors.eq(d).removeData("cache.tabs").data("load.tabs",j)},length:function(){return this.anchors.length}});a.extend(a.ui.tabs,{version:"1.7.2",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,j){var b=this,c=this.options,m=b._rotate||(b._rotate=function(o){clearTimeout(b.rotation);b.rotation=setTimeout(function(){var k=c.selected;b.select(++k<b.anchors.length?k:0)},d);o&&o.stopPropagation()});j=b._unrotate||(b._unrotate=!j?function(o){o.clientX&&b.rotate(null)}:function(){t=c.selected;m()});if(d){this.element.bind("tabsshow",m);this.anchors.bind(c.event+".tabs",j);m()}else{clearTimeout(b.rotation);this.element.unbind("tabsshow",m);this.anchors.unbind(c.event+".tabs",j);delete this._rotate;delete this._unrotate}}})})(jQuery);jQuery.effects||function(a){a.effects={version:"1.7.2",save:function(m,o){for(var k=0;k<o.length;k++)o[k]!==null&&m.data("ec.storage."+o[k],m[0].style[o[k]])},restore:function(m,o){for(var k=0;k<o.length;k++)o[k]!==null&&m.css(o[k],m.data("ec.storage."+o[k]))},setMode:function(m,o){if(o=="toggle")o=m.is(":hidden")?"show":"hide";return o},getBaseline:function(m,o){var k;switch(m[0]){case"top":k=0;break;case"middle":k=0.5;break;case"bottom":k=1;break;default:k=m[0]/o.height}switch(m[1]){case"left":m=0;break;case"center":m=0.5;break;case"right":m=1;break;default:m=m[1]/o.width}return{x:m,y:k}},createWrapper:function(m){if(m.parent().is(".ui-effects-wrapper"))return m.parent();var o={width:m.outerWidth(true),height:m.outerHeight(true),"float":m.css("float")};m.wrap('<div class="ui-effects-wrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');var k=m.parent();if(m.css("position")=="static"){k.css({position:"relative"});m.css({position:"relative"})}else{var g=m.css("top");if(isNaN(parseInt(g,10)))g="auto";var f=m.css("left");if(isNaN(parseInt(f,10)))f="auto";k.css({position:m.css("position"),top:g,left:f,zIndex:m.css("z-index")}).show();m.css({position:"relative",top:0,left:0})}k.css(o);return k},removeWrapper:function(m){if(m.parent().is(".ui-effects-wrapper"))return m.parent().replaceWith(m);return m},setTransition:function(m,o,k,g){g=g||{};a.each(o,function(f,n){unit=m.cssUnit(n);if(unit[0]>0)g[n]=unit[0]*k+unit[1]});return g},animateClass:function(m,o,k,g){var f=typeof k=="function"?k:g?g:null,n=typeof k=="string"?k:null;return this.each(function(){var p={},y=a(this),u=y.attr("style")||"";if(typeof u=="object")u=u.cssText;if(m.toggle)y.hasClass(m.toggle)?(m.remove=m.toggle):(m.add=m.toggle);var s=a.extend({},document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle);m.add&&y.addClass(m.add);m.remove&&y.removeClass(m.remove);var B=a.extend({},document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle);m.add&&y.removeClass(m.add);m.remove&&y.addClass(m.remove);for(var G in B)if(typeof B[G]!="function"&&B[G]&&G.indexOf("Moz")==-1&&G.indexOf("length")==-1&&B[G]!=s[G]&&(G.match(/color/i)||!G.match(/color/i)&&!isNaN(parseInt(B[G],10)))&&(s.position!="static"||s.position=="static"&&!G.match(/left|top|bottom|right/)))p[G]=B[G];y.animate(p,o,n,function(){if(typeof a(this).attr("style")=="object"){a(this).attr("style").cssText="";a(this).attr("style").cssText=u}else a(this).attr("style",u);m.add&&a(this).addClass(m.add);m.remove&&a(this).removeClass(m.remove);f&&f.apply(this,arguments)})})}};function d(m,o){var k=m[1]&&m[1].constructor==Object?m[1]:{};if(o)k.mode=o;o=m[1]&&m[1].constructor!=Object?m[1]:k.duration?k.duration:m[2];o=a.fx.off?0:typeof o==="number"?o:a.fx.speeds[o]||a.fx.speeds._default;var g=k.callback||a.isFunction(m[1])&&m[1]||a.isFunction(m[2])&&m[2]||a.isFunction(m[3])&&m[3];return[m[0],k,o,g]}a.fn.extend({_show:a.fn.show,_hide:a.fn.hide,__toggle:a.fn.toggle,_addClass:a.fn.addClass,_removeClass:a.fn.removeClass,_toggleClass:a.fn.toggleClass,effect:function(m,o,k,g){return a.effects[m]?a.effects[m].call(this,{method:m,options:o||{},duration:k,callback:g}):null},show:function(){return!arguments[0]||arguments[0].constructor==Number||/(slow|normal|fast)/.test(arguments[0])?this._show.apply(this,arguments):this.effect.apply(this,d(arguments,"show"))},hide:function(){return!arguments[0]||arguments[0].constructor==Number||/(slow|normal|fast)/.test(arguments[0])?this._hide.apply(this,arguments):this.effect.apply(this,d(arguments,"hide"))},toggle:function(){return!arguments[0]||arguments[0].constructor==Number||/(slow|normal|fast)/.test(arguments[0])||a.isFunction(arguments[0])||typeof arguments[0]=="boolean"?this.__toggle.apply(this,arguments):this.effect.apply(this,d(arguments,"toggle"))},addClass:function(m,o,k,g){return o?a.effects.animateClass.apply(this,[{add:m},o,k,g]):this._addClass(m)},removeClass:function(m,o,k,g){return o?a.effects.animateClass.apply(this,[{remove:m},o,k,g]):this._removeClass(m)},toggleClass:function(m,o,k,g){return typeof o!=="boolean"&&o?a.effects.animateClass.apply(this,[{toggle:m},o,k,g]):this._toggleClass(m,o)},morph:function(m,o,k,g,f){return a.effects.animateClass.apply(this,[{add:o,remove:m},k,g,f])},switchClass:function(){return this.morph.apply(this,arguments)},cssUnit:function(m){var o=this.css(m),k=[];a.each(["em","px","%","pt"],function(g,f){if(o.indexOf(f)>0)k=[parseFloat(o),f]});return k}});a.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(m,o){a.fx.step[o]=function(k){if(k.state==0){k.start=b(k.elem,o);k.end=j(k.end)}k.elem.style[o]="rgb("+[Math.max(Math.min(parseInt(k.pos*(k.end[0]-k.start[0])+k.start[0],10),255),0),Math.max(Math.min(parseInt(k.pos*(k.end[1]-k.start[1])+k.start[1],10),255),0),Math.max(Math.min(parseInt(k.pos*(k.end[2]-k.start[2])+k.start[2],10),255),0)].join(",")+")"}});function j(m){var o;if(m&&m.constructor==Array&&m.length==3)return m;if(o=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(m))return[parseInt(o[1],10),parseInt(o[2],10),parseInt(o[3],10)];if(o=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(m))return[parseFloat(o[1])*2.55,parseFloat(o[2])*2.55,parseFloat(o[3])*2.55];if(o=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(m))return[parseInt(o[1],16),parseInt(o[2],16),parseInt(o[3],16)];if(o=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(m))return[parseInt(o[1]+o[1],16),parseInt(o[2]+o[2],16),parseInt(o[3]+o[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(m))return c.transparent;return c[a.trim(m).toLowerCase()]}function b(m,o){var k;do{k=a.curCSS(m,o);if(k!=""&&k!="transparent"||a.nodeName(m,"body"))break;o="backgroundColor"}while(m=m.parentNode);return j(k)}var c={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};a.easing.jswing=a.easing.swing;a.extend(a.easing,{def:"easeOutQuad",swing:function(m,o,k,g,f){return a.easing[a.easing.def](m,o,k,g,f)},easeInQuad:function(m,o,k,g,f){return g*(o/=f)*o+k},easeOutQuad:function(m,o,k,g,f){return-g*(o/=f)*(o-2)+k},easeInOutQuad:function(m,o,k,g,f){if((o/=f/2)<1)return g/2*o*o+k;return-g/2*(--o*(o-2)-1)+k},easeInCubic:function(m,o,k,g,f){return g*(o/=f)*o*o+k},easeOutCubic:function(m,o,k,g,f){return g*((o=o/f-1)*o*o+1)+k},easeInOutCubic:function(m,o,k,g,f){if((o/=f/2)<1)return g/2*o*o*o+k;return g/2*((o-=2)*o*o+2)+k},easeInQuart:function(m,o,k,g,f){return g*(o/=f)*o*o*o+k},easeOutQuart:function(m,o,k,g,f){return-g*((o=o/f-1)*o*o*o-1)+k},easeInOutQuart:function(m,o,k,g,f){if((o/=f/2)<1)return g/2*o*o*o*o+k;return-g/2*((o-=2)*o*o*o-2)+k},easeInQuint:function(m,o,k,g,f){return g*(o/=f)*o*o*o*o+k},easeOutQuint:function(m,o,k,g,f){return g*((o=o/f-1)*o*o*o*o+1)+k},easeInOutQuint:function(m,o,k,g,f){if((o/=f/2)<1)return g/2*o*o*o*o*o+k;return g/2*((o-=2)*o*o*o*o+2)+k},easeInSine:function(m,o,k,g,f){return-g*Math.cos(o/f*(Math.PI/2))+g+k},easeOutSine:function(m,o,k,g,f){return g*Math.sin(o/f*(Math.PI/2))+k},easeInOutSine:function(m,o,k,g,f){return-g/2*(Math.cos(Math.PI*o/f)-1)+k},easeInExpo:function(m,o,k,g,f){return o==0?k:g*Math.pow(2,10*(o/f-1))+k},easeOutExpo:function(m,o,k,g,f){return o==f?k+g:g*(-Math.pow(2,-10*o/f)+1)+k},easeInOutExpo:function(m,o,k,g,f){if(o==0)return k;if(o==f)return k+g;if((o/=f/2)<1)return g/2*Math.pow(2,10*(o-1))+k;return g/2*(-Math.pow(2,-10*--o)+2)+k},easeInCirc:function(m,o,k,g,f){return-g*(Math.sqrt(1-(o/=f)*o)-1)+k},easeOutCirc:function(m,o,k,g,f){return g*Math.sqrt(1-(o=o/f-1)*o)+k},easeInOutCirc:function(m,o,k,g,f){if((o/=f/2)<1)return-g/2*(Math.sqrt(1-o*o)-1)+k;return g/2*(Math.sqrt(1-(o-=2)*o)+1)+k},easeInElastic:function(m,o,k,g,f){m=1.70158;var n=0,p=g;if(o==0)return k;if((o/=f)==1)return k+g;n||(n=f*0.3);if(p<Math.abs(g)){p=g;m=n/4}else m=n/(2*Math.PI)*Math.asin(g/p);return-(p*Math.pow(2,10*(o-=1))*Math.sin((o*f-m)*2*Math.PI/n))+k},easeOutElastic:function(m,o,k,g,f){m=1.70158;var n=0,p=g;if(o==0)return k;if((o/=f)==1)return k+g;n||(n=f*0.3);if(p<Math.abs(g)){p=g;m=n/4}else m=n/(2*Math.PI)*Math.asin(g/p);return p*Math.pow(2,-10*o)*Math.sin((o*f-m)*2*Math.PI/n)+g+k},easeInOutElastic:function(m,o,k,g,f){m=1.70158;var n=0,p=g;if(o==0)return k;if((o/=f/2)==2)return k+g;n||(n=f*0.3*1.5);if(p<Math.abs(g)){p=g;m=n/4}else m=n/(2*Math.PI)*Math.asin(g/p);if(o<1)return-0.5*p*Math.pow(2,10*(o-=1))*Math.sin((o*f-m)*2*Math.PI/n)+k;return p*Math.pow(2,-10*(o-=1))*Math.sin((o*f-m)*2*Math.PI/n)*0.5+g+k},easeInBack:function(m,o,k,g,f,n){if(n==undefined)n=1.70158;return g*(o/=f)*o*((n+1)*o-n)+k},easeOutBack:function(m,o,k,g,f,n){if(n==undefined)n=1.70158;return g*((o=o/f-1)*o*((n+1)*o+n)+1)+k},easeInOutBack:function(m,o,k,g,f,n){if(n==undefined)n=1.70158;if((o/=f/2)<1)return g/2*o*o*(((n*=1.525)+1)*o-n)+k;return g/2*((o-=2)*o*(((n*=1.525)+1)*o+n)+2)+k},easeInBounce:function(m,o,k,g,f){return g-a.easing.easeOutBounce(m,f-o,0,g,f)+k},easeOutBounce:function(m,o,k,g,f){return(o/=f)<1/2.75?g*7.5625*o*o+k:o<2/2.75?g*(7.5625*(o-=1.5/2.75)*o+0.75)+k:o<2.5/2.75?g*(7.5625*(o-=2.25/2.75)*o+0.9375)+k:g*(7.5625*(o-=2.625/2.75)*o+0.984375)+k},easeInOutBounce:function(m,o,k,g,f){if(o<f/2)return a.easing.easeInBounce(m,o*2,0,g,f)*0.5+k;return a.easing.easeOutBounce(m,o*2-f,0,g,f)*0.5+g*0.5+k}})}(jQuery);(function(a){a.effects.blind=function(d){return this.queue(function(){var j=a(this),b=["position","top","left"],c=a.effects.setMode(j,d.options.mode||"hide"),m=d.options.direction||"vertical";a.effects.save(j,b);j.show();var o=a.effects.createWrapper(j).css({overflow:"hidden"}),k=m=="vertical"?"height":"width";m=m=="vertical"?o.height():o.width();c=="show"&&o.css(k,0);var g={};g[k]=c=="show"?m:0;o.animate(g,d.duration,d.options.easing,function(){c=="hide"&&j.hide();a.effects.restore(j,b);a.effects.removeWrapper(j);d.callback&&d.callback.apply(j[0],arguments);j.dequeue()})})}})(jQuery);(function(a){a.effects.bounce=function(d){return this.queue(function(){var j=a(this),b=["position","top","left"],c=a.effects.setMode(j,d.options.mode||"effect"),m=d.options.direction||"up",o=d.options.distance||20,k=d.options.times||5,g=d.duration||250;/show|hide/.test(c)&&b.push("opacity");a.effects.save(j,b);j.show();a.effects.createWrapper(j);var f=m=="up"||m=="down"?"top":"left";m=m=="up"||m=="left"?"pos":"neg";o=d.options.distance||(f=="top"?j.outerHeight({margin:true})/3:j.outerWidth({margin:true})/3);if(c=="show")j.css("opacity",0).css(f,m=="pos"?-o:o);if(c=="hide")o/=k*2;c!="hide"&&k--;if(c=="show"){var n={opacity:1};n[f]=(m=="pos"?"+=":"-=")+o;j.animate(n,g/2,d.options.easing);o/=2;k--}for(n=0;n<k;n++){var p={},y={};p[f]=(m=="pos"?"-=":"+=")+o;y[f]=(m=="pos"?"+=":"-=")+o;j.animate(p,g/2,d.options.easing).animate(y,g/2,d.options.easing);o=c=="hide"?o*2:o/2}if(c=="hide"){n={opacity:0};n[f]=(m=="pos"?"-=":"+=")+o;j.animate(n,g/2,d.options.easing,function(){j.hide();a.effects.restore(j,b);a.effects.removeWrapper(j);d.callback&&d.callback.apply(this,arguments)})}else{p={};y={};p[f]=(m=="pos"?"-=":"+=")+o;y[f]=(m=="pos"?"+=":"-=")+o;j.animate(p,g/2,d.options.easing).animate(y,g/2,d.options.easing,function(){a.effects.restore(j,b);a.effects.removeWrapper(j);d.callback&&d.callback.apply(this,arguments)})}j.queue("fx",function(){j.dequeue()});j.dequeue()})}})(jQuery);(function(a){a.effects.clip=function(d){return this.queue(function(){var j=a(this),b=["position","top","left","height","width"],c=a.effects.setMode(j,d.options.mode||"hide"),m=d.options.direction||"vertical";a.effects.save(j,b);j.show();var o=a.effects.createWrapper(j).css({overflow:"hidden"});o=j[0].tagName=="IMG"?o:j;var k={size:m=="vertical"?"height":"width",position:m=="vertical"?"top":"left"};m=m=="vertical"?o.height():o.width();if(c=="show"){o.css(k.size,0);o.css(k.position,m/2)}var g={};g[k.size]=c=="show"?m:0;g[k.position]=c=="show"?0:m/2;o.animate(g,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){c=="hide"&&j.hide();a.effects.restore(j,b);a.effects.removeWrapper(j);d.callback&&d.callback.apply(j[0],arguments);j.dequeue()}})})}})(jQuery);(function(a){a.effects.drop=function(d){return this.queue(function(){var j=a(this),b=["position","top","left","opacity"],c=a.effects.setMode(j,d.options.mode||"hide"),m=d.options.direction||"left";a.effects.save(j,b);j.show();a.effects.createWrapper(j);var o=m=="up"||m=="down"?"top":"left";m=m=="up"||m=="left"?"pos":"neg";var k=d.options.distance||(o=="top"?j.outerHeight({margin:true})/2:j.outerWidth({margin:true})/2);if(c=="show")j.css("opacity",0).css(o,m=="pos"?-k:k);var g={opacity:c=="show"?1:0};g[o]=(c=="show"?m=="pos"?"+=":"-=":m=="pos"?"-=":"+=")+k;j.animate(g,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){c=="hide"&&j.hide();a.effects.restore(j,b);a.effects.removeWrapper(j);d.callback&&d.callback.apply(this,arguments);j.dequeue()}})})}})(jQuery);(function(a){a.effects.explode=function(d){return this.queue(function(){var j=d.options.pieces?Math.round(Math.sqrt(d.options.pieces)):3,b=d.options.pieces?Math.round(Math.sqrt(d.options.pieces)):3;d.options.mode=d.options.mode=="toggle"?a(this).is(":visible")?"hide":"show":d.options.mode;var c=a(this).show().css("visibility","hidden"),m=c.offset();m.top-=parseInt(c.css("marginTop"),10)||0;m.left-=parseInt(c.css("marginLeft"),10)||0;for(var o=c.outerWidth(true),k=c.outerHeight(true),g=0;g<j;g++)for(var f=0;f<b;f++)c.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-f*(o/b),top:-g*(k/j)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:o/b,height:k/j,left:m.left+f*(o/b)+(d.options.mode=="show"?(f-Math.floor(b/2))*(o/b):0),top:m.top+g*(k/j)+(d.options.mode=="show"?(g-Math.floor(j/2))*(k/j):0),opacity:d.options.mode=="show"?0:1}).animate({left:m.left+f*(o/b)+(d.options.mode=="show"?0:(f-Math.floor(b/2))*(o/b)),top:m.top+
g*(k/j)+(d.options.mode=="show"?0:(g-Math.floor(j/2))*(k/j)),opacity:d.options.mode=="show"?1:0},d.duration||500);setTimeout(function(){d.options.mode=="show"?c.css({visibility:"visible"}):c.css({visibility:"visible"}).hide();d.callback&&d.callback.apply(c[0]);c.dequeue();a("div.ui-effects-explode").remove()},d.duration||500)})}})(jQuery);(function(a){a.effects.fold=function(d){return this.queue(function(){var j=a(this),b=["position","top","left"],c=a.effects.setMode(j,d.options.mode||"hide"),m=d.options.size||15,o=!!d.options.horizFirst,k=d.duration?d.duration/2:a.fx.speeds._default/2;a.effects.save(j,b);j.show();var g=a.effects.createWrapper(j).css({overflow:"hidden"}),f=c=="show"!=o,n=f?["width","height"]:["height","width"];f=f?[g.width(),g.height()]:[g.height(),g.width()];var p=/([0-9]+)%/.exec(m);if(p)m=parseInt(p[1],10)/100*f[c=="hide"?0:1];if(c=="show")g.css(o?{height:0,width:m}:{height:m,width:0});o={};p={};o[n[0]]=c=="show"?f[0]:m;p[n[1]]=c=="show"?f[1]:0;g.animate(o,k,d.options.easing).animate(p,k,d.options.easing,function(){c=="hide"&&j.hide();a.effects.restore(j,b);a.effects.removeWrapper(j);d.callback&&d.callback.apply(j[0],arguments);j.dequeue()})})}})(jQuery);(function(a){a.effects.highlight=function(d){return this.queue(function(){var j=a(this),b=["backgroundImage","backgroundColor","opacity"],c=a.effects.setMode(j,d.options.mode||"show"),m=d.options.color||"#ffff99",o=j.css("backgroundColor");a.effects.save(j,b);j.show();j.css({backgroundImage:"none",backgroundColor:m});m={backgroundColor:o};if(c=="hide")m.opacity=0;j.animate(m,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){c=="hide"&&j.hide();a.effects.restore(j,b);c=="show"&&a.browser.msie&&this.style.removeAttribute("filter");d.callback&&d.callback.apply(this,arguments);j.dequeue()}})})}})(jQuery);(function(a){a.effects.pulsate=function(d){return this.queue(function(){var j=a(this),b=a.effects.setMode(j,d.options.mode||"show"),c=d.options.times||5,m=d.duration?d.duration/2:a.fx.speeds._default/2;b=="hide"&&c--;if(j.is(":hidden")){j.css("opacity",0);j.show();j.animate({opacity:1},m,d.options.easing);c-=2}for(var o=0;o<c;o++)j.animate({opacity:0},m,d.options.easing).animate({opacity:1},m,d.options.easing);b=="hide"?j.animate({opacity:0},m,d.options.easing,function(){j.hide();d.callback&&d.callback.apply(this,arguments)}):j.animate({opacity:0},m,d.options.easing).animate({opacity:1},m,d.options.easing,function(){d.callback&&d.callback.apply(this,arguments)});j.queue("fx",function(){j.dequeue()});j.dequeue()})}})(jQuery);(function(a){a.effects.puff=function(d){return this.queue(function(){var j=a(this),b=a.extend(true,{},d.options),c=a.effects.setMode(j,d.options.mode||"hide"),m=parseInt(d.options.percent,10)||150;b.fade=true;var o={height:j.height(),width:j.width()},k=m/100;j.from=c=="hide"?o:{height:o.height*k,width:o.width*k};b.from=j.from;b.percent=c=="hide"?m:100;b.mode=c;j.effect("scale",b,d.duration,d.callback);j.dequeue()})};a.effects.scale=function(d){return this.queue(function(){var j=a(this),b=a.extend(true,{},d.options),c=a.effects.setMode(j,d.options.mode||"effect"),m=parseInt(d.options.percent,10)||(parseInt(d.options.percent,10)==0?0:c=="hide"?0:100),o=d.options.direction||"both",k=d.options.origin;if(c!="effect"){b.origin=k||["middle","center"];b.restore=true}k={height:j.height(),width:j.width()};j.from=d.options.from||(c=="show"?{height:0,width:0}:k);m={y:o!="horizontal"?m/100:1,x:o!="vertical"?m/100:1};j.to={height:k.height*m.y,width:k.width*m.x};if(d.options.fade){if(c=="show"){j.from.opacity=0;j.to.opacity=1}if(c=="hide"){j.from.opacity=1;j.to.opacity=0}}b.from=j.from;b.to=j.to;b.mode=c;j.effect("size",b,d.duration,d.callback);j.dequeue()})};a.effects.size=function(d){return this.queue(function(){var j=a(this),b=["position","top","left","width","height","overflow","opacity"],c=["position","top","left","overflow","opacity"],m=["width","height","overflow"],o=["fontSize"],k=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],g=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],f=a.effects.setMode(j,d.options.mode||"effect"),n=d.options.restore||false,p=d.options.scale||"both",y=d.options.origin,u={height:j.height(),width:j.width()};j.from=d.options.from||u;j.to=d.options.to||u;if(y){y=a.effects.getBaseline(y,u);j.from.top=(u.height-j.from.height)*y.y;j.from.left=(u.width-j.from.width)*y.x;j.to.top=(u.height-j.to.height)*y.y;j.to.left=(u.width-j.to.width)*y.x}var s={from:{y:j.from.height/u.height,x:j.from.width/u.width},to:{y:j.to.height/u.height,x:j.to.width/u.width}};if(p=="box"||p=="both"){if(s.from.y!=s.to.y){b=b.concat(k);j.from=a.effects.setTransition(j,k,s.from.y,j.from);j.to=a.effects.setTransition(j,k,s.to.y,j.to)}if(s.from.x!=s.to.x){b=b.concat(g);j.from=a.effects.setTransition(j,g,s.from.x,j.from);j.to=a.effects.setTransition(j,g,s.to.x,j.to)}}if(p=="content"||p=="both")if(s.from.y!=s.to.y){b=b.concat(o);j.from=a.effects.setTransition(j,o,s.from.y,j.from);j.to=a.effects.setTransition(j,o,s.to.y,j.to)}a.effects.save(j,n?b:c);j.show();a.effects.createWrapper(j);j.css("overflow","hidden").css(j.from);if(p=="content"||p=="both"){k=k.concat(["marginTop","marginBottom"]).concat(o);g=g.concat(["marginLeft","marginRight"]);m=b.concat(k).concat(g);j.find("*[width]").each(function(){child=a(this);n&&a.effects.save(child,m);var B={height:child.height(),width:child.width()};child.from={height:B.height*s.from.y,width:B.width*s.from.x};child.to={height:B.height*s.to.y,width:B.width*s.to.x};if(s.from.y!=s.to.y){child.from=a.effects.setTransition(child,k,s.from.y,child.from);child.to=a.effects.setTransition(child,k,s.to.y,child.to)}if(s.from.x!=s.to.x){child.from=a.effects.setTransition(child,g,s.from.x,child.from);child.to=a.effects.setTransition(child,g,s.to.x,child.to)}child.css(child.from);child.animate(child.to,d.duration,d.options.easing,function(){n&&a.effects.restore(child,m)})})}j.animate(j.to,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){f=="hide"&&j.hide();a.effects.restore(j,n?b:c);a.effects.removeWrapper(j);d.callback&&d.callback.apply(this,arguments);j.dequeue()}})})}})(jQuery);(function(a){a.effects.shake=function(d){return this.queue(function(){var j=a(this),b=["position","top","left"];a.effects.setMode(j,d.options.mode||"effect");var c=d.options.direction||"left",m=d.options.distance||20,o=d.options.times||3,k=d.duration||d.options.duration||140;a.effects.save(j,b);j.show();a.effects.createWrapper(j);var g=c=="up"||c=="down"?"top":"left",f=c=="up"||c=="left"?"pos":"neg";c={};var n={},p={};c[g]=(f=="pos"?"-=":"+=")+m;n[g]=(f=="pos"?"+=":"-=")+m*2;p[g]=(f=="pos"?"-=":"+=")+
m*2;j.animate(c,k,d.options.easing);for(m=1;m<o;m++)j.animate(n,k,d.options.easing).animate(p,k,d.options.easing);j.animate(n,k,d.options.easing).animate(c,k/2,d.options.easing,function(){a.effects.restore(j,b);a.effects.removeWrapper(j);d.callback&&d.callback.apply(this,arguments)});j.queue("fx",function(){j.dequeue()});j.dequeue()})}})(jQuery);(function(a){a.effects.slide=function(d){return this.queue(function(){var j=a(this),b=["position","top","left"],c=a.effects.setMode(j,d.options.mode||"show"),m=d.options.direction||"left";a.effects.save(j,b);j.show();a.effects.createWrapper(j).css({overflow:"hidden"});var o=m=="up"||m=="down"?"top":"left";m=m=="up"||m=="left"?"pos":"neg";var k=d.options.distance||(o=="top"?j.outerHeight({margin:true}):j.outerWidth({margin:true}));if(c=="show")j.css(o,m=="pos"?-k:k);var g={};g[o]=(c=="show"?m=="pos"?"+=":"-=":m=="pos"?"-=":"+=")+k;j.animate(g,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){c=="hide"&&j.hide();a.effects.restore(j,b);a.effects.removeWrapper(j);d.callback&&d.callback.apply(this,arguments);j.dequeue()}})})}})(jQuery);(function(a){a.effects.transfer=function(d){return this.queue(function(){var j=a(this),b=a(d.options.to),c=b.offset();b={top:c.top,left:c.left,height:b.innerHeight(),width:b.innerWidth()};c=j.offset();var m=a('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(d.options.className).css({top:c.top,left:c.left,height:j.innerHeight(),width:j.innerWidth(),position:"absolute"}).animate(b,d.duration,d.options.easing,function(){m.remove();d.callback&&d.callback.apply(j[0],arguments);j.dequeue()})})}})(jQuery);$(document).ready(function(){$.loovrs.config.init()});$.extend({loovrs:{tabs:{init:function(){$("div#tabs").tabs({cache:true,show:function(a,d){$("body:not(.hide)").attr("class",$.loovrs.tabs.bodyClasses[d.index]);$("div#tabs.ui-tabs ul.ui-tabs-nav li#tab1").addClass($.loovrs.tabs.lookingforClass);$("div#tabs.ui-tabs ul.ui-tabs-nav li#tab6").addClass($.loovrs.tabs.imClass);$(document).trigger("tabSelected",d)}});$("div#profile_tabs").tabs({cache:true,fx:{width:"toggle",duration:"fast"},show:function(a,d){$(document).trigger("tabSelected",d)},load:function(a,d){switch(d.index){case 0:$.loovrs.tabs.sixth.profileTabs.yourData.init();break}}})},bodyClasses:["girlsboys"],imClass:"",lookingforClass:"",setTabsSexClasses:function(){var a=$.loovrs.user.me,d=a.sex_id?$.loovrs.user.me.sex_id:3;a=a.lookingfor_id?a.lookingfor_id:3;var j,b=["","imboy","imgirl","girlsboys"],c=["","boys","girls","girlsboys"];$.loovrs.tabs.imClass=b[d];$.loovrs.tabs.lookingforClass=c[a];switch(a){case 1:j=$.loovrs.I18n.t("tabs.tab1-boys");break;case 2:j=$.loovrs.I18n.t("tabs.tab1-girls");break;case 3:j=$.loovrs.I18n.t("tabs.tab1");break}$.loovrs.tabs.bodyClasses=[$.loovrs.tabs.lookingforClass,"pictures",$.loovrs.tabs.imClass];d=$.loovrs.tabs.lookingforClass;if($.loovrs.tabs.first.selected())d=$.loovrs.tabs.lookingforClass;else if($.loovrs.tabs.sixth.selected())d=$.loovrs.tabs.imClass;$("body").attr("class",null).addClass(d);$("div#tabs ul li#tab1").removeClass("boys girls girlsboys").addClass($.loovrs.tabs.lookingforClass).find("a").html(j);$("div#tabs ul li#tab6").removeClass("imboy imgirl").addClass($.loovrs.tabs.imClass)}}}});$.extend($.loovrs,{images:{boygirl:{1:"/images/icons/ico_boy.png",2:"/images/icons/ico_girl.png"},mapMarkers:{1:"/images/icons/ico_map_marker_boy.png",2:"/images/icons/ico_map_marker_girl.png"},uploadImages:{1:"/images/icons/ico_upload_image_boy.png",2:"/images/icons/ico_upload_image_girl.png"},heart:"/images/extra/heart.png"}});$.extend($.loovrs,{I18n:{translations:{},init:function(){$.loovrs.I18n.translations=TRANSLATIONS},getTranslations:function(a){$.loovrs.request.getJSON("/home/get_translations",{},function(d){if(d){$.loovrs.I18n.translations=d;!a||a()}})},getLanguage:function(){if(!$.loovrs.I18n.translations.locale||$.loovrs.I18n.translations.locale.length<2)return"";return $.loovrs.I18n.translations.locale.substr(0,2)},he_she:function(a){if(!a||!a.sex_id||!$.loovrs.I18n.translations)return"";return $.loovrs.I18n.translations.i18n_aux.pronouns.personal.tonic.third_person[a.sex_id]},t:function(a,d){for(var j=a.split("."),b=$.loovrs.I18n.translations,c=0;c<j.length;c++){a=j[c];if(!b)return null;b=b[a]}b=b||{};return a=typeof b=="string"?$.loovrs.I18n.interpolate(b,d):b},interpolate:function(a,d){if(!d||$.isEmpty(d))return a;for(x in d)if(x&&d[x])a=a.replace("{{"+x+"}}",d[x]);return a}}});$.extend($.loovrs,{user:{init:function(a){if(a)$.loovrs.user.me=a;$.loovrs.user.imLogged()?$.loovrs.user.logsIn($.loovrs.user.me):$.loovrs.user.logsOut()},me:{},setMe:function(a){$.loovrs.user.me=a;$.loovrs.user.me.image=$.loovrs.images.boygirl[$.loovrs.user.me.sex_id]},getMe:function(a){$.loovrs.request.get("/home/get_me",{},function(d){d=$.isEmpty(d)?{}:d.user;$.loovrs.user.setMe(d);!a||a()})},isMe:function(a){return a&&$.loovrs.user.me&&a.id==$.loovrs.user.me.id&&a.name==$.loovrs.user.me.name},imLogged:function(){if((me=$.loovrs.user.me)&&!$.isEmpty(me)&&me.id&&me.id>0)return true;return false},inMyFavourites:function(a){return $("div#toolbar div.button.bookmarks div.list div."+a).length>0},inMyLoovrs:function(a){return $("div#toolbar div.button.loovrs div.list div."+a).length>0},logsIn:function(a,d){var j={reload_tabs:false};d=$.extend(j,d);$.loovrs.user.setMe(a);$.loovrs.comet.connect();$.loovrs.general.sound.init();$.loovrs.tabs.sixth.enable(d.reload_tabs)},logsOut:function(){$("div#toolbar div.login div.loginContainer div.input.userContainer input").focus();$.loovrs.comet.unsubscribeAll();$.loovrs.tabs.sixth.disable();$.loovrs.toolbar.userActions.clearLists();$.loovrs.chat.closeAll();$.loovrs.user.me={}},loginFromForm:function(){$(document).trigger("me_logs_in");$("div#banner div.ads.container").fadeOut(800);$.loovrs.tabs.setTabsSexClasses()},logoutFromLink:function(){$(document).trigger("me_logs_out");$("div#banner div.ads.container").fadeOut(800);$.loovrs.tabs.first.rename($.loovrs.I18n.t("tabs.tab1"));$.loovrs.tabs.setTabsSexClasses();$.loovrs.chat.historics={}},getMapMarker:function(){if(!$.loovrs.user.imLogged())return null;return $.loovrs.images.mapMarkers[$.loovrs.user.me.sex_id]},possessive:function(){return $.loovrs.I18n.t("i18n_aux.pronouns.possessive.third_person.singular")[$.loovrs.user.me.sex_id]}}});$.extend($.loovrs,{request:{get:function(a,d,j,b,c){c=c||"json";if(jQuery.isFunction(d)){j=d;d=null}return jQuery.ajax({type:"GET",url:a,data:d,success:j,error:function(m){!b||b($.loovrs.request.getResponse(m,c))},dataType:c})},getJSON:function(a,d,j,b){$.loovrs.request.get(a,d,j,b)},getHTML:function(a,d,j,b){$.loovrs.request.get(a,d,j,b,"html")},post:function(a,d,j,b,c){c=c||"json";if(jQuery.isFunction(d)){j=d;d=null}d=$.loovrs.request.addAuthToken(d);return jQuery.ajax({type:"POST",url:a,data:d,success:j,error:function(m){!b||b($.loovrs.request.getResponse(m,c))},dataType:c})},put:function(a,d,j,b,c){c=c||"json";if(jQuery.isFunction(d)){j=d;d={}}d=$.loovrs.request.addAuthToken(d);return jQuery.ajax({type:"PUT",url:a,data:d,success:j,error:function(m){!b||b($.loovrs.request.getResponse(m,c))},dataType:c})},del:function(a,d,j,b,c){c=c||"json";if(jQuery.isFunction(d)){j=d;d={}}d=$.loovrs.request.addAuthToken(d);return jQuery.ajax({type:"DELETE",url:a,data:d,success:j,error:function(m){!b||b($.loovrs.request.getResponse(m,c))},dataType:c})},addAuthToken:function(a){if(typeof a=="string"&&!a.match("authenticity_token")){if(a&&a.length>0)a+="&";a+="authenticity_token="+AUTHENTICITY_TOKEN}else if(typeof a=="object"&&!a.authenticity_token)a.authenticity_token=decodeURIComponent(AUTHENTICITY_TOKEN);return a},getTokens:function(){$.loovrs.request.getJSON("/home/get_security_tokens",{},function(a){AUTHENTICITY_TOKEN=a.authenticity_token;SESSION_ID=a.session_id},function(){$.loovrs.request.getTokens()})},getResponse:function(a,d){d=d||"json";var j=null;if(a&&$.trim(a.responseText))if(d=="json"||d=="jsonp")try{j=eval("("+a.responseText+")")}catch(b){debug("Error parsing ajax response. Invalid json data format.",b)}else j=a.responseText;return j}}});window.onbeforeunload=function(){$.loovrs.comet.disconnect();$.loovrs.user.imLogged()&&$.ajax({url:"/users/log_out",async:false});GUnload()};$.extend($.loovrs,{general:{init:function(){$.loovrs.general.events();$.loovrs.general.scroll.init()},events:function(){$("a.target.new").live("click",function(a){a.preventDefault();a=$(this).attr("href");if(!a||!$.trim(a)||a=="#")return false;window.open(a);return false})},getLocationAnchor:function(){var a=window.location.href,d={user:null,picture:null};if(a.match("/users/"))d.user=true;else if(a.match("/pictures/"))d.picture=true;return d},checkFlashMessages:function(){var a=document.createElement("div");if($("body div#flash_error").length==1){a=$(a).addClass("flash").html($("body div#flash_error").html());$("body").popup().show(a,{convertNLtoBR:false,onHide:$.loovrs.toolbar.login.focus});$("body div#flash_error").remove()}else if($("body div#flash_notice").length==1){a=$(a).addClass("flash").html($("body div#flash_notice").html());$("body").popup().show(a,{convertNLtoBR:false,onHide:$.loovrs.toolbar.login.focus});$("body div#flash_notice").remove()}else if($("body form#change_password_form").length==1){$("body").popup().show($("body form#change_password_form").show(),{convertNLtoBR:false,main_class:"reset_password",onHide:$.loovrs.toolbar.login.focus});$("form#change_password_form").submit($.loovrs.toolbar.login.submitResetPwdActivateForm)}},addInterestedVisitor:function(a){$("div.img",$($($.loovrs.config.templates.interested_visitor.clone()).fill(a)).appendTo($("div#tabs div#banner")).show("slide",{direction:"left"},300)).css({backgroundImage:"url("+a.picture+")"});addNotification(false,a.name+"-"+a.action)},scroll:{init:function(){$(window).scroll(function(){clearTimeout(this.timeout);var a=$(this).scrollTop();$.loovrs.general.scroll.previousScroll=$.loovrs.general.scroll.previousScroll?$.loovrs.general.scroll.previousScroll:0;a>$.loovrs.general.scroll.previousScroll&&$(document).height()-a<1000&&$(document).trigger("get_people");this.timeout=setTimeout(function(){$.loovrs.tabs.sixth.profileTabs.yourData.placeButton("button#update_data",100,267,a);$.loovrs.tabs.sixth.profileTabs.yourData.placeButton("button#delete_account",161,54,a);$.loovrs.tabs.sixth.profileTabs.yourPhotos.placeButton("button.edit.upload",114,267,a);$.loovrs.tabs.sixth.profileTabs.yourPhotos.placeButton("button.edit.select_face",170,210,a);$.loovrs.tabs.sixth.profileTabs.yourPhotos.placeButton("button.edit.profile",226,154,a);$.loovrs.tabs.sixth.profileTabs.yourPhotos.placeButton("button.edit.delete",326,54,a)},250);$.loovrs.general.scroll.previousScroll=a})}},sound:{init:function(){soundManager.onready(function(a){if(a.success)$.loovrs.chat.messsageReceivedSound=soundManager.createSound({id:"messsageReceivedSound",url:"/sounds/chat.message.mp3"})})}},counter:{addOne:function(){var a=parseInt($("div#counter span").text())+1;$.loovrs.general.counter.updateCounter(a)},substractOne:function(){var a=parseInt($("div#counter span").text())-1;$.loovrs.general.counter.updateCounter(a)},updateCounter:function(a){function d(p,y,u,s,B){return $.easing[B||($.easing.swing?"swing":"linear")](null,y,0,1,s)*u}function j(p,y,u){y=y||"X";var s=$("span."+y,p);if(!s||s.length<=0){s=$(document.createElement("span")).addClass(y).addClass("down").prependTo(p.find("div.numbers"));s.animate({top:"-1px"},u).removeClass("down")}s.animate({top:"-2em"},u,function(){var B=s.text()?parseInt(s.text())+1:0;if(B==10){B=0;j(p,y+"X",u)}$(this).html(B)}).animate({top:"2em"},0).animate({top:"-1px"},u)}function b(p,y,u){y=y||"X";var s=$("span."+y,p);strNumber=s.text();s.length!=0&&s.animate({top:"2em"},u,function(){var B=strNumber?parseInt(strNumber)-1:0;if(B<0){B=9;b(p,y+"X",u)}$(this).html(B)}).animate({top:"-2em"},0).animate({top:"-1px"},u)}var c=parseInt($("div#counter span").text()),m=a-c,o=100,k=+new Date;m=m*o*2;var g=o;if(c<a)for(;c<a;){try{j($("div#counter"),"X",d(k,g,o,m,"easeInOutCirc"));g+=o*2}catch(f){debug(f)}c++}else if(c>a)for(;c>a;){try{b($("div#counter"),"X",d(k,g,o,m,"easeInOutCirc"));g+=o*2}catch(n){debug(n)}c--}}}}});$.extend($.loovrs,{data:{initData:{},peopleList:[],chats:[],init:function(){$.loovrs.data.events()},events:function(){$(document).bind("get_people",function(){if($.loovrs.tabs.first.list.visible()||$.loovrs.tabs.second.list.visible())$(this).hasClass("search")?$.loovrs.toolbar.search.loadMoreResults():$.loovrs.data.loadData({next_page:true})})},getPeople:function(a,d){d=$.isFunction(a)?a:d;a=$.isFunction(a)?{}:a;a=$.extend({},a);if(a.clear){delete a.clear;$.loovrs.data.peopleList=[]}$.loovrs.request.getJSON("/users",a,function(j){if(j){$.merge($.loovrs.data.peopleList,j);!d||d(j)}})},actual_page:0,loadData:function(a,d){if(!$.loovrs.data.loadingPeople){var j=$.loovrs.config.templates.loader_template.clone();a=a||{};var b=a.clear;if(a.next_page){$.loovrs.data.actual_page++;delete a.next_page}$.loovrs.data.loadingPeople=true;if(a.keywords)$.loovrs.data.search_keywords=a.keywords;if(b){$("div#tabs-1 div.list div.people,div#thumbs_list").empty();$(document).trigger("clear_people")}$("div#tabs-1 div.list div.people,div#thumbs_list").append(j);a=$.extend({page:$.loovrs.data.actual_page,keywords:$.loovrs.data.search_keywords},a||{});$.loovrs.data.getPeople(a,function(c){d&&d();$("div#tabs-1 div.list div.people,div#thumbs_list").find("div.loader").remove();$(document).trigger("load_people",{people:c});$.loovrs.tabs.first.addPeople(c);$.loovrs.tabs.second.addPhotos(c);$.loovrs.data.loadingPeople=false})}},resetData:function(a){delete $.loovrs.data.search_keywords;$.loovrs.data.actual_page=0;$.loovrs.data.loadData({clear:true},a)},getPersonDetailData:function(a,d){if(a){var j=$.loovrs.data.getUserById(a);if(j&&j.id)!d||d(j);else $.loovrs.request.get("/users/"+a,{},d)}},getUserById:function(a){for(var d=$.loovrs.data.peopleList.length-1;d>=0;d--){var j=$.loovrs.data.peopleList[d];if(j&&j.user&&j.user.id==a)return j.user}return null},getUserThumbnail:function(a){var d=$.loovrs.images.boygirl[a.sex_id],j;if(a.profile_image&&a.profile_image.thumbnail)d="/images/"+a.profile_image.id+"?name="+a.profile_image.thumbnail;else if(a.images)for(var b=0;b<a.images.length;b++)if((j=a.images[b])&&j.thumbnail)d="/images/"+j.id+"?name="+j.thumbnail;return d},api:{lastfm:{api_key:"9c003de915f205e3228c2b396a50b9fa",api_url:"http://ws.audioscrobbler.com/2.0/",searchAlbum:function(a,d,j){this.lastFmQuery({method:"album.search",album:a,format:"json",api_key:this.api_key},d,j)},searchArtist:function(a,d,j){this.lastFmQuery({method:"artist.search",artist:a,format:"json",api_key:this.api_key},d,j)},searchSong:function(a,d,j,b){this.lastFmQuery({method:"track.search",artist:a,track:d,format:"json",api_key:this.api_key},j,b)},getTopTags:function(a){this.lastFmQuery({method:"tag.getTopTags",api_key:this.api_key},a)},lastFmQuery:function(a,d,j){try{!j||j.loading();$.ajax({url:this.api_url,cache:true,data:a,success:function(c){!j||j.stopLoading();d(c)},dataType:"jsonp",error:function(c){j.stopLoading();debug("error",c)}})}catch(b){debug(b)}}},partigi:{searchMovie:function(a,d,j){$.loovrs.request.getJSON("/movie/search",{"movie[title]":a},d,j)}}}}});$.extend($.loovrs,{config:{init:function(){$.loovrs.I18n.init();if(isIE(6))e("/images/ie6-warning/",$.loovrs.I18n.t("ie6_warning"));else{$("body").removeClass("noscript").find("noscript").remove();$(document).bind("updatePreloadState",$.loovrs.config.updatePreloadState);$.loovrs.config.preloading();$.loovrs.config.start()}},init_modules:function(){$.loovrs.comet.init();$.loovrs.tabs.init();$.loovrs.user.init(ME);$.loovrs.data.init();$.loovrs.general.init();$.loovrs.toolbar.init();var a=$.loovrs.general.getLocationAnchor();$.loovrs.tabs.first.init();$.loovrs.tabs.second.init(a.picture);$.loovrs.tabs.sixth.init();$.loovrs.footer.init()},preloading:function(){$(document).trigger("updatePreloadState",{type:"translations"});$.loovrs.config.preloadTemplates();$.loovrs.config.init_modules();$.loovrs.data.loadData({})},loadIntro:function(){var a=this;$("div#intro").fadeIn(800).find("img#heart").animate({width:"32px",height:"30px",marginLeft:-12,marginTop:-32},600,"easeInExpo").animate({width:"16px",height:"15px",marginLeft:-6,margintop:-16},200,function(){a.loadIntro()})},preloadImages:function(){$.each(arguments,function(a,d){$(new Image).loadImage(d)})},templates:{loader_template:"div#templates div#loader_template",persons_list_item:"div#templates div#person_list_item_template",photo:"div#templates div#photo_template",signup_form:"div#templates div#signup_form_template",send_reset_password_form_template:"div#templates div#send_reset_password_form_template",send_resend_activation_form_template:"div#templates div#send_resend_activation_form_template",interested_visitor:"div#templates div#interested_visitor_template",chat:"div#templates div#chat_template",person_tiny:"div#templates div#person_tiny_template",profile_thumbnails:"div#templates div#profile_thumbnails",tooltip:"div#templates div#tooltip",profile_like_music_album:"div#templates div#profile_like_music_album",profile_like_music_artist:"div#templates div#profile_like_music_artist",profile_like_music_genre:"div#templates div#profile_like_music_genre",profile_like_music_song:"div#templates div#profile_like_music_song",profile_like_movie_title:"div#templates div#profile_like_movie_title",profile_like_movie_genre:"div#templates div#profile_like_movie_genre",profile_like_other:"div#templates div#profile_like_other",confirm_profile_delete:"div#templates div#confirm_profile_delete",confirm_again_profile_delete:"div#templates div#confirm_again_profile_delete",confirm_upload_ending:"div#templates div#confirm_upload_ending",confirm_delete_image:"div#templates div#confirm_delete_image",confirm_profile_image:"div#templates div#confirm_profile_image",upload_message:"div#templates div#upload_message",newmail_template:"div#templates div#newmail_template"},preloadTemplates:function(){$.each($.loovrs.config.templates,function(a,d){$.loovrs.config.templates[a]=$(d).comments().children()})},preloadItemsLoaded:{templates:false,data:false},updatePreloadState:function(a,d){$.loovrs.config.preloadItemsLoaded[d.type]=true;$.loovrs.config.isPreloadComplete()},isPreloadComplete:function(){return $.loovrs.config.preloadItemsLoaded.templates&&$.loovrs.config.preloadItemsLoaded.data},start:function(){$("div#intro img#heart").stop(true,true);$.loovrs.tabs.setTabsSexClasses();$("body div#intro").remove();$.loovrs.general.checkFlashMessages()}}});$.extend($.loovrs,{toolbar:{init:function(){$("div#toolbar div.loovrs, div#toolbar div.bookmarks, div#toolbar div.mails, div#toolbar div.chats").live("mouseover",function(){$(this).addClass("hover")}).live("mouseout",function(){$(this).hasClass("clicked")||$(this).removeClass("hover")});$("div#toolbar div.signupContainer").live("mouseover",function(){$(this).toggleClass("hover")}).live("mouseout",function(){$(this).toggleClass("hover")});$.loovrs.toolbar.signup.init();$.loovrs.toolbar.login.init();$.loovrs.toolbar.search.init();$.loovrs.toolbar.userActions.init()},signup:{init:function(){$("div#toolbar div.signup div.signupContainer").live("click",function(a){a.preventDefault();$("div#signupSuccess").hide();$("div#signupForm form#signup_form").show();$(this).popup().show($.loovrs.config.templates.signup_form,{convertNLtoBR:false,center_vertical:false,main_class:"signup",postDOM:function(){$.loovrs.toolbar.signup.reset();$("form#signup_form").submit(function(d){d.preventDefault();var j=this;$.loader("post",j.action,$(this).serialize(),function(b){$("div#signupSuccess div.success strong").html(b.user.name);$("div#signupForm div.scroll").animate({left:"-36.75em"},800,"easeInOutCirc");$.loovrs.general.counter.addOne();$.loovrs.toolbar.login.loginCallback(b)},function(b){$("ul.hint li.error",$(j)).remove();valid=$.loovrs.toolbar.signup.showSignupFormErrors(b)},$("div#signupForm form#signup_form button.submit"),true)});$("input#singup_user_name").focus().livesearch({searchCallback:function(){var d=$("input#singup_user_name");$.loader("get","/users/check_name",{name:d.val()},function(j){if(!j||$.isEmpty(j))$("div.name ul.hint li.error",$("form#signup_form")).remove()},$.loovrs.toolbar.signup.showSignupFormErrors,d,true)},queryDelay:400,minimumSearchLength:3});$("div#signupForm div.password input#signup_user_random_password").click(function(){var d=$("div#signupForm div.password div.textboxes");this.checked?d.hide("blind",500,{direction:"up"}):d.show("blind",500,{direction:"up"},function(){$("input#signup_user_password").focus()})})},onShow:function(){$("input#singup_user_name").focus()}})})},showSignup:function(){$("div#toolbar div.signup div.signupContainer").fadeIn(1000,function(){$(this).removeClass("hide")})},hideSignup:function(){$("div#toolbar div.signup div.signupContainer").fadeOut(1000,function(){$(this).addClass("hide")})},showSignupFormErrors:function(a){bValid=true;if(a&&a.messages&&a.messages.length>0){var d="div#signupForm form#signup_form";$("ul.hint li.error",$(d)).remove();for(x in a.messages){message=a.messages[x];if(!(!message||message.length<=0)){bValid=false;$("div."+message[0]+" ul.hint",$(d)).append($("<li>").addClass("error").append(message[1]))}}$("ul.hint li.error",$(d)).show("pulsate",500,{times:3})}return bValid},reset:function(){$("div#signupForm div.scroll").css({left:0});$("div#signupForm form#signup_form")[0].reset();$("div#signupForm form#signup_form ul.hint li.error").remove();$("div#signupForm div.password div.textboxes").hide()}},login:{init:function(){$("div.userContainer input, div.passwordContainer input",$("div#toolbar div.login")).focus(function(){this.select()}).keydown(function(a){if($.browser.msie)if(a.keyCode==13){$("div#toolbar div.login form").submit();return false}}).mouseup(function(){this.select();return false});$.loovrs.toolbar.login.login();$.loovrs.toolbar.login.logout();$.loovrs.toolbar.login.loginErrorActions()},focus:function(){$("div#toolbar div.login div.userContainer input").focus()},login:function(){$("div#toolbar div.login form").submit(function(a){a.preventDefault();a=this;$.loader("post",a.action,$(this).serialize(),$.loovrs.toolbar.login.loginCallback,$.loovrs.toolbar.login.showLoginError,$("div#toolbar div.login div.loginContainer"));return false})},loginCallback:function(a){if(a.user){$.loovrs.request.getTokens();$("div#logout span strong").empty().append("&nbsp;").append($(document.createElement("strong")).append(a.user.name));$.loovrs.user.logsIn(a.user,{reload_tabs:true});$.loovrs.user.me.lookingfor_id&&$.loovrs.data.resetData();$.loovrs.toolbar.signup.hideSignup();$.loovrs.toolbar.search.showSearch();$.loovrs.toolbar.login.hideLogin();$.loovrs.toolbar.userActions.createLists();$.loovrs.user.loginFromForm()}},logout:function(){$("div#toolbar div#logout a").live("click",function(a){a.preventDefault();$.getJSON(this.href,function(d){if(d&&d.session){session=d.session;if(!session.user_id){$.loovrs.user.logsOut();$.loovrs.data.resetData();$.loovrs.toolbar.login.hideLogout();$.loovrs.user.logoutFromLink()}}});return false})},showLogin:function(){$("body div#page.logged").removeClass("logged");$("div#toolbar div.login").animate({right:"244px",width:"100%"},1000,"easeOutBounce")},hideLogin:function(){$("div#toolbar div.login").animate({right:"30px",width:"0px"},{duration:1000,easing:"easeOutBounce",complete:function(){$("input:text, input:password",$(this)).val("");$.loovrs.toolbar.userActions.showRegistereduserActions()}})},showLogout:function(){$("div#toolbar div#logout").show().animate({top:"59px"},1500,"easeInOutBack")},hideLogout:function(){$("div#toolbar div#logout").animate({top:"45px"},800,function(){$(this).hide();$.loovrs.toolbar.userActions.hideRegistereduserActions()})},showLoginError:function(a){if(!(!a||!a.messages||a.messages==0)){a=a.messages[0][0];$("div#toolbar div.login form div.loginError."+a).show("slide",{direction:"right"},500)}},loginErrorActions:function(){$("div#toolbar div.login form div.loginError a.try_again").click(function(a){a.preventDefault();$(this).parent().hide("slide",{direction:"right"},400,function(){$(this).parent().addClass("hide");$("div#toolbar div.login form div.user input").focus()})});$("div#toolbar div.login form div.loginError.no_exists a.reset_password").click(function(a){a.preventDefault();$.loovrs.config.templates.send_reset_password_form_template.show();$(this).popup().show($.loovrs.config.templates.send_reset_password_form_template,{convertNLtoBR:false,main_class:"reset_password"});$("form#send_reset_password_form").submit($.loovrs.toolbar.login.submitResetPwdActivateForm);$("input#reset_password_user_name").val($("div#toolbar div.login div.user input").val())});$("div#toolbar div.login form div.loginError.not_activated a.resend_activation").click(function(a){a.preventDefault();$.loovrs.config.templates.send_resend_activation_form_template.show();$(this).popup().show($.loovrs.config.templates.send_resend_activation_form_template,{convertNLtoBR:false,main_class:"reset_password"});$("form#send_resend_activation_form").submit($.loovrs.toolbar.login.submitResetPwdActivateForm);$("input#resend_activation_user_name").val($("div#toolbar div.login div.user input").val())})},submitResetPwdActivateForm:function(a){a.preventDefault();var d=$(this);$("ul li.error",d).hide(500).remove();$.loader("post",this.action,$(this).serialize(),function(j){debug("success",j);if(!(!j||j.length<0)){var b=$(document.createElement("div")).addClass("container success").hide().html(j[0]).appendTo(d.parent());d.hide("slide",500,{direction:"left"},function(){b.show("slide",500,{direction:"right"})})}},function(j){if(j&&j.messages){j=$(document.createElement("li")).addClass("error").html(j.messages[0]);$("ul",d).append(j);j.show("pulsate",500,{times:3})}},d.parent())}},search:{search_page:0,init:function(){$("div#toolbar div.search").hasClass("closed")||$("div#toolbar div.search").addClass("closed");$.loovrs.toolbar.search.form=$("div#toolbar div.search div.searchContainer form.search");$.loovrs.toolbar.search.form.submit(function(a){a.preventDefault();$.loovrs.data.actual_page=0;var d=$(this).find("input:text").addClass("active");a={clear:true,keywords:d.val()};if(!(!a.keywords||$.trim(a.keywords)=="")){d.closest("div.inputs").stopLoading().loading();$.loovrs.data.loadData(a,function(){$.loovrs.tabs.second.list.visible()||$.loovrs.tabs.second.detail.visible()?$.loovrs.tabs.second.list.select():$.loovrs.tabs.first.list.select();d.closest("div.inputs").stopLoading()})}});$("div#toolbar div.search div.searchContainer form.search input:text").keyup(function(a){a.keyCode==27&&$.loovrs.toolbar.search.clearSearch()}).focus(function(){$(this).prev("label.search_textbox_label").fadeOut("fast")}).blur(function(){if(!this.value||$.trim(this.value)=="")$(this).prev("label.search_textbox_label").fadeIn("fast")});$("*",$("div#toolbar div.search div.searchContainer")).focus(function(){clearTimeout($.loovrs.toolbar.search.hide_search_timeout);$.loovrs.toolbar.search.showSearchOptions()}).blur(function(){clearTimeout($.loovrs.toolbar.search.hide_search_timeout);$.loovrs.toolbar.search.hide_search_timeout=setTimeout(function(){$.loovrs.toolbar.search.hideSearchOptions()},1000)}).mouseleave(function(){clearTimeout($.loovrs.toolbar.search.hide_search_timeout);$.loovrs.toolbar.search.hide_search_timeout=setTimeout(function(){$.loovrs.toolbar.search.hideSearchOptions()},1000)}).click(function(){clearTimeout($.loovrs.toolbar.search.hide_search_timeout);$.loovrs.toolbar.search.showSearchOptions()});$("div#toolbar div.searchContainer button.reset").click(function(){$.loovrs.toolbar.search.clearSearch()});$("div#toolbar div.searchContainer div.options a.close").unbind("click focus blur").click(function(a){a.preventDefault();$.loovrs.toolbar.search.hideSearchOptions();return false})},clearSearch:function(){var a=$("div#toolbar div.search div.searchContainer"),d=a.find("input:text");d.val("");a.removeClass("hover").loading();$.loovrs.data.resetData(function(){a.stopLoading()})},showSearch:function(){$("div#toolbar div.search div.searchContainer").fadeIn(1000);$("div#toolbar div.search div.searchContainer a").fadeIn(1000)},hideSearch:function(){$("div#toolbar div.search div.searchContainer").fadeOut(1000)},showSearchOptions:function(){$("div#toolbar div.search").animate({height:"220px"},800,"easeOutBack")},hideSearchOptions:function(){$("div#toolbar div.search").animate({height:"58px"},800,"easeInBack")}},userActions:{loovrized:[],init:function(){$.loovrs.toolbar.userActions.events()},events:function(){$("div#toolbar div.button a.tooltip").live("click",function(a){a.preventDefault();$(this).hideTooltip();$.loovrs.toolbar.userActions.toggleShow($(this))});$("div.button:not(.clicked) a.tooltip").tooltip();$("div#toolbar div.button div.list").mouseleave(function(){var a=this;clearTimeout(this.timeout);this.timeout=setTimeout(function(){$.loovrs.toolbar.userActions.hideToolbarList($("div.list",$(a).parent()))},3000)}).mouseenter(function(){clearTimeout(this.timeout)});$("div.button.bookmarks div.list div.person_tiny a.detail, div.button.loovrs div.list div.person_tiny a.detail",$("div#toolbar")).live("click",function(a){if(a.which==1){a.preventDefault();$.loovrs.toolbar.userActions.toggleShow($(this).closest("a.tooltip"));$.loovrs.tabs.first.getAndShowPersonDetail($(this).closest("div.person_tiny"),$(this).attr("href"))}});$("div#toolbar div.button div.list div.person_tiny a.delete").live("click",function(a){a.preventDefault();$.loovrs.request.post($(this).attr("href"),{});a=$(this).closest("div.person_tiny");var d=a.find("div.data a.name").html();d=$("div#persons_list div.people div.personContainer."+
d);var j=$("div#person_detail");a.hide("explode",800,function(){$(this).remove()});a=a.closest("div.button");if(a.hasClass("bookmarks")){$("li.favourite a.action",d).removeClass("disabled");$("div.actions a.action.favourite",j).removeClass("disabled")}if(a.hasClass("loovrs")){$("li.loovrs a.action",d).removeClass("disabled");$("div.actions a.action.loovrs",j).removeClass("disabled")}})},showRegistereduserActions:function(){$("div#logo").addClass("top");$("div.search, div.search div.searchContainer",$("div#toolbar")).animate({width:"525px"},1000,"easeInOutBack",function(){$("div#logo a img, div#logo").animate({width:"151px",height:"68.7px",top:"0",left:"0"},1200,"easeInOutBack");$.loovrs.toolbar.login.showLogout()});$("div.loovrs.button").animate({right:"528px"},1500,"easeInOutBack");$("div.bookmarks.button").animate({right:"591px"},2000,"easeInOutBack");$("div.chats.button").animate({right:"654px"},2500,"easeInOutBack");$("div.mails.button").animate({right:"717px"},3000,"easeInOutBack",function(){$("div.button a.tooltip").tooltip()});$("div.logo").animate({right:"780px"},3500,"easeInOutBack")},hideRegistereduserActions:function(){$("div.button a.tooltip").clearTooltip();$("div.search, div.search div.searchContainer",$("div#toolbar")).animate({width:"241px"},1000,"easeInOutBack",function(){$("div#logo a img, div#logo").animate({width:"422px",height:"192px",top:"60px",left:"-5px"},1200,"easeInOutBack");$.loovrs.toolbar.login.showLogin()});$.loovrs.toolbar.search.hideSearch();$.loovrs.toolbar.signup.showSignup();$("div.loovrs.button").animate({right:"30px"},1500,"easeInOutBack");$("div.bookmarks.button").animate({right:"30px"},2000,"easeInOutBack");$("div.chats.button").animate({right:"30px"},2500,"easeInOutBack");$("div.mails.button").animate({right:"30px"},3000,"easeInOutBack");$("div.logo").animate({right:"30px"},3500,"easeInOutBack",function(){$("div#logo").removeClass("top")})},addChatToToolbar:function(a){a.preventDefault();a=$(this).closest("div.chat");var d=a.data("person");if(!($("div#toolbar div.chats div.list div."+d.name).length>0)){var j=$.loovrs.toolbar.userActions.createTinyPerson(d);j.find("a.detail").click(function(b){b.preventDefault();$.loovrs.chat.restore(d,$(this).closest("div.person_tiny").data("pendent_chats"));$(this).closest("div.person_tiny").data("pendent_chats",[]);$(this).closest("div.person_tiny").find("a.count").fadeOut(500,function(){var c=parseInt($(this).html()),m=parseInt($("div#toolbar div.chats > a.count").html());$(this).html(0);m-=c;$("div#toolbar div.chats > a.count").html(m);m==0&&$("div#toolbar div.chats > a.count").fadeOut(500)})});j.find("a.delete").click(function(b){b.preventDefault();$(this).closest("div.person_tiny").hide("explode",800,function(){$(this).remove()})});$("div#toolbar div.chats div.list").append(j)}$.loovrs.toolbar.userActions.sendToToolbarButton("chats",a,{remove:true})},updateChatCount:function(a){var d=$("div#toolbar div.chats div.list div."+a.sender.name),j=$("div#toolbar div.chats > a.count"),b=parseInt(d.find("a.count").html())+1,c=parseInt(j.html())+1,m=d.data("pendent_chats")||[];m.push(a);d.data("pendent_chats",m);j.html(c).stop(true,true).show("pulsate",500);d.find("a.count").html(b).show()},toggleShow:function(a){a=$("div.list",a.parent());!a.hasClass("show")?$.loovrs.toolbar.userActions.showToolbarList(a):$.loovrs.toolbar.userActions.hideToolbarList(a)},showToolbarList:function(a){$.loovrs.toolbar.userActions.hideToolbarList($("div#toolbar div div.list"),a);a.animate({top:"4px",opacity:1},300).addClass("show").parent().addClass("hover").addClass("clicked")},hideToolbarList:function(a,d){if(arguments&&arguments.length==1){var j=arguments[0];j.animate({top:"-15px",opacity:0},300,function(){$(this).removeClass("show").parent().removeClass("clicked").removeClass("hover")})}else a.each(function(b,c){c=$(c);c[0]!=d[0]&&c.animate({top:"-15px",opacity:0},300,function(){$(this).removeClass("show").parent().removeClass("clicked").removeClass("hover")})})},sendToToolbarButton:function(a,d,j){var b={};j=$.extend(b,j);var c=$("div."+a,$("div#toolbar"));a=d.offset();b=c.offset();var m=c.width(),o=c.height(),k=j.person||null,g=(j=j.remove)?d:d.clone();d.length&&c.length&&g.css({position:"absolute",top:a.top,left:a.left,backgroundColor:"#999999",zIndex:99999}).appendTo($("body")).animate({top:b.top,left:b.left,width:m,height:o},500,function(){g.remove();c.css("opacity",0).animate({opacity:1},500,function(){$.browser.msie&&$(this).css("filter","")});if(k){var f=c.find("div.list"),n=$.loovrs.toolbar.userActions.createTinyPerson(k);if(f.find("div."+k.name).length<=0){$("a.detail",n).attr("href","/users/"+
k.id);$("a.delete",n).attr("href","/users/"+k.id+"/remove_favourite");f.append(n)}}})},createTinyPerson:function(a){if(a){var d=$.loovrs.config.templates.person_tiny;d=d.clone();d.addClass(a.name).data("person",a);a.profile_image&&a.profile_image.thumbnail&&$("img.photo",d).attr("src",$.loovrs.data.getUserThumbnail(a)).attr("alt",a.name);$("a.name",d).html(a.name);$("a.age",d).html(a.age+" "+$.loovrs.I18n.t("templates.tab1.person_list_item.years"));if(a.address&&(a.address.city||a.address.country)){var j=[];a.address.city&&j.push(a.address.city.name);a.address.country&&j.push(a.address.country.name);$("a.address",d).html(j.join(", "))}return d}},createLists:function(){$.loovrs.user.me.favourites&&$.each($.loovrs.user.me.favourites,function(a,d){if(d&&d.favourite_user){a=d.favourite_user;d=$("div#toolbar div.button.bookmarks div.list");var j=$.loovrs.toolbar.userActions.createTinyPerson(a);if(d.find("div."+a.name).length<=0){$("a.detail",j).attr("href","/users/"+a.id);$("a.delete",j).attr("href","/users/"+
a.id+"/remove_favourite");d.append(j)}}});$.loovrs.user.me.loovrs&&$.each($.loovrs.user.me.loovrs,function(a,d){if(d&&d.loovrs_user){a=d.loovrs_user;var j=$("div#toolbar div.button.loovrs div.list"),b=$.loovrs.toolbar.userActions.createTinyPerson(a);if(j.find("div."+a.name).length<=0){$("a.detail",b).attr("href","/users/"+a.id);d.mutual&&$("a.detail.info",b).html($.loovrs.I18n.t("toolbar.actions.likes_you",{subject:$.loovrs.I18n.he_she(a).capitalize()}));$("a.delete",b).attr("href","/users/"+a.id+"/remove_loovr");j.append(b)}}})},clearLists:function(){$("div#toolbar div.button div.list").empty()},updateLoovr:function(a){a=a.user;var d=$("div#toolbar div.button.loovrs div.list div."+a.name);d.length==1&&$("a.detail.info",d).html($.loovrs.I18n.t("toolbar.actions.likes_you",{subject:$.loovrs.I18n.he_she(a).capitalize()}))}}}});$.extend($.loovrs,{pagination:{defaults:{api:true,vertical:false,size:10,speed:400,hoverClass:"hover",keyboard:false,prevPage:"div.prevPage",nextPage:"div.nextPage"},setScroll:function(a,d){d=$.extend($.loovrs.pagination.defaults,d);scrollable=a.scrollable(d);$("div.pagination div.paginationLink").mouseover(function(){$(this).toggleClass("hover")}).mouseout(function(){$(this).toggleClass("hover")});$("div.pagination div.arrow").mousedown(function(){$(this).removeClass("shadow")}).mouseup(function(){$(this).addClass("shadow")});$("div.items a",a).click(function(j){j.preventDefault()});return scrollable},calculateAndGeneratePages:function(a,d,j,b){a.empty();if(!d||d==0)d=10;d=j/d;for(i=0;i<=d;i++){div=document.createElement("div");i==0&&$(div).toggleClass("active");$(div).append(i+1).click(b);a.append(div)}}}});$.extend($.loovrs.tabs,{first:{personHtml:null,personDetailContainer:null,init:function(){$.loovrs.tabs.first.config()},config:function(){$.loovrs.tabs.first.personHtml=$($.loovrs.config.templates.persons_list_item);$.loovrs.tabs.first.person_list=$("div#persons_list");$.loovrs.tabs.first.addPeople($.loovrs.data.peopleList);$.loovrs.tabs.first.events()},events:function(){$(document).bind("me_logs_in",function(a,d){if(a.target==a.currentTarget){$("div#persons_list div.personContainer ul.actions li a.action").trigger("me_logs_in.firsttab",d);$("div#person_detail div.actions a.action").trigger("me_logs_in.firsttab",d)}}).bind("me_logs_out",function(a,d){if(a.target==a.currentTarget){$("div#persons_list div.personContainer ul.actions li a.action").trigger("me_logs_out.firsttab",d);$("div#person_detail div.actions a.action").trigger("me_logs_out.firsttab",d)}}).bind("person_logs_in",function(a,d){if(a.target==a.currentTarget){$("div#persons_list div.people div.personContainer."+d.name).trigger("person_logs_in.firsttab",d);$("div#persons_list div.personContainer."+
d.name+" ul.actions li a.action").trigger("person_logs_in.firsttab",d);$("div#person_detail").trigger("person_logs_in.firsttab",d);$("div#person_detail div.actions a.action.chat").trigger("person_logs_in.firsttab",d)}}).bind("person_logs_out",function(a,d){if(a.target==a.currentTarget){$("div#persons_list div.people div.personContainer."+d.name).trigger("person_logs_out.firsttab",d);$("div#persons_list div.personContainer."+d.name+" ul.actions li a.action").trigger("person_logs_out.firsttab",d);$("div#person_detail").trigger("person_logs_out.firsttab",d);$("div#person_detail div.actions a.action.chat").trigger("person_logs_out.firsttab",d)}}).bind("person_updated",function(a,d){a.target==a.currentTarget&&$("div#persons_list div.people div.personContainer."+d.name).trigger("person_updated.firsttab",d)});$("a.unregistered").live("click",function(a){a.preventDefault();a=$('<span class="message"/>').html($.loovrs.I18n.t("users.signup_required"));$("div#toolbar div.signup div.signupContainer").popup().show(a,{convertNLtoBR:false,transfer:true})});$.loovrs.tabs.first.list.events();$.loovrs.tabs.first.detail.events()},selected:function(){return $("div#tabs ul.ui-tabs-nav li#tab1.ui-tabs-selected").length==1},rename:function(a){$("div#tabs ul.ui-tabs-nav li#tab1 a").html(a)},list:{visible:function(){return $("div#tabs.ui-tabs ul.ui-tabs-nav li#tab1.ui-tabs-selected").length==1&&!$.loovrs.tabs.first.person_list.hasClass("hidden")},select:function(){$("div#tabs").tabs("option","fx",{width:"toggle"}).tabs("select",0).tabs("option","fx",null);$.loovrs.tabs.first.list.show()},show:function(a){!a||a.preventDefault();$("div#persons_list").removeClass("hidden");$("div#persons_list div.personContainer.active").removeClass("active");a=$("div#person_detail div#basic_data h1.title").html();a=$("div#persons_list div.personContainer."+a).addClass("active");$("div#tabs-1 div.scroll").animate({left:-$("div#persons_list").position().left},500,"easeInOutExpo",function(){$("div#person_detail").addClass("hidden")});a.length>0&&$(window).scrollTo(a,1000,{easing:"easeInOutExpo",offset:-20})},events:function(){$("a#back_to_person_list").live("click",$.loovrs.tabs.first.list.show);$("div.person a.detail",$("div#persons_list")).live("click",function(a){if(a.button==0||$.browser.msie){a.preventDefault();$("div.personContainer.active",$("div#persons_list")).removeClass("active");$.loovrs.tabs.first.getAndShowPersonDetail($(this).closest("div.personContainer").addClass("active"),$(this).attr("href"))}});$("div#basic_data a.address",$("div#person_detail")).live("click",function(a){a.preventDefault();a=$(this).closest("input.sex_id").val()||1;var d=$.loovrs.images.mapMarkers[parseInt(a)];$("div#content div#tabs-1 div#person_detail div#basic_data img#person_detail_map.show").animate({height:400},800,"easeInOutExpo",function(){$(this).next().loadImage(d).show();$(this).toggleClass("show").toggleClass("hide")});$("div#content div#tabs-1 div#person_detail div#basic_data img#person_detail_map.hide").animate({height:0},800,"easeInOutExpo",function(){$(this).toggleClass("show").toggleClass("hide").hide()}).next().hide()});$("div#tabs-1 div#persons_list div.actions a.action").live("click",function(a){a.preventDefault();$.loovrs.tabs.first.orderMainList(this)});$("div#persons_list div.personContainer.loggedin div.person ul.actions li.chat a.action:not(.disabled)").live("click",function(a){a.preventDefault();$.loovrs.chat.open($(this).closest("div.personContainer").data("person"))});$("div.person ul.actions li.favourite a.action:not(.disabled)",$("div#tabs-1 div#persons_list div.people div.personContainer")).live("click",function(a){a.preventDefault();a=$(this).closest("div.personContainer");var d=a.data("person");$.loovrs.request.post($(this).attr("href"),{});$.loovrs.toolbar.userActions.sendToToolbarButton("bookmarks",a,{person:d});$(this).hideTooltip().addClass("disabled").attr("rel",$.loovrs.I18n.t("templates.tab1.person_list_item.person.actions.favourites_already",{name:d.name}))});$("div.person ul.actions li.loovrs a.action:not(.disabled)",$("div#tabs-1 div#persons_list div.people div.personContainer")).live("click",function(a){a.preventDefault();a=$(this).closest("div.personContainer");var d=a.data("person");$.loovrs.request.post($(this).attr("href"),{});$.loovrs.toolbar.userActions.sendToToolbarButton("loovrs",a,{person:d});$(this).hideTooltip().addClass("disabled").attr("rel",$.loovrs.I18n.t("templates.tab1.person_list_item.person.actions.loovrs_already",{name:d.name}))})},personEvents:function(a){var d=$("img.picture",a),j=$("li.chat a.action",a),b=$("li.favourite a.action",a),c=$("li.loovrs a.action",a),m=$("li a.action",a);a.data("person");a.bind("person_logs_in.firsttab",function(){a.addClass("loggedin")}).bind("person_logs_out.firsttab",function(){a.removeClass("loggedin")}).bind("person_updated.firsttab",function(o,k){if(k){$.loovrs.tabs.first.fillPersonData(k,$(this));d.loadImage($.loovrs.data.getUserThumbnail(k))}});m.bind("me_logs_in.firsttab",function(){$(this).removeClass("unregistered")}).bind("me_logs_out.firsttab",function(){$(this).addClass("unregistered")});j.bind("person_logs_in.firsttab",function(o,k){$.loovrs.user.imLogged()?$(this).removeClass("disabled").attr("rel",$.loovrs.I18n.t("templates.tab1.person_list_item.person.actions.chat",{name:k.name})):$(this).addClass("disabled").attr("rel",$.loovrs.I18n.t("templates.tab1.person_list_item.person.actions.signup_required"))}).bind("person_logs_out.firsttab",function(o,k){$(this).addClass("disabled");$.loovrs.user.imLogged()?$(this).attr("rel",$.loovrs.I18n.t("templates.tab1.person_list_item.person.actions.chat_not_loggedin",{name:k.name})):$(this).attr("rel",$.loovrs.I18n.t("templates.tab1.person_list_item.person.actions.signup_required"))});b.bind("favourite_added",function(){$(this).addClass("disabled")});c.bind("loovrs_added",function(){$(this).addClass("disabled")})}},detail:{visible:function(){return $("div#tabs.ui-tabs ul.ui-tabs-nav li#tab1.ui-tabs-selected").length==1&&$.loovrs.tabs.first.person_list.hasClass("hidden")},select:function(){$("div#tabs").tabs("option","fx",{width:"toggle"}).tabs("select",0).tabs("option","fx",null);$.loovrs.tabs.first.detail.show()},show:function(a){a=a?0:500;$("div#person_detail").removeClass("hidden");$("div#tabs-1 div.scroll").animate({left:-$("div#person_detail").position().left},a,"easeInOutExpo",function(){$("div#persons_list").addClass("hidden")});$(window).scrollTo(0,1000,{easing:"easeInOutExpo",offset:-20})},events:function(){$.loovrs.tabs.first.addEventsToPersonDetail();$("div#person_detail:not(.hidden)").bind("person_logs_in.firsttab",function(a,d){d&&d.name&&$(this).find("div.person.detail.container."+d.name).addClass("loggedin")}).bind("person_logs_out.firsttab",function(a,d){d&&d.name&&$(this).find("div.person.detail.container."+d.name).removeClass("loggedin")});$("a.action.chat:not(.disabled)",$("div#person_detail")).live("click",function(a){a.preventDefault();a=$("input.user_id:hidden",$("div#person_detail")).val();$.loovrs.data.getPersonDetailData(a,function(d){$.loovrs.chat.open(d)})});$("a.action.favourite:not(.disabled.added)",$("div#person_detail")).live("click",function(a){a.preventDefault();var d=this;a=$("input.user_id:hidden",$("div#person_detail")).val();person_name=$("div#person_detail div#basic_data h1.title").html();$(this).hideTooltip().addClass("added").attr("rel",$.loovrs.I18n.t("templates.tab1.person_list_item.person.actions.favourites_already",{name:person_name}));$.loovrs.data.getPersonDetailData(a,function(j){$.loovrs.request.post($(d).attr("href"),{});$("div#persons_list div.people div.personContainer."+j.name).find("li.favourite a.action:not(.disabled)").addClass("disabled");$.loovrs.toolbar.userActions.sendToToolbarButton("bookmarks",$("div.person.detail.container",$("div#person_detail")),{person:j});$("div#persons_list div.people div.personContainer."+j.name+" ul.actions li.favourite a.action").trigger("favourite_added",j)})});$("a.action.loovrs:not(.disabled.added)",$("div#person_detail")).live("click",function(a){a.preventDefault();var d=this;a=$("input.user_id:hidden",$("div#person_detail")).val();person_name=$("div#person_detail div#basic_data h1.title").html();$(this).hideTooltip().addClass("added").attr("rel",$.loovrs.I18n.t("templates.tab1.person_list_item.person.actions.loovrs_already",{name:person_name}));$.loovrs.data.getPersonDetailData(a,function(j){$.loovrs.request.post($(d).attr("href"),{});$("div#persons_list div.people div.personContainer."+j.name).find("li.loovrs a.action:not(.disabled)").addClass("disabled");$.loovrs.toolbar.userActions.sendToToolbarButton("loovrs",$("div.person.detail.container",$("div#person_detail")),{person:j});$("div#persons_list div.people div.personContainer."+j.name+" ul.actions li.loovrs a.action").trigger("loovrs_added",j)})})}},orderMainList:function(a){a=$(a).toggleClass("asc").toggleClass("desc");var d=$(a).attr("class").split(" ");field=$.grep(d,function(j){return j!="action"&&j!="last"&&j!="asc"&&j!="desc"&&j!="active"});direction=$.grep(d,function(j){return j=="asc"||j=="desc"});$.loovrs.data.actual_page=0;$.loovrs.tabs.first.person_list.find("div.actions a.active").removeClass("active");a.stopLoading().loading().addClass("active");$.loovrs.data.loadData({clear:true,order:field[0],direction:direction[0]},function(){a.stopLoading()})},addPeople:function(a){$.loovrs.data.initData&&$.loovrs.data.peopleList&&$.each(a,function(d,j){j&&j.user&&$.loovrs.tabs.first.addPersonToList(j.user)})},addPersonToList:function(a){try{var d=$.loovrs.tabs.first.fillPersonData(a,$.loovrs.tabs.first.personHtml.clone());d.appendTo("div.people",$.loovrs.tabs.first.person_list).find("a.tooltip").tooltip();$.loovrs.tabs.first.list.personEvents(d)}catch(j){debug(j)}},fillPersonData:function(a,d){if(a){d.addClass(a.name).addClass({1:"boy",2:"girl"}[a.sex_id]).data("person",a);var j=$("img.picture",d),b=$("a.detail",d),c=$("div.info a.geotag",d),m=$("div.info a.detail.city",d),o=$("div.info a.detail.state",d),k=$("div.info a.detail.country",d),g=$("div.info a.detail.age",d),f=$("div.rating",d),n=$("div.info div.name a.detail",d),p=$("li a.action",d),y=$("li.favourite a.action",d),u=$("li.loovrs a.action",d),s=$("li.chat a.action",d);j.loadImage($.loovrs.data.getUserThumbnail(a)).attr("alt",a.name);b.attr("rel",a.name).attr("href","/users/"+a.id);if(a.address){var B=$.loovrs.maps.create_static(a.address.lat,a.address.lng,256,256,5);c.addClass("show").css("visibility","visible").hover(function(){$(this).showTooltip({domNode:B})},function(){$(this).hideTooltip()});a.address.city&&a.address.city.name&&m.css("visibility","visible").html(a.address.city.name);a.address.state&&a.address.state.name&&o.css("visibility","visible").html(a.address.state.name);a.address.country&&a.address.country.name&&k.css("visibility","visible").html(a.address.country.name)}a.age&&g.css("visibility","visible").html(a.age+" "+
$.loovrs.I18n.t("templates.tab1.person_list_item.years"));f.hide();a.rating&&f.html(a.rating).css("display","block");n.html(a.name);p.addClass("unregistered");y.attr("href","/users/"+a.id+"/add_favourite");u.attr("href","/users/"+a.id+"/add_loovr");if($.loovrs.user.imLogged()){p.removeClass("unregistered");y.attr("rel",$.loovrs.I18n.t("templates.tab1.person_list_item.person.actions.favourites",{name:a.name})).removeClass("disabled");u.attr("rel",$.loovrs.I18n.t("templates.tab1.person_list_item.person.actions.loovrs",{name:a.name})).removeClass("disabled");$.loovrs.user.inMyFavourites(a.name)&&y.addClass("disabled").attr("rel",$.loovrs.I18n.t("templates.tab1.person_list_item.person.actions.favourites_already",{name:a.name}));$.loovrs.user.inMyLoovrs(a.name)&&u.addClass("disabled").attr("rel",$.loovrs.I18n.t("templates.tab1.person_list_item.person.actions.loovrs_already",{name:a.name}));if(a.logged_in){d.addClass("loggedin");$.loovrs.user.imLogged()&&s.removeClass("disabled").attr("rel",$.loovrs.I18n.t("templates.tab1.person_list_item.person.actions.chat",{name:a.name}))}else s.attr("rel",$.loovrs.I18n.t("templates.tab1.person_list_item.person.actions.chat_not_loggedin",{name:a.name}))}return d}},personDetailTemplate:null,getAndShowPersonDetail:function(a,d){a.loading();$.loovrs.request.getHTML(d,{layout:"empty"},function(j){a.stopLoading();var b=$("input.user_id:hidden",$("div#person_detail")).val();$(j).attr("class",null).addClass(b+"");$("div#person_detail").empty().append(j);$.loovrs.tabs.first.addEventsToPersonDetail(a);$.loovrs.tabs.first.detail.show()})},addEventsToPersonDetail:function(){var a=$("div#person_detail div.pagination.vertical div.scrollable");$.loovrs.pagination.setScroll(a,{vertical:true,clickable:true,size:10});$("a.tooltip",$("div#person_detail")).tooltip();a.find("a.photo").click(function(d){var j=$(this);d.preventDefault();$(new Image).loadImage($(this).attr("href"),function(b){var c=$(b).objectSize();j.popup().show(b,{convertNLtoBR:false,transfer:true,main_class:"image_detail",width:c.width+15,height:c.height+15})},$(this))});$("div#rate_person").rate();$("a.action.chat",$("div#person_detail"));$("a.action",$("div#person_detail")).live("click",function(d){d.preventDefault()}).bind("me_logs_in.firsttab",function(){$(this).removeClass("unregistered")}).bind("me_logs_out.firsttab",function(){$(this).addClass("unregistered")});$("a.action.chat",$("div#person_detail")).bind("me_logs_in.firsttab",function(){var d=$("div#person_detail div#basic_data h1.title").html();$("div#person_detail div.detail.person.container").hasClass("loggedin")?$(this).removeClass("disabled").attr("rel",$.loovrs.I18n.t("templates.tab1.person_detail.toolbar.tooltips.chat",{name:d})):$(this).attr("rel",$.loovrs.I18n.t("templates.tab1.person_detail.toolbar.tooltips.chat_not_loggedin",{name:d}))}).bind("me_logs_out.firsttab",function(){$(this).addClass("disabled").attr("rel",$.loovrs.I18n.t("templates.tab1.person_detail.toolbar.tooltips.signup_required"))}).bind("person_logs_in.firsttab",function(d,j){$.loovrs.user.imLogged()?$(this).removeClass("disabled").attr("rel",$.loovrs.I18n.t("templates.tab1.person_detail.toolbar.tooltips.chat",{name:j.name})):$(this).addClass("disabled").attr("rel",$.loovrs.I18n.t("templates.tab1.person_detail.toolbar.tooltips.signup_required"))}).bind("person_logs_out.firsttab",function(d,j){$(this).addClass("disabled");$.loovrs.user.imLogged()?$(this).attr("rel",$.loovrs.I18n.t("templates.tab1.person_detail.toolbar.tooltips.chat_not_loggedin",{name:j.name})):$(this).attr("rel",$.loovrs.I18n.t("templates.tab1.person_detail.toolbar.tooltips.signup_required"))});$("a.action.loovrs, a.action.favourite",$("div#person_detail")).bind("me_logs_in.firsttab",function(){$(this).removeClass("disabled")}).bind("me_logs_out.firsttab",function(){$(this).addClass("disabled").attr("rel",$.loovrs.I18n.t("templates.tab1.person_detail.toolbar.tooltips.signup_required"))});$("a.action.loovrs",$("div#person_detail")).bind("me_logs_in.firsttab",function(){var d=$("div#person_detail div#basic_data h1.title").html();$.loovrs.user.inMyLoovrs(d)?$(this).addClass("added").attr("rel",$.loovrs.I18n.t("templates.tab1.person_detail.toolbar.tooltips.loovrs_already",{name:d})):$(this).attr("rel",$.loovrs.I18n.t("templates.tab1.person_detail.toolbar.tooltips.loovrs",{name:d}))});$("a.action.favourite",$("div#person_detail")).bind("me_logs_in.firsttab",function(){var d=$("div#person_detail div#basic_data h1.title").html();$.loovrs.user.inMyFavourites(d)?$(this).addClass("added").attr("rel",$.loovrs.I18n.t("templates.tab1.person_detail.toolbar.tooltips.favourites_already",{name:d})):$(this).attr("rel",$.loovrs.I18n.t("templates.tab1.person_detail.toolbar.tooltips.favourites",{name:d}))})}}});$.extend($.loovrs.tabs,{second:{init:function(){$.loovrs.tabs.second.photoTemplate=$.loovrs.config.templates.photo;$.loovrs.tabs.second.events();$.loovrs.tabs.second.addPhotos($.loovrs.data.peopleList)},list:{visible:function(){return $("div#tabs.ui-tabs ul.ui-tabs-nav li#tab2.ui-tabs-selected").length==1&&!$("div#tabs-2 div.list").hasClass("hidden")},select:function(){$("div#tabs").tabs("option","fx",{width:"toggle"}).tabs("select",1).tabs("option","fx",null);$.loovrs.tabs.second.list.show()},show:function(){$("div#tabs-2 div.list").removeClass("hidden");$("div#tabs-2 div.scroll").animate({left:0},800,"easeInOutCirc")}},detail:{visible:function(){return $("div#tabs.ui-tabs ul.ui-tabs-nav li#tab2.ui-tabs-selected").length==1&&$("div#tabs-2 div.list").hasClass("hidden")},select:function(){$("div#tabs").tabs("option","fx",{width:"toggle"}).tabs("select",1).tabs("option","fx",null);$.loovrs.tabs.second.detail.show()},show:function(){$("div#tabs-2 div.list").addClass("hidden");$("div#tabs-2 div.scroll").animate({left:-928},800,"easeInOutCirc")}},events:function(){$("div#tabs-2 div.list div.actions a.action").live("click",function(a){a.preventDefault();$.loovrs.tabs.first.orderMainList(this)});$("div#tabs-2 div.detail div.actions a#back_to_photos_list").live("click",function(a){a.preventDefault();$.loovrs.tabs.second.list.show()});$("div#thumbs_list a.photo").live("click",function(a){a.preventDefault();$(this).hideTooltip();a=$(this).data("userData");$.loovrs.tabs.second.detailPanel(a)});$("div#tabs-2 div.detail a.photo").live("click",function(a){a.preventDefault();if(this!=$.loovrs.tabs.second.last_clicked){$(this).hideTooltip();$.loovrs.tabs.second.last_clicked=this;$(this).closest("div.pagination.top").length>0&&$.loovrs.tabs.second.bottomPhotoList($(this).data("userData"));$.loovrs.tabs.second.loadImage($(this).data("imageData"))}});$("div#tabs-2 div.detail div.photoContainer div.big_photo div.image a").live("click",$.loovrs.tabs.second.next)},reloadImages:function(){},detailPanel:function(a){if(!(!a||!a.images&&!a.profile_image)){var d=a.profile_image?a.profile_image:a.images[0]?a.images[0]:null;$.loovrs.tabs.second.topPhotoList();$.loovrs.tabs.second.bottomPhotoList(a);$.loovrs.tabs.second.detail.show();$("div#tabs-2 div.detail div.pagination.top a.photo."+a.name+"."+d.id).click().addClass("active")}},topPhotoList:function(){var a,d;for(d=0;d<$.loovrs.data.peopleList.length;d++){a=$.loovrs.data.peopleList[d];if(!a)return;$.loovrs.tabs.second.generatePhoto(a.user,$("div#tabs-2 div.detail div.photoContainer div.pagination.top div.scrollable div.items"))}$.loovrs.pagination.setScroll($("div#tabs-2 div.detail div.photoContainer div.pagination.top div.scrollable"),{clickable:true,size:6})},bottomPhotoList:function(a){if(a&&a.images){var d,j,b=$('<div class="items"/>');for(j=0;j<a.images.length;j++){d=a.images[j];if(!d)return;$.loovrs.tabs.second.generatePhoto(a,b,j)}if($("div#tabs-2 div.detail div.pagination.bottom a.photo").length>0)$("div#tabs-2 div.detail div.pagination.bottom div.items").hide("drop",{direction:"left"},800,function(){$(this).closest("div.scrollable").empty().append(b);$.loovrs.pagination.setScroll($("div#tabs-2 div.detail div.photoContainer div.pagination.bottom div.scrollable"),{clickable:true,size:6})});else{$("div#tabs-2 div.detail div.pagination.bottom div.scrollable").empty().append(b);$.loovrs.pagination.setScroll($("div#tabs-2 div.detail div.photoContainer div.pagination.bottom div.scrollable"),{clickable:true,size:6})}}},loadImage:function(a){a&&$(new Image).loadImage("/images/"+a.id+"?name="+a.filename,function(d){d=$(d).addClass("photo");$("div#tabs-2 div.detail div.photoContainer div.big_photo div.image img.photo").length>0?$.loovrs.tabs.second.transitionImages(d):$("div#tabs-2 div.detail div.photoContainer div.big_photo div.image").height(a.height+25).find("a").append($(d).css({marginLeft:-a.width/2}));$(window).scrollTo($("div#tabs-2 div.detail div.photoContainer div.pagination.top div.scrollable"),800)},$("div#tabs-2 div.detail div.photoContainer div.big_photo div.image"))},transitionImages:function(a){var d=$("div#tabs-2 div.detail div.photoContainer div.big_photo div.image img.photo"),j=d.outerWidth(),b=$("div#tabs-2 div.detail div.photoContainer div.big_photo div.image");a.css("opacity",0);var c=a.objectSize(850);a.css({width:j,marginLeft:-(j/2)+"px"});b.find("a").append(a);b.animate({height:25+c.height},500);d.animate({marginLeft:-(c.width/2)+"px",width:c.width+"px",opacity:0},1000,function(){$(this).remove()});a.animate({marginLeft:-(c.width/2)+"px",width:c.width+"px",opacity:1},1000,function(){$.browser.msie&&$(this).css("filter","progid:DXImageTransform.Microsoft.DropShadow(color=#969696, offx=1, offy=1) progid:DXImageTransform.Microsoft.DropShadow(color=#C2C2C2, offx=1, offy=1) progid:DXImageTransform.Microsoft.DropShadow(color=#EFEFEF, offx=1, offy=1)")})},next:function(a){a.preventDefault();a=$("div#tabs-2 div.detail div.pagination.top a.photo.active");next=a.next();if(a.is(":last-child"))next=$("div#tabs-2 div.detail div.pagination.top a.photo:first-child");next.click()},addPhotos:function(a){a&&$.each(a,function(d,j){j&&$.loovrs.tabs.second.generatePhoto(j.user,$("div#thumbs_list"))})},generatePhoto:function(a,d,j){if(!(!a||!a.images&&!a.profile_image)){var b=a.profile_image?a.profile_image:a.images[0]?a.images[0]:null;if(b=j>=0&&a.images?a.images[j]:b){j=b.thumbnail?"/images/"+b.id+"?name="+b.thumbnail:$.loovrs.user.me.image;var c=$.loovrs.tabs.second.photoTemplate.clone();c.addClass(a.name+" "+b.id).data("userData",a).data("imageData",b).attr("rel",a.name).tooltip();!b.rating||$("div.rating",c).html(b.rating).show();$("img",c).loadImage(j);d.append(c)}}}}});$.extend($.loovrs.tabs,{sixth:{tab_index:2,enable:function(a){$("#tabs").tabs("enable",$.loovrs.tabs.sixth.tab_index);if(a){a=$($.loovrs.tabs.sixth.profileTabs.container);a.tabs("load",$.loovrs.tabs.sixth.profileTabs.yourData.tab_index)}!$.loovrs.user.imLogged()||$.loovrs.tabs.sixth.profileTabs.yourPhotos.generateThumbnails()},disable:function(){selectedTab=$("div#tabs ul.ui-tabs-nav li.ui-tabs-selected").get(0).id;selectedTab=="tab6"&&$("#tabs").tabs("select",0);$("#tabs").tabs("disable",$.loovrs.tabs.sixth.tab_index)},init:function(){$.loovrs.tabs.sixth.event();$.loovrs.tabs.sixth.profileTabs.yourPhotos.init()},event:function(){$(document).bind("tabSelected",$.loovrs.tabs.sixth.profileTabs.selected)},selected:function(){return $("div#tabs ul.ui-tabs-nav li#tab6.ui-tabs-selected").length==1},profileTabs:{container:"div#profile_tabs",selected:function(a,d){tab=d.tab;if(tab.offsetParent){mainSelectedTab=$("div#tabs ul.ui-tabs-nav li.ui-tabs-selected").get(0).id;profileSelectedTab=$("div#tabs-6 ul.tabs li.ui-tabs-selected").get(0).id;actualTab=tab.offsetParent.id;mainSelectedTab=="tab6"&&profileSelectedTab=="profile_tab1"&&actualTab!=mainSelectedTab&&actualTab!=profileSelectedTab&&$.loovrs.tabs.sixth.profileTabs.yourData.profileEditingBlur();if(actualTab=="tab6")$(document).trigger(profileSelectedTab);else actualTab.match("profile_tab")&&$(document).trigger(actualTab)}},yourData:{tab_index:0,formChanged:false,init:function(){$.loovrs.tabs.sixth.profileTabs.yourData.loadMap();$.loovrs.tabs.sixth.profileTabs.yourData.events()},selected:function(){debug("profile_tab1");$("div#profile_tab_content-1 form button#update_data").hide().removeClass("show saved").html($.loovrs.I18n.t("profile.tabs.tab1.submit"));$.loovrs.tabs.sixth.profileTabs.yourData.resizeMap();if($.loovrs.user.me.address)if($.loovrs.tabs.sixth.profileTabs.yourData.map){$.loovrs.tabs.sixth.profileTabs.yourData.map.setCenter(new GLatLng($.loovrs.user.me.address.lat,$.loovrs.user.me.address.lng),12);$.loovrs.maps.clearMapMarkers($.loovrs.tabs.sixth.profileTabs.yourData.map);$.loovrs.maps.addMapMarker($.loovrs.tabs.sixth.profileTabs.yourData.map)}},placeButton:function(a,d,j,b){d=d+b;j=$("div#profile_tab_content-1").outerHeight()-j;$(a,$("div#tabs-6:not(.ui-tabs-hide) div#profile_tab_content-1:not(.ui-tabs-hide)")).animate({top:d<j?d:j},750)},events:function(){$("form,input,select,button",$("div#profile_tab_content-1")).unbind().die();$(document).bind("profile_tab1",$.loovrs.tabs.sixth.profileTabs.yourData.selected);var a=$("div#profile_tab_content-1 form");a.submit($.loovrs.tabs.sixth.profileTabs.yourData.submitForm);$("input:text:not(.aux.hidden.all), select, textarea",a).focus(function(){var d=this;this.timeout=setTimeout(function(){$(d).hideTooltip()},1500)}).blur(function(){clearTimeout(this.timeout)}).change($.loovrs.tabs.sixth.profileTabs.yourData.showSubmitButton);$("input:checkbox:not(.aux.hidden.all), input:radio:not(.aux.hidden.all)",a).click($.loovrs.tabs.sixth.profileTabs.yourData.showSubmitButton);$("a#change_password",a).click(function(d){d.preventDefault();d=$("div#profile_tab_content-1 form div.change_password");if(d.hasClass("hidden"))d.show(500).addClass("showing").removeClass("hidden");else if(d.hasClass("showing")){$("input:password",a).hideTooltip();d.hide(500).addClass("hidden").removeClass("showing")}});$("a#add_language",a).live("click",$.loovrs.tabs.sixth.profileTabs.yourData.addLanguage);$("div#languages_container a.delete").live("click",function(d){d.preventDefault();$(this).next().remove();$(this).prev().change().remove();$(this).remove()});$("input#user_personality_attributes_want_children_true").click(function(){$(this).is(":checked")&&$("label#children_amount_label.hide, select#user_personality_attributes_children_ammount_id").fadeIn("normal",function(){$("label#children_amount_label.hide").css("display","inline-block")})});$("input#user_personality_attributes_want_children_false").click(function(){$(this).is(":checked")&&$("label#children_amount_label.hide, select#user_personality_attributes_children_ammount_id").fadeOut("normal",function(){$("select#user_personality_attributes_children_ammount_id").val("")})});$("textarea#user_personality_attributes_description").live("keydown",function(){if(!this.value)this.value="";var d=this.value.length;$("div#personality_data span.chars.current").html(d+"/2000");if(d>2000)$(this).addClass("warning");else $(this).hasClass("warning")&&$(this).removeClass("warning")});$("div#likes input.aux").click(function(){var d=$(this).parent().parent().find("div.values, div.options");if($(this).is(":checked"))d.show("drop",500);else{d.hide("drop",500);d.find("input:checkbox").attr("checked",false);d.find("a.delete").click()}});$("div#likes div.like div.values div.all input:checkbox.all").click(function(d){var j=$(this);j.is(":checked")?j.parent().parent().find("div.group input:checkbox").attr("checked",true):j.parent().parent().find("div.group input:checkbox").attr("checked",false);$.loovrs.tabs.sixth.profileTabs.yourData.showSubmitButton(d)});$("div#likes div.like.movie div.value.movie_title input:text").focus(function(){this.select()}).focus().mouseup(function(){this.select();return false}).change($.loovrs.tabs.sixth.profileTabs.yourData.showSubmitButton).livesearch({searchCallback:$.loovrs.tabs.sixth.profileTabs.yourData.moviesSearch,queryDelay:400,minimumSearchLength:3});$("div#likes div.like.music div.value.music_album input:text").focus(function(){this.select()}).focus().mouseup(function(){this.select();return false}).change($.loovrs.tabs.sixth.profileTabs.yourData.showSubmitButton).livesearch({searchCallback:$.loovrs.tabs.sixth.profileTabs.yourData.musicAlbumSearch,queryDelay:400,minimumSearchLength:3});$("div#likes div.like.music div.value.music_artist input:text").focus(function(){this.select()}).focus().mouseup(function(){this.select();return false}).change($.loovrs.tabs.sixth.profileTabs.yourData.showSubmitButton).livesearch({searchCallback:$.loovrs.tabs.sixth.profileTabs.yourData.musicArtistSearch,queryDelay:400,minimumSearchLength:3});$("div#likes div.like.music div.value.music_song input.artist").focus(function(){this.select()}).focus().mouseup(function(){this.select();return false}).livesearch({searchCallback:$.loovrs.tabs.sixth.profileTabs.yourData.musicSongArtistSearch,queryDelay:400,minimumSearchLength:3});$("div#likes div.like.music div.value.music_song input.song").change($.loovrs.tabs.sixth.profileTabs.yourData.showSubmitButton).livesearch({searchCallback:$.loovrs.tabs.sixth.profileTabs.yourData.musicSongSearch,queryDelay:400,minimumSearchLength:3});$("div#likes div.like.music div.options a").live("click",$.loovrs.tabs.sixth.profileTabs.yourData.addMusicLikes);$("div#likes div.like.movie div.options a").live("click",$.loovrs.tabs.sixth.profileTabs.yourData.addMoviesLikes);$("div#likes div.like.others div.options a").live("click",$.loovrs.tabs.sixth.profileTabs.yourData.addOtherLikes);$("div#likes div.like:not(.others) div.value a.delete").live("click",function(d){d.preventDefault();$(this).parent().hide("drop",500,function(){$("input:text, select",this).change();$(this).next("input:hidden").remove();$(this).remove()})});$("div#likes div.like.others div.value a.delete").live("click",function(d){d.preventDefault();$(this).parent().hide("drop",500,function(){var j=$(this).next(),b=$(this).next().next(),c=$("input:text",this),m=b.change().val();j.remove();b.remove();c.remove();$(this).addClass("delete").append($('<input type="hidden" />').attr("name","user[like_attributes][others_attributes][][id]").val(m)).append($('<input type="hidden" />').attr("name","user[like_attributes][others_attributes][][_destroy]").val(1))})});$.loovrs.tabs.sixth.profileTabs.yourData.mapSearchEvents();$("button#delete_account").click(function(){var d=$.loovrs.config.templates.confirm_profile_delete.clone();$(this).popup().show(d,{convertNLtoBR:false,main_class:"profile",transfer:true,postDOM:function(j){j.find("button.yes.confirm_profile_delete_yes").click(function(){var b=$.loovrs.config.templates.confirm_again_profile_delete.clone();$("body").popup().show(b,{convertNLtoBR:false,main_class:"profile",postDOM:function(c){c.find("button.yes.confirm_again_profile_delete_yes").click(function(){var m=$('<div class="loading"/><span class="message">'+$.loovrs.I18n.t("profile.tabs.tab1.deleting_account")+"</span>");$("body").popup().show(m,{convertNLtoBR:false,main_class:"profile",onShow:function(o){o.find("div.loading").loading()}});$("button#delete_account").html($.loovrs.I18n.t("profile.tabs.tab1.deleting"));$.loader("del","/users/"+$.loovrs.user.me.id,{},function(){$("div#popup div#popup_message div.loading").stopLoading().remove();$("div#popup div#popup_message span.message").html($.loovrs.I18n.t("profile.tabs.tab1.deleted"));$("button#delete_account").addClass("saved").html($.loovrs.I18n.t("profile.tabs.tab1.deleted"));setTimeout(function(){$("button#delete_account").fadeOut(500,function(){$(this).removeClass("saved").html($.loovrs.I18n.t("profile.tabs.tab1.delete"))});$("body").popup().hide()},2000);$.loovrs.user.logsOut();$.loovrs.data.resetData();$.loovrs.toolbar.login.hideLogout();$.loovrs.user.logoutFromLink()})})}})})}})})},showSubmitButton:function(){var a=$("div#profile_tab_content-1 form button#update_data"),d=100;a.addClass("show").fadeIn("normal").css("top",d+$(window).scrollTop());$.loovrs.tabs.sixth.profileTabs.yourData.formChanged=true},addMusicLikes:function(a){a.preventDefault();a=$(this).attr("class");switch(a){case"music_album":$.loovrs.tabs.sixth.profileTabs.yourData.addMusicAlbum();break;case"music_artist":$.loovrs.tabs.sixth.profileTabs.yourData.addMusicArtist();break;case"music_genre":$.loovrs.tabs.sixth.profileTabs.yourData.addMusicGenre();break;case"music_song":$.loovrs.tabs.sixth.profileTabs.yourData.addMusicSong();break}},addMusicAlbum:function(){var a=$.loovrs.config.templates.profile_like_music_album.clone(),d=$("input:text",a);$.loovrs.tabs.sixth.profileTabs.yourData.changeInputsName(a,$("div#likes div.like.music div.values"));$("div#likes div.like.music div.values").append(a);d.focus(function(){this.select()}).focus().mouseup(function(){this.select();return false}).change($.loovrs.tabs.sixth.profileTabs.yourData.showSubmitButton).livesearch({searchCallback:$.loovrs.tabs.sixth.profileTabs.yourData.musicAlbumSearch,queryDelay:400,minimumSearchLength:3})},musicAlbumSearch:function(a){var d=$(this),j=d.parent();$.loovrs.data.api.lastfm.searchAlbum(a,function(b){b&&b.results&&b.results.albummatches&&b.results.albummatches.album&&d.suggest({data:b.results.albummatches.album,format:function(c){return c.artist+" - "+c.name},select:function(c){if(c){j.find("input.artist").val(c.artist);j.find("input.name").val(c.name);j.find("input.url").val(c.url);j.find("input.id").val(c.id);j.find("input:text").val(c.artist+" - "+
c.name);c=c.image?c.image:c.likes_images;for(x in c){var m=c[x];if(m&&m["#text"])m=m["#text"];else if(m&&m.image_url)m=m.image_url;j.append(newHidden(j.find("input.id").attr("name").replace(/\[\w*\]$/,"")+"[images][]",m))}}}})},d)},addMusicArtist:function(){var a=$.loovrs.config.templates.profile_like_music_artist.clone(),d=$("input:text",a);$.loovrs.tabs.sixth.profileTabs.yourData.changeInputsName(a,$("div#likes div.like.music div.values"));$("div#likes div.like.music div.values").append(a);d.focus(function(){this.select()}).focus().mouseup(function(){this.select();return false}).change($.loovrs.tabs.sixth.profileTabs.yourData.showSubmitButton).livesearch({searchCallback:$.loovrs.tabs.sixth.profileTabs.yourData.musicArtistSearch,queryDelay:400,minimumSearchLength:3})},musicArtistSearch:function(a){var d=$(this),j=d.parent();$.loovrs.data.api.lastfm.searchArtist(a,function(b){b&&b.results&&b.results.artistmatches&&b.results.artistmatches.artist&&d.suggest({data:b.results.artistmatches.artist,format:function(c){return c.name},select:function(c){if(c){j.find("input.url").val(c.url);j.find("input:text").val(c.name);c=c.image?c.image:c.likes_images;for(x in c){var m=c[x];if(m&&m["#text"])m=m["#text"];else if(m&&m.image_url)m=m.image_url;j.append(newHidden(d.attr("name").replace(/\[\w*\]$/,"")+"[images][]",m))}}}})},d)},addMusicGenre:function(){var a=$.loovrs.config.templates.profile_like_music_genre.clone(),d=$("select",a).change($.loovrs.tabs.sixth.profileTabs.yourData.showSubmitButton);$.loovrs.tabs.sixth.profileTabs.yourData.changeInputsName(a,$("div#likes div.like.music div.values"));$("div#likes div.like.music div.values").append(a);d.focus()},addMusicSong:function(){var a=$.loovrs.config.templates.profile_like_music_song.clone(),d=$("input.artist",a);input_song=$("input.song",a);$.loovrs.tabs.sixth.profileTabs.yourData.changeInputsName(a,$("div#likes div.like.music div.values"));$("div#likes div.like.music div.values").append(a);d.focus(function(){this.select()}).focus().mouseup(function(){this.select();return false}).livesearch({searchCallback:$.loovrs.tabs.sixth.profileTabs.yourData.musicSongArtistSearch,queryDelay:400,minimumSearchLength:3});input_song.change($.loovrs.tabs.sixth.profileTabs.yourData.showSubmitButton).livesearch({searchCallback:$.loovrs.tabs.sixth.profileTabs.yourData.musicSongSearch,queryDelay:400,minimumSearchLength:3})},musicSongArtistSearch:function(a){var d=$(this),j=d.next();$.loovrs.data.api.lastfm.searchArtist(a,function(b){b&&b.results&&b.results.artistmatches&&b.results.artistmatches.artist&&d.suggest({data:b.results.artistmatches.artist,format:function(c){return c.name},select:function(c){if(c){d.val(c.name);j.focus()}}})},d)},musicSongSearch:function(a){var d=$(this),j=d.prev(),b=d.parent();$.loovrs.data.api.lastfm.searchSong(j.val(),a,function(c){c&&c.results&&c.results.trackmatches&&c.results.trackmatches.track&&d.suggest({data:c.results.trackmatches.track,format:function(m){return m.name},select:function(m){if(m){b.find("input.url").val(m.url);b.find("input.artist").val(m.artist);b.find("input.song").val(m.name||m.song)}}})},d)},addMoviesLikes:function(a){a.preventDefault();a=$(this).attr("class");switch(a){case"movie_title":$.loovrs.tabs.sixth.profileTabs.yourData.addMovieTitle();break;case"movie_genre":$.loovrs.tabs.sixth.profileTabs.yourData.addMovieGenre();break}},addMovieTitle:function(){var a=$.loovrs.config.templates.profile_like_movie_title.clone(),d=$("input:text",a);$.loovrs.tabs.sixth.profileTabs.yourData.changeInputsName(a,$("div#likes div.like.movie div.values"));$("div#likes div.like.movie div.values").append(a);d.focus(function(){this.select()}).focus().mouseup(function(){this.select();return false}).change($.loovrs.tabs.sixth.profileTabs.yourData.showSubmitButton).livesearch({searchCallback:$.loovrs.tabs.sixth.profileTabs.yourData.moviesSearch,queryDelay:400,minimumSearchLength:3})},moviesSearch:function(a){var d=$(this);d.loading();$.loovrs.data.api.partigi.searchMovie(a,function(j){d.stopLoading();j&&d.suggest({data:j.items,format:function(b){if(b)return b.title},select:function(b){if(b){d.parent().find("input:text").val(b.title);d.parent().find("input.external_id").val(b.id);d.parent().find("input.url").val(b.url);for(var c=b.posters.length-1;c>=0;c--){var m=b.posters[c];m&&m.href&&d.parent().append(newHidden(d.attr("name").replace(/\[\w*\]$/,"")+"[posters][]",m.href))}}}})},function(){clearTimeout(d.timeout);d.stopLoading().showTooltip($.loovrs.I18n.t("profile.tabs.tab1.error_movie_data"));d.timeout=setTimeout(function(){d.hideTooltip()},3000)})},addMovieGenre:function(){var a=$.loovrs.config.templates.profile_like_movie_genre.clone(),d=$("select",a).change($.loovrs.tabs.sixth.profileTabs.yourData.showSubmitButton);$.loovrs.tabs.sixth.profileTabs.yourData.changeInputsName(a,$("div#likes div.like.movie div.values"));$("div#likes div.like.movie div.values").append(a);d.focus()},changeInputsName:function(a,d){var j=0;d.find("input,select").each(function(b,c){b=$(c).attr("name");if((b=b.match(/\[(\d)\]/))&&b[1]>j)j=parseInt(b[1])});j++;$("input, select, textarea",a).each(function(b,c){$(c).attr("name",$(c).attr("name").replace("[]","["+j+"]"))})},addLanguage:function(a){!a||a.preventDefault();a=$("div#languages_container select:last").clone().attr("id","user_languages_attributes_"+$("div#languages_container select").length+"_id").attr("name","user[languages_attributes]["+$("div#languages_container select").length+"][id]").change($.loovrs.tabs.sixth.profileTabs.yourData.showSubmitButton).val("");var d=$(document.createElement("a")).addClass("delete").addClass("data").attr("href","#").append("["+$.loovrs.I18n.t("profile.tabs.tab1.delete_item")+"]");$("div#languages_container a#add_language").before(a).before(d).before(document.createElement("br"));return a},addOtherLikes:function(a){a.preventDefault();$.loovrs.tabs.sixth.profileTabs.yourData.addOtherLike()},addOtherLike:function(a){var d=$.loovrs.config.templates.profile_like_other.clone(),j=$("input:text",d).change($.loovrs.tabs.sixth.profileTabs.yourData.showSubmitButton);a&&j.val(a);$("div#likes div.like.others div.values").append(d)},clearDeletedOthers:function(){$("div#likes div.like.others div.value.delete").remove()},submitForm:function(a){a.preventDefault();if($.loovrs.tabs.sixth.profileTabs.yourData.formChanged){var d=$("div#profile_tab_content-1 form");$.loovrs.tabs.sixth.profileTabs.yourData.saving(d);$("body").popup().show($('<div class="loading"/><span class="message">'+$.loovrs.I18n.t("profile.tabs.tab1.saving_message")+"</span>"),{modal:true,convertNLtoBR:false,main_class:"profile"});$.loader("put",d.attr("action"),d.serialize(),function(j){debug("user",j);$("body").popup().hide();$.loovrs.tabs.sixth.profileTabs.yourData.saved(d);$.loovrs.tabs.sixth.profileTabs.yourData.clearErrors();$.loovrs.tabs.sixth.profileTabs.yourData.clearDeletedOthers();$.loovrs.user.setMe(j.user);$.loovrs.tabs.setTabsSexClasses();$.loovrs.user.me.lookingfor_id&&$.loovrs.data.resetData()},$.loovrs.tabs.sixth.profileTabs.yourData.showFormErrors,$("div#popup div#popup_message div.loading"));return false}},saving:function(a){a=$("button#update_data",a);a.html($.loovrs.I18n.t("profile.tabs.tab1.saving"))},saved:function(a){var d=$("button#update_data",a);$.loovrs.tabs.sixth.profileTabs.yourData.formChanged=false;d.addClass("saved").stop(true).html($.loovrs.I18n.t("profile.tabs.tab1.saved"));setTimeout(function(){d.fadeOut("normal",function(){$(this).removeClass("show saved").html($.loovrs.I18n.t("profile.tabs.tab1.submit"))})},1500)},showFormErrors:function(a){var d=$("div#profile_tab_content-1 form");$.loovrs.tabs.sixth.profileTabs.yourData.formChanged=false;if(a&&a.messages)for(var j,b=0;b<a.messages.length;b++){j=a.messages[b];$("input#user_"+j[0]).addClass("error").showTooltip({message:j[1]}).focus(function(){this.select()}).mouseup(function(){this.select();return false})}else $("body").popup().show($.loovrs.I18n.t("profile.tabs.tab1.error_profile_save"),{convertNLtoBR:false,modal:false,main_class:"profile"});var c=$("button#update_data",d);c.addClass("error").stop(true).html($.loovrs.I18n.t("profile.tabs.tab1.error"));setTimeout(function(){c.fadeOut("normal",function(){$(this).removeClass("show error").html($.loovrs.I18n.t("profile.tabs.tab1.submit"))})},1500)},clearErrors:function(){$("div#profile_tab_content-1 form input").hideTooltip()},profileEditingBlur:function(){$.loovrs.tabs.sixth.profileTabs.yourData.modified&&debug("profileEditingBlur")},mapSearchEvents:function(){var a=$("input#where_textbox").val();$("input#where_textbox").focus(function(){this.select()}).mouseup(function(){this.select();return false}).livesearch({searchCallback:$.loovrs.tabs.sixth.profileTabs.yourData.searchMap,queryDelay:400,innerText:a,minimumSearchLength:3})},loadMap:function(){if(typeof GBrowserIsCompatible!="undefined"&&GBrowserIsCompatible()){$.loovrs.tabs.sixth.profileTabs.yourData.map=new GMap2($("div#where_map").get(0));$.loovrs.tabs.sixth.profileTabs.yourData.map.setCenter(new GLatLng(37.4419,-122.1419),1);$.loovrs.tabs.sixth.profileTabs.yourData.map.setUIToDefault();$.loovrs.tabs.sixth.profileTabs.yourData.geocoder=new GClientGeocoder;GEvent.addListener($.loovrs.tabs.sixth.profileTabs.yourData.map,"click",function(a,d){$.loovrs.maps.clearMapMarkers($.loovrs.tabs.sixth.profileTabs.yourData.map);$.loovrs.maps.addMapMarker($.loovrs.tabs.sixth.profileTabs.yourData.map,d);$.loovrs.tabs.sixth.profileTabs.yourData.geocoder.getLocations(d,function(j){if(j&&j.Placemark&&j.Placemark.length>=1&&j.Placemark[0]&&j.Placemark[0].address){$("input#where_textbox").val(j.Placemark[0].address);$.loovrs.tabs.sixth.profileTabs.yourData.addressToForm(j.Placemark[0])}})})}},resizeMap:function(){if($.loovrs.tabs.sixth.profileTabs.yourData.map){$.loovrs.tabs.sixth.profileTabs.yourData.map.checkResize();$.loovrs.user.imLogged()&&$.loovrs.user.me.address&&$("input#where_textbox").val($.loovrs.user.me.address.address)}},searchMap:function(a){$("input#where_textbox").loading();if(!$.loovrs.tabs.sixth.profileTabs.yourData.geocoder)$.loovrs.tabs.sixth.profileTabs.yourData.geocoder=new GClientGeocoder;a&&$.loovrs.tabs.sixth.profileTabs.yourData.geocoder.getLocations(a,function(d){$("input#where_textbox").stopLoading();d&&d.Placemark&&$("input#where_textbox").suggest({data:d.Placemark,format:function(j){return j.address},select:function(j){if(j&&j.address){$.loovrs.tabs.sixth.profileTabs.yourData.map.setCenter(new GLatLng(j.Point.coordinates[1],j.Point.coordinates[0]),12);$.loovrs.maps.clearMapMarkers($.loovrs.tabs.sixth.profileTabs.yourData.map);$.loovrs.maps.addMapMarker($.loovrs.tabs.sixth.profileTabs.yourData.map);$.loovrs.tabs.sixth.profileTabs.yourData.addressToForm(j)}}})})},addressToForm:function(a){if(a){$.loovrs.tabs.sixth.profileTabs.yourData.emptyAddressFields();!a.address||$("input#user_address_attributes_address").val(a.address).change();if(a.AddressDetails&&a.AddressDetails.Country){$("input#user_address_attributes_country_attributes_name").val(a.AddressDetails.Country.CountryName).change();$("input#user_address_attributes_country_attributes_code").val(a.AddressDetails.Country.CountryNameCode).change();if(a.AddressDetails.Country.AdministrativeArea){$("input#user_address_attributes_state_attributes_name").val(a.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName).change();if(a.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea){$("input#user_address_attributes_substate_attributes_name").val(a.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.SubAdministrativeAreaName).change();if(a.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality){$("input#user_address_attributes_city_attributes_name").val(a.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.LocalityName).change();if(a.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.PostalCode){$("input#user_address_attributes_postal_code").val(a.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.PostalCode.PostalCodeNumber).change();a.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.Thoroughfare&&$("input#user_address_attributes_street").val(a.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.Thoroughfare.ThoroughfareName).change()}}}}}if(a.Point&&a.Point.coordinates&&a.Point.coordinates.length>=2){$("input#user_address_attributes_lat").val(a.Point.coordinates[1]).change();$("input#user_address_attributes_lng").val(a.Point.coordinates[0]).change()}!a.address||$("input#where_textbox").val(a.address).change()}},emptyAddressFields:function(){$("input#user_address_attributes_address").val("").change();$("input#user_address_attributes_postal_code").val("").change();$("input#user_address_attributes_street").val("").change();$("input#user_address_attributes_lat").val("").change();$("input#user_address_attributes_lng").val("").change();$("input#user_address_attributes_country_attributes_name").val("").change();$("input#user_address_attributes_country_attributes_code").val("").change();$("input#user_address_attributes_country_attributes_id").val("").change();$("input#user_address_attributes_state_attributes_name").val("").change();$("input#user_address_attributes_state_attributes_id").val("").change();$("input#user_address_attributes_substate_attributes_name").val("").change();$("input#user_address_attributes_substate_attributes_id").val("").change();$("input#user_address_attributes_city_attributes_name").val("").change();$("input#user_address_attributes_city_attributes_id").val("").change();$("input#user_address_attributes_id").val("").change()}},yourPhotos:{detailPanel:"div#profile_tab_content-2:not(.ui-tabs-hide)",init:function(){$.loovrs.tabs.sixth.profileTabs.yourPhotos.events();$.loovrs.tabs.sixth.profileTabs.yourPhotos.initFileUpload()},events:function(){$(document).bind("profile_tab2",$.loovrs.tabs.sixth.profileTabs.yourPhotos.selected);$(document).bind("coords_ready",$.loovrs.tabs.sixth.profileTabs.yourPhotos.beginCropping);$("div#profile_tab_content-2 div.pagination div.scrollable div.user_photos div.photo").live("click",function(a){a.preventDefault();$.loovrs.tabs.sixth.profileTabs.yourPhotos.loadImageDetail($(this))});$("div#profile_tab_content-2 button.edit.delete.show").live("click",function(a){a.preventDefault();a=$("div#profile_tab_content-2 div.user_photos div.photo.active").data("imageData");var d=$(new Image).attr("src",$.loovrs.user.me.image),j=$.loovrs.config.templates.confirm_delete_image.clone(),b;$("body").popup().show(j,{convertNLtoBR:false,main_class:"images"});$("div#popup.images div.image_to_delete").append(d);if(a.thumbnail)b="/images/"+a.id+"?name="+a.thumbnail;else if(a.filename)b="/images/"+a.id+"?name="+a.filename;$("div#popup.images div.image_to_delete img").loadImage(b)});$("div#profile_tab_content-2 button.edit.profile.show").live("click",function(a){a.preventDefault();a=$("div#profile_tab_content-2 div.user_photos div.photo.active").data("imageData");var d=$(new Image).attr("src",$.loovrs.user.me.image),j=$.loovrs.config.templates.confirm_profile_image.clone(),b;$("body").popup().show(j,{convertNLtoBR:false,main_class:"images"});$("div#popup.images div.profile_image").append(d);if(a.thumbnail)b="/images/"+a.id+"?name="+a.thumbnail;else if(a.filename)b="/images/"+a.id+"?name="+a.filename;$("div#popup.images div.profile_image img").loadImage(b)});$("div#profile_tab_content-2 button.edit.select_face.show:not(.finish)").live("click",function(a){a.preventDefault();var d=$("div#profile_tab_content-2 div.user_photos div.photo.active").data("imageData");$.loader("get","/images/find_face",{id:d.id},function(j){$(document).trigger("coords_ready",{coords:j.coords,imageData:d})},$("div.photo_and_comments div.photo, div.user_photos div.photo.active",$("div#profile_tab_content-2")))});$("div#profile_tab_content-2 button.edit.select_face.finish.show").live("click",function(a){a.preventDefault();a=$("div#profile_tab_content-2 div.user_photos div.photo.active");var d=$("button.edit.select_face",$($.loovrs.tabs.sixth.profileTabs.yourPhotos.detailPanel));$.loovrs.tabs.sixth.profileTabs.yourPhotos.endFaceSelection(a,d);$(this).removeClass("finish")});$("div#popup div#popup_message button.confirm_upload_yes").live("click",function(a){a.preventDefault();$.loovrs.tabs.sixth.profileTabs.yourPhotos.endFaceSelection()});$("div#popup div#popup_message button.confirm_delete_image_yes").live("click",$.loovrs.tabs.sixth.profileTabs.yourPhotos.deleteImage);$("div#popup div#popup_message button.confirm_profile_image_yes").live("click",$.loovrs.tabs.sixth.profileTabs.yourPhotos.setProfileImage)},selected:function(){debug("profile_tab2")},placeButton:function(a,d,j,b){d=d+b;j=$("div#profile_tab_content-2").outerHeight()-j;$(a,$("div#tabs-6:not(.ui-tabs-hide) div#profile_tab_content-2:not(.ui-tabs-hide)")).animate({top:d<j?d:j},750)},showEditButtons:function(){},generateThumbnails:function(){var a=$.loovrs.user.me.images;$.loovrs.user.me.images&&$.loovrs.user.me.images.length>0&&$("div#profile_tab_content-2").find("button.edit.select_face:not(.show),button.edit.delete:not(.show)").addClass("show");$("div#profile_tab_content-2 div.pagination div.scrollable div.items").empty();for(x in a){image=a[x];$.loovrs.tabs.sixth.profileTabs.yourPhotos.addThumbnail(image)}$.loovrs.pagination.setScroll($("div#profile_tab_content-2 div.pagination div.scrollable"),{size:3});$("div#profile_tab_content-2 div.thumbnails.top div.user_photos div.photo:first").addClass("active");$("div#profile_tab_content-2 div.thumbnails.bottom div.user_photos div.photo:first").addClass("active");$.loovrs.tabs.sixth.profileTabs.yourPhotos.loadImageDetail($("div#profile_tab_content-2 div.thumbnails.top div.user_photos div.photo:first-child"))},addThumbnail:function(a){if(a){var d=0,j,b=$.loovrs.config.templates.profile_thumbnails.clone(),c=$("img",b),m=$("span".thumbnail);j=a.thumbnail?"/images/"+a.id+"?name="+a.thumbnail:$.loovrs.user.me.image;a.profile_image_id&&b.addClass("profile");c.loadImage(j);a.rating&&$("div.rating",b).show().html(a.rating.rate);a.comments&&m.prepend(d);if(a.id){b.addClass(a.id+"");$("div#profile_tab_content-2 div.user_photos").append(b).find("div.photo."+a.id).data("imageData",a)}return b}},loadImageDetail:function(a){if(!a.hasClass("preview")){var d=a.data("imageData");a=$(new Image).loadImage($.loovrs.user.me.image);if(!(!d||$("div#profile_tab_content-2 div.user_photos div.photo.preview").length>0)){$("div#profile_tab_content-2 div.photo_and_comments div.photo").length==0&&$("div#profile_tab_content-2 div.photo_and_comments").append($('<div class="photo"/>'));$("div#profile_tab_content-2 div.user_photos div.photo").animate({opacity:0.7},300);$("div#profile_tab_content-2 div.user_photos div.photo").each(function(){if($(this).data("imageData")){var j=$(this).data("imageData").id;j==d.id&&$(this).animate({opacity:1},300)}});a.loadImage("/images/"+d.id+"?name="+d.filename,function(j){$(j).attr("alt",d.id);$("div#profile_tab_content-2 div.user_photos div.photo").removeClass("active");$("div#profile_tab_content-2 div.user_photos div.photo."+d.id).addClass("active");var b=$.loovrs.tabs.sixth.profileTabs.yourPhotos.detailPanel;$("button.edit.select_face",$(b)).fadeIn(500).removeClass("hide").addClass("show");$("button.edit.delete",$(b)).fadeIn(500).removeClass("hide").addClass("show");$.loovrs.tabs.sixth.profileTabs.yourPhotos.isProfileImage(d);$("div#profile_tab_content-2 div.photo_and_comments div.photo img").remove();$("div#profile_tab_content-2 div.photo_and_comments div.photo").show().append(j);$("div#profile_tab_content-2 div.photo_and_comments").find("div.photo, div.photo img").css({width:d.width,height:d.height});$("div#profile_tab_content-2 div.photo_and_comments div.photo span.profile_image_explain").css({width:parseInt(d.width)-20})},$("div.photo_and_comments div.photo, div.user_photos div.photo.active",$("div#profile_tab_content-2")))}}},initFileUpload:function(){if(!$.loovrs.tabs.sixth.profileTabs.yourPhotos.uploader)$.loovrs.tabs.sixth.profileTabs.yourPhotos.uploader=new AjaxUpload($("button#upload"),{action:"/images",name:"image",responseType:"json",onSubmit:function(){if($(this).parent().hasClass("disabled"))return false;$.loovrs.tabs.sixth.profileTabs.yourPhotos.showUploadingMessage();$.loovrs.tabs.sixth.profileTabs.yourPhotos.uploader.setData({authenticity_token:AUTHENTICITY_TOKEN});$("div#profile_tab_content-2 div.user_photos div.photo").removeClass("active").animate({opacity:0.7},300);$("div#profile_tab_content-2 div.photo_and_comments div.photo").hide();$.loovrs.tabs.sixth.profileTabs.yourPhotos.hideButtons("upload",$.loovrs.I18n.t("profile.tabs.tab2.uploading"))},onComplete:function(a,d){d&&d&&d.image&&$.loovrs.tabs.sixth.profileTabs.yourPhotos.processUploadedPhoto(d.image)}})},showUploadingMessage:function(){$("body").popup().show($.loovrs.config.templates.upload_message.clone(),{modal:true,convertNLtoBR:false,main_class:"images"});$("div#popup div#popup_message div.loading").loading()},hideUploadingMessage:function(){$("div#popup div#popup_message div.loading").stopLoading();$("body").popup().hide()},processUploadedPhoto:function(a){var d=$(document.createElement("div")).addClass("uploaded_image photo").width(a.width).height(a.height),j=$(new Image),b=$("div#profile_tab_content-2 div.user_photos div.photo.active");b.addClass(a.id+"");j.loadImage("/images/"+a.id+"?name="+a.filename,function(){$("div#profile_tab_content-2 div.photo_and_comments").empty().append(d.append(j));$.loader("get","/images/find_face",{id:a.id},function(c){$("div#profile_tab_content-2 div.user_photos").append($.loovrs.tabs.sixth.profileTabs.yourPhotos.addThumbnail({}).addClass("active"));var m=$("div#profile_tab_content-2 div.pagination div.scrollable").scrollable(0);m.reload().end(1000);m=$("div#profile_tab_content-2 div.pagination div.scrollable").scrollable(1);m.reload().end(1000);$.loovrs.tabs.sixth.profileTabs.yourPhotos.hideUploadingMessage();$(document).trigger("coords_ready",{coords:c.coords,imageData:a})},$("div.photo_and_comments div.photo, div.user_photos div.photo.active",$("div#profile_tab_content-2")),true)}).parent().css({width:j.attr("width"),height:j.attr("height")})},beginCropping:function(a,d){a=d.coords?d.coords:{x:0,y:0,w:0,h:0};var j=d.imageData;d=$("div#profile_tab_content-2 div.photo_and_comments div.photo img");var b=$("div#profile_tab_content-2 div.user_photos div.photo.active"),c=$("div#profile_tab_content-2 div.user_photos div.photo.active img.user_photo");function m(o){o=o?o:{x:0,y:0,w:0,h:0};var k=o.w>0?187/o.w:0,g=o.h>0?187/o.h:0;c.css({width:Math.round(k*j.width)+"px",height:Math.round(g*j.height)+"px",marginLeft:"-"+Math.round(k*o.x)+"px",marginTop:"-"+Math.round(g*o.y)+"px"}).data("coords",{x:o.x,y:o.y,width:o.w,height:o.h})}if(b){b.addClass("preview").data("imageData",j);c.attr("src",d.attr("src"));$.loovrs.tabs.sixth.profileTabs.yourPhotos.hideButtons("select_face",$.loovrs.I18n.t("profile.tabs.tab2.select_face_done"));$.loovrs.tabs.sixth.profileTabs.yourPhotos.jcrop_api=$.Jcrop(d,{keySupport:false,boxWidth:parseInt(j.width),boxHeight:parseInt(j.height),onSelect:m,onChange:m,aspectRatio:1,setSelect:[parseInt(a.x),parseInt(a.y),parseInt(a.x+a.width),parseInt(a.y+a.height)]});$("button.edit.upload.show",$($.loovrs.tabs.sixth.profileTabs.yourPhotos.detailPanel)).html($.loovrs.I18n.t("profile.tabs.tab2.upload_done")).click(function(o){o.preventDefault();$("body").popup().show($.loovrs.config.templates.confirm_upload_ending.clone(),{convertNLtoBR:false,main_class:"images"})});$(document).scrollTo($("div#profile_tab_content-2 div.gallery.top div.user_photos"),500)}},endFaceSelection:function(a,d){a=a?a:$("div#profile_tab_content-2 div.user_photos div.photo.preview");var j=a.find("img.user_photo").data("coords"),b=a.data("imageData");d=d?d:$("button.edit.upload.show",$($.loovrs.tabs.sixth.profileTabs.yourPhotos.detailPanel));if(b){a.addClass(b.id+"");d.html($.loovrs.I18n.t("profile.tabs.tab2.saving"));$("div#profile_tab_content-2 div.photo_and_comments div.photo img").show().parent().removeClass("uploaded_image");$.loovrs.tabs.sixth.profileTabs.yourPhotos.jcrop_api.destroy();$("body").popup().hide();$.loader("put","/images/"+b.id,{"coords[x]":j.x,"coords[y]":j.y,"coords[width]":j.width,"coords[height]":j.height},function(c){if(c||c.image){a.data("imageData",c.image);d.html($.loovrs.I18n.t("profile.tabs.tab2.saved")).addClass("saved");setTimeout(function(){d.fadeOut(500,function(){$.loovrs.tabs.sixth.profileTabs.yourPhotos.uploader.enable();$.loovrs.tabs.sixth.profileTabs.yourPhotos.resetButtons();$.loovrs.tabs.sixth.profileTabs.yourPhotos.isProfileImage(c.image)})},2000);$("div#profile_tab_content-2 div.user_photos div.photo.active img.user_photo").loadImage("/images/"+c.image.id+"?name="+c.image.thumbnail,function(){$("div#profile_tab_content-2 div.user_photos div.photo.active img.user_photo").css({width:null,height:null,marginLeft:null,marginTop:null})},null,true);$("div#profile_tab_content-2 div.user_photos div.photo").removeClass("active");a.addClass("active").removeClass("preview")}},function(){$("body").popup().show($.loovrs.I18n.t("profile.tabs.tab2.error_image_upload"),{convertNLtoBR:false,main_class:"images"});$.loovrs.tabs.sixth.profileTabs.yourPhotos.resetButtons()},$("div.photo_and_comments div.photo, div.user_photos div.photo.active",$("div#profile_tab_content-2")))}},hideButtons:function(a,d){var j=$.loovrs.tabs.sixth.profileTabs.yourPhotos.detailPanel;$("button.edit",$(j)).each(function(){if($(this).hasClass(a)){$(this).html(d).addClass("finish");$(this).hasClass("hide")&&$(this).fadeIn(500,function(){$(this).removeClass("hide").addClass("show")})}else $(this).fadeOut(500,function(){$(this).removeClass("show").addClass("hide")})})},resetButtons:function(){var a=$.loovrs.tabs.sixth.profileTabs.yourPhotos.detailPanel;$("button.edit.upload",$(a)).removeClass("saved").html($.loovrs.I18n.t("profile.tabs.tab2.upload_picture")).fadeIn(500);$("button.edit.select_face",$(a)).removeClass("saved").html($.loovrs.I18n.t("profile.tabs.tab2.select_face")).fadeIn(500);$("button.edit.profile",$(a)).removeClass("saved").html($.loovrs.I18n.t("profile.tabs.tab2.profile")).fadeIn(500);$("button.edit.delete",$(a)).removeClass("saved").html($.loovrs.I18n.t("profile.tabs.tab2.del")).fadeIn(500);$("button.edit.hide",$(a)).addClass("show").fadeIn(500,function(){$(this).removeClass("hide")})},isProfileImage:function(a){var d=$("div#profile_tab_content-2 button.edit.profile");if(a.profile_image_id){$("div#profile_tab_content-2 div.user_photos div.photo.active").hasClass("profile")||$("div#profile_tab_content-2 div.user_photos div.photo.active").addClass("profile");d.hasClass("show")&&d.fadeOut(800,function(){$(this).removeClass("show")});$("div#profile_tab_content-2 div.photo_and_comments div.photo").append($('<span class="profile_image_explain notes"></span>').html($.loovrs.I18n.t("profile.tabs.tab2.profile_image_explain")))}else{d.hasClass("show")||d.hide().addClass("show").fadeIn(800);$("div#profile_tab_content-2 div.photo_and_comments div.photo span.profile_image_explain").remove()}},setProfileImage:function(a){a.preventDefault();var d=$("div#profile_tab_content-2 div.user_photos div.photo.active").data("imageData");$("body").popup().hide();$.loader("put","/images/set_profile_image/"+d.id,{},function(j){$("div#profile_tab_content-2 div.user_photos div.photo").removeClass("profile");$("div#profile_tab_content-2 div.user_photos div.photo."+d.id).addClass("profile");$("div#profile_tab_content-2 button.edit.profile.show").fadeOut(800,function(){$(this).removeClass("show")});$("div.user_photos div.photo.active, div.photo_and_comments div.photo",$("div#profile_tab_content-2")).effect("pulsate",{times:1},500);$("div.user_photos div.photo").each(function(){var b=$(this).data("imageData");if(b){b.profile_image_id=null;$(this).data("imageData",b)}});$("div.user_photos div.photo.active").data("imageData",j.image);$("div#profile_tab_content-2 div.photo_and_comments div.photo").append($('<span class="profile_image_explain notes"></span>').html($.loovrs.I18n.t("profile.tabs.tab2.profile_image_explain")))})},deleteImage:function(a){a.preventDefault();var d=$("div#profile_tab_content-2 div.user_photos div.photo.active").data("imageData");$("body").popup().hide();$.loader("del","/images/"+d.id,{},function(){$("div#profile_tab_content-2 div.user_photos div.photo").each(function(){if($(this).data("imageData")){var j=$(this).data("imageData").id;j==d.id&&$(this).hide("explode",{pieces:12},1000,function(){$(this).remove()})}});$("div.photo_and_comments div.photo",$("div#profile_tab_content-2")).hide("explode",{pieces:12},1000,function(){$(this).prev().click();$(this).remove();$(window).scrollTo($(this).prev(),800)});scrollable=$("div#profile_tab_content-2 div.pagination div.scrollable").scrollable(0);scrollable.reload().prev();scrollable=$("div#profile_tab_content-2 div.pagination div.scrollable").scrollable(1);scrollable.reload().prev()})}}}}});$.extend($.loovrs,{footer:{init:function(){$.loovrs.footer.events()},events:function(){$("div#footer ul.footer li.link a").hover(function(){$(this).parent().toggleClass("hover")},function(){$(this).parent().toggleClass("hover")});$("div#footer ul.footer li.link a:not(.new)").click(function(a){a.preventDefault();$(this).popup().show($("<div>").addClass("footer_content"),{convertNLtoBR:false});$.loader("getHTML",$(this).attr("href"),{},function(d){$("div#popup div.footer_content").html(d)},$("div#popup div.footer_content"))})}}});$.extend({loader:function(a,d,j,b,c,m){a=$.loovrs.request[a];if(c&&c.jquery){m=c;c=null}$.loadRequest(a,d,j,b,c,m)},loadRequest:function(a,d,j,b,c,m){!m||m.loading();a(d,j,function(o){!m||m.stopLoading();!b||b(o)},function(o){!m||m.stopLoading();!c||c(o)})},viewportHeight:function(){var a=0;if(typeof window.innerHeight=="number")a=window.innerHeight;else if(document.documentElement&&document.documentElement.clientHeight)a=document.documentElement.clientHeight;else if(document.body&&document.body.clientHeight)a=document.body.clientHeight;return a},isEmpty:function(a){for(x in a)return false;return true}});$.extend($.loovrs,{comet:{client:null,connected:false,subscriptions:[],init:function(){$.loovrs.comet.config();$.loovrs.comet.client=new STOMPClient;$.loovrs.comet.client.onopen=function(){$.loovrs.comet.connected=true;$.loovrs.comet.setSubscriptions()};$.loovrs.comet.client.onclose=function(){$.loovrs.comet.connected=false};$.loovrs.comet.client.onerror=function(){};$.loovrs.comet.client.onerrorframe=function(){};$.loovrs.comet.client.onconnectedframe=function(){};$.loovrs.comet.client.onmessageframe=$.loovrs.comet.dispatcher},config:function(){document.domain=document.domain;TCPSocket=Orbited.TCPSocket;Orbited.settings.port=31453;Orbited.settings.hostname=document.domain;var a=Orbited.util.chooseTransport;Orbited.util.chooseTransport=function(){if($.browser.msie)return Orbited.CometTransports.LongPoll;return a()};$.loovrs.comet.events()},events:function(){$(document).bind("load_people",function(a,d){a=d.people;!a||a.length==0||$.each(a,function(j,b){b&&b.user&&b.user.public_comet_channel&&$.loovrs.comet.subscribe("/"+
b.user.public_comet_channel)})});$(document).bind("clear_people",function(){$("div#tabs-1 div.list div.people div.personContainer").each(function(a,d){(a=$(d).data("person"))&&a.public_comet_channel&&$.loovrs.comet.unsubscribe("/"+a.public_comet_channel)})})},connect:function(){$.loovrs.comet.client.connect(document.domain,61613,"guest","guest")},setSubscriptions:function(){if($.loovrs.comet.connected){$.loovrs.user.me&&$.loovrs.user.me.private_comet_channel&&$.loovrs.comet.subscribe("/"+$.loovrs.user.me.private_comet_channel);$.loovrs.comet.subscribe("/info");$.each($.loovrs.user.me.loovrs,function(a,d){d&&d.loovrs_user&&d.loovrs_user.public_comet_channel&&$.loovrs.comet.subscribe("/"+d.loovrs_user.public_comet_channel)});$.each($.loovrs.user.me.favourites,function(a,d){if(d&&d.favourite_user&&d.favourite_user.public_comet_channel)try{$.loovrs.comet.subscribe("/"+d.favourite_user.public_comet_channel)}catch(j){}})}},unsubscribeAll:function(){if($.loovrs.comet.connected){$.loovrs.user.me&&$.loovrs.user.me.private_comet_channel&&$.loovrs.comet.unsubscribe("/"+$.loovrs.user.me.private_comet_channel);$.loovrs.comet.unsubscribe("/info");$.each($.loovrs.user.me.loovrs,function(d,j){j&&j.loovrs_user&&$.loovrs.comet.unsubscribe("/"+j.loovrs_user.public_comet_channel)});$.each($.loovrs.user.me.favourites,function(d,j){j&&j.favourite_user&&$.loovrs.comet.unsubscribe("/"+j.favourite_user.public_comet_channel)});for(var a=$.loovrs.comet.subscriptions.length-1;a>=0;a--)$.loovrs.comet.unsubscribe($.loovrs.comet.subscriptions[a]);$.loovrs.comet.disconnect()}},dispatcher:function(a){debug(a);if(a&&a.headers&&a.headers["X-type"]&&a.body)try{var d=eval("("+a.body+")"),j=a.headers["X-type"];$.loovrs.events.bind_by_type(d,j)}catch(b){debug(b)}},subscribe:function(a){try{if($.loovrs.comet.connected)if(!($.inArray(a,$.loovrs.comet.subscriptions)>-1)){if($.loovrs.user.me){var d=$.loovrs.user.me;if(a=="/"+d.public_comet_channel)return}$.loovrs.comet.client.subscribe(a);$.loovrs.comet.subscriptions.push(a)}}catch(j){debug(j)}},unsubscribe:function(a){if($.loovrs.comet.connected)try{$.loovrs.comet.client.unsubscribe(a);$.loovrs.comet.subscriptions.splice($.inArray(a,$.loovrs.comet.subscriptions),1)}catch(d){debug(d)}},disconnect:function(){if($.loovrs.comet.connected)try{!$.loovrs.comet.client||$.loovrs.comet.client.disconnect()}catch(a){debug(a)}}}});$.extend($.loovrs,{events:{bind_by_type:function(a,d){switch(d){case"chat":a.chat&&a.chat.message&&$.loovrs.chat.messageReceived(a.chat);break;case"user_logs_in":$.loovrs.events.personLogsIn(a);break;case"user_logs_out":$.loovrs.events.personLogsOut(a);break;case"updated_image":$.loovrs.events.photoUpdated(a);break;case"updated_user":$.loovrs.events.userUpdated(a);break;case"new_vote":$.loovrs.events.newVote(a);break;case"add_favourite":$.loovrs.events.favouriteAdded(a);break;case"remove_favourite":$.loovrs.events.favouriteRemoved(a);break;case"add_loovr":$.loovrs.events.loovrsAdded(a);break;case"remove_loovr":$.loovrs.events.loovrsRemoved(a);break;case"profile_visit":$.loovrs.events.profileVisit(a);break;case"new_user":$.loovrs.events.newUser();break;case"delete_user":$.loovrs.events.deletedUser();break;default:debug("unknown comet type request: ",d);break}},personLogsIn:function(a){if(a&&a.user){a=a.user;$.loovrs.user.isMe(a)||addNotification(false,$.loovrs.I18n.t("events.person_logs_in",{name:"<strong>"+a.name+"</strong>"}));$(document).trigger("person_logs_in",a)}},personLogsOut:function(a){if(a&&a.user){a=a.user;$.loovrs.user.isMe(a)||addNotification(false,$.loovrs.I18n.t("events.person_logs_out",{name:"<strong>"+a.name+"</strong>"}));$(document).trigger("person_logs_out",a)}},photoUpdated:function(a){if(!(!a||!a.image||!a.image.user)){var d=a.image.user;$.loovrs.user.isMe(d)||addNotification(false,$.loovrs.I18n.t("events.new_photo",{name:"<strong>"+d.name+"</strong>",possessive:$.loovrs.user.possessive()}));$(document).trigger("person_updated",d);$.loovrs.tabs.second.reloadImages(a)}},userUpdated:function(a){if(a&&a.user){a=a.user;$.loovrs.user.isMe(a)||addNotification(false,$.loovrs.I18n.t("events.user_updated",{name:"<strong>"+a.name+"</strong>",possessive:$.loovrs.user.possessive()}));$(document).trigger("person_updated",a)}},newProfilePhoto:function(){},newVote:function(a){if(!(!a||!a.vote||!a.vote.voter)){var d=a.vote.voter;$.loovrs.user.isMe(d)||addNotification(false,$.loovrs.I18n.t("events.vote",{name:"<strong>"+d.name+"</strong>",count:a.vote.rating}));$(document).trigger("person_updated",d)}},favouriteAdded:function(a){if(!(!a||!a.favourite||!a.favourite.user)){a=a.favourite.user;addNotification(false,$.loovrs.I18n.t("events.favourite_added",{name:"<strong>"+a.name+"</strong>",possessive:$.loovrs.user.possessive()}))}},favouriteRemoved:function(a){if(!(!a||!a.favourite||!a.favourite.user)){a=a.favourite.user;addNotification(false,$.loovrs.I18n.t("events.favourite_remove",{name:"<strong>"+a.name+"</strong>",possessive:$.loovrs.user.possessive()}))}},loovrsAdded:function(a){if(!(!a||!a.loovr||!a.loovr.user)){var d=a.loovr.user;addNotification(false,$.loovrs.I18n.t("events.loovrs_added",{name:"<strong>"+d.name+"</strong>",possessive:$.loovrs.user.possessive()}));$.loovrs.toolbar.userActions.updateLoovr(a.loovr)}},loovrsRemoved:function(a){if(!(!a||!a.loovr||!a.loovr.user)){a=a.loovr.user;addNotification(false,$.loovrs.I18n.t("events.loovrs_remove",{name:"<strong>"+a.name+"</strong>",possessive:$.loovrs.user.possessive()}))}},profileVisit:function(a){if(a&&a.user){a=a.user;addNotification(false,$.loovrs.I18n.t("events.profile_visit",{name:"<strong>"+a.name+"</strong>"}))}},newUser:function(){$.loovrs.general.counter.addOne()},deletedUser:function(){$.loovrs.general.counter.substractOne()}}});$.extend($.loovrs,{maps:{api_key:"ABQIAAAApzvKd8OI-7IEJPl_AD0lOhQS9yR-LLkDH1DRbjYDqshB7oNq6RQwASlKzNf-7PgbytqMRrK-CcE38Q",clearMapMarkers:function(a){a&&a.clearOverlays()},addMapMarker:function(a,d){if(a){var j=new GIcon(G_DEFAULT_ICON);j.iconSize=new GSize(23,28);j.shadowSize=new GSize(34,38);j.image=$.loovrs.user.getMapMarker();markerOptions={icon:j};d=d||a.getCenter();a.addOverlay(new GMarker(d,markerOptions))}},create_static:function(a,d,j,b,c){var m=$("<img />");m.attr("src","http://maps.google.com/staticmap?center="+
a+","+d+"&size="+j+"x"+b+"&zoom="+c+"&key="+$.loovrs.maps.api_key+"&sensor=false").attr("alt",a+","+d);return m}}});$.extend($.loovrs,{chat:{open:function(a,d){var j=$($.loovrs.config.templates.chat).clone();j.attr("id","chat_user_"+a.id).data("person",a);j.find("img").loadImage($.loovrs.data.getUserThumbnail(a));$("input[name=chat[receiver_id]]",j).val(a.id);$.loovrs.chat.historic(j,a,d);marginLeft=$("body > div.chat.static").length*270+20;j.css({marginLeft:marginLeft+"px"});$("body").append(j);$("div#chat_user_"+a.id).show("clip",500,function(){var b=$(this);$("input.text",this).focus();b.draggable({start:function(){b.removeClass("static")}}).resizable({stop:function(c,m){$("ul",b).height(m.size.height-49+"px")}});$("div.close a",b).click($.loovrs.toolbar.userActions.addChatToToolbar);$("div.write form",b).submit(function(c){c.preventDefault();data=$(this).serialize();$.loovrs.chat.addMessage(b,$.loovrs.user.me.name,$(this).find("input.text").val());$("input.text",b).val("");$.loader("post",this.action,data,function(m){$.loovrs.chat.addToHistoric(m.chat,m.chat.receiver_id)})});$("ul.messages",b).scrollTo($("ul.messages li:last-child",b),200)});return j},restore:function(a,d){var j=$.loovrs.chat.open(a);$.each(d||[],function(b,c){$.loovrs.chat.addMessage(j,a.name,c.message)})},historics:{},historic:function(a,d,j){function b(m){var o,k,g;$.each(m,function(f,n){if(!(!n||!n.chat||!n.chat.message)){o=n.chat;k=Date.parse(o.date);if(k.getHours()!=g&&o.human_date){g=k.getHours();li_date=$(document.createElement("li")).addClass("time").append($(document.createElement("span")).append("..."+o.human_date));$("ul.messages",a).append(li_date)}n=$("ul li.hidden",a).clone().show().removeClass("hidden").addClass("historic");$("span:not(.message)",n).html(o.sender.name+":&nbsp;");j&&o.id==j.id&&n.removeClass("historic").addClass("nick");$("span.message",n).html(o.message);$("ul.messages",a).append(n);f==m.length-1&&$("ul.messages",a).scrollTo($("ul.messages li:last-child",a),200)}})}var c=$.loovrs.chat.historics[d.id];c&&c.length>0?b(c):$.loader("get","/chats/last_day_chats",{sender_id:$.loovrs.user.me.id,receiver_id:d.id},function(m){if(!(!m||m.length<=0)){$.loovrs.chat.historics[d.id]=m;b(m)}})},addToHistoric:function(a,d){if(a&&d){if(!$.loovrs.chat.historics)$.loovrs.chat.historics={};$.loovrs.chat.historics[d]||($.loovrs.chat.historics[d]=[]);$.loovrs.chat.historics[d].push({chat:a})}},messageReceived:function(a){!$.loovrs.chat.messsageReceivedSound||$.loovrs.chat.messsageReceivedSound.play();chat_window=$("div#chat_user_"+a.sender_id);if(chat_window.length==0)$("div#toolbar div.chats div.list div."+a.sender.name).length==0?$.loovrs.chat.open(a.sender,a):$.loovrs.toolbar.userActions.updateChatCount(a);else{$.loovrs.chat.addToHistoric(a,a.sender_id);$.loovrs.chat.addMessage(chat_window,a.sender.name,a.message)}},addMessage:function(a,d,j){if(j){var b="nick";if(d==$.loovrs.user.me.name)b="me";var c=$("ul li.hidden",a).clone();c.addClass(b);$("span.name",c).html(d+":&nbsp;");$("span.message",c).html(j);$("ul.messages",a).append(c);c.removeClass("hidden");$("ul.messages").scrollTo(c,200)}},closeAll:function(){$("div.chat").hide("clip",500,function(){chat_window.remove()})}}});function debug(){if(RAILS_ENV!="production")if($.browser.mozilla)try{console.debug(arguments)}catch(a){}else if($.browser.safari)try{console.debug($.makeArray(arguments))}catch(d){}else if($.browser.opera)try{window.opera.postError(arguments)}catch(j){}else if($.browser.msie&&$.browser.version=="8.0")try{if(!console.debug)console.debug=iedebug;console.debug(arguments)}catch(b){}}function iedebug(){try{$.each(arguments,function(d,j){console.log("DEBUG["+d+"]: "+j)})}catch(a){alert(a)}}
function dir(){if($.browser.mozilla||$.browser.safari)console.dir(arguments)}function isIE(a){if($.browser.msie){var d=$.browser.version;if(d&&d!=""){d=parseInt(d.substring(0,1));return a>=d}}return false}function newHidden(a,d){return $(document.createElement("input")).attr("type","hidden").attr("name",a).val(d)}String.prototype.capitalize=function(){return this.replace(/\w+/g,function(a){return a.charAt(0).toUpperCase()+a.slice(1).toLowerCase()})};var notificationDiv=$('<div class="notification showing"><div class="close"><a href="#">close</a></div></div>'),computeSizesLayer,margin=5;function addNotification(a,d){var j=notificationDiv.clone();a&&j.addClass("sticky");j.append(d);a||setTimeout(function(){hideNotification(j)},7000);$("div.close a",j).click(function(b){b.preventDefault();hideNotification(j)});$("body").append(j);checkNotificationPosition(j);j.show("scale",500)}
function checkNotificationPosition(a){if(a){var d=a.prev().find("div.notification");if(!d||!d.length)d=a.prev("div.notification");var j=a.clone(),b=j.objectSize(),c=b.height;b=b.width;var m,o;if(d&&d.length){m=parseInt(d.outerHeight());o=d.offset();d=+parseInt(d.css("right"))}else{m=c;o={top:$.viewportHeight(),left:0};d=margin}o=parseInt(o.top);var k=$.viewportHeight()-(o+m),g=0;if(o-c>0)g=k+m+margin;else d=d+b+margin;a.css({bottom:g+"px",right:d+"px"});j.remove()}}
function hideNotification(a){a.addClass("hidding").hide("scale",500,function(){var d=$(this).nextAll("div.notification");$(this).remove();$.each(d,function(j,b){checkNotificationPosition($(b),500)})})}(function(a){jQuery.fn.comments=function(d){d=d||false;var j=a([]);this.each(function(b,c){b=c.firstChild;for(c=a(this).attr("id");b;){if(b.nodeType===8)j=j.add("<div rel='"+c+"'>"+b.nodeValue+"</div>");else if(d&&b.nodeType===1)j=j.add(a(b).comments(true));b=b.nextSibling}});return j}})(jQuery);(function(a){a.tools=a.tools||{};a.tools.scrollable={version:"1.1.2",conf:{size:5,vertical:false,speed:400,keyboard:true,keyboardSteps:null,disabledClass:"disabled",hoverClass:null,clickable:true,activeClass:"active",easing:"swing",loop:false,items:".items",item:null,prev:".prev",next:".next",prevPage:".prevPage",nextPage:".nextPage",api:false}};var d;function j(b,c){var m=this,o=a(this),k=!c.vertical,g=b.children(),f=0,n;d||(d=m);a.each(c,function(D,H){a.isFunction(H)&&o.bind(D,H)});if(g.length>1)g=a(c.items,b);function p(D){var H=a(D);return c.globalNav?H:b.parent().find(D)}b.data("finder",p);var y=p(c.prev),u=p(c.next),s=p(c.prevPage),B=p(c.nextPage);a.extend(m,{getIndex:function(){return f},getClickIndex:function(){var D=m.getItems();return D.index(D.filter("."+c.activeClass))},getConf:function(){return c},getSize:function(){return m.getItems().size()},getPageAmount:function(){return Math.ceil(this.getSize()/c.size)},getPageIndex:function(){return Math.ceil(f/c.size)},getNaviButtons:function(){return y.add(u).add(s).add(B)},getRoot:function(){return b},getItemWrap:function(){return g},getItems:function(){return g.children(c.item)},getVisibleItems:function(){return m.getItems().slice(f,f+c.size)},seekTo:function(D,H,K){if(D<0)D=0;if(f===D)return m;if(a.isFunction(H))K=H;if(D>m.getSize()-c.size)return c.loop?m.begin():this.end();var N=m.getItems().eq(D);if(!N.length)return m;var O=a.Event("onBeforeSeek");o.trigger(O,[D]);if(O.isDefaultPrevented())return m;if(H===undefined||a.isFunction(H))H=c.speed;function Z(){K&&K.call(m,D);o.trigger("onSeek",[D])}k?g.animate({left:-N.position().left},H,c.easing,Z):g.animate({top:-N.position().top},H,c.easing,Z);d=m;f=D;O=a.Event("onStart");o.trigger(O,[D]);if(O.isDefaultPrevented())return m;y.add(s).toggleClass(c.disabledClass,D===0);u.add(B).toggleClass(c.disabledClass,D>=m.getSize()-c.size);return m},move:function(D,H,K){n=D>0;return this.seekTo(f+D,H,K)},next:function(D,H){return this.move(1,D,H)},prev:function(D,H){return this.move(-1,D,H)},movePage:function(D,H,K){n=D>0;var N=c.size*D,O=f%c.size;if(O>0)N+=D>0?-O:c.size-O;return this.move(N,H,K)},prevPage:function(D,H){return this.movePage(-1,D,H)},nextPage:function(D,H){return this.movePage(1,D,H)},setPage:function(D,H,K){return this.seekTo(D*c.size,H,K)},begin:function(D,H){n=false;return this.seekTo(0,D,H)},end:function(D,H){n=true;var K=this.getSize()-c.size;return K>0?this.seekTo(K,D,H):m},reload:function(){o.trigger("onReload");return m},focus:function(){return d=m},click:function(D){var H=m.getItems().eq(D),K=c.activeClass,N=c.size,O=c.speed;if(D<0||D>=m.getSize())return m;if(N==1){if(c.loop)return m.next();if(D===0||D==m.getSize()-1)n=n===undefined?true:!n;return n===false?m.prev():m.next()}if(N==2){D==f&&D--;m.getItems().removeClass(K);H.addClass(K);return m.seekTo(D,O)}if(!H.hasClass(K)){m.getItems().removeClass(K);H.addClass(K);H=Math.floor(N/2);H=D-H;if(H>m.getSize()-N)H=m.getSize()-N;if(H!==D)return m.seekTo(H)}return m},bind:function(D,H){o.bind(D,H);return m},unbind:function(D){o.unbind(D);return m}});a.each("onBeforeSeek,onStart,onSeek,onReload".split(","),function(D,H){m[H]=function(K){return m.bind(H,K)}});y.addClass(c.disabledClass).click(function(){m.prev()});u.click(function(){m.next()});B.click(function(){m.nextPage()});m.getSize()<c.size&&u.add(B).addClass(c.disabledClass);s.addClass(c.disabledClass).click(function(){m.prevPage()});var G=c.hoverClass,F="keydown."+Math.random().toString().substring(10);m.onReload(function(){G&&m.getItems().hover(function(){a(this).addClass(G)},function(){a(this).removeClass(G)});c.clickable&&m.getItems().each(function(D){a(this).unbind("click.scrollable").bind("click.scrollable",function(H){if(!a(H.target).is("a"))return m.click(D)})});c.keyboard?a(document).unbind(F).bind(F,function(D){if(!(D.altKey||D.ctrlKey))if(!(c.keyboard!="static"&&d!=m)){var H=c.keyboardSteps;if(k&&(D.keyCode==37||D.keyCode==39)){m.move(D.keyCode==37?-H:H);return D.preventDefault()}if(!k&&(D.keyCode==38||D.keyCode==40)){m.move(D.keyCode==38?-H:H);return D.preventDefault()}return true}}):a(document).unbind(F)});m.reload()}a.fn.scrollable=function(b){var c=this.eq(typeof b=="number"?b:0).data("scrollable");if(c)return c;var m=a.extend({},a.tools.scrollable.conf);b=a.extend(m,b);b.keyboardSteps=b.keyboardSteps||b.size;this.each(function(){c=new j(a(this),b);a(this).data("scrollable",c)});return b.api?c:this}})(jQuery);(function(a){var d=a.scrollTo=function(b,c,m){a(window).scrollTo(b,c,m)};d.defaults={axis:"xy",duration:parseFloat(a.fn.jquery)>=1.3?0:1};d.window=function(){return a(window)._scrollable()};a.fn._scrollable=function(){return this.map(function(){var b=this,c=!b.nodeName||a.inArray(b.nodeName.toLowerCase(),["iframe","#document","html","body"])!=-1;if(!c)return b;b=(b.contentWindow||b).document||b.ownerDocument||b;return a.browser.safari||b.compatMode=="BackCompat"?b.body:b.documentElement})};a.fn.scrollTo=function(b,c,m){if(typeof c=="object"){m=c;c=0}if(typeof m=="function")m={onAfter:m};if(b=="max")b=9000000000;m=a.extend({},d.defaults,m);c=c||m.speed||m.duration;m.queue=m.queue&&m.axis.length>1;if(m.queue)c/=2;m.offset=j(m.offset);m.over=j(m.over);return this._scrollable().each(function(){var o=this,k=a(o),g=b,f,n={},p=k.is("html,body");switch(typeof g){case"number":case"string":if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(g)){g=j(g);break}g=a(g,this);case"object":if(g.is||g.style)f=(g=a(g)).offset()}a.each(m.axis.split(""),function(u,s){var B=s=="x"?"Left":"Top",G=B.toLowerCase(),F="scroll"+B,D=o[F],H=d.max(o,s);if(f){n[F]=f[G]+(p?0:D-k.offset()[G]);if(m.margin){n[F]-=parseInt(g.css("margin"+B))||0;n[F]-=parseInt(g.css("border"+B+"Width"))||0}n[F]+=m.offset[G]||0;if(m.over[G])n[F]+=g[s=="x"?"width":"height"]()*m.over[G]}else{s=g[G];n[F]=s.slice&&s.slice(-1)=="%"?parseFloat(s)/100*H:s}if(/^\d+$/.test(n[F]))n[F]=n[F]<=0?0:Math.min(n[F],H);if(!u&&m.queue){D!=n[F]&&y(m.onAfterFirst);delete n[F]}});y(m.onAfter);function y(u){k.animate(n,c,m.easing,u&&function(){u.call(this,b,m)})}}).end()};d.max=function(b,c){var m=c=="x"?"Width":"Height";c="scroll"+m;if(!a(b).is("html,body"))return b[c]-a(b)[m.toLowerCase()]();m="client"+m;var o=b.ownerDocument.documentElement;b=b.ownerDocument.body;return Math.max(o[c],b[c])-Math.min(o[m],b[m])};function j(b){return typeof b=="object"?b:{top:b,left:b}}})(jQuery);(function(a){a.fn.fill=function(d){var j=new RegExp("\\n","g");function b(k,g,f){!k||!k.nodeValue||!g||a.each(g,function(n,p){if(n){if(p==null)p="?";n=f?f+"."+n:n;if(k.nodeValue.match(n))if(typeof p=="object"&&p!=null)b(k,p,n);else k.nodeValue=k.nodeValue.replace(new RegExp("{"+n+"}","ig"),p)}})}function c(k,g,f){!k||!k.textContent||!g||a.each(g,function(n,p){if(n){n=f?f+"."+n:n;if(k.textContent.match(n))if(p&&a.isArray(p)&&k.textContent.match(n)){k.removeChild(k.firstChild);a.each(p,function(y,u){li=document.createElement("li");li.textContent=u.name;k.appendChild(li)})}else typeof p=="object"&&c(k,p,n)}})}function m(k,g){a.each(k,function(f,n){b(n,g)})}function o(k,g){k&&g&&a.each(k.childNodes,function(f,n){if(n)if(n&&n.nodeType===3&&n.nodeValue&&!n.nodeValue.match(j))b(n,g);else if(n&&n.nodeType===1&&(n.nodeName=="UL"||n.nodeName=="LI")){c(n,g);b(n,g);o(n,g)}else{n.attributes&&n.attributes.length>0&&m(n.attributes,g);n&&n.nodeType===1&&o(n,g)}})}return this.each(function(){o(this,d)})}})(jQuery);(function(a){function d(k){k.keyCode==27&&this.hide()}function j(k){if(!this.showing){var g=this.popup.height(),f=this.popup.width();if(this.settings.transfer&&k.selector!="body"){b.call(this,k);c.call(this,g,f,true)}else c.call(this,g,f);this.bg.css({opacity:"0.6"});this.bg.fadeIn("normal")}}function b(k){var g=k.outerWidth(),f=k.outerHeight();k=k.offset();this.popup.css({top:k.top,left:k.left,width:g,height:f})}function c(k,g,f){var n=document.documentElement.clientWidth,p=a.viewportHeight(),y=a(document).scrollTop(),u=this;f?this.popup.animate({top:this.settings.center_vertical?p/2-k/2+y:25,left:n/2-g/2,width:g,height:k},"normal").fadeIn("normal",function(){u.showing=true;u.settings.onShow&&u.settings.onShow(u.message)}):this.popup.hide().css({top:this.settings.center_vertical?p/2-k/2+y:25,left:n/2-g/2}).show("puff",{},500,function(){u.showing=true;u.settings.onShow&&u.settings.onShow(u.message)});this.bg.css({height:p})}function m(){if(navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPod/i))return true;return false}function o(k){var g=this;k=jQuery(k);this.settings={};this.show=function(f,n){var p={convertNLtoBR:true,postDOM:function(){},onShow:function(){},onHide:function(){},simpleAlert:false,main_class:"",main_id:"popup",bg_id:"popup_bg",msg_id:"popup_message",close_id:"popup_close",center_vertical:true,modal:false,transfer:false,width:null,height:null};this.settings=jQuery.extend(p,n);if(this.showing){this.settings.onHide=function(){g.settings.onHide=null;g.show(f,n)};this.hide()}else{domElements='<div id="'+this.settings.bg_id+'"></div>';domElements+='<div id="'+this.settings.main_id+'" class="'+this.settings.main_class+'">';domElements+='<div id="'+this.settings.msg_id+'">';this.settings.modal||(domElements+='<a id="'+this.settings.close_id+'" class="close"></a>');domElements+="</div>";domElements+="</div>";jQuery("body").append(domElements);this.popup=jQuery("#"+this.settings.main_id);this.bg=jQuery("#"+this.settings.bg_id);this.message=this.popup.find("#"+this.settings.msg_id);this.popup.css({width:"",height:""});if(!m()&&!this.settings.simpleAlert){this.settings.width&&this.popup.css("width",this.settings.width);this.settings.height&&this.popup.css("height",this.settings.height);if(this.settings.convertNLtoBR)f=typeof f=="string"?f.replace(/\n/g,"<br/>"):a(f).html().replace(/\n/g,"<br/>");this.message.append(f);this.settings.postDOM(this.message);this.popup.draggable({});if(!this.settings.modal){this.bg.click(function(){g.hide()});this.popup.find(".close").click(function(){g.hide()});a(document).bind("keyup",function(y){d.call(g,y)})}j.call(this,k)}else alert(f);return jQuery}};this.hide=function(){try{this.popup.bind("popup.close",function(u,s){if(s){g.popup.data("close.event",a.extend({},g.popup.data("close.event"),s));if(g.popup.data("close.event").popup&&g.popup.data("close.event").bg){g.showing=false;a(document).unbind("keyup",d);g.popup.data("close.event",null);g.popup.remove();g.bg.remove();g.settings.onHide&&g.settings.onHide()}}});if(this.showing){if(this.settings.transfer&&k.selector!="body"){var f=k.outerWidth(),n=k.outerHeight(),p=k.offset();this.popup.animate({width:f,height:n,top:p.top,left:p.left,opacity:0},"normal",function(){g.popup.trigger("popup.close",{popup:true})})}else this.popup.hide("puff",{},500,function(){g.popup.trigger("popup.close",{popup:true})});this.bg.fadeOut("normal",function(){g.popup.trigger("popup.close",{bg:true})})}}catch(y){this.showing=true}}}a.fn.popup=function(k,g){var f=a(this).data("plugin.popup");if(!f){f=new o(this,k,g);a(this).data("plugin.popup",f)}return f}})(jQuery);(function(a){a.Jcrop=function(d,j){d=d;j=j;if(typeof d!=="object")d=a(d)[0];if(typeof j!=="object")j={};if(!("trackDocument"in j))j.trackDocument=true;if(!("keySupport"in j))j.keySupport=a.browser.msie?false:true;var b={trackDocument:false,baseClass:"jcrop",addClass:null,bgColor:"black",bgOpacity:0.6,borderOpacity:0.4,handleOpacity:0.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(){}},c=b;T(j);var m=a(d),o=m.clone().removeAttr("id").css({position:"absolute"});o.width(m.width());o.height(m.height());m.after(o).hide();va(o,c.boxWidth,c.boxHeight);var k=o.width(),g=o.height(),f=a("<div />").width(k).height(g).addClass(v("holder")).css({position:"relative",backgroundColor:c.bgColor}).insertAfter(m).append(o);c.addClass&&f.addClass(c.addClass);var n=a("<img />").attr("src",o.attr("src")).css("position","absolute").width(k).height(g),p=a("<div />").width(q(100)).height(q(100)).css({zIndex:310,position:"absolute",overflow:"hidden"}).append(n),y=a("<div />").width(q(100)).height(q(100)).css("zIndex",320),u=a("<div />").css({position:"absolute",zIndex:300}).insertBefore(o).append(p,y);d=c.boundary;var s=C().width(k+d*2).height(g+d*2).css({position:"absolute",top:l(-d),left:l(-d),zIndex:290}).mousedown(Ca),B,G,F,D,H,K,N=A(o),O,Z,W,ma,V=function(){var J=0,R=0,aa=0,Y=0,oa,ra;function ia(U){U=Oa(U);aa=J=U[0];Y=R=U[1]}function wa(U){U=Oa(U);oa=U[0]-aa;ra=U[1]-Y;aa=U[0];Y=U[1]}function Fa(){return[oa,ra]}function ua(U){var ja=U[0];U=U[1];if(0>J+ja)ja-=ja+J;if(0>R+U)U-=U+R;if(g<Y+U)U+=g-(Y+U);if(k<aa+ja)ja+=k-(aa+ja);J+=ja;aa+=ja;R+=U;Y+=U}function Ha(U){var ja=Ia();switch(U){case"ne":return[ja.x2,ja.y];case"nw":return[ja.x,ja.y];case"se":return[ja.x2,ja.y2];case"sw":return[ja.x,ja.y2]}}function Ia(){if(!c.aspectRatio)return za();var U=c.aspectRatio,ja=c.minSize[0]/H,Ba=c.maxSize[0]/H,Da=aa-J,Ea=Y-R,ka=Math.abs(Da),ha=Math.abs(Ea),Pa=ka/ha;if(Ba==0)Ba=k*10;if(Pa<U){ka=Y;w=ha*U;ha=Da<0?J-w:w+J;if(ha<0){ha=0;h=Math.abs((ha-J)/U);ka=Ea<0?R-h:h+R}else if(ha>k){ha=k;h=Math.abs((ha-J)/U);ka=Ea<0?R-h:h+R}}else{ha=aa;h=ka/U;ka=Ea<0?R-h:R+h;if(ka<0){ka=0;w=Math.abs((ka-R)*U);ha=Da<0?J-w:w+J}else if(ka>g){ka=g;w=Math.abs(ka-R)*U;ha=Da<0?J-w:w+J}}if(ha>J){if(ha-J<ja)ha=J+ja;else if(ha-J>Ba)ha=J+Ba;ka=ka>R?R+(ha-J)/U:R-(ha-J)/U}else if(ha<J){if(J-ha<ja)ha=J-ja;else if(J-ha>Ba)ha=J-Ba;ka=ka>R?R+(J-ha)/U:R-(J-ha)/U}if(ha<0){J-=ha;ha=0}else if(ha>k){J-=ha-k;ha=k}if(ka<0){R-=ka;ka=0}else if(ka>g){R-=ka-g;ka=g}return last=Ka(La(J,R,ha,ka))}function Oa(U){if(U[0]<0)U[0]=0;if(U[1]<0)U[1]=0;if(U[0]>k)U[0]=k;if(U[1]>g)U[1]=g;return[U[0],U[1]]}function La(U,ja,Ba,Da){var Ea=U,ka=Ba,ha=ja,Pa=Da;if(Ba<U){Ea=Ba;ka=U}if(Da<ja){ha=Da;Pa=ja}return[Math.round(Ea),Math.round(ha),Math.round(ka),Math.round(Pa)]}function za(){var U=aa-J,ja=Y-R;if(B&&Math.abs(U)>B)aa=U>0?J+B:J-B;if(G&&Math.abs(ja)>G)Y=ja>0?R+G:R-G;if(D&&Math.abs(ja)<D)Y=ja>0?R+D:R-D;if(F&&Math.abs(U)<F)aa=U>0?J+F:J-F;if(J<0){aa-=J;J-=J}if(R<0){Y-=R;R-=R}if(aa<0){J-=aa;aa-=aa}if(Y<0){R-=Y;Y-=Y}if(aa>k){U=aa-k;J-=U;aa-=U}if(Y>g){U=Y-g;R-=U;Y-=U}if(J>k){U=J-g;Y-=U;R-=U}if(R>g){U=R-g;Y-=U;R-=U}return Ka(La(J,R,aa,Y))}function Ka(U){return{x:U[0],y:U[1],x2:U[2],y2:U[3],w:U[2]-U[0],h:U[3]-U[1]}}return{flipCoords:La,setPressed:ia,setCurrent:wa,getOffset:Fa,moveOffset:ua,getCorner:Ha,getFixed:Ia}}(),fa=function(){var J,R=370,aa={},Y={},oa=false,ra=c.handleOffset;if(c.drawBorders)aa={top:ia("hline").css("top",a.browser.msie?l(-1):l(0)),bottom:ia("hline"),left:ia("vline"),right:ia("vline")};if(c.dragEdges){Y.t=ua("n");Y.b=ua("s");Y.r=ua("e");Y.l=ua("w")}c.sideHandles&&Ha(["n","s","e","w"]);c.cornerHandles&&Ha(["sw","nw","ne","se"]);function ia(ca){ca=a("<div />").css({position:"absolute",opacity:c.borderOpacity}).addClass(v(ca));p.append(ca);return ca}function wa(ca,xa){ca=a("<div />").mousedown(pa(ca)).css({cursor:ca+"-resize",position:"absolute",zIndex:xa});y.append(ca);return ca}function Fa(ca){return wa(ca,R++).css({top:l(-ra+1),left:l(-ra+1),opacity:c.handleOpacity}).addClass(v("handle"))}function ua(ca){var xa=c.handleSize,Ma=ra,Na=xa;xa=xa;var Sa=Ma;Ma=Ma;switch(ca){case"n":case"s":xa=q(100);break;case"e":case"w":Na=q(100);break}return wa(ca,R++).width(xa).height(Na).css({top:l(-Sa+1),left:l(-Ma+1)})}function Ha(ca){for(i in ca)Y[ca[i]]=Fa(ca[i])}function Ia(ca){var xa=Math.round(ca.h/2-ra),Ma=Math.round(ca.w/2-ra);west=-ra+1;var Na=ca.w-ra;ca=ca.h-ra;"e"in Y&&Y.e.css({top:l(xa),left:l(Na)})&&Y.w.css({top:l(xa)})&&Y.s.css({top:l(ca),left:l(Ma)})&&Y.n.css({left:l(Ma)});"ne"in Y&&Y.ne.css({left:l(Na)})&&Y.se.css({top:l(ca),left:l(Na)})&&Y.sw.css({top:l(ca)});"b"in Y&&Y.b.css({top:l(ca)})&&Y.r.css({left:l(Na)})}function Oa(ca,xa){n.css({top:l(-xa),left:l(-ca)});u.css({top:l(xa),left:l(ca)})}function La(ca,xa){u.width(ca).height(xa)}function za(){var ca=V.getFixed();V.setPressed([ca.x,ca.y]);V.setCurrent([ca.x2,ca.y2]);Ka()}function Ka(){if(J)return U()}function U(){var ca=V.getFixed();La(ca.w,ca.h);Oa(ca.x,ca.y);c.drawBorders&&aa.right.css({left:l(ca.w-1)})&&aa.bottom.css({top:l(ca.h-1)});oa&&Ia(ca);J||ja();c.onChange(sa(ca))}function ja(){u.show();o.css("opacity",c.bgOpacity);J=true}function Ba(){ka();u.hide();o.css("opacity",1);J=false}function Da(){if(oa){Ia(V.getFixed());y.show()}}function Ea(){oa=true;if(c.allowResize){Ia(V.getFixed());y.show();return true}}function ka(){oa=false;y.hide()}function ha(ca){(W=ca)?ka():Ea()}function Pa(){ha(false);za()}var Ra=C().mousedown(pa("move")).css({cursor:"move",position:"absolute",zIndex:360});p.append(Ra);ka();return{updateVisible:Ka,update:U,release:Ba,refresh:za,setCursor:function(ca){Ra.css("cursor",ca)},enableHandles:Ea,enableOnly:function(){oa=true},showHandles:Da,disableHandles:ka,animMode:ha,done:Pa}}(),la=function(){function J(){}function R(){}var aa=c.trackDocument;aa||s.mousemove(ra).mouseup(ia).mouseout(ia);function Y(){s.css({zIndex:450});aa&&a(document).mousemove(ra).mouseup(ia)}
function oa(){s.css({zIndex:290});aa&&a(document).unbind("mousemove",ra).unbind("mouseup",ia)}function ra(ua){J(E(ua))}function ia(ua){ua.preventDefault();ua.stopPropagation();if(O){O=false;R(E(ua));c.onSelect(sa(V.getFixed()));oa();J=function(){};R=function(){}}return false}function wa(ua,Ha){O=true;J=ua;R=Ha;Y();return false}function Fa(ua){s.css("cursor",ua)}o.before(s);return{activateHandlers:wa,setCursor:Fa}}(),ya=function(){var J=a('<input type="radio" />').css({position:"absolute",left:"-30px"}).keypress(ra).blur(Y),R=a("<div />").css({position:"absolute",overflow:"hidden"}).append(J);function aa(){if(c.keySupport){J.show();J.focus()}}function Y(){J.hide()}function oa(ia,wa,Fa){if(c.allowMove){V.moveOffset([wa,Fa]);fa.updateVisible()}ia.preventDefault();ia.stopPropagation()}function ra(ia){if(ia.ctrlKey)return true;var wa=(ma=ia.shiftKey?true:false)?10:1;switch(ia.keyCode){case 37:oa(ia,-wa,0);break;case 39:oa(ia,wa,0);break;case 38:oa(ia,0,-wa);break;case 40:oa(ia,0,wa);break;case 27:fa.release();break;case 9:return true}return nothing(ia)}
c.keySupport&&R.insertBefore(o);return{watchKeys:aa}}();function l(J){return""+parseInt(J)+"px"}function q(J){return""+parseInt(J)+"%"}function v(J){return c.baseClass+"-"+J}function A(J){J=a(J).offset();return[J.left,J.top]}function E(J){return[J.pageX-N[0],J.pageY-N[1]]}function L(J){if(J!=Z){la.setCursor(J);Z=J}}function S(J,R){N=A(o);la.setCursor(J=="move"?J:J+"-resize");if(J=="move")return la.activateHandlers(ea(R),ga);R=V.getFixed();var aa=na(J),Y=V.getCorner(na(aa));V.setPressed(V.getCorner(aa));V.setCurrent(Y);la.activateHandlers(P(J,R),ga)}function P(J,R){return function(aa){if(c.aspectRatio)switch(J){case"e":aa[1]=R.y+1;break;case"w":aa[1]=R.y+1;break;case"n":aa[0]=R.x+1;break;case"s":aa[0]=R.x+1;break}else switch(J){case"e":aa[1]=R.y2;break;case"w":aa[1]=R.y2;break;case"n":aa[0]=R.x2;break;case"s":aa[0]=R.x2;break}V.setCurrent(aa);fa.update()}}function ea(J){var R=J;ya.watchKeys();return function(aa){V.moveOffset([aa[0]-R[0],aa[1]-R[1]]);R=aa;fa.update()}}function na(J){switch(J){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 pa(J){return function(R){if(c.disabled)return false;if(J=="move"&&!c.allowMove)return false;O=true;S(J,E(R));R.stopPropagation();R.preventDefault();return false}}function va(J,R,aa){var Y=J.width(),oa=J.height();if(Y>R&&R>0){Y=R;oa=R/J.width()*J.height()}if(oa>aa&&aa>0){oa=aa;Y=aa/J.height()*J.width()}H=J.width()/Y;K=J.height()/oa;J.width(Y).height(oa)}
function sa(J){return{x:parseInt(J.x*H),y:parseInt(J.y*K),x2:parseInt(J.x2*H),y2:parseInt(J.y2*K),w:parseInt(J.w*H),h:parseInt(J.h*K)}}function ga(){var J=V.getFixed();if(J.w>c.minSelect[0]&&J.h>c.minSelect[1]){fa.enableHandles();fa.done()}else fa.release();la.setCursor(c.allowSelect?"crosshair":"default")}function Ca(J){if(c.disabled)return false;if(!c.allowSelect)return false;O=true;N=A(o);fa.disableHandles();L("crosshair");var R=E(J);V.setPressed(R);la.activateHandlers(z,ga);ya.watchKeys();fa.update();J.stopPropagation();J.preventDefault();return false}function z(J){V.setCurrent(J);fa.update()}function C(){var J=a("<div></div>").addClass(v("tracker"));a.browser.msie&&J.css({opacity:0,backgroundColor:"white"});return J}function I(J){var R=J[0]/H,aa=J[1]/K,Y=J[2]/H,oa=J[3]/K;if(!W){function ra(){window.setTimeout(U,wa)}J=V.flipCoords(R,aa,Y,oa);R=V.getFixed();var ia=initcr=[R.x,R.y,R.x2,R.y2],wa=c.animationDelay,Fa=ia[0],ua=ia[1];Y=ia[2];oa=ia[3];var Ha=J[0]-initcr[0],Ia=J[1]-initcr[1],Oa=J[2]-initcr[2],La=J[3]-initcr[3],za=0,Ka=c.swingSpeed;fa.animMode(true);var U=function(){return function(){za+=(100-za)/Ka;ia[0]=Fa+za/100*Ha;ia[1]=ua+za/100*Ia;ia[2]=Y+za/100*Oa;ia[3]=oa+za/100*La;za<100?ra():fa.done();if(za>=99.8)za=100;Q(ia)}}();ra()}}function M(J){Q([J[0]/H,J[1]/K,J[2]/H,J[3]/K])}function Q(J){V.setPressed([J[0],J[1]]);V.setCurrent([J[2],J[3]]);fa.update()}function T(J){if(typeof J!="object")J={};c=a.extend(c,J);if(typeof c.onChange!=="function")c.onChange=function(){};if(typeof c.onSelect!=="function")c.onSelect=function(){}}function ba(){return sa(V.getFixed())}function qa(){return V.getFixed()}function da(J){T(J);Ga()}function ta(){c.disabled=true;fa.disableHandles();fa.setCursor("default");la.setCursor("default")}function Aa(){c.disabled=false;Ga()}function Qa(){fa.done();la.activateHandlers(null,null)}function Ja(){f.remove();m.show()}function Ga(J){c.allowResize?J?fa.enableOnly():fa.enableHandles():fa.disableHandles();la.setCursor(c.allowSelect?"crosshair":"default");fa.setCursor(c.allowMove?"move":"default");f.css("backgroundColor",c.bgColor);if("setSelect"in c){M(j.setSelect);fa.done();delete c.setSelect}if("trueSize"in c){H=c.trueSize[0]/k;K=c.trueSize[1]/g}B=c.maxSize[0]||0;G=c.maxSize[1]||0;F=c.minSize[0]||0;D=c.minSize[1]||0;if("outerImage"in c){o.attr("src",c.outerImage);delete c.outerImage}fa.refresh()}y.hide();Ga(true);d={animateTo:I,setSelect:M,setOptions:da,tellSelect:ba,tellScaled:qa,disable:ta,enable:Aa,cancel:Qa,focus:ya.watchKeys,getBounds:function(){return[k*H,g*K]},getWidgetSize:function(){return[k,g]},release:fa.release,destroy:Ja};m.data("Jcrop",d);return d};a.fn.Jcrop=function(d){function j(b){var c=d.useImg||b.src,m=new Image;m.onload=function(){a.Jcrop(b,d)};m.src=c}if(typeof d!=="object")d={};this.each(function(){if(a(this).data("Jcrop"))if(d=="api")return a(this).data("Jcrop");else a(this).data("Jcrop").setOptions(d);else j(this)});return this}})(jQuery);(function(a){a.fn.loadImage=function(d,j,b,c){function m(o,k,g,f,n){!f||f.stopLoading().loading();if(n)k=k+"&"+escape(new Date);o.unbind("error").unbind("load");o.error(function(){!f||f.stopLoading();console.error("Error loading image",this,arguments)}).load(function(){!f||f.stopLoading();!g||g(this)}).attr("src",k)}return this.each(function(){b=b?b:a(this);a(this)&&d&&m(a(this),d,j,b,c)})}})(jQuery);(function(a){a.fn.rate=function(){function d(c,m){var o=parseInt(a(c).attr("rel"));c=a(c).attr("href");if(!o||!c)return false;a.loovrs.request.post(c,{rating:o});a("a.vote",m).removeClass("vote");a("a.point",m).each(function(k,g){var f=parseInt(a(g).attr("rel"));f<=o&&setTimeout(function(){a(g).addClass("vote")},100*k)})}function j(c,m){var o=parseInt(a(c).attr("rel"));c=a(c).attr("href");if(!o||!c)return false;a.loovrs.request.post(c,{rating:0});a.each(a("a.vote",m).get().reverse(),function(k,g){var f=parseInt(a(g).attr("rel"));f<=o&&setTimeout(function(){a(g).removeClass("vote")},100*k)})}var b;return this.each(function(){var c=a(this);a("a.point",c).click(function(m){m.preventDefault();if(b===this){j(this,c);b=null;return false}else d(this,c);b=this})})}})(jQuery);(function(a){a.fn.objectSize=function(d,j){function b(c){var m=a(document.createElement("div")).attr("id","sizer").css({width:"100%",height:"100%",position:"absolute",left:"-10000px"}).appendTo("body"),o={width:0,height:0};m.append(c);o.width=parseInt(c.outerWidth());o.height=parseInt(c.outerHeight());if(d&&o.width>d){o.height=o.height*d/o.width;o.width=d}if(j&&o.height>d){o.width=o.width*d/o.height;o.height=d}m.remove();delete m;return o}return b(a(this[0]))}})(jQuery);(function(a){a.fn.showTooltip=function(d){var j={message:null,domNode:null},b=typeof d=="string"?a.extend(j,{message:d}):a.extend({},j,d),c=a.loovrs.config.templates.tooltip.clone().appendTo("body"),m=a("div.img",c),o=5,k=20;return this.each(function(){if(!b.message){b.message=a(this).attr("rel");if(!b.message&&!b.domNode)return}c.addClass(this.id);b.message?c.find("p").text(b.message):c.append(b.domNode);var g=parseInt(a(this).offset().top),f=parseInt(a(this).offset().left),n=parseInt(a(this).outerHeight()),p=parseInt(a(this).outerWidth());tooltipHeight=c.outerHeight();tooltipWidth=parseInt(c.outerWidth());tooltipBottom=g+n+tooltipHeight;bodyHeight=parseInt(a.viewportHeight())+a("html,body").scrollTop();tooltipTopUp=g-tooltipHeight-o;tooltipTopDown=g+n+o;tooltipTop=(tooltipBottom>bodyHeight?tooltipTopUp:tooltipTopDown)+"px";tooltipDisplacement=(tooltipBottom>bodyHeight?parseInt(tooltipTop)-k:parseInt(tooltipTop)+k)+"px";tooltipLeft=p>tooltipWidth?(p-tooltipWidth)/2:(tooltipWidth-p)/2;urlImagePosition=tooltipBottom>bodyHeight?"up":"down";m.removeClass("down up").addClass(urlImagePosition);tooltipLeft=p>tooltipWidth?tooltipLeft:-tooltipLeft;c.stop(true,true).css({top:tooltipTop,left:f+"px",marginLeft:tooltipLeft+"px"}).animate({top:tooltipDisplacement,opacity:1},300,function(){a(this).css("opacity",null)})})};a.fn.hideTooltip=function(){var d,j=5,b=20;return this.each(function(){d=a("body div.tooltip."+this.id);var c=parseInt(a(this).offset().top),m=parseInt(a(this).outerHeight()),o=d.outerHeight(),k=c+m+o,g=parseInt(a.viewportHeight())+a("html,body").scrollTop();o=c-o+j;c=c+m-j+b;k=(k>g?o:c)+"px";d.stop(true,true).animate({opacity:0,top:k},300,function(){d.css({top:0,left:"-10000px"});d.remove()})})};a.fn.tooltip=function(){return this.each(function(){a(this).mouseenter(function(){a(this).showTooltip()}).mouseleave(function(){a(this).hideTooltip()})})};a.fn.clearTooltip=function(){return this.each(function(){a(this).unbind("mouseenter").unbind("mouseleave").hideTooltip()})}})(jQuery);(function(){function a(u,s,B){if(u.addEventListener)u.addEventListener(s,B,false);else if(u.attachEvent)u.attachEvent("on"+s,function(){B.call(u)});else throw new Error("not supported or DOM not loaded");}var d=document.documentElement.getBoundingClientRect?function(u){var s=u.getBoundingClientRect(),B=u.ownerDocument;u=B.body;B=B.documentElement;var G=B.clientTop||u.clientTop||0,F=B.clientLeft||u.clientLeft||0,D=1;if(u.getBoundingClientRect){D=u.getBoundingClientRect();D=(D.right-D.left)/u.clientWidth}if(D>1)F=G=0;G=s.top/D+(window.pageYOffset||B&&B.scrollTop/D||u.scrollTop/D)-G;s=s.left/D+(window.pageXOffset||B&&B.scrollLeft/D||u.scrollLeft/D)-F;return{top:G,left:s}}:function(u){var s=0,B=0;do{s+=u.offsetTop||0;B+=u.offsetLeft||0;u=u.offsetParent}while(u);return{left:B,top:s}};function j(u){var s,B,G;B=d(u);s=B.left;G=B.top;B=s+u.offsetWidth;u=G+u.offsetHeight;return{left:s,right:B,top:G,bottom:u}}function b(u,s){for(var B in s)if(s.hasOwnProperty(B))u.style[B]=s[B]}function c(u,s){var B=j(u);b(s,{position:"absolute",left:B.left+"px",top:B.top+"px",width:u.offsetWidth+"px",height:u.offsetHeight+"px"})}var m=function(){var u=document.createElement("div");return function(s){u.innerHTML=s;s=u.firstChild;return u.removeChild(s)}}(),o=function(){var u=0;return function(){return"ValumsAjaxUpload"+u++}}();function k(u){return u.replace(/.*(\/|\\)/,"")}function g(u){return-1!==u.indexOf(".")?u.replace(/.*[.]/,""):""}function f(u,s){s=new RegExp("\\b"+s+"\\b");return s.test(u.className)}function n(u,s){f(u,s)||(u.className+=" "+s)}function p(u,s){s=new RegExp("\\b"+s+"\\b");u.className=u.className.replace(s,"")}function y(u){u.parentNode.removeChild(u)}window.AjaxUpload=function(u,s){this._settings={action:"upload.php",name:"userfile",data:{},autoSubmit:true,responseType:false,hoverClass:"hover",disabledClass:"disabled",onChange:function(){},onSubmit:function(){},onComplete:function(){}};for(var B in s)if(s.hasOwnProperty(B))this._settings[B]=s[B];if(u.jquery)u=u[0];else if(typeof u=="string"){if(/^#.*/.test(u))u=u.slice(1);u=document.getElementById(u)}if(!u||u.nodeType!==1)throw new Error("Please make sure that you're passing a valid element");u.nodeName.toUpperCase()=="A"&&a(u,"click",function(G){if(G&&G.preventDefault)G.preventDefault();else if(window.event)window.event.returnValue=false});this._button=u;this._input=null;this._disabled=false;this.enable();this._rerouteClicks()};AjaxUpload.prototype={setData:function(u){this._settings.data=u},disable:function(){n(this._button,this._settings.disabledClass);this._disabled=true;var u=this._button.nodeName.toUpperCase();if(u=="INPUT"||u=="BUTTON")this._button.setAttribute("disabled","disabled");if(this._input)this._input.parentNode.style.visibility="hidden"},enable:function(){p(this._button,this._settings.disabledClass);this._button.removeAttribute("disabled");this._disabled=false},_createInput:function(){var u=this,s=document.createElement("input");s.setAttribute("type","file");s.setAttribute("name",this._settings.name);b(s,{position:"absolute",right:0,margin:0,padding:0,fontSize:"480px",cursor:"pointer"});var B=document.createElement("div");b(B,{display:"block",position:"absolute",overflow:"hidden",margin:0,padding:0,opacity:0,direction:"ltr",zIndex:2147483583});if(B.style.opacity!=="0"){if(typeof B.filters=="undefined")throw new Error("Opacity not supported by the browser");B.style.filter="alpha(opacity=0)"}a(s,"change",function(){if(!(!s||s.value==="")){var G=k(s.value);if(false===u._settings.onChange.call(u,G,g(G)))u._clearInput();else u._settings.autoSubmit&&u.submit()}});a(s,"mouseover",function(){n(u._button,u._settings.hoverClass)});a(s,"mouseout",function(){p(u._button,u._settings.hoverClass);s.parentNode.style.visibility="hidden"});B.appendChild(s);document.body.appendChild(B);this._input=s},_clearInput:function(){if(this._input){y(this._input.parentNode);this._input=null;this._createInput();p(this._button,this._settings.hoverClass)}},_rerouteClicks:function(){var u=this;a(u._button,"mouseover",function(){if(!u._disabled){u._input||u._createInput();var s=u._input.parentNode;c(u._button,s);s.style.visibility="visible"}})},_createIframe:function(){var u=o(),s=m('<iframe src="javascript:false;" name="'+u+'" />');s.setAttribute("id",u);s.style.display="none";document.body.appendChild(s);return s},_createForm:function(u){var s=this._settings,B=m('<form method="post" enctype="multipart/form-data"></form>');B.setAttribute("action",s.action);B.setAttribute("target",u.name);B.style.display="none";document.body.appendChild(B);for(var G in s.data)if(s.data.hasOwnProperty(G)){u=document.createElement("input");u.setAttribute("type","hidden");u.setAttribute("name",G);u.setAttribute("value",s.data[G]);B.appendChild(u)}return B},_getResponse:function(u,s){var B=false,G=this,F=this._settings;a(u,"load",function(){if(u.src=="javascript:'%3Chtml%3E%3C/html%3E';"||u.src=="javascript:'<html></html>';")B&&setTimeout(function(){y(u)},0);else{var D=u.contentDocument?u.contentDocument:window.frames[u.id].document;if(!(D.readyState&&D.readyState!="complete"))if(!(D.body&&D.body.innerHTML=="false")){var H;if(D.XMLDocument)H=D.XMLDocument;else if(D.body){H=D.body.innerHTML;if(F.responseType&&F.responseType.toLowerCase()=="json"){if(D.body.firstChild&&D.body.firstChild.nodeName.toUpperCase()=="PRE")H=D.body.firstChild.firstChild.nodeValue;H=H?eval("("+H+")"):{}}}else H=D;F.onComplete.call(G,s,H);B=true;u.src="javascript:'<html></html>';"}}})},submit:function(){var u=this,s=this._settings;if(!(!this._input||this._input.value==="")){var B=k(this._input.value);if(false===s.onSubmit.call(this,B,g(B)))this._clearInput();else{s=this._createIframe();var G=this._createForm(s);y(this._input.parentNode);p(u._button,u._settings.hoverClass);G.appendChild(this._input);G.submit();y(G);y(this._input);this._input=null;this._getResponse(s,B);this._createInput()}}}}})();(function(a){a.fn.suggest=function(d){var j,b,c=-1,m=false,o=[],k={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8},g={data:null,height:"150px",format:function(N){return N},select:function(){}};b=a.extend({},g,d);function f(){if(!m){a(j).keydown(function(N){switch(N.keyCode){case k.DOWN:y(j);break;case k.UP:u(j);break;case k.ESC:D(j);H(j);break;case k.RETURN:N.preventDefault();K(j,b);break;case k.TAB:K(j,b);break}}).blur(function(){c>=0&&K(j,b);H(j)});m=true}}
function n(){a(j).offset();return a(document.createElement("div")).addClass("suggest").width(a(j).outerWidth()).height(b.height)}function p(){if(b.data){if(!a.isArray(b.data))b.data=[b.data];var N=a(document.createElement("ul")),O=n(j,b.height);a.each(b.data,function(Z,W){var ma=a(document.createElement("li")),V;if(V=b.format(W)){o.push(W);ma.html(a(document.createElement("span")).append(V)).hover(function(){c=Z;B(j)});N.append(ma)}});if(N.children().length!=0){O.append(N);c=0;a("li:first-child",N).addClass("focus");a(j).showTooltip({domNode:O})}}}function y(){if(c+1<a("div.suggest ul li").length)c++;else c=0;s(j)}function u(){if(c>0)c--;else c=a("div.suggest ul li").length;s(j)}function s(){B(j);G()}function B(){a(a("div.suggest ul li").removeClass("focus")[c]).addClass("focus")}function G(){F()&&a("div.suggest").scrollTo(a("div.suggest ul li.focus"))}function F(){return true}function D(){a(j).val("")}function H(){c<0&&D(j);a(j).hideTooltip()}function K(){if(c<0)a(j).val("").hideTooltip();else{var N=o[c];!b.select||b.select.call(j,N);a(j).hideTooltip().change()}}return this.each(function(){j=this;a(this).hideTooltip().attr("autocomplete","off");f();p()})}})(jQuery);(function(a){var d={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8};function j(b,c){b=a(b);var m=a.extend({},a.fn.livesearch.defaults,c),o=undefined,k=b.val();b.empty();b.bind("keyup",function(y){for(x in d)if(y.keyCode==d[x])return;o!=undefined&&clearTimeout(o);o=setTimeout(function(){g.call(b)},m.queryDelay)});this.DoSearch=g;function g(){var y=b.val();if(y!=k){k=y;if(y.length>=m.minimumSearchLength)f.call(this,y);else y.length==0&&f.call(this,"")}}function f(y){o=undefined;m.searchCallback.call(this,y)}b.val()==""||b.val()==m.innerText?p():n();b.focus(function(){b.hasClass("inactive_search")&&n()});b.blur(function(){b.val()==""&&p()});function n(){b.addClass("active_search");b.removeClass("inactive_search")}function p(){b.addClass("inactive_search");b.removeClass("active_search")}}a.fn.livesearch=function(b){return this.each(function(){var c=a(this);if(!c.data("livesearch")){var m=new j(this,b);c.data("livesearch",m)}})};a.fn.livesearch.defaults={queryDelay:250,innerText:"Search",minimumSearchLength:3}})(jQuery);(function(a){var d=a(document.createElement("img")).attr("src",a.loovrs.images.heart).css({position:"absolute",zIndex:3000000});a.fn.loading=function(){return this.each(function(){if(!a(this).is(":hidden")){a(this).stopLoading();if(a(this).offset()){this.heart=d.clone();if(!(a.browser.msie||a.browser.opera)&&a(this).css("position")=="relative"&&b(this)){this.heart.center(this,{mode:"relative"});a(this).append(this.heart)}else{this.heart.center(this);a("body").append(this.heart)}j(this.heart)}}})};a.fn.stopLoading=function(){return this.each(function(){if(this.heart){this.heart.stop(true,true).remove();this.heart=null}})};function j(c){var m=c.outerWidth(),o=c.outerHeight(),k=m-25*m/100,g=o-25*m/100;c.animate({width:k,height:g},200).animate({width:m,height:o},600,"easeInExpo",function(){j(c)})}function b(c){if(!c)return false;switch(c.nodeName){case"IMG":return false;case"INPUT":return false;default:return true}}})(jQuery);(function(a){var d={mode:"absolute"};a.fn.center=function(j,b){b=a.extend(d,b);b=b.mode=="absolute"?a(j).offset()?a(j).offset():{top:0,left:0}:{top:0,left:0};var c=b.top,m=b.left,o=a(j).outerWidth(),k=a(j).outerHeight();return this.each(function(){var g=c+k/2,f=m+o/2,n=a(this).objectSize().width,p=a(this).objectSize().height;n=-(n/2);p=-(p/2);a(this).css({top:g,left:f,marginLeft:n,marginTop:p})})}})(jQuery);(function(){var a=250,d=30000;Orbited={};Orbited.settings={};Orbited.settings.hostname=document.domain;Orbited.settings.port=location.port.length>0?location.port:80;Orbited.settings.protocol=location.protocol.slice(0,-1);Orbited.settings.log=false;Orbited.settings.streaming=true;Orbited.settings.HEARTBEAT_TIMEOUT=6000;Orbited.settings.POLL_INTERVAL=2000;Orbited.settings.pageLoggerHeight="200px";Orbited.settings.pageLoggerWidth=null;Orbited.settings.enableFFPrivileges=false;Orbited.singleton={};Orbited.Errors={};Orbited.Errors.ConnectionTimeout=101;Orbited.Errors.InvalidHandshake=102;Orbited.Errors.UserConnectionReset=103;Orbited.Errors.Unauthorized=106;Orbited.Errors.RemoteConnectionFailed=108;Orbited.Statuses={};Orbited.Statuses.ServerClosedConnection=201;Orbited.Statuses.SocketControlKilled=301;Orbited.util={};Orbited.util.browser=null;if(typeof ActiveXObject!="undefined")Orbited.util.browser="ie";else if(navigator.userAgent.indexOf("WebKit")!=-1||navigator.userAgent.indexOf("Konqueror")!=-1)Orbited.util.browser="webkit";else if(navigator.product=="Gecko"&&window.find&&!navigator.savePreferences)Orbited.util.browser="firefox";else if(typeof window.addEventStream==="function")Orbited.util.browser="opera";(function(){Orbited.base64={};var f="=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";if(window.btoa&&window.btoa("1")=="MQ=="){Orbited.base64.encode=function(p){return btoa(p)};Orbited.base64.decode=function(p){return atob(p)}}else{Orbited.base64.encode=function(p){var y=[],u=p.length,s=u%3;u=u-s;for(var B=0;B<u;){var G=p.charCodeAt(B++)<<16|p.charCodeAt(B++)<<8|p.charCodeAt(B++);y.push(n.charAt(G>>>18&63));y.push(n.charAt(G>>>12&63));y.push(n.charAt(G>>>6&63));y.push(n.charAt(G&63))}switch(s){case 2:G=p.charCodeAt(B++)<<16|p.charCodeAt(B++)<<8;y.push(n.charAt(G>>>18&63));y.push(n.charAt(G>>>12&63));y.push(n.charAt(G>>>6&63));y.push(f);break;case 1:G=p.charCodeAt(B++)<<16;y.push(n.charAt(G>>>18&63));y.push(n.charAt(G>>>12&63));y.push(f);y.push(f);break}return y.join("")};Orbited.base64.decode=function(p){p=p.split("");for(var y=[],u=p.length,s=0;p[--u]==f;)++s;for(var B=0;B<u;){var G=n.indexOf(p[B++])<<18;if(B<=u)G|=n.indexOf(p[B++])<<12;if(B<=u)G|=n.indexOf(p[B++])<<6;if(B<=u)G|=n.indexOf(p[B++]);y.push(String.fromCharCode(G>>>16&255));y.push(String.fromCharCode(G>>>8&255));y.push(String.fromCharCode(G&255))}for(;s--;)y.pop();return y.join("")}}})();Orbited.loggers={};Orbited.Loggers={};Orbited.util.loggingSystem=null;if(window.Log4js)Orbited.util.loggingSystem="log4js";else if(window.console&&console.firebug&&console.firebug!="1.3.0")Orbited.util.loggingSystem="firebug";Orbited.getLogger=function(f){if(!Orbited.loggers[f]){var n=null;switch(Orbited.util.loggingSystem){case"firebug":n=new Orbited.Loggers.FirebugLogger(f);break;case"log4js":n=new Orbited.Loggers.Log4jsLogger(f);break;default:n=new Orbited.Loggers.PageLogger(f);break}Orbited.loggers[f]=n}return Orbited.loggers[f]};Orbited.Loggers.FirebugLogger=function(f){var n=this;n.name=f;n.enabled=false;function p(y){for(var u=[f+":"],s=0;s<y.length;++s)u.push(y[s]);return u}n.log=function(){n.enabled&&console.log.apply(this,p(arguments))};n.debug=function(){n.enabled&&console.debug.apply(this,p(arguments))};n.info=function(){n.enabled&&console.info.apply(this,p(arguments))};n.warn=function(){n.enabled&&console.warn.apply(this,p(arguments))};n.error=function(){n.enabled&&console.error.apply(this,p(arguments))};n.assert=function(){if(n.enabled){for(var y=[arguments[0],f+":"],u=1;u<arguments.length;++u)y.push(arguments[u]);console.assert.apply(this,y)}};n.trace=function(){n.enabled&&console.trace.apply(this,p(arguments))}};Orbited.singleton.pageLoggerPane=null;Orbited.Loggers.PageLogger=function(f){var n=this;n.enabled=false;n.name=f;function p(){if(!Orbited.singleton.pageLoggerPane){var u=document.createElement("div");u.border="1px solid black";if(Orbited.settings.pageLoggerHeight)u.style.height=Orbited.settings.pageLoggerHeight;if(Orbited.settings.pageLoggerWidth)u.style.height=Orbited.settings.pageLoggerWidth;u.style.overflow="scroll";document.body.appendChild(u);Orbited.singleton.pageLoggerPane=u}}function y(u){p();var s=document.createElement("div");s.innerHTML=u;Orbited.singleton.pageLoggerPane.appendChild(s);Orbited.singleton.pageLoggerPane.scrollTop=Orbited.singleton.pageLoggerPane.scrollHeight}n.log=function(){if(n.enabled){for(var u=["log",new Date,"debug","<b>"+f+"</b>"],s=0;s<arguments.length;++s)u.push(arguments[s]);y(u.join(", "))}};n.debug=function(){if(n.enabled){for(var u=[new Date,"debug","<b>"+f+"</b>"],s=0;s<arguments.length;++s)u.push(arguments[s]);y(u.join(", "))}};n.info=function(){if(n.enabled){for(var u=[new Date,"info","<b>"+f+"</b>"],s=0;s<arguments.length;++s)u.push(arguments[s]);y(u.join(", "))}};n.warn=function(){};n.error=function(){};n.assert=function(){};n.trace=function(){}};Orbited.Loggers.Log4jsLogger=function(f){var n=this;for(var p=n.name=f;p.indexOf(".")!=-1;)p=p.replace(".","_");var y=Log4js.getLogger(p);n.logger=y;y.setLevel(Log4js.Level.OFF);function u(s){for(var B=[f+":"],G=0;G<s.length;++G)B.push(s[G]);return B.join(" ")}
n.setLevel=function(s){y.setLevel(s)};n.addAppender=function(s){y.addAppender(s)};n.log=function(){y.info(u(arguments))};n.debug=function(){y.debug(u(arguments))};n.info=function(){y.info(u(arguments))};n.warn=function(){y.warn(u(arguments))};n.error=function(){y.error(u(arguments))};n.assert=function(){};n.trace=function(){}};Orbited.system=Orbited.getLogger("system");Orbited.CometTransports={};Orbited.util.chooseTransport=function(){if(Orbited.settings.streaming==false||Orbited.util.browser=="webkit")return Orbited.CometTransports.LongPoll;var f=[];for(var n in Orbited.CometTransports){var p=Orbited.CometTransports[n];if(typeof p[Orbited.util.browser]=="number"){Orbited.system.log("viable transport: ",n);f.push(p)}}return f[0]};function j(){try{return new XMLHttpRequest}catch(f){}try{return new ActiveXObject("MSXML3.XMLHTTP")}catch(n){}try{return new ActiveXObject("MSXML2.XMLHTTP.3.0")}catch(p){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(y){}try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(u){}throw new Error("Could not find XMLHttpRequest or an alternative.");}Orbited.legacy={};Orbited.CometSession=function(){var f=this;f.readyState=f.READY_STATE_INITIALIZED;f.onopen=function(){};f.onread=function(){};f.onclose=function(){};var n=null,p=null,y=[],u=0,s=null,B=null,G=30000,F=30000,D=null,H=0,K=false,N=null;function O(){var q=ma([[++u,"close"]]);if(N)N.contentWindow.sendCloseFrame(n.render(),q);else{s.open("POST",n.render(),!n.isSameDomain(location.href));s.send(q)}}f.open=function(q){f.logger.debug("open");f.readyState=f.READY_STATE_OPENING;n=new Orbited.URL(q);if(n.isSameDomain(location.href))s=j();else{s=new Orbited.XSDR;if(n.isSamePort(location.href)){N=document.createElement("iframe");N.style.display="block";N.style.width="0";N.style.height="0";N.style.border="0";N.style.margin="0";N.style.padding="0";N.style.overflow="hidden";N.style.visibility="hidden";var v=new Orbited.URL("");v.protocol=Orbited.settings.protocol;v.domain=Orbited.settings.hostname;v.port=Orbited.settings.port;v.path="/static/xsdClose.html";v.hash=document.domain;N.src=v.render();document.body.appendChild(N)}}if(Orbited.settings.enableFFPrivileges)try{netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead")}catch(A){}s.open("GET",q,true);s.onreadystatechange=function(){if(s.readyState==4)if(s.status==200){p=s.responseText;f.logger.debug("session key is: ",p);la();if(n.path[n.path.length]!="/")n.path+="/";n.path+=p;var E=Orbited.util.chooseTransport();B=new E;B.timeoutResetter=la;B.isSameDomain=n.isSameDomain(location.href);B.onReadFrame=Z;B.onclose=W;B.connect(n.render())}else{s=null;f.readyState=f.READY_STATE_CLOSED;f.onclose(Orbited.Errors.InvalidHandshake)}};s.send(null)};f.send=function(q){f.logger.debug("send",q);if(f.readyState!=f.READY_STATE_OPEN)throw new Error("Invalid readyState");q=Orbited.base64.encode(q);y.push([++u,"data",q]);f.logger.debug("sending ==",K);if(!K){f.logger.debug("starting send");V()}};f.close=function(){switch(f.readyState){case f.READY_STATE_CLOSING:case f.READY_STATE_CLOSED:return;case f.READY_STATE_INITIALIZED:f.readyState=f.READY_STATE_CLOSED;return;default:break}f.readyState=f.READY_STATE_CLOSING;y.push([++u,"close"]);K||V()};f.reset=function(){f.logger.debug("reset");var q=f.readyState;f.readyState=f.READY_STATE_CLOSED;switch(q){case f.READY_STATE_INITIALIZED:f.onclose(Orbited.Errors.UserConnectionReset);break;case f.READY_STATE_OPENING:s.onreadystatechange=function(){};s.abort();f.onclose(Orbited.Errors.UserConnectionReset);break;case f.READY_STATE_OPEN:f.sendQueue=[];f.sending=false;if(s.readyState<4){s.onreadystatechange=function(){};s.abort()}fa(Orbited.Errors.UserConnectionReset);O();break;case f.READY_STATE_CLOSING:break;case f.READY_STATE_CLOSED:break}};f.cleanup=function(){f.readyState=f.READY_STATE_CLOSED;B.close()};function Z(q){f.logger.debug("transportOnReadFrame");f.logger.debug("READ FRAME: ",q.id,q.name,q.data?q.data.length:"");isNaN(q.id)||(H=Math.max(H,q.id));f.logger.debug(q);switch(q.name){case"close":f.readyState<f.READY_STATE_CLOSED&&fa(Orbited.Statuses.ServerClosedConnection);break;case"data":f.logger.debug("base64 decoding "+
q.data.length+" bytes of data");q=Orbited.base64.decode(q.data);f.logger.debug("decode complete");f.onread(q);break;case"open":if(f.readyState==f.READY_STATE_OPENING){f.readyState=f.READY_STATE_OPEN;f.logger.debug("Call self.onopen()");f.onopen()}break;case"ping":switch(B.name){case"longpoll":break;case"poll":break;default:y.push([++u,"ping",null]);K||V();break}break;case"opt":q=q.data.split(",");switch(q[0]){case"pingTimeout":F=parseInt(q[1])*1000;break;case"pingInterval":G=parseInt(q[1])*1000;break;default:f.logger.warn("unknown opt key",q[0]);break}break}f.logger.debug("resetting timeout from transportOnReadFrame");la()}function W(){f.logger.debug("transportOnClose");if(f.readyState<f.READY_STATE_CLOSED)try{fa(Orbited.Statuses.ServerClosedConnection)}catch(q){}}function ma(q){for(var v=[],A=0;A<q.length;++A)for(var E=q[A],L=0;L<E.length;++L){var S=E[L];if(S==null)S="";L==E.length-1?v.push("0"):v.push("1");v.push(S.toString().length);v.push(",");v.push(S.toString())}return v.join("")}
function V(q){f.logger.debug("in doSend");if(typeof q=="undefined")q=0;if(q*a>=d){fa(Orbited.Errors.ConnectionTimeout);K=false}else if(y.length==0){f.logger.debug("sendQueue exhausted");K=false}else{K=true;f.logger.debug("setting sending=true");var v=y.length;n.setQsParameter("ack",H);var A=ma(y);f.logger.debug("post",q,A);if(Orbited.settings.enableFFPrivileges)try{netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead")}catch(E){}s.open("POST",n.render(),true);s.onreadystatechange=function(){f.logger.debug("doSend onreadystatechange");switch(s.readyState){case 4:if(s.status==200){la();y.splice(0,v);return V()}else window.setTimeout(function(){V(++q)},a);break}};s.send(A)}}function fa(q){f.logger.debug("doClose",q);ya();f.readyState=f.READY_STATE_CLOSED;if(B!=null){B.onReadFrame=function(){};B.onclose=function(){};B.close()}f.onclose(q)}function la(){f.logger.debug("reset Timeout",G+F);ya();D=window.setTimeout(l,G+F)}function ya(){window.clearTimeout(D)}function l(){f.logger.debug("timed out!");fa(Orbited.Errors.ConnectionTimeout)}};Orbited.CometSession.prototype.logger=Orbited.getLogger("Orbited.CometSession");Orbited.CometSession.prototype.READY_STATE_INITIALIZED=1;Orbited.CometSession.prototype.READY_STATE_OPENING=2;Orbited.CometSession.prototype.READY_STATE_OPEN=3;Orbited.CometSession.prototype.READY_STATE_CLOSING=4;Orbited.CometSession.prototype.READY_STATE_CLOSED=5;var b=0,c={};Orbited.test={};Orbited.test.logger=Orbited.getLogger("Orbited.test");Orbited.test.socketcontrol={};Orbited.test.socketcontrol.kill=function(f){Orbited.test.logger.debug("kill ordered for socket:",f);if(c[f.id]){c[f.id](Orbited.Statuses.SocketControlKilled);Orbited.test.logger.debug("socket killed")}else Orbited.test.logger.debug("socket not found")};Orbited.test.stompdispatcher={};Orbited.test.stompdispatcher.send=function(f,n){Orbited.test.logger.debug("stompdispatcher dispatching "+n+" to "+f);var p=document.createElement("script");p.src="http://"+Orbited.settings.hostname+":"+Orbited.settings.port+"/system/test/stomp?";p.src+="msg="+n;p.src+="&dest="+f;document.body.appendChild(p)};Orbited.TCPSocket=function(){var f=this;f.id=++b;if(arguments.length>0)throw new Error("TCPSocket() accepts no arguments");f.readyState=f.READY_STATE_INITIALIZED;f.onopen=function(){};f.onread=function(){};f.onclose=function(){};var n=false,p="",y=null,u=false,s=null,B=null,G=null;f.open=function(O,Z,W){if(f.readyState!=f.READY_STATE_INITIALIZED)throw new Error("Invalid readyState");if(O==false)throw new Error("No hostname specified");if(isNaN(Z))throw new Error("Invalid port specified");u=!!W;f.readyState=f.READY_STATE_OPENING;B=O;G=Z;y=new Orbited.CometSession;O=new Orbited.URL("/tcp");O.domain=Orbited.settings.hostname;O.port=Orbited.settings.port;O.protocol=Orbited.settings.protocol;O.setQsParameter("nocache",Math.random());y.open(O.render());y.onopen=K;y.onread=D;y.onclose=N;s="initial"};f.close=function(){if(f.readyState!=f.READY_STATE_CLOSED){f.readyState=f.READY_STATE_CLOSED;H(Orbited.Errors.UserConnectionReset)}};f.reset=function(){y&&y.reset()};f.send=function(O){if(f.readyState!=f.READY_STATE_OPEN)throw new Error("Invalid readyState");u||(O=Orbited.utf8.encode(O));f.logger.debug("SEND: ",O);y.send(O)};function F(){var O=Orbited.utf8.decode(p),Z=O[0];O=O[1];p=p.slice(O);Z.length>0&&window.setTimeout(function(){f.onread(Z)},0)}function D(O){switch(f.readyState){case f.READY_STATE_OPEN:f.logger.debug("READ: ",O);if(u)window.setTimeout(function(){f.onread(O)},0);else{f.logger.debug("start buffer size:",p.length);p+=O;F();f.logger.debug("end buffer size:",p.length)}break;case f.READY_STATE_OPENING:switch(s){case"initial":O=Orbited.utf8.decode(O)[0];f.logger.debug("initial");f.logger.debug("data",O);f.logger.debug("len",O.length);f.logger.debug("typeof(data)",typeof O);f.logger.debug("data[0] ",O.slice(0,1));f.logger.debug("type ",typeof O.slice(0,1));var Z=O.slice(0,1)=="1";f.logger.debug("result",Z);if(!Z){f.logger.debug("!result");var W=O.slice(1,4);H(parseInt(W))}if(Z){f.readyState=f.READY_STATE_OPEN;f.logger.debug("tcpsocket.onopen..");f.onopen();f.logger.debug("did onopen")}break}break}}function H(O){f.logger.debug("doClose",O);if(y){if(O==Orbited.Statuses.ServerClosedConnection||O==Orbited.Errors.Unauthorized||O==Orbited.Errors.RemoteConnectionFailed)y.cleanup();else{N=function(){};y.close()}y=null}f.logger.debug("onCloseTriggered",n);if(!n){f.logger.debug("triggerClose timer",O);n=true;window.setTimeout(function(){f.logger.debug("onclose!",O);f.onclose(O)},0)}}c[f.id]=H;function K(){var O=B+":"+G+"\n";f.logger.debug("sessionOpen; sending:",O);O=Orbited.utf8.encode(O);f.logger.debug("encoded payload:",O);X=O;y.send(O);s="initial"}function N(O){f.logger.debug("sessionOnClose");H(O)}};Orbited.TCPSocket.prototype.toString=function(){return"<Orbited.TCPSocket "+this.id+">"};Orbited.TCPSocket.prototype.logger=Orbited.getLogger("Orbited.TCPSocket");Orbited.TCPSocket.prototype.READY_STATE_INITIALIZED=1;Orbited.TCPSocket.prototype.READY_STATE_OPENING=2;Orbited.TCPSocket.prototype.READY_STATE_OPEN=3;Orbited.TCPSocket.prototype.READY_STATE_CLOSING=4;Orbited.TCPSocket.prototype.READY_STATE_CLOSED=5;Orbited.singleton.XSDR={receiveCbs:{},queues:{},iframes:{},id:0,register:function(f,n){var p=++Orbited.singleton.XSDR.id;Orbited.singleton.XSDR.receiveCbs[p]=f;Orbited.singleton.XSDR.queues[p]=n;Orbited.system.debug("id is",p);return p}};Orbited.XSDR=function(){var f=this,n=null,p,y,u,s,B=[],G=Orbited.singleton.XSDR.register(function(N){H(N)},B),F=new Orbited.URL("");F.domain=Orbited.settings.hostname;F.port=Orbited.settings.port;F.path="/static/xsdrBridge.html";F.hash=G.toString();F.protocol=Orbited.settings.protocol;f.logger.debug("bridgeUrl.hash is",F.hash);f.logger.debug("bridgeUrl.path is",F.path);f.logger.debug("bridgeUrl is",F.render());function D(){f.responseText="";f.status=null;f.readyState=0;u=y=p=null;s={}}D();f.onreadystatechange=function(){};f.open=function(N,O,Z){f.readyState==4&&D();if(f.readyState!=0)throw new Error("Invalid readyState");if(!Z)throw new Error("Only Async XSDR supported");f.logger.debug("open",N,O,Z);f.readyState=1;p=O;y=N};f.send=function(N){if(f.readyState!=1)throw new Error("Invalid readyState");f.logger.debug("send",N);if(n)B.push([y,p,N,s]);else{f.logger.debug("creating iframe");n=document.createElement("iframe");K(n);n.src=F.render();f.logger.debug("set ifr.src to",n.src);document.body.appendChild(n);Orbited.singleton.XSDR.iframes[G]=n}};f.abort=function(){if(f.readyState>0&&f.readyState<4){f.logger.debug("ABORT called");n.src="about:blank";document.body.removeChild(n);n=null;f.readyState=4;f.onreadystatechange()}};f.setRequestHeader=function(N,O){if(f.readyState!=0)throw new Error("Invalid readyState");s[N]=O};f.getResponseHeader=function(){if(f.readyState<2)throw new Error("Invalid readyState");return responseHeaders[key]};function H(N){f.logger.debug("received",N);switch(N[0]){case"initialized":B.push([y,p,u,s]);f.logger.debug("queue is",B);f.logger.debug("Orbited.singleton.XSDR.queues[id] is",Orbited.singleton.XSDR.queues[G]);break;case"readystatechange":u=N[1];f.readyState=u.readyState;f.logger.debug("readystatechange",f.readyState);if(u.status){f.status=u.status;f.logger.debug("status",u.status)}if(u.responseText){f.responseText+=u.responseText;f.logger.debug("responseText",u.responseText)}f.logger.debug("doing trigger");f.onreadystatechange();f.logger.debug("trigger complete");break}}function K(N){N.style.display="block";N.style.width="0";N.style.height="0";N.style.border="0";N.style.margin="0";N.style.padding="0";N.style.overflow="hidden";N.style.visibility="hidden"}};if(Orbited.util.browser=="opera"){var m=window.postMessage&&"contentWindow"||"document";(window.postMessage&&window||document).addEventListener("message",function(f){var n=f.data.split(" "),p=n.shift();if(p=="event"){var y=n.shift(),u=n.join(" ");u=Orbited.JSON.parse(u);Orbited.singleton.XSDR.receiveCbs[y](u)}if(p=="queues"){y=n.shift();n=Orbited.singleton.XSDR.queues[y];if(n.length>0){u=n.shift();Orbited.singleton.XSDR.iframes[y][m].postMessage(Orbited.JSON.stringify(u),f.origin)}}},false)}Orbited.XSDR.prototype.logger=Orbited.getLogger("Orbited.XSDR");Orbited.singleton.XSDRBridgeLogger=Orbited.getLogger("XSDRBridge");var o=0,k=1,g=2;Orbited.CometTransports.XHRStream=function(){var f=this;f.name="xhrstream";var n=null,p=null,y=null,u=0,s=null,B=null,G=50;f.readyState=o;f.onReadFrame=function(){};f.onread=function(V){f.onReadFrame(V)};f.onclose=function(){};f.close=function(){if(f.readyState!=g){if(p!=null&&(p.readyState>1||p.readyState<4)){p.onreadystatechange=function(){};p.abort();p=null}f.readyState=g;window.clearTimeout(s);window.clearTimeout(B);f.onclose()}};f.connect=function(V){if(f.readyState==k)throw new Error("Already Connected");n=new Orbited.URL(V);if(p==null)p=n.isSameDomain(location.href)?j():new Orbited.XSDR;n.path+="/xhrstream";f.readyState=k;F()};function F(){try{typeof y=="number"&&n.setQsParameter("ack",y);if(typeof p=="undefined"||p==null)throw new Error("how did this happen?");if(Orbited.settings.enableFFPrivileges)try{netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead")}catch(V){}p.open("GET",n.render(),true);p.onreadystatechange=function(){f.logger.debug(p.readyState);if(f.readyState!=g)switch(p.readyState){case 2:try{var la=p.status}catch(ya){return}if(la==200)try{s=window.setTimeout(W,Orbited.settings.HEARTBEAT_TIMEOUT)}catch(l){f.close();return}break;case 3:try{la=p.status}catch(q){return}if(la==200){G=50;O()}break;case 4:la=true;try{la=p.status===null?true:false}catch(v){}if(la){G*=2;window.clearTimeout(s);B=window.setTimeout(D,G);return}switch(p.status){case 200:O();u=0;setTimeout(F,0);window.clearTimeout(s);break;case 404:f.close();break;default:f.close();break}break}};p.send(null)}catch(fa){f.close()}}function D(){f.logger.debug("reconnect...");if(p.readyState<4&&p.readyState>0){p.onreadystatechange=function(){p.readyState==4&&D()};f.logger.debug("do abort..");p.abort();window.clearTimeout(s)}else{f.logger.debug("reconnect do open");u=0;setTimeout(F,0)}}var H=-1,K=null,N=[];function O(){var V=p.responseText;for(Z();V[u]==" ";)u+=1;for(;V[u]=="x";)u+=1;for(var fa=0;1;){fa+=1;if(fa>2000)throw new Error("Borked XHRStream transport");if(H==-1)H=V.indexOf(",",u);if(H==-1)return;if(K==null){argSize=parseInt(V.slice(u+1,H));K=H+1+argSize}if(V.length<K)return;var la=V.slice(H+1,K);N.push(la);la=V.charAt(u)=="0";u=K;K=null;H=-1;if(la){la=N;N=[];ma(la)}}}function Z(){window.clearTimeout(s);f.logger.debug("clearing heartbeatTimer",s);try{s=window.setTimeout(function(){f.logger.debug("timer",fa,"did it");W()},Orbited.settings.HEARTBEAT_TIMEOUT)}catch(V){return}var fa=s;f.logger.debug("heartbeatTimer is now",s)}function W(){f.logger.debug("heartbeat timeout... reconnect");D()}function ma(V){var fa=parseInt(V[0]);isNaN(fa)||(y=fa);V={id:fa,name:V[1],data:V[2]};f.onread(V)}};Orbited.CometTransports.XHRStream.prototype.logger=Orbited.getLogger("Orbited.CometTransports.XHRStream");Orbited.CometTransports.XHRStream.firefox=1;Orbited.CometTransports.XHRStream.firefox2=1;Orbited.CometTransports.XHRStream.firefox3=1;Orbited.CometTransports.XHRStream.safari2=1;Orbited.CometTransports.XHRStream.safari3=1;Orbited.CometTransports.LongPoll=function(){var f=this;f.name="longpoll";var n=null,p=null,y=null,u=null,s=50;f.readyState=o;f.onReadFrame=function(){};f.onclose=function(){};f.close=function(){f.logger.debug("close");if(f.readyState!=g){if(p!=null&&(p.readyState>1||p.readyState<4)){p.onreadystatechange=function(){};p.abort();p=null}f.logger.debug("close! self.readyState now is 2");f.readyState=g;window.clearTimeout(u);f.onclose()}};f.connect=function(H){f.logger.debug("connect");if(f.readyState==k)throw new Error("Already Connected");n=new Orbited.URL(H);if(p==null)p=n.isSameDomain(location.href)?j():new Orbited.XSDR;n.path+="/longpoll";f.readyState=k;B()};function B(){f.logger.debug("open... self.readyState = "+f.readyState);if(f.readyState!=g)try{typeof y=="number"&&n.setQsParameter("ack",y);if(typeof p=="undefined"||p==null)throw new Error("how did this happen?");if(Orbited.settings.enableFFPrivileges)try{netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead")}catch(H){}p.open("GET",n.render(),true);p.onreadystatechange=function(){f.logger.debug("readystate",p.readyState);switch(p.readyState){case 4:switch(p.status){case 200:f.timeoutResetter();F();f.logger.debug("completed request, reconnect immediately");setTimeout(B,0);break;case 404:f.close();break;case null:s*=2;f.logger.debug("start reconnect Timer (null xhr.status)");window.setTimeout(G,s);break;default:f.logger.debug("something broke, xhr.status=",p.status);f.close();break}break}};p.send(null)}catch(K){f.close()}}function G(){f.logger.debug("reconnect...");if(p.readyState<4&&p.readyState>0){p.onreadystatechange=function(){p.readyState==4&&G()};f.logger.debug("do abort..");p.abort();window.clearTimeout(heartbeatTimer)}else{f.logger.debug("reconnect do open");offset=0;setTimeout(B,0)}}function F(){f.logger.debug("process");for(var H=-1,K=null,N,O=[],Z=p.responseText,W=0,ma=0;1;){ma+=1;if(ma>2000)throw new Error("Borked XHRStream transport");if(H==-1)H=Z.indexOf(",",W);if(H==-1){f.logger.debug("no more commas. offset:",W,"stream.length:",Z.length);return}if(K==null){N=parseInt(Z.slice(W+1,H));K=H+1+N}f.logger.assert(true);H=Z.slice(H+1,K);f.logger.assert(H.length==N,"argSize:",N,"data.length",H.length);if(H.length!=N)DEBUGDATA=Z;O.push(H);var V=Z.charAt(W)=="0";W=K;K=null;H=-1;if(V){V=O;O=[];D(V)}}}function D(H){var K=parseInt(H[0]);f.logger.debug("args",H);isNaN(K)||(y=K);f.logger.debug("testAckId",K,"ackId",y);H={id:K,name:H[1],data:H[2]};f.onReadFrame(H)}};Orbited.CometTransports.LongPoll.prototype.logger=Orbited.getLogger("Orbited.CometTransports.LongPoll");Orbited.CometTransports.Poll=function(){var f=this;f.name="poll";var n=null,p=null,y=null,u=null,s=Orbited.settings.POLL_INTERVAL,B=s;f.readyState=o;f.onReadFrame=function(){};f.onclose=function(){};f.close=function(){f.logger.debug("close...");if(f.readyState!=g){if(p!=null&&(p.readyState>1||p.readyState<4)){p.onreadystatechange=function(){};p.abort();p=null}f.readyState=g;window.clearTimeout(u);f.onclose()}};f.connect=function(K){f.logger.debug("connect...");if(f.readyState==k)throw new Error("Already Connected");n=new Orbited.URL(K);if(p==null)p=n.isSameDomain(location.href)?j():new Orbited.XSDR;n.path+="/poll";f.readyState=k;G()};function G(){f.logger.debug("open...");try{typeof y=="number"&&n.setQsParameter("ack",y);if(typeof p=="undefined"||p==null)throw new Error("how did this happen?");if(Orbited.settings.enableFFPrivileges)try{netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead")}catch(K){}p.open("GET",n.render(),true);p.onreadystatechange=function(){switch(p.readyState){case 4:switch(p.status){case 200:f.timeoutResetter();B=s;D();setTimeout(G,B);break;case 404:f.close();break;case null:B*=2;window.setTimeout(F,B);break;default:f.close();break}break}};p.send(null)}catch(N){f.close()}}function F(){f.logger.debug("reconnect...");if(p.readyState<4&&p.readyState>0){p.onreadystatechange=function(){p.readyState==4&&F()};f.logger.debug("do abort..");p.abort();window.clearTimeout(heartbeatTimer)}else{f.logger.debug("reconnect do open");offset=0;setTimeout(G,0)}}function D(){f.logger.debug("process...");for(var K=-1,N=null,O,Z=[],W=p.responseText,ma=0,V=0;1;){V+=1;if(V>2000)throw new Error("Borked XHRStream transport");if(K==-1)K=W.indexOf(",",ma);if(K==-1){f.logger.debug("no more commas. offset:",ma,"stream.length:",W.length);return}if(N==null){O=parseInt(W.slice(ma+1,K));N=K+1+O}K=W.slice(K+1,N);f.logger.assert(K.length==O,"argSize:",O,"data.length",K.length);if(K.length!=O)DEBUGDATA=W;Z.push(K);var fa=W.charAt(ma)=="0";ma=N;N=null;K=-1;if(fa){fa=Z;Z=[];H(fa)}}}function H(K){f.logger.debug("receivedPacket...");var N=parseInt(K[0]);f.logger.debug("args",K);isNaN(N)||(y=N);f.logger.debug("testAckId",N,"ackId",y);K={id:N,name:K[1],data:K[2]};f.onReadFrame(K)}};Orbited.CometTransports.Poll.prototype.logger=Orbited.getLogger("Orbited.CometTransports.Poll");Orbited.CometTransports.HTMLFile=function(){var f=this;f.name="htmlfile";var n=++Orbited.singleton.HTMLFile.i;Orbited.singleton.HTMLFile.instances[n]=f;var p=null,y=null,u=null,s=null,B=null,G=2000,F=G;f.onReadFrame=function(){};f.onread=function(K){f.onReadFrame(K)};f.onclose=function(){};f.connect=function(K){if(f.readyState==k)throw new Error("Already Connected");f.logger.debug("self.connect",K);u=new Orbited.URL(K);u.path+="/htmlfile";u.setQsParameter("frameID",n.toString());f.readyState=k;D(u.render())};function D(K){f.logger.debug("doOpen",K);p=new ActiveXObject("htmlfile");p.open();f.isSameDomain?p.write("<html></html>"):p.write('<html><script>document.domain="'+document.domain+'";<\/script></html>');p.parentWindow.Orbited=Orbited;p.close();var N=p.createElement("div");p.body.appendChild(N);y=p.createElement("iframe");N.appendChild(y);s=y.src=K;B=window.setTimeout(H,F)}f.restartingStream=function(K){s=K;B=window.setTimeout(H,F)};function H(){f.logger.debug("doing reconnect... "+F);F*=2;y.src=s;B=window.setTimeout(H,F)}f.streamStarted=function(){f.logger.debug("stream started..");window.clearTimeout(B);B=null;F=G};f.streamClosed=function(){f.logger.debug("stream closed!");window.clearTimeout(B);f.close()};f.receive=function(K,N,O){packet={id:K,name:N,data:O};f.onread(packet)};f.close=function(){if(f.readyState!=g){f.logger.debug("close called, clearing timer");window.clearTimeout(B);f.readyState=g;y.src="about:blank";p=null;CollectGarbage();f.onclose()}}};Orbited.CometTransports.HTMLFile.prototype.logger=Orbited.getLogger("Orbited.CometTransports.HTMLFile");Orbited.CometTransports.HTMLFile.ie=1;Orbited.singleton.HTMLFile={i:0,instances:{}};Orbited.CometTransports.SSE=function(){var f=this;f.name="sse";f.onReadFrame=function(){};f.onclose=function(){};f.readyState=o;var n=null,p=null,y=-1;f.close=function(){if(f.readyState!=g){f.readyState=g;doClose();f.onclose()}};f.connect=function(B){if(f.readyState==k)throw new Error("Already Connected");p=new Orbited.URL(B);p.path+="/sse";f.readyState=k;doOpen()};doClose=function(){n.removeEventSource(n.getAttribute("src"));n.setAttribute("src","");opera.version()<9.5&&document.body.removeChild(n);n=null};doOpen=function(){n=document.createElement("event-source");n.setAttribute("src",p.render());opera.version()<9.5&&document.body.appendChild(n);n.addEventListener("payload",u,false)};function u(B){B=eval(B.data);if(typeof B!="undefined")for(var G=0;G<B.length;++G){var F=B[G];s(F[0],F[1],F[2])}}function s(B,G,F){var D=parseInt(B);isNaN(D)||(y=D);packet={id:B,name:G,data:F};f.onReadFrame(packet)}};Orbited.CometTransports.SSE.prototype.logger=Orbited.getLogger("Orbited.CometTransports.SSE");Orbited.CometTransports.SSE.opera=1;Orbited.CometTransports.SSE.opera8=1;Orbited.CometTransports.SSE.opera9=1;Orbited.CometTransports.SSE.opera9_5=0.8;Orbited.URL=function(f){var n=this,p=f.indexOf("://");if(p!=-1)n.protocol=f.slice(0,p);else p=-3;var y=f.indexOf("/",p+3);if(y==-1)y=f.length;var u=f.indexOf("#",y);if(u!=-1)n.hash=f.slice(u+1);else u=f.length;u=f.slice(y,u);var s=u.indexOf("?");if(s==-1)s=u.length;n.path=u.slice(0,s);n.qs=u.slice(s+1);if(n.path=="")n.path="/";f=f.slice(p+3,y);p=f.indexOf(":");if(p==-1){n.port=80;p=f.length}else n.port=parseInt(f.slice(p+1));if(isNaN(this.port))throw new Error("Invalid _url");n.domain=f.slice(0,p);n.render=function(){var F="";if(typeof n.protocol!="undefined")F+=n.protocol+"://";F+=n.domain;if(n.port!=80&&typeof n.port!="undefined"&&n.port!=null)if(typeof n.port!="string"||n.port.length>0)F+=":"+n.port;F+=typeof n.path=="undefined"||n.path==null?"/":n.path;if(n.qs.length>0)F+="?"+n.qs;if(typeof n.hash!="undefined"&&n.hash.length>0)F+="#"+n.hash;return F};n.isSamePort=function(F){F=new Orbited.URL(F);return F.port==n.port};n.isSameDomain=function(F){F=new Orbited.URL(F);if(!F.domain||!n.domain)return true;return F.port==n.port&&F.domain==n.domain};n.isSameParentDomain=function(F){F=new Orbited.URL(F);if(F.domain==n.domain)return true;F=F.domain;for(var D=document.domain.split("."),H=0;H<D.length-1;++H){var K=D.slice(H).join(".");if(F==K)return true}return false};n.isSubDomain=function(F){F=new Orbited.URL(F);if(!F.domain||!n.domain)return false;return F.port==n.port&&F.domain==n.domain.split(".").slice(1).join(".")};function B(F){if(F.indexOf("=")==-1)return{};var D={};F=F.split("&");for(var H=0;H<F.length;++H){var K=F[H];K=K.split("=");D[K[0]]=K[1]}return D}function G(F){var D="";for(var H in F)D+="&"+H+"="+F[H];return D.slice(1)}n.setQsParameter=function(F,D){var H=B(n.qs);H[F]=D;n.qs=G(H)};n.mergeQs=function(F){F=B(F);for(key in F)curQsObj[key]=F[key]};n.removeQsParameter=function(F){var D=B(n.qs);delete D[F];n.qs=G(D)};n.merge=function(F){if(typeof n.protocol!="undefined"&&n.protocol.length>0)n.protocol=F.protocol;if(F.domain.length>0){n.domain=F.domain;n.port=F.port}n.path=F.path;n.qs=F.qs;n.hash=F.hash}};Orbited.utf8={};Orbited.utf8.decode=function(f){var n=[],p=0;function y(s){for(;s.length<6;)s="0"+s;return s}for(var u=0;u<f.length;u++)if((f.charCodeAt(u)&248)==240){if(f.length-p<4)break;p+=4;n.push(String.fromCharCode(parseInt((f.charCodeAt(u)&7).toString(2)+y((f.charCodeAt(u+1)&63).toString(2))+y((f.charCodeAt(u+2)&63).toString(2))+y((f.charCodeAt(u+3)&63).toString(2)),2)));u+=3}else if((f.charCodeAt(u)&240)==224){if(f.length-p<3)break;p+=3;n.push(String.fromCharCode(parseInt((f.charCodeAt(u)&15).toString(2)+y((f.charCodeAt(u+1)&63).toString(2))+y((f.charCodeAt(u+
2)&63).toString(2)),2)));u+=2}else if((f.charCodeAt(u)&224)==192){if(f.length-p<2)break;p+=2;n.push(String.fromCharCode(parseInt((f.charCodeAt(u)&31).toString(2)+y((f.charCodeAt(u+1)&63).toString(2),6),2)));u+=1}else{p+=1;n.push(String.fromCharCode(f.charCodeAt(u)))}return[n.join(""),p]};Orbited.utf8.encode=function(f){var n=[];function p(B,G){for(;B.length<G;)B="0"+B;return B}for(var y=String.fromCharCode,u=0;u<f.length;u++){var s=f.charCodeAt(u);if(s<=127)n.push(y(s));else if(s<=2047){s=p(s.toString(2),11);n.push(y(parseInt("110"+s.substr(0,5),2)));n.push(y(parseInt("10"+s.substr(5,6),2)))}else if(s<=65535){s=p(s.toString(2),16);n.push(y(parseInt("1110"+s.substr(0,4),2)));n.push(y(parseInt("10"+s.substr(4,6),2)));n.push(y(parseInt("10"+s.substr(10,6),2)))}else if(s<=1114111){s=p(s.toString(2),21);n.push(y(parseInt("11110"+s.substr(0,3),2)));n.push(y(parseInt("10"+s.substr(3,6),2)));n.push(y(parseInt("10"+s.substr(9,6),2)));n.push(y(parseInt("10"+s.substr(15,6),2)))}}return n.join("")};Orbited.JSON=function(){function f(D){return D<10?"0"+D:D}Date.prototype.toJSON=function(){return this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z"};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()};var n=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,p=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,y,u,s={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},B;function G(D){p.lastIndex=0;return p.test(D)?'"'+D.replace(p,function(H){var K=s[H];if(typeof K==="string")return K;return"\\u"+("0000"+(+H.charCodeAt(0)).toString(16)).slice(-4)})+'"':'"'+D+'"'}function F(D,H){var K,N,O=y,Z,W=H[D];if(W&&typeof W==="object"&&typeof W.toJSON==="function")W=W.toJSON(D);if(typeof B==="function")W=B.call(H,D,W);switch(typeof W){case"string":return G(W);case"number":return isFinite(W)?String(W):"null";case"boolean":case"null":return String(W);case"object":if(!W)return"null";y+=u;Z=[];if(typeof W.length==="number"&&!W.propertyIsEnumerable("length")){N=W.length;for(D=0;D<N;D+=1)Z[D]=F(D,W)||"null";H=Z.length===0?"[]":y?"[\n"+y+Z.join(",\n"+y)+"\n"+O+"]":"["+Z.join(",")+"]";y=O;return H}if(B&&typeof B==="object"){N=B.length;for(D=0;D<N;D+=1){K=B[D];if(typeof K==="string")if(H=F(K,W))Z.push(G(K)+(y?": ":":")+H)}}else for(K in W)if(Object.hasOwnProperty.call(W,K))if(H=F(K,W))Z.push(G(K)+
(y?": ":":")+H);H=Z.length===0?"{}":y?"{\n"+y+Z.join(",\n"+y)+"\n"+O+"}":"{"+Z.join(",")+"}";y=O;return H}}return{stringify:function(D,H,K){var N;u=y="";if(typeof K==="number")for(N=0;N<K;N+=1)u+=" ";else if(typeof K==="string")u=K;if((B=H)&&typeof H!=="function"&&(typeof H!=="object"||typeof H.length!=="number"))throw new Error("JSON.stringify");return F("",{"":D})},parse:function(D,H){function K(N,O){var Z,W,ma=N[O];if(ma&&typeof ma==="object")for(Z in ma)if(Object.hasOwnProperty.call(ma,Z)){W=K(ma,Z);if(W!==undefined)ma[Z]=W;else delete ma[Z]}return H.call(N,O,ma)}n.lastIndex=0;if(n.test(D))D=D.replace(n,function(N){return"\\u"+("0000"+(+N.charCodeAt(0)).toString(16)).slice(-4)});if(/^[\],:{}\s]*$/.test(D.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){D=eval("("+D+")");return typeof H==="function"?K({"":D},""):D}throw new SyntaxError("JSON.parse");}}}()})();(function(){try{for(var a=document.getElementsByTagName("script"),d=0;d<a.length;++d){var j=a[d];if(j.src.match("/static/Orbited.js$")){var b=new Orbited.URL(j.src);if(b.render().indexOf("http")!=0)b=new Orbited.URL(window.location.toString());Orbited.settings.hostname=b.domain;Orbited.settings.port=b.port;break}}}catch(c){}})();var STOMP_DEBUG=false;if(STOMP_DEBUG){function getStompLogger(a){return{debug:function(){var d=Array.prototype.slice.call(arguments);d.unshift(a,": ");console.debug.apply(console,d)},dir:function(){console.debug(a,":");console.dir.apply(console,arguments)}}}}else{function getStompLogger(a){return{debug:function(){},dir:function(){}}}}
LineProtocol=function(a){var d=getStompLogger("LineProtocol"),j=this,b=null,c=true;a.onopen=function(){b="";c=true;j.onopen()};a.onclose=function(m){b=null;j.onclose(m)};a.onerror=function(m){j.onerror(m)};a.onread=function(m){d.debug("transport.onread: enter isLineMode=",c," buffer[",b.length,"]=",b," data[",m.length,"]=",m);if(c){b+=m;m="";for(var o=0,k;(k=b.indexOf("\n",o))>=0&&c;){o=b.slice(o,k);o=Orbited.utf8.decode(o)[0];d.debug("fire onlinereceived line[",o.length,"]=",o);j.onlinereceived(o);o=k+1}b=b.slice(o);if(!c){m=b;b=""}}if(m.length>0){d.debug("fire onrawdatareceived data[",m.length,"]=",m);j.onrawdatareceived(m)}d.debug("transport.onread: leave")};j.setRawMode=function(){d.debug("setRawMode");c=false};j.setLineMode=function(m){d.debug("setLineMode: extra=",m);c=true;m&&m.length>0&&a.onread(m)};j.send=function(m){d.debug("send: data=",m);return a.send(m)};j.open=function(m,o,k){d.debug("open: host=",m,":",o," isBinary=",k);a.open(m,o,k)};j.close=function(){d.debug("close");a.close()};j.reset=function(){a.reset()};j.onopen=function(){};j.onclose=function(){};j.onerror=function(){};j.onlinereceived=function(){};j.onrawdatareceived=function(){}};STOMPClient=function(){var a=getStompLogger("STOMPClient"),d=this,j=null,b="",c=null,m=null,o=null;d.user=null;function k(s){return s.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function g(s,B){for(var G in B)s[G]=B[G];return s}function f(s){a.debug("protocol_onLineReceived: line=",s);if(s.length==0){if(c!==null){a.debug("onLineReceived: all headers:");a.dir(m);o="content-length"in m?parseInt(m["content-length"])+1:null;j.setRawMode()}}else if(c===null){a.debug("onLineReceived: begin ",s," frame");c=s;m={};b="";o=null}else{var B=s.search(":"),G=k(s.slice(0,B));s=k(s.slice(B+1));m[G]=s;a.debug("onLineReceived: found header ",G,"=",s)}}if(STOMP_DEBUG){function n(s,B){for(var G=[],F=0;F<B.length;++F)G.push(B.charCodeAt(F));a.debug(s);a.debug("length=",G.length," bytes=",G)}}else{function n(){}}function p(s){a.debug("protocol_onRawDataReceived");n("buffer",b);n("data",s);if(o===null){b+=s;s=b.indexOf("\u0000");if(s>=0){var B=b.slice(0,s);b=b.slice(s+1);y(B,b)}}else{var G=Math.min(s.length,o);o-=G;B=o===0?s.slice(0,G-1):s.slice(0,G);s=s.slice(G);b+=B;o===0&&y(b,s)}}function y(s,B){a.debug("doDispatch: bytes[",s.length,"]=",s," extra[",B.length,"]=",B);n("bytes",s);n("extra",B);s={type:c,headers:m,body:Orbited.utf8.decode(s)[0]};a.debug("doDispatch: end frame; body.length=",s.body.length);a.dir(s);d.onframe(s);b="";c=null;m={};o=null;j.setLineMode(B)}function u(){}d.onopen=u;d.onclose=u;d.onerror=u;d.onframe=function(s){switch(s.type){case"CONNECTED":d.onconnectedframe(s);break;case"MESSAGE":d.onmessageframe(s);break;case"RECEIPT":d.onreceiptframe(s);break;case"ERROR":d.onerrorframe(s);break;default:d.onerror("Unknown STOMP frame type "+s.type)}};d.onconnectedframe=u;d.onreceiptframe=u;d.onmessageframe=function(s){this.onmessage&&this.onmessage(s)};d.onerrorframe=u;d.onmessage=u;d.sendFrame=function(s,B,G){s=[s];var F={};if(G&&B["content-length"]===undefined){if(B["content-type"]===undefined){s.push("content-type:text/plain");F["content-type"]=true}if(B["content-encoding"]===undefined){s.push("content-encoding:utf-8");F["content-encoding"]=true;G=Orbited.utf8.encode(G)}s.push("content-length:"+G.length);F["content-length"]=true}for(var D in B)D in F||s.push(D+":"+B[D]);s.push("\n");B=Orbited.utf8.encode(s.join("\n"));if(G)B+=G;B+="\u0000";j.send(B)};d.send_frame=d.sendFrame;d.connect=function(s,B,G,F){d.user=G;function D(){d.sendFrame("CONNECT",{login:G,passcode:F});d.onopen()}j=d._createProtocol();j.onopen=D;j.onclose=d.onclose;j.onerror=d.onerror;j.onlinereceived=f;j.onrawdatareceived=p;j.open(s,B,true)};d._createProtocol=function(){return new LineProtocol(new TCPSocket)};d.disconnect=function(){d.sendFrame("DISCONNECT")};d.reset=function(){j.reset()};d.send=function(s,B,G){d.sendFrame("SEND",g({destination:B},G),s)};d.subscribe=function(s,B){d.sendFrame("SUBSCRIBE",g({destination:s},B))};d.unsubscribe=function(s,B){d.sendFrame("UNSUBSCRIBE",g({destination:s},B))};d.begin=function(s){d.sendFrame("BEGIN",{transaction:s})};d.commit=function(s){d.sendFrame("COMMIT",{transaction:s})};d.abort=function(s){d.sendFrame("ABORT",{transaction:s})};d.ack=function(){}};var soundManager=null;function SoundManager(a,d){this.flashVersion=8;this.debugFlash=this.debugMode=false;this.useConsole=true;this.waitForWindowLoad=this.consoleOnly=false;this.nullURL="null.mp3";this.allowPolling=true;this.useMovieStar=this.useFastPolling=false;this.bgColor="#ffffff";this.useHighPerformance=false;this.flashLoadTimeout=1000;this.wmode=null;this.allowFullScreen=true;this.allowScriptAccess="always";this.defaultOptions={autoLoad:false,stream:true,autoPlay:false,onid3:null,onload:null,whileloading:null,onplay:null,onpause:null,onresume:null,whileplaying:null,onstop:null,onfinish:null,onbeforefinish:null,onbeforefinishtime:5000,onbeforefinishcomplete:null,onjustbeforefinish:null,onjustbeforefinishtime:200,multiShot:true,multiShotEvents:false,position:null,pan:0,volume:100};this.flash9Options={isMovieStar:null,usePeakData:false,useWaveformData:false,useEQData:false,onbufferchange:null,ondataerror:null};this.movieStarOptions={onmetadata:null,useVideo:false,bufferTime:null};var j=null,b=this,c="soundManager";this.version=null;this.versionNumber="V2.95b.20100101";this.movieURL=null;this.url="/flash/soundmanager/";this.altURL=null;this.enabled=this.swfLoaded=false;this.o=null;this.id=d||"sm2movie";this.oMC=null;this.sounds={};this.soundIDs=[];this.isFullScreen=this.muted=false;this.isIE=navigator.userAgent.match(/MSIE/i);this.isSafari=navigator.userAgent.match(/safari/i);this.debugID="soundmanager-debug";this.debugURLParam=/([#?&])debug=1/i;this.specialWmodeCase=false;this._onready=[];this._debugOpen=true;this._windowLoaded=this._disabled=this._didInit=this._appendSuccess=this._didAppend=false;this._hasConsole=typeof console!="undefined"&&typeof console.log!="undefined";this._debugLevels=["log","info","warn","error"];this._defaultFlashVersion=8;this._oRemovedHTML=this._oRemoved=null;function m(k){return document.getElementById(k)}this.filePatterns={flash8:/\.mp3(\?.*)?$/i,flash9:/\.mp3(\?.*)?$/i};this.netStreamTypes=["aac","flv","mov","mp4","m4v","f4v","m4a","mp4v","3gp","3g2"];this.netStreamPattern=new RegExp("\\.("+
this.netStreamTypes.join("|")+")(\\?.*)?$","i");this.filePattern=null;this.features={buffering:false,peakData:false,waveformData:false,eqData:false,movieStar:false};this.sandbox={type:null,types:{remote:"remote (domain-based) rules",localWithFile:"local with file access (no internet access)",localWithNetwork:"local with network (internet access only, no local access)",localTrusted:"local, trusted (local+internet access)"},description:null,noRemote:null,noLocal:null};this._setVersionInfo=function(){if(b.flashVersion!=8&&b.flashVersion!=9){alert(b._str("badFV",b.flashVersion,b._defaultFlashVersion));b.flashVersion=b._defaultFlashVersion}b.version=b.versionNumber+(b.flashVersion==9?" (AS3/Flash 9)":" (AS2/Flash 8)");if(b.flashVersion>8){b.defaultOptions=b._mergeObjects(b.defaultOptions,b.flash9Options);b.features.buffering=true}if(b.flashVersion>8&&b.useMovieStar){b.defaultOptions=b._mergeObjects(b.defaultOptions,b.movieStarOptions);b.filePatterns.flash9=new RegExp("\\.(mp3|"+b.netStreamTypes.join("|")+")(\\?.*)?$","i");b.features.movieStar=true}else{b.useMovieStar=false;b.features.movieStar=false}b.filePattern=b.filePatterns[b.flashVersion!=8?"flash9":"flash8"];b.movieURL=b.flashVersion==8?"soundmanager2.swf":"soundmanager2_flash9.swf";b.features.peakData=b.features.waveformData=b.features.eqData=b.flashVersion>8};this._overHTTP=document.location?document.location.protocol.match(/http/i):null;this._initPending=this._waitingforEI=false;this._tryInitOnFocus=this.isSafari&&typeof document.hasFocus=="undefined";this._isFocused=typeof document.hasFocus!="undefined"?document.hasFocus():null;this._okToDisable=!this._tryInitOnFocus;this.useAltURL=!this._overHTTP;a="http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html";this.strings={notReady:"Not loaded yet - wait for soundManager.onload() before calling sound-related methods",appXHTML:c+"_createMovie(): appendChild/innerHTML set failed. May be app/xhtml+xml DOM-related.",swf404:c+": Verify that %s is a valid path.",tryDebug:"Try "+
c+".debugFlash = true for more security details (output goes to SWF.)",checkSWF:"See SWF output for more debug info.",localFail:c+": Non-HTTP page ("+document.location.protocol+" URL?) Review Flash player security settings for this special case:\n"+a+"\nMay need to add/allow path, eg. c:/sm2/ or /users/me/sm2/",waitFocus:c+": Special case: Waiting for focus-related event..",waitImpatient:c+": Getting impatient, still waiting for Flash%s...",waitForever:c+": Waiting indefinitely for Flash...",needFunction:c+".onready(): Function object expected",badID:'Warning: Sound ID "%s" should be a string, starting with a non-numeric character',fl9Vid:"flash 9 required for video. Exiting.",noMS:"MovieStar mode not enabled. Exiting.",spcWmode:c+"._createMovie(): Removing wmode, preventing win32 below-the-fold SWF loading issue",currentObj:"--- "+c+"._debug(): Current sound objects ---",waitEI:c+"._initMovie(): Waiting for ExternalInterface call from Flash..",waitOnload:c+": Waiting for window.onload()",docLoaded:c+": Document already loaded",onload:c+".initComplete(): calling soundManager.onload()",onloadOK:c+".onload() complete",init:"-- "+c+".init() --",didInit:c+".init(): Already called?",flashJS:c+": Attempting to call Flash from JS..",noPolling:c+": Polling (whileloading()/whileplaying() support) is disabled.",secNote:"Flash security note: Network/internet URLs will not load due to security restrictions. Access can be configured via Flash Player Global Security Settings Page: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html",badRemove:"Warning: Failed to remove flash movie.",peakWave:"Warning: peak/waveform/eqData features unsupported for non-MP3 formats",shutdown:c+".disable(): Shutting down",queue:c+".onready(): Queueing handler",smFail:c+": Failed to initialise.",smError:"SMSound.load(): Exception: JS-Flash communication failed, or JS error.",manURL:"SMSound.load(): Using manually-assigned URL",onURL:c+".load(): current URL already assigned.",badFV:'soundManager.flashVersion must be 8 or 9. "%s" is invalid. Reverting to %s.'};this._str=function(){var k=Array.prototype.slice.call(arguments),g=k.shift();if((g=b.strings&&b.strings[g]?b.strings[g]:"")&&k&&k.length)for(var f=0,n=k.length;f<n;f++)g=g.replace("%s",k[f]);return g};this.supported=function(){return b._didInit&&!b._disabled};this.getMovie=function(k){return b.isIE?window[k]:b.isSafari?m(k)||document[k]:m(k)};this.loadFromXML=function(k){try{b.o._loadFromXML(k)}catch(g){b._failSafely();return true}};this.createSound=function(k){var g="soundManager.createSound(): ";if(!b._didInit)throw b._complain(g+b._str("notReady"),arguments.callee.caller);if(arguments.length==2)k={id:arguments[0],url:arguments[1]};var f=b._mergeObjects(k);f=f;f.id.toString().charAt(0).match(/^[0-9]$/)&&b._wD(g+b._str("badID",f.id),2);b._wD(g+f.id+" ("+f.url+")",1);if(b._idCheck(f.id,true)){b._wD(g+f.id+" exists",1);return b.sounds[f.id]}if(b.flashVersion>8&&b.useMovieStar){if(f.isMovieStar===null)f.isMovieStar=f.url.match(b.netStreamPattern)?true:false;f.isMovieStar&&b._wD(g+"using MovieStar handling");if(f.isMovieStar&&(f.usePeakData||f.useWaveformData||f.useEQData)){b._wDS("peakWave");f.usePeakData=false;f.useWaveformData=false;f.useEQData=false}}b.sounds[f.id]=new j(f);b.soundIDs[b.soundIDs.length]=f.id;b.flashVersion==8?b.o._createSound(f.id,f.onjustbeforefinishtime):b.o._createSound(f.id,f.url,f.onjustbeforefinishtime,f.usePeakData,f.useWaveformData,f.useEQData,f.isMovieStar,f.isMovieStar?f.useVideo:false,f.isMovieStar?f.bufferTime:false);if(f.autoLoad||f.autoPlay)b.sounds[f.id]&&b.sounds[f.id].load(f);f.autoPlay&&b.sounds[f.id].play();return b.sounds[f.id]};this.createVideo=function(k){var g="soundManager.createVideo(): ";if(arguments.length==2)k={id:arguments[0],url:arguments[1]};if(b.flashVersion>=9){k.isMovieStar=true;k.useVideo=true}else{b._wD(g+b._str("f9Vid"),2);return false}b.useMovieStar||b._wD(g+b._str("noMS"),2);return b.createSound(k)};this.destroyVideo=this.destroySound=function(k,g){if(!b._idCheck(k))return false;for(var f=0;f<b.soundIDs.length;f++)b.soundIDs[f]==k&&b.soundIDs.splice(f,1);b.sounds[k].unload();g||b.sounds[k].destruct();delete b.sounds[k]};this.load=function(k,g){if(!b._idCheck(k))return false;b.sounds[k].load(g)};this.unload=function(k){if(!b._idCheck(k))return false;b.sounds[k].unload()};this.start=this.play=function(k,g){var f="soundManager.play(): ";if(!b._didInit)throw b._complain(f+b._str("notReady"),arguments.callee.caller);if(!b._idCheck(k)){if(typeof g!="Object")g={url:g};if(g&&g.url){b._wD(f+'attempting to create "'+k+'"',1);g.id=k;b.createSound(g)}else return false}b.sounds[k].play(g)};this.setPosition=function(k,g){if(!b._idCheck(k))return false;b.sounds[k].setPosition(g)};this.stop=function(k){if(!b._idCheck(k))return false;b._wD("soundManager.stop("+k+")",1);b.sounds[k].stop()};this.stopAll=function(){b._wD("soundManager.stopAll()",1);for(var k in b.sounds)b.sounds[k]instanceof j&&b.sounds[k].stop()};this.pause=function(k){if(!b._idCheck(k))return false;b.sounds[k].pause()};this.pauseAll=function(){for(var k=b.soundIDs.length;k--;)b.sounds[b.soundIDs[k]].pause()};this.resume=function(k){if(!b._idCheck(k))return false;b.sounds[k].resume()};this.resumeAll=function(){for(var k=b.soundIDs.length;k--;)b.sounds[b.soundIDs[k]].resume()};this.togglePause=function(k){if(!b._idCheck(k))return false;b.sounds[k].togglePause()};this.setPan=function(k,g){if(!b._idCheck(k))return false;b.sounds[k].setPan(g)};this.setVolume=function(k,g){if(!b._idCheck(k))return false;b.sounds[k].setVolume(g)};this.mute=function(k){var g="soundManager.mute(): ";if(typeof k!="string")k=null;if(k){if(!b._idCheck(k))return false;b._wD(g+'Muting "'+k+'"');b.sounds[k].mute()}else{b._wD(g+"Muting all sounds");for(k=b.soundIDs.length;k--;)b.sounds[b.soundIDs[k]].mute();b.muted=true}};this.muteAll=function(){b.mute()};this.unmute=function(k){var g="soundManager.unmute(): ";if(typeof k!="string")k=null;if(k){if(!b._idCheck(k))return false;b._wD(g+'Unmuting "'+k+'"');b.sounds[k].unmute()}else{b._wD(g+"Unmuting all sounds");for(k=b.soundIDs.length;k--;)b.sounds[b.soundIDs[k]].unmute();b.muted=false}};this.unmuteAll=function(){b.unmute()};this.toggleMute=function(k){if(!b._idCheck(k))return false;b.sounds[k].toggleMute()};this.getMemoryUse=function(){if(b.flashVersion==8)return 0;if(b.o)return parseInt(b.o._getMemoryUse(),10)};this.disable=function(k){if(typeof k=="undefined")k=false;if(b._disabled)return false;b._disabled=true;b._wDS("shutdown",1);for(var g=b.soundIDs.length;g--;)b._disableObject(b.sounds[b.soundIDs[g]]);b.initComplete(k)};this.canPlayURL=function(k){return k?k.match(b.filePattern)?true:false:null};this.getSoundById=function(k,g){if(!k)throw new Error("SoundManager.getSoundById(): sID is null/undefined");var f=b.sounds[k];!f&&!g&&b._wD('"'+k+'" is an invalid sound ID.',2);return f};this.onready=function(k,g){if(k&&k instanceof Function){b._didInit&&b._wDS("queue");g||(g=window);b._addOnReady(k,g);b._processOnReady();return true}else throw b._str("needFunction");};this.oninitmovie=function(){};this.onload=function(){soundManager._wD("soundManager.onload()",1)};this.onerror=function(){};this._idCheck=this.getSoundById;this._complain=function(k,g){var f="Error: ";if(!g)return new Error(f+k);var n=new Error(""),p=null;if(n.stack)try{var y="@",u=n.stack.split(y);p=u[4]}catch(s){p=n.stack}typeof console!="undefined"&&typeof console.trace!="undefined"&&console.trace();k=f+k+". \nCaller: "+g.toString()+(n.stack?" \nTop of stacktrace: "+p:n.message?" \nMessage: "+n.message:"");return new Error(k)};function o(){return false}o._protected=true;this._disableObject=function(k){for(var g in k)if(typeof k[g]=="function"&&typeof k[g]._protected=="undefined")k[g]=o};this._failSafely=function(k){if(typeof k=="undefined")k=false;if(!b._disabled||k){b._wDS("smFail",2);b.disable(k)}};this._normalizeMovieURL=function(k){var g=null;if(k)if(k.match(/\.swf(\?.*)?$/i)){if(g=k.substr(k.toLowerCase().lastIndexOf(".swf?")+4))return k}else if(k.lastIndexOf("/")!=k.length-1)k+="/";return(k&&k.lastIndexOf("/")!=-1?k.substr(0,k.lastIndexOf("/")+1):"./")+b.movieURL};this._getDocument=function(){return document.body?document.body:document.documentElement?document.documentElement:document.getElementsByTagName("div")[0]};this._getDocument._protected=true;this._setPolling=function(k,g){if(!b.o||!b.allowPolling)return false;b.o._setPolling(k,g)};this._createMovie=function(k,g){var f=null;g=g?g:b.url;var n=b.altURL?b.altURL:g;if(b.debugURLParam.test(window.location.href.toString()))b.debugMode=true;if(b._didAppend&&b._appendSuccess)return false;b._didAppend=true;b._setVersionInfo();b.url=b._normalizeMovieURL(b._overHTTP?g:n);g=b.url;if(b.useHighPerformance&&b.useMovieStar&&b.defaultOptions.useVideo===true){f="soundManager note: disabling highPerformance, not applicable with movieStar mode+useVideo";b.useHighPerformance=false}b.wmode=!b.wmode&&b.useHighPerformance&&!b.useMovieStar?"transparent":b.wmode;if(b.wmode!==null&&b.flashLoadTimeout!==0&&(!b.useHighPerformance||b.debugFlash)&&!b.isIE&&navigator.platform.match(/win32/i)){b.specialWmodeCase=true;b._wDS("spcWmode");b.wmode=null}if(b.flashVersion==8)b.allowFullScreen=false;var p={name:k,id:k,src:g,width:"100%",height:"100%",quality:"high",allowScriptAccess:b.allowScriptAccess,bgcolor:b.bgColor,pluginspage:"http://www.macromedia.com/go/getflashplayer",type:"application/x-shockwave-flash",wmode:b.wmode,allowfullscreen:b.allowFullScreen?"true":"false"};if(b.debugFlash)p.FlashVars="debug=1";b.wmode||delete p.wmode;var y=n=null,u=null,s=null;if(b.isIE){n=document.createElement("div");u='<object id="'+k+'" data="'+g+'" type="'+p.type+'" width="'+p.width+'" height="'+p.height+'"><param name="movie" value="'+g+'" /><param name="AllowScriptAccess" value="'+b.allowScriptAccess+'" /><param name="quality" value="'+p.quality+'" />'+(b.wmode?'<param name="wmode" value="'+b.wmode+'" /> ':"")+'<param name="bgcolor" value="'+b.bgColor+'" /><param name="allowFullScreen" value="'+p.allowFullScreen+'" />'+(b.debugFlash?'<param name="FlashVars" value="'+p.FlashVars+'" />':"")+"<!-- --\></object>"}else{n=document.createElement("embed");for(y in p)p.hasOwnProperty(y)&&n.setAttribute(y,p[y])}s=k=null;if(b.debugMode){k=document.createElement("div");k.id=b.debugID+"-toggle";s={position:"fixed",bottom:"0px",right:"0px",width:"1.2em",height:"1.2em",lineHeight:"1.2em",margin:"2px",textAlign:"center",border:"1px solid #999",cursor:"pointer",background:"#fff",color:"#333",zIndex:10001};k.appendChild(document.createTextNode("-"));k.onclick=b._toggleDebug;k.title="Toggle SM2 debug console";if(navigator.userAgent.match(/msie 6/i)){k.style.position="absolute";k.style.cursor="hand"}for(y in s)if(s.hasOwnProperty(y))k.style[y]=s[y]}if(y=b._getDocument()){b.oMC=m("sm2-container")?m("sm2-container"):document.createElement("div");s=(b.debugMode?" sm2-debug":"")+(b.debugFlash?" flash-debug":"");if(b.oMC.id){if(b.debugMode||b.debugFlash)b.oMC.className+=s;b.oMC.appendChild(n);if(b.isIE){s=b.oMC.appendChild(document.createElement("div"));s.className="sm2-object-box";s.innerHTML=u}b._appendSuccess=true}else{b.oMC.id="sm2-container";b.oMC.className="movieContainer"+s;s=p=null;p=b.useHighPerformance?{position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"}:{position:"absolute",width:"8px",height:"8px",top:"-9999px",left:"-9999px"};var B=null;if(!b.debugFlash)for(B in p)if(p.hasOwnProperty(B))b.oMC.style[B]=p[B];try{b.isIE||b.oMC.appendChild(n);y.appendChild(b.oMC);if(b.isIE){s=b.oMC.appendChild(document.createElement("div"));s.className="sm2-object-box";s.innerHTML=u}b._appendSuccess=true}catch(G){throw new Error(b._str("appXHTML"));}}if(b.debugMode&&!m(b.debugID)&&(!b._hasConsole||!b.useConsole||b.useConsole&&b._hasConsole&&!b.consoleOnly)){n=document.createElement("div");n.id=b.debugID;n.style.display=b.debugMode?"block":"none";if(b.debugMode&&!m(k.id)){try{y.appendChild(k)}catch(F){throw new Error(b._str("appXHTML"));}y.appendChild(n)}}}f&&b._wD(f);b._wD("-- SoundManager 2 "+b.version+(b.useMovieStar?", MovieStar mode":"")+(b.useHighPerformance?", high performance mode, ":", ")+((b.useFastPolling?"fast":"normal")+" polling")+(b.wmode?", wmode: "+b.wmode:"")+(b.debugFlash?", flash debug mode":"")+" --",1);b._wD("soundManager._createMovie(): Trying to load "+g+(!b._overHTTP&&b.altURL?" (alternate URL)":""),1)};this._writeDebug=function(k,g,f){if(!b.debugMode)return false;if(typeof f!="undefined"&&f)k=k+" | "+(new Date).getTime();if(b._hasConsole&&b.useConsole){f=b._debugLevels[g];typeof console[f]!="undefined"?console[f](k):console.log(k);if(b.useConsoleOnly)return true}f="soundmanager-debug";var n=null;try{n=m(f);if(!n)return false;var p=document.createElement("div");if(++b._wdCount%2===0)p.className="sm2-alt";g=typeof g=="undefined"?0:parseInt(g,10);p.appendChild(document.createTextNode(k));if(g){if(g>=2)p.style.fontWeight="bold";if(g==3)p.style.color="#ff3333"}n.insertBefore(p,n.firstChild)}catch(y){}};this._writeDebug._protected=true;this._wdCount=0;this._wdCount._protected=true;this._wD=this._writeDebug;this._wDS=function(k,g){return k?b._wD(b._str(k),g):""};this._wDS._protected=true;this._wDAlert=function(k){alert(k)};if(window.location.href.indexOf("debug=alert")+1&&b.debugMode)b._wD=b._wDAlert;this._toggleDebug=function(){var k=m(b.debugID),g=m(b.debugID+"-toggle");if(!k)return false;if(b._debugOpen){g.innerHTML="+";k.style.display="none"}else{g.innerHTML="-";k.style.display="block"}b._debugOpen=!b._debugOpen};this._toggleDebug._protected=true;this._debug=function(){b._wDS("currentObj",1);for(var k=0,g=b.soundIDs.length;k<g;k++)b.sounds[b.soundIDs[k]]._debug()};this._debugTS=function(k,g,f){if(typeof sm2Debugger!="undefined")try{sm2Debugger.handleEvent(k,g,f)}catch(n){}};this._debugTS._protected=true;this._mergeObjects=function(k,g){var f={};for(var n in k)if(k.hasOwnProperty(n))f[n]=k[n];k=typeof g=="undefined"?b.defaultOptions:g;for(var p in k)if(k.hasOwnProperty(p)&&typeof f[p]=="undefined")f[p]=k[p];return f};this.go=this.createMovie=function(k){if(k)b.url=k;b._initMovie()};this._initMovie=function(){if(b.o)return false;b.o=b.getMovie(b.id);if(!b.o){if(b.oRemoved){if(b.isIE)b.oMC.innerHTML=b.oRemovedHTML;else b.oMC.appendChild(b.oRemoved);b.oRemoved=null;b._didAppend=true}else b._createMovie(b.id,b.url);b.o=b.getMovie(b.id)}b.o&&b.flashLoadTimeout>0&&b._wDS("waitEI");typeof b.oninitmovie=="function"&&setTimeout(b.oninitmovie,1)};this.waitForExternalInterface=function(){if(b._waitingForEI)return false;b._waitingForEI=true;if(b._tryInitOnFocus&&!b._isFocused){b._wDS("waitFocus");return false}if(b.flashLoadTimeout>0){if(!b._didInit){var k=b.getMoviePercent();b._wD(b._str("waitImpatient",k==100?" (SWF loaded)":k>0?" (SWF "+k+"% loaded)":""))}setTimeout(function(){var g=b.getMoviePercent();if(!b._didInit){b._wD(c+": No Flash response within reasonable time after document load.\nLikely causes: "+
(g===null||g===0?"Loading "+b.movieURL+" may have failed (and/or Flash "+b.flashVersion+"+ not present?), ":"")+"Flash blocked or JS-Flash security error."+(b.debugFlash?" "+b._str("checkSWF"):""),2);if(!b._overHTTP){b._wDS("localFail",2);b.debugFlash||b._wDS("tryDebug",2)}g===0&&b._wD(b._str("swf404",b.url));b._debugTS("flashtojs",false,": Timed out"+b._overHTTP?" (Check flash security or flash blockers)":" (No plugin/missing SWF?)")}!b._didInit&&b._okToDisable&&b._failSafely(true)},b.flashLoadTimeout)}else b._didInit||b._wDS("waitForever")};this.getMoviePercent=function(){return b.o&&typeof b.o.PercentLoaded!="undefined"?b.o.PercentLoaded():null};this.handleFocus=function(){if(b._isFocused||!b._tryInitOnFocus)return true;b._okToDisable=true;b._isFocused=true;b._wD("soundManager.handleFocus()");b._tryInitOnFocus&&window.removeEventListener("mousemove",b.handleFocus,false);b._waitingForEI=false;setTimeout(b.waitForExternalInterface,500);if(window.removeEventListener)window.removeEventListener("focus",b.handleFocus,false);else window.detachEvent&&window.detachEvent("onfocus",b.handleFocus)};this.initComplete=function(k){if(b._didInit)return false;b._didInit=true;b._wD("-- SoundManager 2 "+(b._disabled?"failed to load":"loaded")+" ("+(b._disabled?"security/load error":"OK")+") --",1);if(b._disabled||k){b._processOnReady();b._debugTS("onload",false);b.onerror.apply(window);return false}else b._debugTS("onload",true);if(b.waitForWindowLoad&&!b._windowLoaded){b._wDS("waitOnload");if(window.addEventListener)window.addEventListener("load",b._initUserOnload,false);else window.attachEvent&&window.attachEvent("onload",b._initUserOnload);return false}else{b.waitForWindowLoad&&b._windowLoaded&&b._wDS("docLoaded");b._initUserOnload()}};this._addOnReady=function(k,g){b._onready.push({method:k,scope:g||null,fired:false})};this._processOnReady=function(){if(!b._didInit)return false;for(var k={success:!b._disabled},g=[],f=0,n=b._onready.length;f<n;f++)b._onready[f].fired!==true&&g.push(b._onready[f]);if(g.length){b._wD(c+": Firing "+g.length+" onready() item"+(g.length>1?"s":""));f=0;for(n=g.length;f<n;f++){g[f].scope?g[f].method.apply(g[f].scope,[k]):g[f].method(k);g[f].fired=true}}};this._initUserOnload=function(){window.setTimeout(function(){b._processOnReady();b._wDS("onload",1);b.onload.apply(window);b._wDS("onloadOK",1)})};this.init=function(){b._wDS("init");b._initMovie();if(b._didInit){b._wDS("didInit");return false}if(window.removeEventListener)window.removeEventListener("load",b.beginDelayedInit,false);else window.detachEvent&&window.detachEvent("onload",b.beginDelayedInit);try{b._wDS("flashJS");b.o._externalInterfaceTest(false);b.allowPolling?b._setPolling(true,b.useFastPolling?true:false):b._wDS("noPolling",1);b.debugMode||b.o._disableDebug();b.enabled=true;b._debugTS("jstoflash",true)}catch(k){b._wD("js/flash exception: "+k.toString());b._debugTS("jstoflash",false);b._failSafely(true);b.initComplete();return false}b.initComplete()};this.beginDelayedInit=function(){b._windowLoaded=true;setTimeout(b.waitForExternalInterface,500);setTimeout(b.beginInit,20)};this.beginInit=function(){if(b._initPending)return false;b.createMovie();b._initMovie();return b._initPending=true};this.domContentLoaded=function(){document.removeEventListener&&document.removeEventListener("DOMContentLoaded",b.domContentLoaded,false);b.go()};this._externalInterfaceOK=function(k){if(b.swfLoaded)return false;var g=(new Date).getTime();b._wD("soundManager._externalInterfaceOK()"+(k?" (~"+(g-k)+" ms)":""));b._debugTS("swf",true);b._debugTS("flashtojs",true);b.swfLoaded=true;b._tryInitOnFocus=false;b.isIE?setTimeout(b.init,100):b.init()};this._setSandboxType=function(k){var g=b.sandbox;g.type=k;g.description=g.types[typeof g.types[k]!="undefined"?k:"unknown"];b._wD("Flash security sandbox type: "+g.type);if(g.type=="localWithFile"){g.noRemote=true;g.noLocal=false;b._wDS("secNote",2)}else if(g.type=="localWithNetwork"){g.noRemote=false;g.noLocal=true}else if(g.type=="localTrusted"){g.noRemote=false;g.noLocal=false}};this.reboot=function(){b._wD("soundManager.reboot()");b.soundIDs.length&&b._wD("Destroying "+b.soundIDs.length+" SMSound objects...");for(var k=b.soundIDs.length;k--;)b.sounds[b.soundIDs[k]].destruct();try{if(b.isIE)b.oRemovedHTML=b.o.innerHTML;b.oRemoved=b.o.parentNode.removeChild(b.o);b._wD("Flash movie removed.")}catch(g){b._wDS("badRemove",2)}b.oRemovedHTML=null;b.oRemoved=null;b.enabled=false;b._didInit=false;b._waitingForEI=false;b._initPending=false;b._didAppend=false;b._appendSuccess=false;b._disabled=false;b._waitingforEI=true;b.swfLoaded=false;b.soundIDs={};b.sounds=[];b.o=null;for(k=b._onready.length;k--;)b._onready[k].fired=false;b._wD(c+": Rebooting...");window.setTimeout(soundManager.beginDelayedInit,20)};this.destruct=function(){b._wD("soundManager.destruct()");b.disable(true)};j=function(k){var g=this;this.sID=k.id;this.url=k.url;this._iO=this.instanceOptions=this.options=b._mergeObjects(k);this.pan=this.options.pan;this.volume=this.options.volume;this._lastURL=null;this._debug=function(){if(b.debugMode){var f=null,n=[],p=null,y=null,u=64;for(f in g.options)if(g.options[f]!==null)if(g.options[f]instanceof Function){p=g.options[f].toString();p=p.replace(/\s\s+/g," ");y=p.indexOf("{");n[n.length]=" "+f+": {"+p.substr(y+1,Math.min(Math.max(p.indexOf("\n")-1,u),u)).replace(/\n/g,"")+"... }"}else n[n.length]=" "+f+": "+g.options[f];b._wD("SMSound() merged options: {\n"+n.join(", \n")+"\n}")}};this._debug();this.id3={};this.resetProperties=function(){g.bytesLoaded=null;g.bytesTotal=null;g.position=null;g.duration=null;g.durationEstimate=null;g.loaded=false;g.playState=0;g.paused=false;g.readyState=0;g.muted=false;g.didBeforeFinish=false;g.didJustBeforeFinish=false;g.isBuffering=false;g.instanceOptions={};g.instanceCount=0;g.peakData={left:0,right:0};g.waveformData={left:[],right:[]};g.eqData=[];g.eqData.left=[];g.eqData.right=[]};g.resetProperties();this.load=function(f){if(typeof f!="undefined"){g._iO=b._mergeObjects(f);g.instanceOptions=g._iO}else{f=g.options;g._iO=f;g.instanceOptions=g._iO;if(g._lastURL&&g._lastURL!=g.url){b._wDS("manURL");g._iO.url=g.url;g.url=null}}if(typeof g._iO.url=="undefined")g._iO.url=g.url;b._wD("soundManager.load(): "+g._iO.url,1);if(g._iO.url==g.url&&g.readyState!==0&&g.readyState!=2){b._wDS("onURL",1);return false}g.url=g._iO.url;g._lastURL=g._iO.url;g.loaded=false;g.readyState=1;g.playState=0;try{if(b.flashVersion==8)b.o._load(g.sID,g._iO.url,g._iO.stream,g._iO.autoPlay,g._iO.whileloading?1:0);else{b.o._load(g.sID,g._iO.url,g._iO.stream?true:false,g._iO.autoPlay?true:false);g._iO.isMovieStar&&g._iO.autoLoad&&!g._iO.autoPlay&&g.pause()}}catch(n){b._wDS("smError",2);b._debugTS("onload",false);b.onerror();b.disable()}};this.unload=function(){if(g.readyState!==0){b._wD('SMSound.unload(): "'+g.sID+'"');g.readyState!=2&&g.setPosition(0,true);b.o._unload(g.sID,b.nullURL);g.resetProperties()}};this.destruct=function(){b._wD('SMSound.destruct(): "'+g.sID+'"');b.o._destroySound(g.sID);b.destroySound(g.sID,true)};this.start=this.play=function(f){var n="SMSound.play(): ";f||(f={});g._iO=b._mergeObjects(f,g._iO);g._iO=b._mergeObjects(g._iO,g.options);g.instanceOptions=g._iO;if(g.playState==1)if(f=g._iO.multiShot)b._wD(n+'"'+g.sID+'" already playing (multi-shot)',1);else{b._wD(n+'"'+g.sID+'" already playing (one-shot)',1);return false}if(g.loaded)b._wD(n+'"'+g.sID+'"');else if(g.readyState===0){b._wD(n+'Attempting to load "'+g.sID+'"',1);g._iO.autoPlay=true;g.load(g._iO)}else if(g.readyState==2){b._wD(n+'Could not load "'+g.sID+'" - exiting',2);return false}else b._wD(n+'"'+g.sID+'" is loading - attempting to play..',1);if(g.paused)g.resume();else{g.playState=1;if(!g.instanceCount||b.flashVersion>8)g.instanceCount++;g.position=typeof g._iO.position!="undefined"&&!isNaN(g._iO.position)?g._iO.position:0;g._iO.onplay&&g._iO.onplay.apply(g);g.setVolume(g._iO.volume,true);g.setPan(g._iO.pan,true);b.o._start(g.sID,g._iO.loop||1,b.flashVersion==9?g.position:g.position/1000)}};this.stop=function(f){if(g.playState==1){g.playState=0;g.paused=false;g._iO.onstop&&g._iO.onstop.apply(g);b.o._stop(g.sID,f);g.instanceCount=0;g._iO={}}};this.setPosition=function(f){if(typeof f=="undefined")f=0;f=Math.min(g.duration,Math.max(f,0));g._iO.position=f;b.o._setPosition(g.sID,b.flashVersion==9?g._iO.position:g._iO.position/1000,g.paused||!g.playState)};this.pause=function(){if(g.paused||g.playState===0)return false;b._wD("SMSound.pause()");g.paused=true;b.o._pause(g.sID);g._iO.onpause&&g._iO.onpause.apply(g)};this.resume=function(){if(!g.paused||g.playState===0)return false;b._wD("SMSound.resume()");g.paused=false;b.o._pause(g.sID);g._iO.onresume&&g._iO.onresume.apply(g)};this.togglePause=function(){b._wD("SMSound.togglePause()");if(g.playState===0){g.play({position:b.flashVersion==9?g.position:g.position/1000});return false}g.paused?g.resume():g.pause()};this.setPan=function(f,n){if(typeof f=="undefined")f=0;if(typeof n=="undefined")n=false;b.o._setPan(g.sID,f);g._iO.pan=f;if(!n)g.pan=f};this.setVolume=function(f,n){if(typeof f=="undefined")f=100;if(typeof n=="undefined")n=false;b.o._setVolume(g.sID,b.muted&&!g.muted||g.muted?0:f);g._iO.volume=f;if(!n)g.volume=f};this.mute=function(){g.muted=true;b.o._setVolume(g.sID,0)};this.unmute=function(){g.muted=false;var f=typeof g._iO.volume!="undefined";b.o._setVolume(g.sID,f?g._iO.volume:g.options.volume)};this.toggleMute=function(){g.muted?g.unmute():g.mute()};this._whileloading=function(f,n,p){if(g._iO.isMovieStar){g.bytesLoaded=f;g.bytesTotal=n;g.duration=Math.floor(p);g.durationEstimate=g.duration}else{g.bytesLoaded=f;g.bytesTotal=n;g.duration=Math.floor(p);g.durationEstimate=parseInt(g.bytesTotal/g.bytesLoaded*g.duration,10);if(g.durationEstimate===undefined)g.durationEstimate=g.duration}g.readyState!=3&&g._iO.whileloading&&g._iO.whileloading.apply(g)};this._onid3=function(f,n){b._wD('SMSound._onid3(): "'+this.sID+'" ID3 data received.');for(var p=[],y=0,u=f.length;y<u;y++)p[f[y]]=n[y];g.id3=b._mergeObjects(g.id3,p);g._iO.onid3&&g._iO.onid3.apply(g)};this._whileplaying=function(f,n,p,y,u){if(isNaN(f)||f===null)return false;if(g.playState===0&&f>0)f=0;g.position=f;if(b.flashVersion>8){if(g._iO.usePeakData&&typeof n!="undefined"&&n)g.peakData={left:n.leftPeak,right:n.rightPeak};if(g._iO.useWaveformData&&typeof p!="undefined"&&p)g.waveformData={left:p.split(","),right:y.split(",")};if(g._iO.useEQData)if(typeof u!="undefined"&&u.leftEQ){f=u.leftEQ.split(",");g.eqData=f;g.eqData.left=f;if(typeof u.rightEQ!="undefined"&&u.rightEQ)g.eqData.right=u.rightEQ.split(",")}}if(g.playState==1){g.isBuffering&&g._onbufferchange(0);g._iO.whileplaying&&g._iO.whileplaying.apply(g);if(g.loaded&&g._iO.onbeforefinish&&g._iO.onbeforefinishtime&&!g.didBeforeFinish&&g.duration-g.position<=g._iO.onbeforefinishtime){b._wD("duration-position &lt;= onbeforefinishtime: "+g.duration+" - "+g.position+" &lt= "+g._iO.onbeforefinishtime+" ("+(g.duration-g.position)+")");g._onbeforefinish()}}};this._onload=function(f){var n="SMSound._onload(): ";f=f==1?true:false;b._wD(n+'"'+g.sID+'"'+(f?" loaded.":" failed to load? - "+g.url),f?1:2);if(!f){b.sandbox.noRemote===true&&b._wD(n+b._str("noNet"),1);b.sandbox.noLocal===true&&b._wD(n+b._str("noLocal"),1)}g.loaded=f;g.readyState=f?3:2;g._iO.onload&&g._iO.onload.apply(g)};this._onbeforefinish=function(){if(!g.didBeforeFinish){g.didBeforeFinish=true;if(g._iO.onbeforefinish){b._wD('SMSound._onbeforefinish(): "'+g.sID+'"');g._iO.onbeforefinish.apply(g)}}};this._onjustbeforefinish=function(){if(!g.didJustBeforeFinish){g.didJustBeforeFinish=true;if(g._iO.onjustbeforefinish){b._wD('SMSound._onjustbeforefinish(): "'+g.sID+'"');g._iO.onjustbeforefinish.apply(g)}}};this._onfinish=function(){g._iO.onbeforefinishcomplete&&g._iO.onbeforefinishcomplete.apply(g);g.didBeforeFinish=false;g.didJustBeforeFinish=false;if(g.instanceCount){g.instanceCount--;if(!g.instanceCount){g.playState=0;g.paused=false;g.instanceCount=0;g.instanceOptions={}}if(!g.instanceCount||g._iO.multiShotEvents)if(g._iO.onfinish){b._wD('SMSound._onfinish(): "'+g.sID+'"');g._iO.onfinish.apply(g)}}};this._onmetadata=function(f){var n="SMSound.onmetadata()";b._wD(n);if(!f.width&&!f.height){b._wDS("noWH");f.width=320;f.height=240}g.metadata=f;g.width=f.width;g.height=f.height;if(g._iO.onmetadata){b._wD(n+': "'+g.sID+'"');g._iO.onmetadata.apply(g)}b._wD(n+" complete")};this._onbufferchange=function(f){var n="SMSound._onbufferchange()";if(g.playState===0)return false;if(f==g.isBuffering){b._wD(n+": ignoring false default / loaded sound");return false}g.isBuffering=f==1?true:false;if(g._iO.onbufferchange){b._wD(n+": "+f);g._iO.onbufferchange.apply(g)}};this._ondataerror=function(f){if(g.playState>0){b._wD("SMSound._ondataerror(): "+
f);g._iO.ondataerror&&g._iO.ondataerror.apply(g)}}};this._onfullscreenchange=function(k){b._wD("onfullscreenchange(): "+k);b.isFullScreen=k==1?true:false;if(!b.isFullScreen)try{window.focus();b._wD("window.focus()")}catch(g){}};if(window.addEventListener){window.addEventListener("focus",b.handleFocus,false);window.addEventListener("load",b.beginDelayedInit,false);window.addEventListener("unload",b.destruct,false);b._tryInitOnFocus&&window.addEventListener("mousemove",b.handleFocus,false)}else if(window.attachEvent){window.attachEvent("onfocus",b.handleFocus);window.attachEvent("onload",b.beginDelayedInit);window.attachEvent("unload",b.destruct)}else{b._debugTS("onload",false);soundManager.onerror();soundManager.disable()}document.addEventListener&&document.addEventListener("DOMContentLoaded",b.domContentLoaded,false)}if(typeof SM2_DEFER=="undefined"||!SM2_DEFER)soundManager=new SoundManager;Date.CultureInfo={name:"en-US",englishName:"English (United States)",nativeName:"English (United States)",dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],shortestDayNames:["Su","Mo","Tu","We","Th","Fr","Sa"],firstLetterDayNames:["S","M","T","W","T","F","S"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],amDesignator:"AM",pmDesignator:"PM",firstDayOfWeek:0,twoDigitYearMax:2029,dateElementOrder:"mdy",formatPatterns:{shortDate:"M/d/yyyy",longDate:"dddd, MMMM dd, yyyy",shortTime:"h:mm tt",longTime:"h:mm:ss tt",fullDateTime:"dddd, MMMM dd, yyyy h:mm:ss tt",sortableDateTime:"yyyy-MM-ddTHH:mm:ss",universalSortableDateTime:"yyyy-MM-dd HH:mm:ssZ",rfc1123:"ddd, dd MMM yyyy HH:mm:ss GMT",monthDay:"MMMM dd",yearMonth:"MMMM, yyyy"},regexPatterns:{jan:/^jan(uary)?/i,feb:/^feb(ruary)?/i,mar:/^mar(ch)?/i,apr:/^apr(il)?/i,may:/^may/i,jun:/^jun(e)?/i,jul:/^jul(y)?/i,aug:/^aug(ust)?/i,sep:/^sep(t(ember)?)?/i,oct:/^oct(ober)?/i,nov:/^nov(ember)?/i,dec:/^dec(ember)?/i,sun:/^su(n(day)?)?/i,mon:/^mo(n(day)?)?/i,tue:/^tu(e(s(day)?)?)?/i,wed:/^we(d(nesday)?)?/i,thu:/^th(u(r(s(day)?)?)?)?/i,fri:/^fr(i(day)?)?/i,sat:/^sa(t(urday)?)?/i,future:/^next/i,past:/^last|past|prev(ious)?/i,add:/^(\+|aft(er)?|from|hence)/i,subtract:/^(\-|bef(ore)?|ago)/i,yesterday:/^yes(terday)?/i,today:/^t(od(ay)?)?/i,tomorrow:/^tom(orrow)?/i,now:/^n(ow)?/i,millisecond:/^ms|milli(second)?s?/i,second:/^sec(ond)?s?/i,minute:/^mn|min(ute)?s?/i,hour:/^h(our)?s?/i,week:/^w(eek)?s?/i,month:/^m(onth)?s?/i,day:/^d(ay)?s?/i,year:/^y(ear)?s?/i,shortMeridian:/^(a|p)/i,longMeridian:/^(a\.?m?\.?|p\.?m?\.?)/i,timezone:/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\s*(\+|\-)\s*\d\d\d\d?)|gmt|utc)/i,ordinalSuffix:/^\s*(st|nd|rd|th)/i,timeContext:/^\s*(\:|a(?!u|p)|p)/i},timezones:[{name:"UTC",offset:"-000"},{name:"GMT",offset:"-000"},{name:"EST",offset:"-0500"},{name:"EDT",offset:"-0400"},{name:"CST",offset:"-0600"},{name:"CDT",offset:"-0500"},{name:"MST",offset:"-0700"},{name:"MDT",offset:"-0600"},{name:"PST",offset:"-0800"},{name:"PDT",offset:"-0700"}]};(function(){var a=Date,d=a.prototype,j=a.CultureInfo;function b(k,g){g||(g=2);return("000"+k).slice(g*-1)}d.clearTime=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this};d.setTimeToNow=function(){var k=new Date;this.setHours(k.getHours());this.setMinutes(k.getMinutes());this.setSeconds(k.getSeconds());this.setMilliseconds(k.getMilliseconds());return this};a.today=function(){return(new Date).clearTime()};a.compare=function(k,g){if(isNaN(k)||isNaN(g))throw new Error(k+" - "+g);else if(k instanceof Date&&g instanceof Date)return k<g?-1:k>g?1:0;else throw new TypeError(k+" - "+g);};a.equals=function(k,g){return k.compareTo(g)===0};a.getDayNumberFromName=function(k){var g=j.dayNames,f=j.abbreviatedDayNames,n=j.shortestDayNames;k=k.toLowerCase();for(var p=0;p<g.length;p++)if(g[p].toLowerCase()==k||f[p].toLowerCase()==k||n[p].toLowerCase()==k)return p;return-1};a.getMonthNumberFromName=function(k){var g=j.monthNames,f=j.abbreviatedMonthNames;k=k.toLowerCase();for(var n=0;n<g.length;n++)if(g[n].toLowerCase()==k||f[n].toLowerCase()==k)return n;return-1};a.isLeapYear=function(k){return k%4===0&&k%100!==0||k%400===0};a.getDaysInMonth=function(k,g){return[31,a.isLeapYear(k)?29:28,31,30,31,30,31,31,30,31,30,31][g]};a.getTimezoneAbbreviation=function(k){for(var g=j.timezones,f=0;f<g.length;f++)if(g[f].offset===k)return g[f].name;return null};a.getTimezoneOffset=function(k){for(var g=j.timezones,f=0;f<g.length;f++)if(g[f].name===k.toUpperCase())return g[f].offset;return null};d.clone=function(){return new Date(this.getTime())};d.compareTo=function(k){return Date.compare(this,k)};d.equals=function(k){return Date.equals(this,k||new Date)};d.between=function(k,g){return this.getTime()>=k.getTime()&&this.getTime()<=g.getTime()};d.isAfter=function(k){return this.compareTo(k||new Date)===1};d.isBefore=function(k){return this.compareTo(k||new Date)===-1};d.isToday=function(){return this.isSameDay(new Date)};d.isSameDay=function(k){return this.clone().clearTime().equals(k.clone().clearTime())};d.addMilliseconds=function(k){this.setMilliseconds(this.getMilliseconds()+k);return this};d.addSeconds=function(k){return this.addMilliseconds(k*1000)};d.addMinutes=function(k){return this.addMilliseconds(k*60000)};d.addHours=function(k){return this.addMilliseconds(k*3600000)};d.addDays=function(k){this.setDate(this.getDate()+k);return this};d.addWeeks=function(k){return this.addDays(k*7)};d.addMonths=function(k){var g=this.getDate();this.setDate(1);this.setMonth(this.getMonth()+k);this.setDate(Math.min(g,a.getDaysInMonth(this.getFullYear(),this.getMonth())));return this};d.addYears=function(k){return this.addMonths(k*12)};d.add=function(k){if(typeof k=="number"){this._orient=k;return this}k=k;k.milliseconds&&this.addMilliseconds(k.milliseconds);k.seconds&&this.addSeconds(k.seconds);k.minutes&&this.addMinutes(k.minutes);k.hours&&this.addHours(k.hours);k.weeks&&this.addWeeks(k.weeks);k.months&&this.addMonths(k.months);k.years&&this.addYears(k.years);k.days&&this.addDays(k.days);return this};var c,m,o;d.getWeek=function(){var k,g,f,n,p;c=!c?this.getFullYear():c;m=!m?this.getMonth()+1:m;o=!o?this.getDate():o;if(m<=2){k=c-1;g=(k/4|0)-(k/100|0)+(k/400|0);f=((k-1)/4|0)-((k-1)/100|0)+((k-1)/400|0);f=g-f;n=0;p=o-1+31*(m-1)}else{k=c;g=(k/4|0)-(k/100|0)+(k/400|0);f=((k-1)/4|0)-((k-1)/100|0)+((k-1)/400|0);f=g-f;n=f+1;p=o+(153*(m-3)+2)/5+58+f}k=(k+g)%7;g=(p+k-n)%7;p=p+3-g|0;f=p<0?53-((k-f)/5|0):p>364+f?1:(p/7|0)+1;c=m=o=null;return f};d.getISOWeek=function(){c=this.getUTCFullYear();m=this.getUTCMonth()+
1;o=this.getUTCDate();return b(this.getWeek())};d.setWeek=function(k){return this.moveToDayOfWeek(1).addWeeks(k-this.getWeek())};a._validate=function(k,g,f,n){if(typeof k=="undefined")return false;else if(typeof k!="number")throw new TypeError(k+" is not a Number.");else if(k<g||k>f)throw new RangeError(k+" is not a valid value for "+n+".");return true};a.validateMillisecond=function(k){return a._validate(k,0,999,"millisecond")};a.validateSecond=function(k){return a._validate(k,0,59,"second")};a.validateMinute=function(k){return a._validate(k,0,59,"minute")};a.validateHour=function(k){return a._validate(k,0,23,"hour")};a.validateDay=function(k,g,f){return a._validate(k,1,a.getDaysInMonth(g,f),"day")};a.validateMonth=function(k){return a._validate(k,0,11,"month")};a.validateYear=function(k){return a._validate(k,0,9999,"year")};d.set=function(k){a.validateMillisecond(k.millisecond)&&this.addMilliseconds(k.millisecond-this.getMilliseconds());a.validateSecond(k.second)&&this.addSeconds(k.second-this.getSeconds());a.validateMinute(k.minute)&&this.addMinutes(k.minute-this.getMinutes());a.validateHour(k.hour)&&this.addHours(k.hour-this.getHours());a.validateMonth(k.month)&&this.addMonths(k.month-this.getMonth());a.validateYear(k.year)&&this.addYears(k.year-this.getFullYear());a.validateDay(k.day,this.getFullYear(),this.getMonth())&&this.addDays(k.day-this.getDate());k.timezone&&this.setTimezone(k.timezone);k.timezoneOffset&&this.setTimezoneOffset(k.timezoneOffset);k.week&&a._validate(k.week,0,53,"week")&&this.setWeek(k.week);return this};d.moveToFirstDayOfMonth=function(){return this.set({day:1})};d.moveToLastDayOfMonth=function(){return this.set({day:a.getDaysInMonth(this.getFullYear(),this.getMonth())})};d.moveToNthOccurrence=function(k,g){var f=0;if(g>0)f=g-1;else if(g===-1){this.moveToLastDayOfMonth();this.getDay()!==k&&this.moveToDayOfWeek(k,-1);return this}return this.moveToFirstDayOfMonth().addDays(-1).moveToDayOfWeek(k,+1).addWeeks(f)};d.moveToDayOfWeek=function(k,g){k=(k-this.getDay()+7*(g||+1))%7;return this.addDays(k===0?(k+=7*(g||+1)):k)};d.moveToMonth=function(k,g){k=(k-this.getMonth()+12*(g||+1))%12;return this.addMonths(k===0?(k+=12*(g||+1)):k)};d.getOrdinalNumber=function(){return Math.ceil((this.clone().clearTime()-new Date(this.getFullYear(),0,1))/86400000)+1};d.getTimezone=function(){return a.getTimezoneAbbreviation(this.getUTCOffset())};d.setTimezoneOffset=function(k){var g=this.getTimezoneOffset();k=Number(k)*-6/10;return this.addMinutes(k-g)};d.setTimezone=function(k){return this.setTimezoneOffset(a.getTimezoneOffset(k))};d.hasDaylightSavingTime=function(){return Date.today().set({month:0,day:1}).getTimezoneOffset()!==Date.today().set({month:6,day:1}).getTimezoneOffset()};d.isDaylightSavingTime=function(){return this.hasDaylightSavingTime()&&(new Date).getTimezoneOffset()===Date.today().set({month:6,day:1}).getTimezoneOffset()};d.getUTCOffset=function(){var k=this.getTimezoneOffset()*-10/6;if(k<0){k=(k-10000).toString();return k.charAt(0)+k.substr(2)}else{k=(k+10000).toString();return"+"+k.substr(1)}};d.getElapsed=function(k){return(k||new Date)-this};if(!d.toISOString)d.toISOString=function(){function k(g){return g<10?"0"+g:g}return'"'+this.getUTCFullYear()+"-"+k(this.getUTCMonth()+1)+"-"+k(this.getUTCDate())+"T"+k(this.getUTCHours())+":"+k(this.getUTCMinutes())+":"+k(this.getUTCSeconds())+'Z"'};d._toString=d.toString;d.toString=function(k){var g=this;if(k&&k.length==1){var f=j.formatPatterns;g.t=g.toString;switch(k){case"d":return g.t(f.shortDate);case"D":return g.t(f.longDate);case"F":return g.t(f.fullDateTime);case"m":return g.t(f.monthDay);case"r":return g.t(f.rfc1123);case"s":return g.t(f.sortableDateTime);case"t":return g.t(f.shortTime);case"T":return g.t(f.longTime);case"u":return g.t(f.universalSortableDateTime);case"y":return g.t(f.yearMonth)}}function n(p){switch(p*1){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th"}}return k?k.replace(/(\\)?(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|S)/g,function(p){if(p.charAt(0)==="\\")return p.replace("\\","");g.h=g.getHours;switch(p){case"hh":return b(g.h()<13?g.h()===0?12:g.h():g.h()-12);case"h":return g.h()<13?g.h()===0?12:g.h():g.h()-12;case"HH":return b(g.h());case"H":return g.h();case"mm":return b(g.getMinutes());case"m":return g.getMinutes();case"ss":return b(g.getSeconds());case"s":return g.getSeconds();case"yyyy":return b(g.getFullYear(),4);case"yy":return b(g.getFullYear());case"dddd":return j.dayNames[g.getDay()];case"ddd":return j.abbreviatedDayNames[g.getDay()];case"dd":return b(g.getDate());case"d":return g.getDate();case"MMMM":return j.monthNames[g.getMonth()];case"MMM":return j.abbreviatedMonthNames[g.getMonth()];case"MM":return b(g.getMonth()+1);case"M":return g.getMonth()+1;case"t":return g.h()<12?j.amDesignator.substring(0,1):j.pmDesignator.substring(0,1);case"tt":return g.h()<12?j.amDesignator:j.pmDesignator;case"S":return n(g.getDate());default:return p}}):this._toString()}})();(function(){var a=Date,d=a.prototype,j=a.CultureInfo,b=Number.prototype;d._orient=+1;d._nth=null;d._is=false;d._same=false;d._isSecond=false;b._dateElement="day";d.next=function(){this._orient=+1;return this};a.next=function(){return a.today().next()};d.last=d.prev=d.previous=function(){this._orient=-1;return this};a.last=a.prev=a.previous=function(){return a.today().last()};d.is=function(){this._is=true;return this};d.same=function(){this._same=true;this._isSecond=false;return this};d.today=function(){return this.same().day()};d.weekday=function(){if(this._is){this._is=false;return!this.is().sat()&&!this.is().sun()}return false};d.at=function(F){return typeof F==="string"?a.parse(this.toString("d")+" "+F):this.set(F)};b.fromNow=b.after=function(F){var D={};D[this._dateElement]=this;return(!F?new Date:F.clone()).add(D)};b.ago=b.before=function(F){var D={};D[this._dateElement]=this*-1;return(!F?new Date:F.clone()).add(D)};var c="sunday monday tuesday wednesday thursday friday saturday".split(/\s/),m="january february march april may june july august september october november december".split(/\s/),o="Millisecond Second Minute Hour Day Week Month Year".split(/\s/),k="Milliseconds Seconds Minutes Hours Date Week Month FullYear".split(/\s/),g="final first second third fourth fifth".split(/\s/);d.toObject=function(){for(var F={},D=0;D<o.length;D++)F[o[D].toLowerCase()]=this["get"+k[D]]();return F};a.fromObject=function(F){F.week=null;return Date.today().set(F)};function f(F){return function(){if(this._is){this._is=false;return this.getDay()==F}if(this._nth!==null){this._isSecond&&this.addSeconds(this._orient*-1);this._isSecond=false;var D=this._nth;this._nth=null;var H=this.clone().moveToLastDayOfMonth();this.moveToNthOccurrence(F,D);if(this>H)throw new RangeError(a.getDayName(F)+" does not occur "+D+" times in the month of "+a.getMonthName(H.getMonth())+" "+H.getFullYear()+".");return this}return this.moveToDayOfWeek(F,this._orient)}}function n(F){return function(){var D=a.today(),H=F-D.getDay();if(F===0&&j.firstDayOfWeek===1&&D.getDay()!==0)H+=7;return D.addDays(H)}}for(var p=0;p<c.length;p++){a[c[p].toUpperCase()]=a[c[p].toUpperCase().substring(0,3)]=p;a[c[p]]=a[c[p].substring(0,3)]=n(p);d[c[p]]=d[c[p].substring(0,3)]=f(p)}function y(F){return function(){if(this._is){this._is=false;return this.getMonth()===F}return this.moveToMonth(F,this._orient)}}function u(F){return function(){return a.today().set({month:F,day:1})}}for(c=0;c<m.length;c++){a[m[c].toUpperCase()]=a[m[c].toUpperCase().substring(0,3)]=c;a[m[c]]=a[m[c].substring(0,3)]=u(c);d[m[c]]=d[m[c].substring(0,3)]=y(c)}function s(F){return function(D){if(this._isSecond){this._isSecond=false;return this}if(this._same){this._same=this._is=false;var H=this.toObject();D=(D||new Date).toObject();for(var K="",N=F.toLowerCase(),O=o.length-1;O>-1;O--){K=o[O].toLowerCase();if(H[K]!=D[K])return false;if(N==K)break}return true}if(F.substring(F.length-1)!="s")F+="s";return this["add"+F](this._orient)}}function B(F){return function(){this._dateElement=F;return this}}for(c=0;c<o.length;c++){m=o[c].toLowerCase();d[m]=d[m+"s"]=s(o[c]);b[m]=b[m+"s"]=B(m)}d._ss=s("Second");function G(F){return function(D){if(this._same)return this._ss(D);if(D||D===0)return this.moveToNthOccurrence(D,F);this._nth=F;if(F===2&&(D===undefined||D===null)){this._isSecond=true;return this.addSeconds(this._orient)}return this}}for(b=0;b<g.length;b++)d[g[b]]=b===0?G(-1):G(b)})();(function(){Date.Parsing={Exception:function(o){this.message="Parse error at '"+o.substring(0,10)+" ...'"}};var a=Date.Parsing,d=a.Operators={rtoken:function(o){return function(k){var g=k.match(o);if(g)return[g[0],k.substring(g[0].length)];else throw new a.Exception(k);}},token:function(){return function(o){return d.rtoken(new RegExp("^s*"+o+"s*"))(o)}},stoken:function(o){return d.rtoken(new RegExp("^"+o))},until:function(o){return function(k){for(var g=[],f=null;k.length;){try{f=o.call(this,k)}catch(n){g.push(f[0]);k=f[1];continue}break}return[g,k]}},many:function(o){return function(k){for(var g=[],f=null;k.length;){try{f=o.call(this,k)}catch(n){return[g,k]}g.push(f[0]);k=f[1]}return[g,k]}},optional:function(o){return function(k){var g=null;try{g=o.call(this,k)}catch(f){return[null,k]}return[g[0],g[1]]}},not:function(o){return function(k){try{o.call(this,k)}catch(g){return[null,k]}throw new a.Exception(k);}},ignore:function(o){return o?function(k){var g=null;g=o.call(this,k);return[null,g[1]]}:null},product:function(){for(var o=arguments[0],k=Array.prototype.slice.call(arguments,1),g=[],f=0;f<o.length;f++)g.push(d.each(o[f],k));return g},cache:function(o){var k={},g=null;return function(f){try{g=k[f]=k[f]||o.call(this,f)}catch(n){g=k[f]=n}if(g instanceof a.Exception)throw g;else return g}},any:function(){var o=arguments;return function(k){for(var g=null,f=0;f<o.length;f++)if(o[f]!=null){try{g=o[f].call(this,k)}catch(n){g=null}if(g)return g}throw new a.Exception(k);}},each:function(){var o=arguments;return function(k){for(var g=[],f=null,n=0;n<o.length;n++)if(o[n]!=null){try{f=o[n].call(this,k)}catch(p){throw new a.Exception(k);}g.push(f[0]);k=f[1]}return[g,k]}},all:function(){var o=arguments,k=k;return k.each(k.optional(o))},sequence:function(o,k,g){k=k||d.rtoken(/^\s*/);g=g||null;if(o.length==1)return o[0];return function(f){for(var n=null,p=null,y=[],u=0;u<o.length;u++){try{n=o[u].call(this,f)}catch(s){break}y.push(n[0]);try{p=k.call(this,n[1])}catch(B){p=null;break}f=p[1]}if(!n)throw new a.Exception(f);if(p)throw new a.Exception(p[1]);if(g)try{n=g.call(this,n[1])}catch(G){throw new a.Exception(n[1]);}return[y,n?n[1]:f]}},between:function(o,k,g){g=g||o;var f=d.each(d.ignore(o),k,d.ignore(g));return function(n){n=f.call(this,n);return[[n[0][0],r[0][2]],n[1]]}},list:function(o,k,g){k=k||d.rtoken(/^\s*/);g=g||null;return o instanceof Array?d.each(d.product(o.slice(0,-1),d.ignore(k)),o.slice(-1),d.ignore(g)):d.each(d.many(d.each(o,d.ignore(k))),px,d.ignore(g))},set:function(o,k,g){k=k||d.rtoken(/^\s*/);g=g||null;return function(f){var n=null;for(var p=n=null,y=null,u=[[],f],s=false,B=0;B<o.length;B++){n=p=null;s=o.length==1;try{n=o[B].call(this,f)}catch(G){continue}y=[[n[0]],n[1]];if(n[1].length>0&&!s)try{p=k.call(this,n[1])}catch(F){s=true}else s=true;if(!s&&p[1].length===0)s=true;if(!s){n=[];for(s=0;s<o.length;s++)B!=s&&n.push(o[s]);n=d.set(n,k).call(this,p[1]);if(n[0].length>0){y[0]=y[0].concat(n[0]);y[1]=n[1]}}if(y[1].length<u[1].length)u=y;if(u[1].length===0)break}if(u[0].length===0)return u;if(g){try{p=g.call(this,u[1])}catch(D){throw new a.Exception(u[1]);}u[1]=p[1]}return u}},forward:function(o,k){return function(g){return o[k].call(this,g)}},replace:function(o,k){return function(g){g=o.call(this,g);return[k,g[1]]}},process:function(o,k){return function(g){g=o.call(this,g);return[k.call(this,g[0]),g[1]]}},min:function(o,k){return function(g){var f=k.call(this,g);if(f[0].length<o)throw new a.Exception(g);return f}}};function j(o){return function(){var k=null,g=[];if(arguments.length>1)k=Array.prototype.slice.call(arguments);else if(arguments[0]instanceof
Array)k=arguments[0];if(k)for(var f=0,n=k.shift();f<n.length;){k.unshift(n[f]);g.push(o.apply(null,k));k.shift();return g}else return o.apply(null,arguments)}}for(var b="optional not ignore cache".split(/\s/),c=0;c<b.length;c++)d[b[c]]=j(d[b[c]]);function m(o){return function(){return arguments[0]instanceof Array?o.apply(null,arguments[0]):o.apply(null,arguments)}}b="each any all".split(/\s/);for(c=0;c<b.length;c++)d[b[c]]=m(d[b[c]])})();(function(){var a=Date,d=a.CultureInfo;function j(n){for(var p=[],y=0;y<n.length;y++)if(n[y]instanceof Array)p=p.concat(j(n[y]));else n[y]&&p.push(n[y]);return p}a.Grammar={};a.Translator={hour:function(n){return function(){this.hour=Number(n)}},minute:function(n){return function(){this.minute=Number(n)}},second:function(n){return function(){this.second=Number(n)}},meridian:function(n){return function(){this.meridian=n.slice(0,1).toLowerCase()}},timezone:function(n){return function(){var p=n.replace(/[^\d\+\-]/g,"");if(p.length)this.timezoneOffset=Number(p);else this.timezone=n.toLowerCase()}},day:function(n){var p=n[0];return function(){this.day=Number(p.match(/\d+/)[0])}},month:function(n){return function(){this.month=n.length==3?"jan feb mar apr may jun jul aug sep oct nov dec".indexOf(n)/4:Number(n)-1}},year:function(n){return function(){var p=Number(n);this.year=n.length>2?p:p+(p+2000<d.twoDigitYearMax?2000:1900)}},rday:function(n){return function(){switch(n){case"yesterday":this.days=-1;break;case"tomorrow":this.days=1;break;case"today":this.days=0;break;case"now":this.days=0;this.now=true;break}}},finishExact:function(n){n=n instanceof Array?n:[n];for(var p=0;p<n.length;p++)n[p]&&n[p].call(this);n=new Date;if((this.hour||this.minute)&&!this.month&&!this.year&&!this.day)this.day=n.getDate();if(!this.year)this.year=n.getFullYear();if(!this.month&&this.month!==0)this.month=n.getMonth();if(!this.day)this.day=1;if(!this.hour)this.hour=0;if(!this.minute)this.minute=0;if(!this.second)this.second=0;if(this.meridian&&this.hour)if(this.meridian=="p"&&this.hour<12)this.hour+=12;else if(this.meridian=="a"&&this.hour==12)this.hour=0;if(this.day>a.getDaysInMonth(this.year,this.month))throw new RangeError(this.day+" is not a valid value for days.");n=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second);if(this.timezone)n.set({timezone:this.timezone});else this.timezoneOffset&&n.set({timezoneOffset:this.timezoneOffset});return n},finish:function(n){n=n instanceof Array?j(n):[n];if(n.length===0)return null;for(var p=0;p<n.length;p++)typeof n[p]=="function"&&n[p].call(this);n=a.today();if(this.now&&!this.unit&&!this.operator)return new Date;else if(this.now)n=new Date;p=!!(this.days&&this.days!==null||this.orient||this.operator);var y,u,s;s=this.orient=="past"||this.operator=="subtract"?-1:1;!this.now&&"hour minute second".indexOf(this.unit)!=-1&&n.setTimeToNow();if(this.month||this.month===0)if("year day hour minute second".indexOf(this.unit)!=-1){this.value=this.month+1;this.month=null;p=true}if(!p&&this.weekday&&!this.day&&!this.days){y=Date[this.weekday]();this.day=y.getDate();if(!this.month)this.month=y.getMonth();this.year=y.getFullYear()}if(p&&this.weekday&&this.unit!="month"){this.unit="day";y=a.getDayNumberFromName(this.weekday)-n.getDay();u=7;this.days=y?(y+s*u)%u:s*u}if(this.month&&this.unit=="day"&&this.operator){this.value=this.month+1;this.month=null}if(this.value!=null&&this.month!=null&&this.year!=null)this.day=this.value*1;if(this.month&&!this.day&&this.value){n.set({day:this.value*1});if(!p)this.day=this.value*1}if(!this.month&&this.value&&this.unit=="month"&&!this.now){this.month=this.value;p=true}if(p&&(this.month||this.month===0)&&this.unit!="year"){this.unit="month";y=this.month-n.getMonth();u=12;this.months=y?(y+s*u)%u:s*u;this.month=null}if(!this.unit)this.unit="day";if(!this.value&&this.operator&&this.operator!==null&&this[this.unit+"s"]&&this[this.unit+"s"]!==null)this[this.unit+"s"]=this[this.unit+"s"]+(this.operator=="add"?1:-1)+(this.value||0)*s;else if(this[this.unit+"s"]==null||this.operator!=null){if(!this.value)this.value=1;this[this.unit+"s"]=this.value*s}if(this.meridian&&this.hour)if(this.meridian=="p"&&this.hour<12)this.hour+=12;else if(this.meridian=="a"&&this.hour==12)this.hour=0;if(this.weekday&&!this.day&&!this.days){y=Date[this.weekday]();this.day=y.getDate();if(y.getMonth()!==n.getMonth())this.month=y.getMonth()}if((this.month||this.month===0)&&!this.day)this.day=1;if(!this.orient&&!this.operator&&this.unit=="week"&&this.value&&!this.day&&!this.month)return Date.today().setWeek(this.value);if(p&&this.timezone&&this.day&&this.days)this.day=this.days;return p?n.add(this):n.set(this)}};var b=a.Parsing.Operators,c=a.Grammar,m=a.Translator,o;c.datePartDelimiter=b.rtoken(/^([\s\-\.\,\/\x27]+)/);c.timePartDelimiter=b.stoken(":");c.whiteSpace=b.rtoken(/^\s*/);c.generalDelimiter=b.rtoken(/^(([\s\,]|at|@|on)+)/);var k={};c.ctoken=function(n){var p=k[n];if(!p){p=d.regexPatterns;for(var y=n.split(/\s+/),u=[],s=0;s<y.length;s++)u.push(b.replace(b.rtoken(p[y[s]]),y[s]));p=k[n]=b.any.apply(null,u)}return p};c.ctoken2=function(n){return b.rtoken(d.regexPatterns[n])};c.h=b.cache(b.process(b.rtoken(/^(0[0-9]|1[0-2]|[1-9])/),m.hour));c.hh=b.cache(b.process(b.rtoken(/^(0[0-9]|1[0-2])/),m.hour));c.H=b.cache(b.process(b.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/),m.hour));c.HH=b.cache(b.process(b.rtoken(/^([0-1][0-9]|2[0-3])/),m.hour));c.m=b.cache(b.process(b.rtoken(/^([0-5][0-9]|[0-9])/),m.minute));c.mm=b.cache(b.process(b.rtoken(/^[0-5][0-9]/),m.minute));c.s=b.cache(b.process(b.rtoken(/^([0-5][0-9]|[0-9])/),m.second));c.ss=b.cache(b.process(b.rtoken(/^[0-5][0-9]/),m.second));c.hms=b.cache(b.sequence([c.H,c.m,c.s],c.timePartDelimiter));c.t=b.cache(b.process(c.ctoken2("shortMeridian"),m.meridian));c.tt=b.cache(b.process(c.ctoken2("longMeridian"),m.meridian));c.z=b.cache(b.process(b.rtoken(/^((\+|\-)\s*\d\d\d\d)|((\+|\-)\d\d\:?\d\d)/),m.timezone));c.zz=b.cache(b.process(b.rtoken(/^((\+|\-)\s*\d\d\d\d)|((\+|\-)\d\d\:?\d\d)/),m.timezone));c.zzz=b.cache(b.process(c.ctoken2("timezone"),m.timezone));c.timeSuffix=b.each(b.ignore(c.whiteSpace),b.set([c.tt,c.zzz]));c.time=b.each(b.optional(b.ignore(b.stoken("T"))),c.hms,c.timeSuffix);c.d=b.cache(b.process(b.each(b.rtoken(/^([0-2]\d|3[0-1]|\d)/),b.optional(c.ctoken2("ordinalSuffix"))),m.day));c.dd=b.cache(b.process(b.each(b.rtoken(/^([0-2]\d|3[0-1])/),b.optional(c.ctoken2("ordinalSuffix"))),m.day));c.ddd=c.dddd=b.cache(b.process(c.ctoken("sun mon tue wed thu fri sat"),function(n){return function(){this.weekday=n}}));c.M=b.cache(b.process(b.rtoken(/^(1[0-2]|0\d|\d)/),m.month));c.MM=b.cache(b.process(b.rtoken(/^(1[0-2]|0\d)/),m.month));c.MMM=c.MMMM=b.cache(b.process(c.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"),m.month));c.y=b.cache(b.process(b.rtoken(/^(\d\d?)/),m.year));c.yy=b.cache(b.process(b.rtoken(/^(\d\d)/),m.year));c.yyy=b.cache(b.process(b.rtoken(/^(\d\d?\d?\d?)/),m.year));c.yyyy=b.cache(b.process(b.rtoken(/^(\d\d\d\d)/),m.year));o=function(){return b.each(b.any.apply(null,arguments),b.not(c.ctoken2("timeContext")))};c.day=o(c.d,c.dd);c.month=o(c.M,c.MMM);c.year=o(c.yyyy,c.yy);c.orientation=b.process(c.ctoken("past future"),function(n){return function(){this.orient=n}});c.operator=b.process(c.ctoken("add subtract"),function(n){return function(){this.operator=n}});c.rday=b.process(c.ctoken("yesterday tomorrow today now"),m.rday);c.unit=b.process(c.ctoken("second minute hour day week month year"),function(n){return function(){this.unit=n}});c.value=b.process(b.rtoken(/^\d\d?(st|nd|rd|th)?/),function(n){return function(){this.value=n.replace(/\D/g,"")}});c.expression=b.set([c.rday,c.operator,c.value,c.unit,c.orientation,c.ddd,c.MMM]);o=function(){return b.set(arguments,c.datePartDelimiter)};c.mdy=o(c.ddd,c.month,c.day,c.year);c.ymd=o(c.ddd,c.year,c.month,c.day);c.dmy=o(c.ddd,c.day,c.month,c.year);c.date=function(n){return(c[d.dateElementOrder]||c.mdy).call(this,n)};c.format=b.process(b.many(b.any(b.process(b.rtoken(/^(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?)/),function(n){if(c[n])return c[n];else throw a.Parsing.Exception(n);}),b.process(b.rtoken(/^[^dMyhHmstz]+/),function(n){return b.ignore(b.stoken(n))}))),function(n){return b.process(b.each.apply(null,n),m.finishExact)});var g={};function f(n){return g[n]=g[n]||c.format(n)[0]}c.formats=function(n){if(n instanceof Array){for(var p=[],y=0;y<n.length;y++)p.push(f(n[y]));return b.any.apply(null,p)}else return f(n)};c._formats=c.formats(['"yyyy-MM-ddTHH:mm:ssZ"',"yyyy-MM-ddTHH:mm:ssZ","yyyy-MM-ddTHH:mm:ssz","yyyy-MM-ddTHH:mm:ss","yyyy-MM-ddTHH:mmZ","yyyy-MM-ddTHH:mmz","yyyy-MM-ddTHH:mm","ddd, MMM dd, yyyy H:mm:ss tt","ddd MMM d yyyy HH:mm:ss zzz","MMddyyyy","ddMMyyyy","Mddyyyy","ddMyyyy","Mdyyyy","dMyyyy","yyyy","Mdyy","dMyy","d"]);c._start=b.process(b.set([c.date,c.time,c.expression],c.generalDelimiter,c.whiteSpace),m.finish);c.start=function(n){try{var p=c._formats.call({},n);if(p[1].length===0)return p}catch(y){}return c._start.call({},n)};a._parse=a.parse;a.parse=function(n){var p=null;if(!n)return null;if(n instanceof Date)return n;try{p=a.Grammar.start.call({},n.replace(/^\s*(\S*(\s+\S+)*)\s*$/,"$1"))}catch(y){return null}return p[1].length===0?p[0]:null};a.getParseFunction=function(n){var p=a.Grammar.formats(n);return function(y){var u=null;try{u=p.call({},y)}catch(s){return null}return u[1].length===0?u[0]:null}};a.parseExact=function(n,p){return a.getParseFunction(p)(n)}})();