
(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return!!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return!!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return+new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return!o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return-1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return!!T.firstChild},empty:function(T){return!T.firstChild},has:function(V,U,T){return!!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex"in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return!F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();WIB={baseURL:'/',apiURL:'/api.php',executedClasses:{},executedClassesPointer:0,onLoginCallback:0,justLoggedIn:false,mouseX:0,mouseY:0,sessionID:0,out:function(msg){if(typeof(console)!="undefined"){console.log(msg);}},errorLog:function(message){$.get(WIB.apiURL+'?method=error.log',{message:message});},reload:function(){window.location.href=unescape(window.location.pathname);},clickAway:function(aElt){href=$(aElt).attr('href');WIB.pageLog('/outbound_click/'+href);},ugcLog:function(type,section,action){if(action){WIB.pageLog('/ugc_creation/'+type+'/'+section+'/'+action+'/');}else{WIB.pageLog('/ugc_creation/'+type+'/'+section+'/add/');}},clickTrack:function(type,section,action,value){if(value){WIB.pageLog('/dynamic_event/'+type+'/'+section+'/'+action+'/'+value+'/');}else{WIB.pageLog('/dynamic_event/'+type+'/'+section+'/'+action+'/');}},pageLog:function(value){if(typeof(pageTracker)!='undefined'){pageTracker._trackPageview(value);}else{WIB.out('if google analytics was set up we would be tracking the event '+value);}},showMessage:function(text,type,domPath,callback){if(typeof(type)=='undefined'||!type){type='notification';}
pause=2000;if(type=='success'||type=='notification'){pause=700;}
if(WIB.justLoggedIn){$div=$('.login-register.component .messages');$div.find('.message').remove();$div.append('<p class="message notification" style="display:none">'+text+'</p>').find('.message').fadeIn(250).pause(pause).fadeOut(250,function(){$(this).remove();if(typeof(callback)=='function'){callback(callback);}});}
if(type=='tooltip'){WIB.tooltip(text);}else{if(typeof(domPath)=='undefined'||!domPath){domPath='#content .messages';}
$div=$(domPath);$div.find('.message').remove();$div.append('<p class="message '+type+'" style="display:none">'+text+'</p>');$div.find('.message').fadeIn(250).pause(pause).fadeOut(250,function(){$(this).remove();if(typeof(callback)=='function'){callback(callback);}});$div.find('p.'+type).click(function(){$(this).remove();if(typeof(callback)=='function'){callback(callback);}});}},facebookShowFeed:function(template_data,then_reload,user_message_prompt,user_message_value,promptConnect){var user_message=null;if(user_message_value){user_message={value:user_message_value};}
if(WIB.Networks.Facebook.expectedFacebookID){FB.ensureInit(function(){FB.Connect.showFeedDialog(94946316322,template_data,null,null,null,FB.RequireConnect.promptConnect,function(){},user_message_prompt,user_message);});}else if(WIB.inFacebook()||promptConnect){WIB.onLoginCallback=function(){FB.Connect.showFeedDialog(94946316322,template_data,null,null,null,FB.RequireConnect.promptConnect,function(){WIB.reload();},user_message_prompt,user_message);}
FB.Connect.requireSession();}},facebookExtendedPermission:function(permission,reload){WIB.out('facebookExtendedPermission '+permission);FB.Facebook.apiClient.users_hasAppPermission(permission,function(result){if(result==0){WIB.out('doesnthaveAppPermission '+permission);if(reload){FB.Connect.showPermissionDialog(permission,function(){WIB.reload()});}else{FB.Connect.showPermissionDialog(permission);}}else{WIB.out('alreadyHasAppPermission '+permission);}});},tooltip:function(text){$("#tooltip .tip-text").html(text);$("body").mousemove(function(e){var width=$("#tooltip").width();$("#tooltip").css("top",(e.pageY-20)+"px").css("left",(e.pageX-(width/2))+"px");});$("#tooltip").stop(true,true).fadeIn(1).pause(1500).fadeOut(1,function(){$("body").unbind('mousemove');});},tooltipAnchored:function(text,x,y){$("#tooltip-anchored .tip-text").html(text);if(text){var width=$("#tooltip-anchored").width();$("#tooltip-anchored").css("top",(y-35)+"px").css("left",(x-(width/2))+"px");$("#tooltip-anchored:hidden").stop(true,true).show();}else{$("#tooltip-anchored").stop(true,true).hide();}},addLike:function(objectType,objectID,buttonElt){var next_label='saved';if($(buttonElt).html()=='Add to Favorites'){next_label='Remove from Favorites';likeAction='add';}else if($(buttonElt).html()=='Remove from Favorites'){next_label='Add to Favorites';likeAction='remove';}
if($(buttonElt).html()=='Favorite'){next_label='Un-Favorite';likeAction='add';}else if($(buttonElt).html()=='Un-Favorite'){next_label='Favorite';likeAction='remove';}
$(buttonElt).html('saving...');$.get(WIB.apiURL+'?method=like.add',{objectType:objectType,objectID:objectID},function(data){if(typeof(data.success)=='undefined'||!data.success){var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.tooltip(msgText);}else{$(buttonElt).html(next_label);WIB.ugcLog('like',objectType,likeAction);if(WIB.justLoggedIn==true){WIB.reload();}}},'json');},getYPosition:function(){if(WIB.inFacebook()){yPosition=WIB.mouseY-300;if(yPosition<10){yPosition=30;}}
else{yPosition=$().scrollTop()+70;}
return yPosition;},showPopup:function(component,params,onCancel){var localParams=jQuery.extend(true,{},params?params:{});localParams.method='component.get';localParams.component=component;$('embed').css({'visibility':'hidden'});WIB.showPopupHTML('<div class="popup-title">Loading content...</div>'+$('#loading-graphic').html());$content=$('#popup-overlay .popup-box-content');$.get(WIB.apiURL,localParams,function(data){if(typeof(data.content)=='undefined'&&typeof(data.message)!='undefined'){WIB.clickTrack('site','showPopup',component+' failed');$content.html(data.message);}
else{WIB.clickTrack('site','showPopup',component);$content.html(data.content);if(typeof(onCancel)=='function'){$('#popup-overlay .popup-box-content').each(function(){this.onCancel=onCancel;});}else{$('#popup-overlay .popup-box-content').each(function(){this.onCancel=0;});}
if(!$('#popup-overlay .popup-box-content input[type="text"]:first').hasClass('clickClear')){setTimeout(function(){$('#popup-overlay .popup-box-content input[type="text"]:first').focus();},500);}}},'json');},hidePopup:function(){$popup=$('#popup-overlay');$popup.find('.popup-box-container').fadeOut(300,function(){$popup.hide();});$('embed').css({'visibility':''});if(WIB.justLoggedIn){WIB.reload();}
WIB.onLoginCallback=0;},showPopupHTML:function(html,type){type=type||'popup';$popup=$('#'+type+'-overlay');$popup.find('.popup-box-content').html(html);$popup.find('.popup-box-container').show().css({top:WIB.getYPosition()+'px'});$popup.show();},showConfirmBox:function(content,opt){opt=opt||{};title=opt.title||'Are you sure?';okText=opt.okText||'Ok';cancelText=opt.cancelText||'Cancel';okCallback=opt.okCallback||function(){WIB.hideConfirmBox();}
cancelCallback=opt.cancelCallback||function(){WIB.hideConfirmBox();}
var divID='ok-cancel-'+new Date().getTime();html='<div class="popup-title">'+title+'</div><div class="confirm-box-content">'+content+'</div><div id="'+divID+'" class="actions"><a href="#none" class="cancel fake-submit"><span>'+cancelText+'</span></a> <a href="#none" class="ok fake-submit"><span>'+okText+'</span></a><div class="clr"></div></div>';WIB.showPopupHTML(html,'confirm');$('#'+divID+' a.ok').click(okCallback).focus();$('#'+divID+' a.cancel').click(cancelCallback);},hideConfirmBox:function(){$('#confirm-overlay').hide();},findValue:function(li,inputID){if(li==null){return alert("No match!");}
var val=li.extra?li.extra[0]:li.selectValue;$('#'+inputID).attr({value:val});},addSuggester:function(field,type,callBack){$(document).ready(function(){if(!(typeof(callBack)=='function')){callBack=null;}
$('#'+field+'_text').autocomplete(WIB.apiURL,{extraParams:{method:'autocomplete.'+type},onItemSelect:function(li){WIB.findValue(li,field+'_value');callBack(li);},onFindValue:function(li){WIB.findValue(li,field+'_value');callBack(li);},dataFormat:'json',matchSubset:false,minChars:2,width:300});$('#'+field+'_text').change(function(){if($(this).val()==''){$('#'+field+'_value').attr({value:''});}});});},loggedIn:function(){return $('body').hasClass('logged-in')||WIB.justLoggedIn;},inFacebook:function(){return $('body').hasClass('facebook');},requireLogin:function(callback,title){WIB.out('requireLogin');if(typeof(callback)=='function'){WIB.onLoginCallback=callback;if(WIB.loggedIn()){WIB.onLogin();}else{if(WIB.inFacebook()){WIB.out('prompt for access');FB.Connect.requireSession();}else{WIB.showPopup('login_register',{active_tab:'0',title:title});}}}else{alert(typeof(callback)+' not a function');}},onLogin:function(){if(typeof(WIB.onLoginCallback)=='function'){WIB.onLoginCallback();}else{if(typeof(REDIRECT_URL)!='undefined'&&REDIRECT_URL!=''){location.href=REDIRECT_URL;}
else{WIB.reload();}}},safariCookieFix:function(){var url_with_redirect=WIB.apiURL+"?method=user.safariCookieFix&redirect_to="+location.href;$('body').append('<form method="post" action="'+url_with_redirect+'" id="safariFixSession"><input type="hidden" name="_session_id" value="'+WIB.sessionID+'"/></form>');$('#safariFixSession').submit();},init:function(className){$(document).ready(function(){if(className){var execute=true;for(i=0;i<=WIB.executedClassesPointer;i++){if(WIB.executedClasses[i]==className){execute=false;}}
if(execute){if(className.indexOf('.')){eval('WIB.'+className+'.init();');}else{WIB[className].init();}
WIB.executedClasses[WIB.executedClassesPointer]=className;WIB.executedClassesPointer++;}
if(className.indexOf('.')){eval('if( typeof(WIB.'+className+'.render) != "undefined" ) WIB.'+className+'.render();');}else{if(typeof(WIB[className].render)!="undefined")WIB[className].render();}}else{if(navigator.userAgent.match('Safari')=='Safari'){if(window.location!=window.parent.location){if(!WIB.loggedIn()){if(document.cookie.indexOf("safari_cookie_fix")==-1){WIB.safariCookieFix();}}}}
$('.show-all-languages').live('click',function(){WIB.showPopup('translate');});$("body").append('<div style="display:none;" id="tooltip"><span class="tip-text">tooltip</span></div>');$("body").append('<div style="display:none;" id="tooltip-anchored"><span class="tip-text">tooltip</span><div class="carrot"></div></div>');$('#search').autocomplete(WIB.apiURL,{extraParams:{method:'search.typeahead'},onItemSelect:function(li){window.location=li.extra[0];},onFindValue:function(li){},dataFormat:'json',matchSubset:false,minChars:2,width:178});$('.query-count').live('click',function(){$(this).find('.queries').toggle();});$('.mc-query-count').live('click',function(){$(this).find('.mc-queries').toggle();});$('.network-query-count').live('click',function(){$(this).find('.network-queries').toggle();});$('#search-box input[type="text"], .clickClear, .click-clear').live('click',function(){if($(this).val()==$(this).attr('title')){$(this).val('');}}).livequery('blur',function(){if($(this).val()==''){$(this).val($(this).attr('title'));}});$('.location-header.component a.change').live('click',function(){WIB.requireLogin(function(){WIB.showPopup('profile_editor');},' to change your current location');});$('#primary-column-left .simple-image.component').live('click',function(){WIB.requireLogin(function(){if(WIB.loggedIn()){location.href='/profile/wib';}else{location.href='/profile/wib';}},' to setup your map');});$('#primary-menu a.friends-login').live('click',function(){WIB.requireLogin(function(){location.href='/friends';},' to access this area');});$('#primary-menu a.profile-login').live('click',function(){WIB.requireLogin(function(){location.href='/profile';},' to access this area');});$('#tagline').live('click',function(){WIB.clickTrack('tagline','click');WIB.requireLogin(function(){location.href='/profile/wib';},' to access this area');});$('#invite-friends-header-prompt span').live('click',function(){WIB.clickTrack('header','invite_prompt','click');WIB.requireLogin(function(){location.href='/friends/invite';},' to invite friends');});$('input[type="submit"], a.fake-submit span').hover(function(){$(this).addClass('hover')},function(){$(this).removeClass('hover')});$('#primary-menu li.'+CURRENT_PAGE).addClass('active');$('#footer-links a.'+CURRENT_PAGE).addClass('active');$('#popup-overlay a.close, #popup-overlay a.cancel').live('click',function(){if(typeof($('#popup-overlay .popup-box-content')[0].onCancel)=='function'){$('#popup-overlay .popup-box-content')[0].onCancel();}
WIB.hidePopup();});$('#confirm-overlay a.close, #confirm-overlay a.cancel').live('click',function(){WIB.hideConfirmBox();});if(WIB.inFacebook()){$().mousemove(function(e){WIB.mouseX=e.pageX;WIB.mouseY=e.pageY;});}}});}};WIB.Component={};WIB.AdminComponent={};WIB.FeedItem={};WIB.CombinedFeedItem={};WIB.Notification={};WIB.Page={};WIB.API={};WIB.Networks={};jQuery.autocomplete=function(input,options){var me=this;var $input=$(input).attr("autocomplete","off");if(options.inputClass)$input.addClass(options.inputClass);var results=document.createElement("div");var $results=$(results);$results.hide().addClass(options.resultsClass).css("position","absolute");if(options.width>0)$results.css("width",options.width);$("body").append(results);input.autocompleter=me;var timeout=null;var prev="";var active=-1;var cache={};var keyb=false;var hasFocus=false;var lastKeyPressCode=null;function flushCache(){cache={};cache.data={};cache.length=0;};flushCache();if(options.data!=null){var sFirstChar="",stMatchSets={},row=[];if(typeof options.url!="string")options.cacheLength=1;for(var i=0;i<options.data.length;i++){row=((typeof options.data[i]=="string")?[options.data[i]]:options.data[i]);if(row[0].length>0){sFirstChar=row[0].substring(0,1).toLowerCase();if(!stMatchSets[sFirstChar])stMatchSets[sFirstChar]=[];stMatchSets[sFirstChar].push(row);}}
for(var k in stMatchSets){options.cacheLength++;addToCache(k,stMatchSets[k]);}}
$input.keydown(function(e){lastKeyPressCode=e.keyCode;switch(e.keyCode){case 38:e.preventDefault();moveSelect(-1);break;case 40:e.preventDefault();moveSelect(1);break;case 9:case 13:if(selectCurrent()){$input.get(0).blur();e.preventDefault();}
break;default:active=-1;if(timeout)clearTimeout(timeout);timeout=setTimeout(function(){onChange();},options.delay);break;}}).focus(function(){hasFocus=true;}).blur(function(){hasFocus=false;hideResults();});hideResultsNow();function onChange(){if(lastKeyPressCode==46||(lastKeyPressCode>8&&lastKeyPressCode<32))return $results.hide();var v=$input.val();if(v==prev)return;prev=v;if(v.length>=options.minChars){$input.addClass(options.loadingClass);requestData(v);}else{$input.removeClass(options.loadingClass);$results.hide();}};function moveSelect(step){var lis=$("li",results);if(!lis)return;active+=step;if(active<0){active=0;}else if(active>=lis.size()){active=lis.size()-1;}
lis.removeClass("ac_over");$(lis[active]).addClass("ac_over");};function selectCurrent(){var li=$("li.ac_over",results)[0];if(!li){var $li=$("li",results);if(options.selectOnly){if($li.length==1)li=$li[0];}else if(options.selectFirst){li=$li[0];}}
if(li){selectItem(li);return true;}else{return false;}};function selectItem(li){if(!li){li=document.createElement("li");li.extra=[];li.selectValue="";}
var v=$.trim(li.selectValue?li.selectValue:li.innerHTML);input.lastSelected=v;prev=v;$results.html("");$input.val(v);hideResultsNow();if(options.onItemSelect)setTimeout(function(){options.onItemSelect(li)},1);};function createSelection(start,end){var field=$input.get(0);if(field.createTextRange){var selRange=field.createTextRange();selRange.collapse(true);selRange.moveStart("character",start);selRange.moveEnd("character",end);selRange.select();}else if(field.setSelectionRange){field.setSelectionRange(start,end);}else{if(field.selectionStart){field.selectionStart=start;field.selectionEnd=end;}}
field.focus();};function autoFill(sValue){if(lastKeyPressCode!=8){$input.val($input.val()+sValue.substring(prev.length));createSelection(prev.length,sValue.length);}};function showResults(){var pos=findPos(input);var iWidth=(options.width>0)?options.width:$input.width();$results.css({width:parseInt(iWidth)+"px",top:(pos.y+input.offsetHeight)+"px",left:pos.x+"px"}).show();};function hideResults(){if(timeout)clearTimeout(timeout);timeout=setTimeout(hideResultsNow,200);};function hideResultsNow(){if(timeout)clearTimeout(timeout);$input.removeClass(options.loadingClass);if($results.is(":visible")){$results.hide();}
if(options.mustMatch){var v=$input.val();if(v!=input.lastSelected){selectItem(null);}}};function receiveData(q,data){if(data){$input.removeClass(options.loadingClass);results.innerHTML="";if(!hasFocus||data.length==0)return hideResultsNow();if($.browser.msie){$results.append(document.createElement('iframe'));}
results.appendChild(dataToDom(data));if(options.autoFill&&($input.val().toLowerCase()==q.toLowerCase()))autoFill(data[0][0]);showResults();}else{hideResultsNow();}};function parseData(data){if(!data)return null;var parsed=[];if(typeof(data)=='object'){$.each(data,function(i,obj){if(typeof(obj.icon)!='undefined'){parsed[parsed.length]=[obj.name,obj.id,obj.icon];}else{parsed[parsed.length]=[obj.name,obj.id];}});}
else{var rows=data.split(options.lineSeparator);for(var i=0;i<rows.length;i++){var row=$.trim(rows[i]);if(row){parsed[parsed.length]=row.split(options.cellSeparator);}}}
return parsed;};function dataToDom(data){var ul=document.createElement("ul");var num=data.length;if((options.maxItemsToShow>0)&&(options.maxItemsToShow<num))num=options.maxItemsToShow;for(var i=0;i<num;i++){var row=data[i];if(!row)continue;var li=document.createElement("li");if(options.formatItem){li.innerHTML=options.formatItem(row,i,num);li.selectValue=row[0];}else{if(typeof(row[2])!='undefined'){li.innerHTML='<img src="'+row[2]+'"/>'+row[0];}else{li.innerHTML=row[0];}
li.selectValue=row[0];}
var extra=null;if(row.length>1){extra=[];for(var j=1;j<row.length;j++){extra[extra.length]=row[j];}}
li.extra=extra;ul.appendChild(li);$(li).hover(function(){$("li",ul).removeClass("ac_over");$(this).addClass("ac_over");active=$("li",ul).indexOf($(this).get(0));},function(){$(this).removeClass("ac_over");}).click(function(e){e.preventDefault();e.stopPropagation();selectItem(this)});}
return ul;};function requestData(q){if(!options.matchCase)q=q.toLowerCase();var data=options.cacheLength?loadFromCache(q):null;if(data){receiveData(q,data);}else if((typeof options.url=="string")&&(options.url.length>0)){$.get(makeUrl(q),null,function(data){data=parseData(data,options.dataFormat);addToCache(q,data);receiveData(q,data);},options.dataFormat);}else{$input.removeClass(options.loadingClass);}};function makeUrl(q){var url=options.url+"?q="+encodeURI(q);for(var i in options.extraParams){url+="&"+i+"="+encodeURI(options.extraParams[i]);}
return url;};function loadFromCache(q){if(!q)return null;if(cache.data[q])return cache.data[q];if(options.matchSubset){for(var i=q.length-1;i>=options.minChars;i--){var qs=q.substr(0,i);var c=cache.data[qs];if(c){var csub=[];for(var j=0;j<c.length;j++){var x=c[j];var x0=x[0];if(matchSubset(x0,q)){csub[csub.length]=x;}}
return csub;}}}
return null;};function matchSubset(s,sub){if(!options.matchCase)s=s.toLowerCase();var i=s.indexOf(sub);if(i==-1)return false;return i==0||options.matchContains;};this.flushCache=function(){flushCache();};this.setExtraParams=function(p){options.extraParams=p;};this.findValue=function(){var q=$input.val();if(!options.matchCase)q=q.toLowerCase();var data=options.cacheLength?loadFromCache(q):null;if(data){findValueCallback(q,data);}else if((typeof options.url=="string")&&(options.url.length>0)){$.get(makeUrl(q),null,function(data){data=parseData(data)
addToCache(q,data);findValueCallback(q,data);},options.dataFormat);}else{findValueCallback(q,null);}}
function findValueCallback(q,data){if(data)$input.removeClass(options.loadingClass);var num=(data)?data.length:0;var li=null;for(var i=0;i<num;i++){var row=data[i];if(row[0].toLowerCase()==q.toLowerCase()){li=document.createElement("li");if(options.formatItem){li.innerHTML=options.formatItem(row,i,num);li.selectValue=row[0];}else{li.innerHTML=row[0];li.selectValue=row[0];}
var extra=null;if(row.length>1){extra=[];for(var j=1;j<row.length;j++){extra[extra.length]=row[j];}}
li.extra=extra;}}
if(options.onFindValue)setTimeout(function(){options.onFindValue(li)},1);}
function addToCache(q,data){if(!data||!q||!options.cacheLength)return;if(!cache.length||cache.length>options.cacheLength){flushCache();cache.length++;}else if(!cache[q]){cache.length++;}
cache.data[q]=data;};function findPos(obj){var curleft=obj.offsetLeft||0;var curtop=obj.offsetTop||0;while(obj=obj.offsetParent){curleft+=obj.offsetLeft
curtop+=obj.offsetTop}
return{x:curleft,y:curtop};}}
jQuery.fn.autocomplete=function(url,options,data){options=options||{};options.url=url;options.data=((typeof data=="object")&&(data.constructor==Array))?data:null;options.inputClass=options.inputClass||"ac_input";options.resultsClass=options.resultsClass||"ac_results";options.lineSeparator=options.lineSeparator||"\n";options.cellSeparator=options.cellSeparator||"|";options.minChars=options.minChars||1;options.delay=options.delay||400;options.matchCase=options.matchCase||0;if(typeof(options.matchSubset)=='undefined'){options.matchSubset=1;}
if(typeof(options.cacheLength)=='undefined'){options.cacheLength=1;}
options.dataFormat=options.dataFormat||'html';options.matchContains=options.matchContains||0;options.cacheLength=options.cacheLength||1;options.mustMatch=options.mustMatch||0;options.extraParams=options.extraParams||{};options.loadingClass=options.loadingClass||"ac_loading";options.selectFirst=options.selectFirst||false;options.selectOnly=options.selectOnly||false;options.maxItemsToShow=options.maxItemsToShow||-1;options.autoFill=options.autoFill||false;options.width=parseInt(options.width,10)||0;this.each(function(){var input=this;new jQuery.autocomplete(input,options);});return this;}
jQuery.fn.autocompleteArray=function(data,options){return this.autocomplete(null,options,data);}
jQuery.fn.indexOf=function(e){for(var i=0;i<this.length;i++){if(this[i]==e)return i;}
return-1;};(function($){$.fn.extend({renderCalendar:function(s)
{var dc=function(a)
{return document.createElement(a);};s=$.extend({},$.fn.datePicker.defaults,s);if(s.showHeader!=$.dpConst.SHOW_HEADER_NONE){var headRow=$(dc('tr'));for(var i=Date.firstDayOfWeek;i<Date.firstDayOfWeek+7;i++){var weekday=i%7;var day=Date.dayNames[weekday];headRow.append(jQuery(dc('th')).attr({'scope':'col','abbr':day,'title':day,'class':(weekday==0||weekday==6?'weekend':'weekday')}).html(s.showHeader==$.dpConst.SHOW_HEADER_SHORT?day.substr(0,1):day));}};var calendarTable=$(dc('table')).attr({'cellspacing':2,'className':'jCalendar'}).append((s.showHeader!=$.dpConst.SHOW_HEADER_NONE?$(dc('thead')).append(headRow):dc('thead')));var tbody=$(dc('tbody'));var today=(new Date()).zeroTime();var month=s.month==undefined?today.getMonth():s.month;var year=s.year||today.getFullYear();var currentDate=new Date(year,month,1);var firstDayOffset=Date.firstDayOfWeek-currentDate.getDay()+1;if(firstDayOffset>1)firstDayOffset-=7;var weeksToDraw=Math.ceil(((-1*firstDayOffset+1)+currentDate.getDaysInMonth())/7);currentDate.addDays(firstDayOffset-1);var doHover=function()
{if(s.hoverClass){$(this).addClass(s.hoverClass);}};var unHover=function()
{if(s.hoverClass){$(this).removeClass(s.hoverClass);}};var w=0;while(w++<weeksToDraw){var r=jQuery(dc('tr'));for(var i=0;i<7;i++){var thisMonth=currentDate.getMonth()==month;var d=$(dc('td')).text(currentDate.getDate()+'').attr('className',(thisMonth?'current-month ':'other-month ')+
(currentDate.isWeekend()?'weekend ':'weekday ')+
(thisMonth&&currentDate.getTime()==today.getTime()?'today ':'')).hover(doHover,unHover);if(s.renderCallback){s.renderCallback(d,currentDate,month,year);}
r.append(d);currentDate.addDays(1);}
tbody.append(r);}
calendarTable.append(tbody);return this.each(function()
{$(this).empty().append(calendarTable);});},datePicker:function(s)
{if(!$.event._dpCache)$.event._dpCache=[];s=$.extend({},$.fn.datePicker.defaults,s);return this.each(function()
{var $this=$(this);var alreadyExists=true;if(!this._dpId){this._dpId=$.event.guid++;$.event._dpCache[this._dpId]=new DatePicker(this);alreadyExists=false;}
if(s.inline){s.createButton=false;s.displayClose=false;s.closeOnSelect=false;$this.empty();}
var controller=$.event._dpCache[this._dpId];controller.init(s);if(!alreadyExists&&s.createButton){controller.button=$('<a href="#" class="dp-choose-date" title="'+$.dpText.TEXT_CHOOSE_DATE+'">'+$.dpText.TEXT_CHOOSE_DATE+'</a>').bind('click',function()
{$this.dpDisplay(this);this.blur();return false;});$this.after(controller.button);}
if(!alreadyExists&&$this.is(':text')){$this.bind('dateSelected',function(e,selectedDate,$td)
{this.value=selectedDate.asString();}).bind('change',function()
{if(this.value!=''){var d=Date.fromString(this.value);if(d){controller.setSelected(d,true,true);}}});if(s.clickInput){$this.bind('click',function()
{$this.dpDisplay();});}
var d=Date.fromString(this.value);if(this.value!=''&&d){controller.setSelected(d,true,true);}}
$this.addClass('dp-applied');})},dpSetDisabled:function(s)
{return _w.call(this,'setDisabled',s);},dpSetStartDate:function(d)
{return _w.call(this,'setStartDate',d);},dpSetEndDate:function(d)
{return _w.call(this,'setEndDate',d);},dpGetSelected:function()
{var c=_getController(this[0]);if(c){return c.getSelected();}
return null;},dpSetSelected:function(d,v,m)
{if(v==undefined)v=true;if(m==undefined)m=true;return _w.call(this,'setSelected',Date.fromString(d),v,m,true);},dpSetDisplayedMonth:function(m,y)
{return _w.call(this,'setDisplayedMonth',Number(m),Number(y),true);},dpDisplay:function(e)
{return _w.call(this,'display',e);},dpSetRenderCallback:function(a)
{return _w.call(this,'setRenderCallback',a);},dpSetPosition:function(v,h)
{return _w.call(this,'setPosition',v,h);},dpSetOffset:function(v,h)
{return _w.call(this,'setOffset',v,h);},dpClose:function()
{return _w.call(this,'_closeCalendar',false,this[0]);},_dpDestroy:function()
{}});var _w=function(f,a1,a2,a3,a4)
{return this.each(function()
{var c=_getController(this);if(c){c[f](a1,a2,a3,a4);}});};function DatePicker(ele)
{this.ele=ele;this.displayedMonth=null;this.displayedYear=null;this.startDate=null;this.endDate=null;this.showYearNavigation=null;this.closeOnSelect=null;this.displayClose=null;this.rememberViewedMonth=null;this.selectMultiple=null;this.verticalPosition=null;this.horizontalPosition=null;this.verticalOffset=null;this.horizontalOffset=null;this.button=null;this.renderCallback=[];this.selectedDates={};this.inline=null;this.context='#dp-popup';};$.extend(DatePicker.prototype,{init:function(s)
{this.setStartDate(s.startDate);this.setEndDate(s.endDate);this.setDisplayedMonth(Number(s.month),Number(s.year));this.setRenderCallback(s.renderCallback);this.showYearNavigation=s.showYearNavigation;this.closeOnSelect=s.closeOnSelect;this.displayClose=s.displayClose;this.rememberViewedMonth=s.rememberViewedMonth;this.selectMultiple=s.selectMultiple;this.verticalPosition=s.verticalPosition;this.horizontalPosition=s.horizontalPosition;this.hoverClass=s.hoverClass;this.setOffset(s.verticalOffset,s.horizontalOffset);this.inline=s.inline;if(this.inline){this.context=this.ele;this.display();}},setStartDate:function(d)
{if(d){this.startDate=Date.fromString(d);}
if(!this.startDate){this.startDate=(new Date()).zeroTime();}
this.setDisplayedMonth(this.displayedMonth,this.displayedYear);},setEndDate:function(d)
{if(d){this.endDate=Date.fromString(d);}
if(!this.endDate){this.endDate=(new Date('12/31/2999'));}
if(this.endDate.getTime()<this.startDate.getTime()){this.endDate=this.startDate;}
this.setDisplayedMonth(this.displayedMonth,this.displayedYear);},setPosition:function(v,h)
{this.verticalPosition=v;this.horizontalPosition=h;},setOffset:function(v,h)
{this.verticalOffset=parseInt(v)||0;this.horizontalOffset=parseInt(h)||0;},setDisabled:function(s)
{$e=$(this.ele);$e[s?'addClass':'removeClass']('dp-disabled');if(this.button){$but=$(this.button);$but[s?'addClass':'removeClass']('dp-disabled');$but.attr('title',s?'':$.dpText.TEXT_CHOOSE_DATE);}
if($e.is(':text')){$e.attr('disabled',s?'disabled':'');}},setDisplayedMonth:function(m,y,rerender)
{if(this.startDate==undefined||this.endDate==undefined){return;}
var s=new Date(this.startDate.getTime());s.setDate(1);var e=new Date(this.endDate.getTime());e.setDate(1);var t;if((!m&&!y)||(isNaN(m)&&isNaN(y))){t=new Date().zeroTime();t.setDate(1);}else if(isNaN(m)){t=new Date(y,this.displayedMonth,1);}else if(isNaN(y)){t=new Date(this.displayedYear,m,1);}else{t=new Date(y,m,1)}
if(t.getTime()<s.getTime()){t=s;}else if(t.getTime()>e.getTime()){t=e;}
var oldMonth=this.displayedMonth;var oldYear=this.displayedYear;this.displayedMonth=t.getMonth();this.displayedYear=t.getFullYear();if(rerender&&(this.displayedMonth!=oldMonth||this.displayedYear!=oldYear))
{this._rerenderCalendar();$(this.ele).trigger('dpMonthChanged',[this.displayedMonth,this.displayedYear]);}},setSelected:function(d,v,moveToMonth,dispatchEvents)
{if(v==this.isSelected(d))
{return;}
if(this.selectMultiple==false){this.selectedDates={};$('td.selected',this.context).removeClass('selected');}
if(moveToMonth&&(this.displayedMonth!=d.getMonth()||this.displayedYear!=d.getFullYear())){this.setDisplayedMonth(d.getMonth(),d.getFullYear(),true);}
this.selectedDates[d.toString()]=v;var selectorString='td.';selectorString+=d.getMonth()==this.displayedMonth?'current-month':'other-month';selectorString+=':contains("'+d.getDate()+'")';var $td;$(selectorString,this.ele).each(function()
{if($(this).text()==d.getDate())
{$td=$(this);$td[v?'addClass':'removeClass']('selected');}});if(dispatchEvents)
{var s=this.isSelected(d);$e=$(this.ele);var dClone=Date.fromString(d.asString());$e.trigger('dateSelected',[dClone,$td,s]);$e.trigger('change');}},isSelected:function(d)
{return this.selectedDates[d.toString()];},getSelected:function()
{var r=[];for(s in this.selectedDates){if(this.selectedDates[s]==true){r.push(Date.parse(s));}}
return r;},display:function(eleAlignTo)
{if($(this.ele).is('.dp-disabled'))return;eleAlignTo=eleAlignTo||this.ele;var c=this;var $ele=$(eleAlignTo);var eleOffset=$ele.offset();var $createIn;var attrs;var attrsCalendarHolder;var cssRules;if(c.inline){$createIn=$(this.ele);attrs={'id':'calendar-'+this.ele._dpId,'className':'dp-popup dp-popup-inline'};cssRules={};}else{$createIn=$('body');attrs={'id':'dp-popup','className':'dp-popup'};cssRules={'top':eleOffset.top+c.verticalOffset,'left':eleOffset.left+c.horizontalOffset};var _checkMouse=function(e)
{var el=e.target;var cal=$('#dp-popup')[0];while(true){if(el==cal){return true;}else if(el==document){c._closeCalendar();return false;}else{el=$(el).parent()[0];}}};this._checkMouse=_checkMouse;this._closeCalendar(true);}
if(!c.rememberViewedMonth)
{var selectedDate=this.getSelected()[0];if(selectedDate){selectedDate=new Date(selectedDate);this.setDisplayedMonth(selectedDate.getMonth(),selectedDate.getFullYear(),false);}}
$createIn.append($('<div></div>').attr(attrs).css(cssRules).append($('<h2></h2>'),$('<div class="dp-nav-prev"></div>').append($('<a class="dp-nav-prev-year" href="#" title="'+$.dpText.TEXT_PREV_YEAR+'">&lt;&lt;</a>').bind('click',function()
{return c._displayNewMonth.call(c,this,0,-1);}),$('<a class="dp-nav-prev-month" href="#" title="'+$.dpText.TEXT_PREV_MONTH+'">&lt;</a>').bind('click',function()
{return c._displayNewMonth.call(c,this,-1,0);})),$('<div class="dp-nav-next"></div>').append($('<a class="dp-nav-next-year" href="#" title="'+$.dpText.TEXT_NEXT_YEAR+'">&gt;&gt;</a>').bind('click',function()
{return c._displayNewMonth.call(c,this,0,1);}),$('<a class="dp-nav-next-month" href="#" title="'+$.dpText.TEXT_NEXT_MONTH+'">&gt;</a>').bind('click',function()
{return c._displayNewMonth.call(c,this,1,0);})),$('<div></div>').attr('className','dp-calendar')).bgIframe());var $pop=this.inline?$('.dp-popup',this.context):$('#dp-popup');if(this.showYearNavigation==false){$('.dp-nav-prev-year, .dp-nav-next-year',c.context).css('display','none');}
if(this.displayClose){$pop.append($('<a href="#" id="dp-close">'+$.dpText.TEXT_CLOSE+'</a>').bind('click',function()
{c._closeCalendar();return false;}));}
c._renderCalendar();$(this.ele).trigger('dpDisplayed',$pop);if(!c.inline){if(this.verticalPosition==$.dpConst.POS_BOTTOM){$pop.css('top',eleOffset.top+$ele.height()-$pop.height()+c.verticalOffset);}
if(this.horizontalPosition==$.dpConst.POS_RIGHT){$pop.css('left',eleOffset.left+$ele.width()-$pop.width()+c.horizontalOffset);}
$(document).bind('mousedown',this._checkMouse);}},setRenderCallback:function(a)
{if(a==null)return;if(a&&typeof(a)=='function'){a=[a];}
this.renderCallback=this.renderCallback.concat(a);},cellRender:function($td,thisDate,month,year){var c=this.dpController;var d=new Date(thisDate.getTime());$td.bind('click',function()
{var $this=$(this);if(!$this.is('.disabled')){c.setSelected(d,!$this.is('.selected')||!c.selectMultiple,false,true);if(c.closeOnSelect){c._closeCalendar();}}});if(c.isSelected(d)){$td.addClass('selected');}
for(var i=0;i<c.renderCallback.length;i++){c.renderCallback[i].apply(this,arguments);}},_displayNewMonth:function(ele,m,y)
{if(!$(ele).is('.disabled')){this.setDisplayedMonth(this.displayedMonth+m,this.displayedYear+y,true);}
ele.blur();return false;},_rerenderCalendar:function()
{this._clearCalendar();this._renderCalendar();},_renderCalendar:function()
{$('h2',this.context).html(Date.monthNames[this.displayedMonth]+' '+this.displayedYear);$('.dp-calendar',this.context).renderCalendar({month:this.displayedMonth,year:this.displayedYear,renderCallback:this.cellRender,dpController:this,hoverClass:this.hoverClass});if(this.displayedYear==this.startDate.getFullYear()&&this.displayedMonth==this.startDate.getMonth()){$('.dp-nav-prev-year',this.context).addClass('disabled');$('.dp-nav-prev-month',this.context).addClass('disabled');$('.dp-calendar td.other-month',this.context).each(function()
{var $this=$(this);if(Number($this.text())>20){$this.addClass('disabled');}});var d=this.startDate.getDate();$('.dp-calendar td.current-month',this.context).each(function()
{var $this=$(this);if(Number($this.text())<d){$this.addClass('disabled');}});}else{$('.dp-nav-prev-year',this.context).removeClass('disabled');$('.dp-nav-prev-month',this.context).removeClass('disabled');var d=this.startDate.getDate();if(d>20){var sd=new Date(this.startDate.getTime());sd.addMonths(1);if(this.displayedYear==sd.getFullYear()&&this.displayedMonth==sd.getMonth()){$('dp-calendar td.other-month',this.context).each(function()
{var $this=$(this);if(Number($this.text())<d){$this.addClass('disabled');}});}}}
if(this.displayedYear==this.endDate.getFullYear()&&this.displayedMonth==this.endDate.getMonth()){$('.dp-nav-next-year',this.context).addClass('disabled');$('.dp-nav-next-month',this.context).addClass('disabled');$('.dp-calendar td.other-month',this.context).each(function()
{var $this=$(this);if(Number($this.text())<14){$this.addClass('disabled');}});var d=this.endDate.getDate();$('.dp-calendar td.current-month',this.context).each(function()
{var $this=$(this);if(Number($this.text())>d){$this.addClass('disabled');}});}else{$('.dp-nav-next-year',this.context).removeClass('disabled');$('.dp-nav-next-month',this.context).removeClass('disabled');var d=this.endDate.getDate();if(d<13){var ed=new Date(this.endDate.getTime());ed.addMonths(-1);if(this.displayedYear==ed.getFullYear()&&this.displayedMonth==ed.getMonth()){$('.dp-calendar td.other-month',this.context).each(function()
{var $this=$(this);if(Number($this.text())>d){$this.addClass('disabled');}});}}}},_closeCalendar:function(programatic,ele)
{if(!ele||ele==this.ele)
{$(document).unbind('mousedown',this._checkMouse);this._clearCalendar();$('#dp-popup a').unbind();$('#dp-popup').empty().remove();if(!programatic){$(this.ele).trigger('dpClosed',[this.getSelected()]);}}},_clearCalendar:function()
{$('.dp-calendar td',this.context).unbind();$('.dp-calendar',this.context).empty();}});$.dpConst={SHOW_HEADER_NONE:0,SHOW_HEADER_SHORT:1,SHOW_HEADER_LONG:2,POS_TOP:0,POS_BOTTOM:1,POS_LEFT:0,POS_RIGHT:1};$.dpText={TEXT_PREV_YEAR:'Previous year',TEXT_PREV_MONTH:'Previous month',TEXT_NEXT_YEAR:'Next year',TEXT_NEXT_MONTH:'Next month',TEXT_CLOSE:'Close',TEXT_CHOOSE_DATE:'Choose date'};$.dpVersion='$Id: jquery.datePicker.js 21 2009-01-11 19:45:13Z kelvin.luck $';$.fn.datePicker.defaults={month:undefined,year:undefined,showHeader:$.dpConst.SHOW_HEADER_SHORT,startDate:undefined,endDate:undefined,inline:false,renderCallback:null,createButton:true,showYearNavigation:true,closeOnSelect:true,displayClose:false,selectMultiple:false,clickInput:false,rememberViewedMonth:true,verticalPosition:$.dpConst.POS_TOP,horizontalPosition:$.dpConst.POS_LEFT,verticalOffset:0,horizontalOffset:0,hoverClass:'dp-hover'};function _getController(ele)
{if(ele._dpId)return $.event._dpCache[ele._dpId];return false;};if($.fn.bgIframe==undefined){$.fn.bgIframe=function(){return this;};};$(window).bind('unload',function(){var els=$.event._dpCache||[];for(var i in els){$(els[i].ele)._dpDestroy();}});})(jQuery);jQuery.fn.dump=function(showTypes,showAttributes){jQuery.dump($(this),showTypes,showAttributes);return this;};jQuery.dump=function(object,showTypes,showAttributes){var dump='';var st=typeof showTypes=='undefined'?true:showTypes;var sa=typeof showAttributes=='undefined'?true:showAttributes;var winName='dumpWin';var w=760;var h=500;var leftPos=screen.width?(screen.width-w)/2:0;var topPos=screen.height?(screen.height-h)/2:0;var settings='height='+h+',width='+w+',top='+topPos+',left='+leftPos+',scrollbars=yes,menubar=yes,status=yes,resizable=yes';var title='Dump';var script='function tRow(s) {t = s.parentNode.lastChild;tTarget(t, tSource(s)) ;}function tTable(s) {var switchToState = tSource(s) ;var table = s.parentNode.parentNode;for (var i = 1; i < table.childNodes.length; i++) {t = table.childNodes[i] ;if (t.style) {tTarget(t, switchToState);}}}function tSource(s) {if (s.style.fontStyle == "italic" || s.style.fontStyle == null) {s.style.fontStyle = "normal";s.title = "click to collapse";return "open";} else {s.style.fontStyle = "italic";s.title = "click to expand";return "closed" ;}}function tTarget (t, switchToState) {if (switchToState == "open") {t.style.display = "";} else {t.style.display = "none";}}';var _recurse=function(o,type){var i;var j=0;var r='';type=_dumpType(o);switch(type){case'regexp':var t=type;r+='<table'+_dumpStyles(t,'table')+'><tr><th colspan="2"'+_dumpStyles(t,'th')+'>'+t+'</th></tr>';r+='<tr><td colspan="2"'+_dumpStyles(t,'td-value')+'><table'+_dumpStyles('arguments','table')+'><tr><td'+_dumpStyles('arguments','td-key')+'><i>RegExp: </i></td><td'+_dumpStyles(type,'td-value')+'>'+o+'</td></tr></table>';j++;break;case'date':var t=type;r+='<table'+_dumpStyles(t,'table')+'><tr><th colspan="2"'+_dumpStyles(t,'th')+'>'+t+'</th></tr>';r+='<tr><td colspan="2"'+_dumpStyles(t,'td-value')+'><table'+_dumpStyles('arguments','table')+'><tr><td'+_dumpStyles('arguments','td-key')+'><i>Date: </i></td><td'+_dumpStyles(type,'td-value')+'>'+o+'</td></tr></table>';j++;break;case'function':var t=type;var a=o.toString().match(/^.*function.*?\((.*?)\)/im);var args=(a==null||typeof a[1]=='undefined'||a[1]=='')?'none':a[1];r+='<table'+_dumpStyles(t,'table')+'><tr><th colspan="2"'+_dumpStyles(t,'th')+'>'+t+'</th></tr>';r+='<tr><td colspan="2"'+_dumpStyles(t,'td-value')+'><table'+_dumpStyles('arguments','table')+'><tr><td'+_dumpStyles('arguments','td-key')+'><i>Arguments: </i></td><td'+_dumpStyles(type,'td-value')+'>'+args+'</td></tr><tr><td'+_dumpStyles('arguments','td-key')+'><i>Function: </i></td><td'+_dumpStyles(type,'td-value')+'>'+o+'</td></tr></table>';j++;break;case'domelement':var t=type;var attr='';if(sa){for(i in o){if(!/innerHTML|outerHTML/i.test(i)){attr+=i+': '+o[i]+'<br />';}}}
r+='<table'+_dumpStyles(t,'table')+'><tr><th colspan="2"'+_dumpStyles(t,'th')+'>'+t+'</th></tr>';r+='<tr><td'+_dumpStyles(t,'td-key')+'><i>Node Name: </i></td><td'+_dumpStyles(type,'td-value')+'>'+o.nodeName.toLowerCase()+'</td></tr>';r+='<tr><td'+_dumpStyles(t,'td-key')+'><i>Node Type: </i></td><td'+_dumpStyles(type,'td-value')+'>'+o.nodeType+'</td></tr>';r+='<tr><td'+_dumpStyles(t,'td-key')+'><i>Node Value: </i></td><td'+_dumpStyles(type,'td-value')+'>'+o.nodeValue+'</td></tr>';if(sa){r+='<tr><td'+_dumpStyles(t,'td-key')+'><i>Attributes: </i></td><td'+_dumpStyles(type,'td-value')+'>'+attr+'</td></tr>';r+='<tr><td'+_dumpStyles(t,'td-key')+'><i>innerHTML: </i></td><td'+_dumpStyles(type,'td-value')+'>'+o.innerHTML+'</td></tr>';if(typeof o.outerHTML!='undefined'){r+='<tr><td'+_dumpStyles(t,'td-key')+'><i>outerHTML: </i></td><td'+_dumpStyles(type,'td-value')+'>'+o.outerHTML+'</td></tr>';}}
j++;break;}
if(/object|array/.test(type)){for(i in o){var t=_dumpType(o[i]);if(j<1){r+='<table'+_dumpStyles(type,'table')+'><tr><th colspan="2"'+_dumpStyles(type,'th')+'>'+type+'</th></tr>';j++;}
if(typeof o[i]=='object'&&o[i]!=null){r+='<tr><td'+_dumpStyles(type,'td-key')+'>'+i+(st?' ['+t+']':'')+'</td><td'+_dumpStyles(type,'td-value')+'>'+_recurse(o[i],t)+'</td></tr>';}else if(typeof o[i]=='function'){r+='<tr><td'+_dumpStyles(type,'td-key')+'>'+i+(st?' ['+t+']':'')+'</td><td'+_dumpStyles(type,'td-value')+'>'+_recurse(o[i],t)+'</td></tr>';}else{r+='<tr><td'+_dumpStyles(type,'td-key')+'>'+i+(st?' ['+t+']':'')+'</td><td'+_dumpStyles(type,'td-value')+'>'+o[i]+'</td></tr>';}}}
if(j==0){r+='<table'+_dumpStyles(type,'table')+'><tr><th colspan="2"'+_dumpStyles(type,'th')+'>'+type+' [empty]</th></tr>';}
r+='</table>';return r;};var _dumpStyles=function(type,use){var r='';var table='font-size:xx-small;font-family:verdana,arial,helvetica,sans-serif;cell-spacing:2px;';var th='font-size:xx-small;font-family:verdana,arial,helvetica,sans-serif;text-align:left;color: white;padding: 5px;vertical-align :top;cursor:hand;cursor:pointer;';var td='font-size:xx-small;font-family:verdana,arial,helvetica,sans-serif;vertical-align:top;padding:3px;';var thScript='onClick="tTable(this);" title="click to collapse"';var tdScript='onClick="tRow(this);" title="click to collapse"';switch(type){case'string':case'number':case'boolean':case'undefined':case'object':switch(use){case'table':r=' style="'+table+'background-color:#0000cc;"';break;case'th':r=' style="'+th+'background-color:#4444cc;"'+thScript;break;case'td-key':r=' style="'+td+'background-color:#ccddff;cursor:hand;cursor:pointer;"'+tdScript;break;case'td-value':r=' style="'+td+'background-color:#fff;"';break;}
break;case'array':switch(use){case'table':r=' style="'+table+'background-color:#006600;"';break;case'th':r=' style="'+th+'background-color:#009900;"'+thScript;break;case'td-key':r=' style="'+td+'background-color:#ccffcc;cursor:hand;cursor:pointer;"'+tdScript;break;case'td-value':r=' style="'+td+'background-color:#fff;"';break;}
break;case'function':switch(use){case'table':r=' style="'+table+'background-color:#aa4400;"';break;case'th':r=' style="'+th+'background-color:#cc6600;"'+thScript;break;case'td-key':r=' style="'+td+'background-color:#fff;cursor:hand;cursor:pointer;"'+tdScript;break;case'td-value':r=' style="'+td+'background-color:#fff;"';break;}
break;case'arguments':switch(use){case'table':r=' style="'+table+'background-color:#dddddd;cell-spacing:3;"';break;case'td-key':r=' style="'+th+'background-color:#eeeeee;color:#000000;cursor:hand;cursor:pointer;"'+tdScript;break;}
break;case'regexp':switch(use){case'table':r=' style="'+table+'background-color:#CC0000;cell-spacing:3;"';break;case'th':r=' style="'+th+'background-color:#FF0000;"'+thScript;break;case'td-key':r=' style="'+th+'background-color:#FF5757;color:#000000;cursor:hand;cursor:pointer;"'+tdScript;break;case'td-value':r=' style="'+td+'background-color:#fff;"';break;}
break;case'date':switch(use){case'table':r=' style="'+table+'background-color:#663399;cell-spacing:3;"';break;case'th':r=' style="'+th+'background-color:#9966CC;"'+thScript;break;case'td-key':r=' style="'+th+'background-color:#B266FF;color:#000000;cursor:hand;cursor:pointer;"'+tdScript;break;case'td-value':r=' style="'+td+'background-color:#fff;"';break;}
break;case'domelement':case'document':case'window':switch(use){case'table':r=' style="'+table+'background-color:#FFCC33;cell-spacing:3;"';break;case'th':r=' style="'+th+'background-color:#FFD966;"'+thScript;break;case'td-key':r=' style="'+th+'background-color:#FFF2CC;color:#000000;cursor:hand;cursor:pointer;"'+tdScript;break;case'td-value':r=' style="'+td+'background-color:#fff;"';break;}
break;}
return r;};var _dumpType=function(obj){var t=typeof(obj);if(t=='function'){var f=obj.toString();if((/^\/.*\/[gi]??[gi]??$/).test(f)){return'regexp';}else if((/^\[object.*\]$/i).test(f)){t='object'}}
if(t!='object'){return t;}
switch(obj){case null:return'null';case window:return'window';case document:return'document';case window.event:return'event';}
if(window.event&&(event.type==obj.type)){return'event';}
var c=obj.constructor;if(c!=null){switch(c){case Array:t='array';break;case Date:return'date';case RegExp:return'regexp';case Object:t='object';break;case ReferenceError:return'error';default:var sc=c.toString();var m=sc.match(/\s*function (.*)\(/);if(m!=null){return'object';}}}
var nt=obj.nodeType;if(nt!=null){switch(nt){case 1:return'domelement';case 3:return'string';}}
if(obj.toString!=null){var ex=obj.toString();var am=ex.match(/^\[object (.*)\]$/i);if(am!=null){var am=am[1];switch(am.toLowerCase()){case'event':return'event';case'nodelist':case'htmlcollection':case'elementarray':return'array';case'htmldocument':return'htmldocument';}}}
return t;};dump+=(/string|number|undefined|boolean/.test(typeof(object))||object==null)?object:_recurse(object,typeof object);winName=window.open('','',settings);if(jQuery.browser.msie||jQuery.browser.browser=='opera'||jQuery.browser.browser=='safari'){winName.document.write('<html><head><title> '+title+' </title><script type="text/javascript">'+script+'</script><head>');winName.document.write('<body>'+dump+'</body></html>');}else{winName.document.body.innerHTML=dump;winName.document.title=title;var ffs=winName.document.createElement('script');ffs.setAttribute('type','text/javascript');ffs.appendChild(document.createTextNode(script));winName.document.getElementsByTagName('head')[0].appendChild(ffs);}
winName.focus();};;(function(){var $$;$$=jQuery.fn.flash=function(htmlOptions,pluginOptions,replace,update){var block=replace||$$.replace;pluginOptions=$$.copy($$.pluginOptions,pluginOptions);if(!$$.hasFlash(pluginOptions.version)){if(pluginOptions.expressInstall&&$$.hasFlash(6,0,65)){var expressInstallOptions={flashvars:{MMredirectURL:location,MMplayerType:'PlugIn',MMdoctitle:jQuery('title').text()}};}else if(pluginOptions.update){block=update||$$.update;}else{return this;}}
htmlOptions=$$.copy($$.htmlOptions,expressInstallOptions,htmlOptions);return this.each(function(){block.call(this,$$.copy(htmlOptions));});};$$.copy=function(){var options={},flashvars={};for(var i=0;i<arguments.length;i++){var arg=arguments[i];if(arg==undefined)continue;jQuery.extend(options,arg);if(arg.flashvars==undefined)continue;jQuery.extend(flashvars,arg.flashvars);}
options.flashvars=flashvars;return options;};$$.hasFlash=function(){if(/hasFlash\=true/.test(location))return true;if(/hasFlash\=false/.test(location))return false;var pv=$$.hasFlash.playerVersion().match(/\d+/g);var rv=String([arguments[0],arguments[1],arguments[2]]).match(/\d+/g)||String($$.pluginOptions.version).match(/\d+/g);for(var i=0;i<3;i++){pv[i]=parseInt(pv[i]||0);rv[i]=parseInt(rv[i]||0);if(pv[i]<rv[i])return false;if(pv[i]>rv[i])return true;}
return true;};$$.hasFlash.playerVersion=function(){try{try{var axo=new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');try{axo.AllowScriptAccess='always';}
catch(e){return'6,0,0';}}catch(e){}
return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g,',').match(/^,?(.+),?$/)[1];}catch(e){try{if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){return(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g,",").match(/^,?(.+),?$/)[1];}}catch(e){}}
return'0,0,0';};$$.htmlOptions={height:240,flashvars:{},pluginspage:'http://www.adobe.com/go/getflashplayer',src:'#',type:'application/x-shockwave-flash',width:320};$$.pluginOptions={expressInstall:false,update:true,version:'6.0.65'};$$.replace=function(htmlOptions){this.innerHTML='<div class="alt">'+this.innerHTML+'</div>';jQuery(this).addClass('flash-replaced').prepend($$.transform(htmlOptions));};$$.update=function(htmlOptions){var url=String(location).split('?');url.splice(1,0,'?hasFlash=true&');url=url.join('');var msg='<p>This content requires the Flash Player. <a href="http://www.adobe.com/go/getflashplayer">Download Flash Player</a>. Already have Flash Player? <a href="'+url+'">Click here.</a></p>';this.innerHTML='<span class="alt">'+this.innerHTML+'</span>';jQuery(this).addClass('flash-update').prepend(msg);};function toAttributeString(){var s='';for(var key in this)
if(typeof this[key]!='function')
s+=key+'="'+this[key]+'" ';return s;};function toFlashvarsString(){var s='';for(var key in this)
if(typeof this[key]!='function')
s+=key+'='+encodeURIComponent(this[key])+'&';return s.replace(/&$/,'');};$$.transform=function(htmlOptions){htmlOptions.toString=toAttributeString;if(htmlOptions.flashvars)htmlOptions.flashvars.toString=toFlashvarsString;return'<embed '+String(htmlOptions)+'/>';};if(window.attachEvent){window.attachEvent("onbeforeunload",function(){var backup=window.__flash__removeCallback;window.__flash__removeCallback=function(instance,name){try{backup(instance,name)}catch(x){}};__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};});}})();
/* Copyright (c) 2008 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Version: 1.0.3
 * Requires jQuery 1.1.3+
 * Docs: http://docs.jquery.com/Plugins/livequery
 */
(function($){$.extend($.fn,{livequery:function(type,fn,fn2){var self=this,q;if($.isFunction(type))
fn2=fn,fn=type,type=undefined;$.each($.livequery.queries,function(i,query){if(self.selector==query.selector&&self.context==query.context&&type==query.type&&(!fn||fn.$lqguid==query.fn.$lqguid)&&(!fn2||fn2.$lqguid==query.fn2.$lqguid))
return(q=query)&&false;});q=q||new $.livequery(this.selector,this.context,type,fn,fn2);q.stopped=false;q.run();return this;},expire:function(type,fn,fn2){var self=this;if($.isFunction(type))
fn2=fn,fn=type,type=undefined;$.each($.livequery.queries,function(i,query){if(self.selector==query.selector&&self.context==query.context&&(!type||type==query.type)&&(!fn||fn.$lqguid==query.fn.$lqguid)&&(!fn2||fn2.$lqguid==query.fn2.$lqguid)&&!this.stopped)
$.livequery.stop(query.id);});return this;}});$.livequery=function(selector,context,type,fn,fn2){this.selector=selector;this.context=context||document;this.type=type;this.fn=fn;this.fn2=fn2;this.elements=[];this.stopped=false;this.id=$.livequery.queries.push(this)-1;fn.$lqguid=fn.$lqguid||$.livequery.guid++;if(fn2)fn2.$lqguid=fn2.$lqguid||$.livequery.guid++;return this;};$.livequery.prototype={stop:function(){var query=this;if(this.type)
this.elements.unbind(this.type,this.fn);else if(this.fn2)
this.elements.each(function(i,el){query.fn2.apply(el);});this.elements=[];this.stopped=true;},run:function(){if(this.stopped)return;var query=this;var oEls=this.elements,els=$(this.selector,this.context),nEls=els.not(oEls);this.elements=els;if(this.type){nEls.bind(this.type,this.fn);if(oEls.length>0)
$.each(oEls,function(i,el){if($.inArray(el,els)<0)
$.event.remove(el,query.type,query.fn);});}
else{nEls.each(function(){query.fn.apply(this);});if(this.fn2&&oEls.length>0)
$.each(oEls,function(i,el){if($.inArray(el,els)<0)
query.fn2.apply(el);});}}};$.extend($.livequery,{guid:0,queries:[],queue:[],running:false,timeout:null,checkQueue:function(){if($.livequery.running&&$.livequery.queue.length){var length=$.livequery.queue.length;while(length--)
$.livequery.queries[$.livequery.queue.shift()].run();}},pause:function(){$.livequery.running=false;},play:function(){$.livequery.running=true;$.livequery.run();},registerPlugin:function(){$.each(arguments,function(i,n){if(!$.fn[n])return;var old=$.fn[n];$.fn[n]=function(){var r=old.apply(this,arguments);$.livequery.run();return r;}});},run:function(id){if(id!=undefined){if($.inArray(id,$.livequery.queue)<0)
$.livequery.queue.push(id);}
else
$.each($.livequery.queries,function(id){if($.inArray(id,$.livequery.queue)<0)
$.livequery.queue.push(id);});if($.livequery.timeout)clearTimeout($.livequery.timeout);$.livequery.timeout=setTimeout($.livequery.checkQueue,20);},stop:function(id){if(id!=undefined)
$.livequery.queries[id].stop();else
$.each($.livequery.queries,function(id){$.livequery.queries[id].stop();});}});$.livequery.registerPlugin('append','prepend','after','before','wrap','attr','removeAttr','addClass','removeClass','toggleClass','empty','remove');$(function(){$.livequery.play();});var init=$.prototype.init;$.prototype.init=function(a,c){var r=init.apply(this,arguments);if(a&&a.selector)
r.context=a.context,r.selector=a.selector;if(typeof a=='string')
r.context=c||document,r.selector=a;return r;};$.prototype.init.prototype=$.prototype;})(jQuery);$.fn.pause=function(milli,type){milli=milli||1000;type=type||"fx";return this.queue(type,function(){var self=this;setTimeout(function(){$(self).dequeue();},milli);});};$.fn.clearQueue=$.fn.unpause=function(type){return this.each(function(){type=type||"fx";if(this.queue&&this.queue[type]){this.queue[type].length=0;}});};;(function(h){var m=h.scrollTo=function(b,c,g){h(window).scrollTo(b,c,g)};m.defaults={axis:'y',duration:1};m.window=function(b){return h(window).scrollable()};h.fn.scrollable=function(){return this.map(function(){var b=this.parentWindow||this.defaultView,c=this.nodeName=='#document'?b.frameElement||b:this,g=c.contentDocument||(c.contentWindow||c).document,i=c.setInterval;return c.nodeName=='IFRAME'||i&&h.browser.safari?g.body:i?g.documentElement:this})};h.fn.scrollTo=function(r,j,a){if(typeof j=='object'){a=j;j=0}if(typeof a=='function')a={onAfter:a};a=h.extend({},m.defaults,a);j=j||a.speed||a.duration;a.queue=a.queue&&a.axis.length>1;if(a.queue)j/=2;a.offset=n(a.offset);a.over=n(a.over);return this.scrollable().each(function(){var k=this,o=h(k),d=r,l,e={},p=o.is('html,body');switch(typeof d){case'number':case'string':if(/^([+-]=)?\d+(px)?$/.test(d)){d=n(d);break}d=h(d,this);case'object':if(d.is||d.style)l=(d=h(d)).offset()}h.each(a.axis.split(''),function(b,c){var g=c=='x'?'Left':'Top',i=g.toLowerCase(),f='scroll'+g,s=k[f],t=c=='x'?'Width':'Height',v=t.toLowerCase();if(l){e[f]=l[i]+(p?0:s-o.offset()[i]);if(a.margin){e[f]-=parseInt(d.css('margin'+g))||0;e[f]-=parseInt(d.css('border'+g+'Width'))||0}e[f]+=a.offset[i]||0;if(a.over[i])e[f]+=d[v]()*a.over[i]}else e[f]=d[i];if(/^\d+$/.test(e[f]))e[f]=e[f]<=0?0:Math.min(e[f],u(t));if(!b&&a.queue){if(s!=e[f])q(a.onAfterFirst);delete e[f]}});q(a.onAfter);function q(b){o.animate(e,j,a.easing,b&&function(){b.call(this,r,a)})};function u(b){var c='scroll'+b,g=k.ownerDocument;return p?Math.max(g.documentElement[c],g.body[c]):k[c]}}).end()};function n(b){return typeof b=='object'?b:{top:b,left:b}}})(jQuery);(function($){var defaultHandlers=['swfupload_loaded_handler','file_queued_handler','file_queue_error_handler','file_dialog_start_handler','file_dialog_complete_handler','upload_start_handler','upload_progress_handler','upload_error_handler','upload_success_handler','upload_complete_handler','queue_complete_handler'];var additionalHandlers=[];$.fn.swfupload=function(){var args=$.makeArray(arguments);return this.each(function(){var swfu;if(args.length==1&&typeof(args[0])=='object'){swfu=$(this).data('__swfu');if(!swfu){var settings=args[0];var $magicUploadControl=$(this);var handlers=[];$.merge(handlers,defaultHandlers);$.merge(handlers,additionalHandlers);$.each(handlers,function(i,v){var eventName=v.replace(/_handler$/,'').replace(/_([a-z])/g,function(){return arguments[1].toUpperCase();});settings[v]=function(){var event=$.Event(eventName);$magicUploadControl.trigger(event,$.makeArray(arguments));return!event.isDefaultPrevented();};});$(this).data('__swfu',new SWFUpload(settings));}}else if(args.length>0&&typeof(args[0])=='string'){var methodName=args.shift();swfu=$(this).data('__swfu');if(swfu&&swfu[methodName]){swfu[methodName].apply(swfu,args);}}});};$.swfupload={additionalHandlers:function(){if(arguments.length===0){return additionalHandlers.slice();}else{$(arguments).each(function(i,v){$.merge(additionalHandlers,$.makeArray(v));});}},defaultHandlers:function(){return defaultHandlers.slice();},getInstance:function(el){return $(el).data('__swfu');}};})(jQuery);(function($){$.url={};$.extend($.url,{_params:{},init:function(){var paramsRaw="";try{paramsRaw=(document.location.href.split("?",2)[1]||"").split("#")[0].split("&")||[];for(var i=0;i<paramsRaw.length;i++){var single=paramsRaw[i].split("=");if(single[0])
this._params[single[0]]=unescape(single[1]);}}
catch(e){alert(e);}},param:function(name){return this._params[name]||"";},paramAll:function(){return this._params;}});$.url.init();})(jQuery);Date.dayNames=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];Date.abbrDayNames=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];Date.monthNames=['January','February','March','April','May','June','July','August','September','October','November','December'];Date.abbrMonthNames=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];Date.firstDayOfWeek=1;Date.format='dd/mm/yyyy';Date.fullYearStart='20';(function(){function add(name,method){if(!Date.prototype[name]){Date.prototype[name]=method;}};add("isLeapYear",function(){var y=this.getFullYear();return(y%4==0&&y%100!=0)||y%400==0;});add("isWeekend",function(){return this.getDay()==0||this.getDay()==6;});add("isWeekDay",function(){return!this.isWeekend();});add("getDaysInMonth",function(){return[31,(this.isLeapYear()?29:28),31,30,31,30,31,31,30,31,30,31][this.getMonth()];});add("getDayName",function(abbreviated){return abbreviated?Date.abbrDayNames[this.getDay()]:Date.dayNames[this.getDay()];});add("getMonthName",function(abbreviated){return abbreviated?Date.abbrMonthNames[this.getMonth()]:Date.monthNames[this.getMonth()];});add("getDayOfYear",function(){var tmpdtm=new Date("1/1/"+this.getFullYear());return Math.floor((this.getTime()-tmpdtm.getTime())/86400000);});add("getWeekOfYear",function(){return Math.ceil(this.getDayOfYear()/7);});add("setDayOfYear",function(day){this.setMonth(0);this.setDate(day);return this;});add("addYears",function(num){this.setFullYear(this.getFullYear()+num);return this;});add("addMonths",function(num){var tmpdtm=this.getDate();this.setMonth(this.getMonth()+num);if(tmpdtm>this.getDate())
this.addDays(-this.getDate());return this;});add("addDays",function(num){this.setDate(this.getDate()+num);return this;});add("addHours",function(num){this.setHours(this.getHours()+num);return this;});add("addMinutes",function(num){this.setMinutes(this.getMinutes()+num);return this;});add("addSeconds",function(num){this.setSeconds(this.getSeconds()+num);return this;});add("zeroTime",function(){this.setMilliseconds(0);this.setSeconds(0);this.setMinutes(0);this.setHours(0);return this;});add("asString",function(){var r=Date.format;return r.split('yyyy').join(this.getFullYear()).split('yy').join((this.getFullYear()+'').substring(2)).split('mmm').join(this.getMonthName(true)).split('mm').join(_zeroPad(this.getMonth()+1)).split('dd').join(_zeroPad(this.getDate()));});Date.fromString=function(s)
{var f=Date.format;var d=new Date('01/01/1977');var iY=f.indexOf('yyyy');if(iY>-1){d.setFullYear(Number(s.substr(iY,4)));}else{d.setFullYear(Number(Date.fullYearStart+s.substr(f.indexOf('yy'),2)));}
var iM=f.indexOf('mmm');if(iM>-1){var mStr=s.substr(iM,3);for(var i=0;i<Date.abbrMonthNames.length;i++){if(Date.abbrMonthNames[i]==mStr)break;}
d.setMonth(i);}else{d.setMonth(Number(s.substr(f.indexOf('mm'),2))-1);}
d.setDate(Number(s.substr(f.indexOf('dd'),2)));if(isNaN(d.getTime())){return false;}
return d;};var _zeroPad=function(num){var s='0'+num;return s.substring(s.length-2)};})();WIB.Page.Inbox={init:function(){$(document).ready(function(){$('.chalkline.component .actions li.delete-notifications a').live('click',function(){$.get(WIB.apiURL+'?method=notification.deleteAll',{},function(data){if(typeof(data.success)=='undefined'||!data.success){var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','#content .messages');}else{$('.inbox-messages .inside').fadeOut('normal',function(){$('.inbox .none').show();});}},'json');});});}};WIB.Page.Setup={currentStep:1,postSetupURL:'/home',loadStep:function(step){window.location.href='/setup?step='+step;},init:function(){$(document).ready(function(){$('.header-nav.component .main').append('<a class="skip-all fake-submit" href="/setup?action=skip"><span>Skip</span></a>');$('#thumbnail-form').append('<div><input type="hidden" id="thumbnail_step" name="step" value="1" /></div>');for(i=1;i<=4;i++){$tab=$('.header-nav .tabs .step'+i);$tab.find('a').attr('href','#none').click(function(){var step=$(this).parents('li').attr('class').replace(/active/,'').replace(/step/,'');WIB.Page.Setup.loadStep(step);});$('.header-nav .steps .step'+i).width($tab.width());}
for(i=1;i<=4;i++){$('#setup-step'+i+' .actions a.next, #setup-step'+i+' .actions a.skip').click(function(){var step=parseInt($(this).parents('.setup-step-container').attr('id').replace(/^setup-step/,''))+1;WIB.Page.Setup.loadStep(step);});}
$('.setup-page .actions a.finished').click(function(){location.href=WIB.Page.Setup.postSetupURL;});});}};var SWFUpload;if(SWFUpload==undefined){SWFUpload=function(settings){this.initSWFUpload(settings);};}
SWFUpload.prototype.initSWFUpload=function(settings){try{this.customSettings={};this.settings=settings;this.eventQueue=[];this.movieName="SWFUpload_"+SWFUpload.movieCount++;this.movieElement=null;SWFUpload.instances[this.movieName]=this;this.initSettings();this.loadFlash();this.displayDebugInfo();}catch(ex){delete SWFUpload.instances[this.movieName];throw ex;}};SWFUpload.instances={};SWFUpload.movieCount=0;SWFUpload.version="2.2.0 2009-03-25";SWFUpload.QUEUE_ERROR={QUEUE_LIMIT_EXCEEDED:-100,FILE_EXCEEDS_SIZE_LIMIT:-110,ZERO_BYTE_FILE:-120,INVALID_FILETYPE:-130};SWFUpload.UPLOAD_ERROR={HTTP_ERROR:-200,MISSING_UPLOAD_URL:-210,IO_ERROR:-220,SECURITY_ERROR:-230,UPLOAD_LIMIT_EXCEEDED:-240,UPLOAD_FAILED:-250,SPECIFIED_FILE_ID_NOT_FOUND:-260,FILE_VALIDATION_FAILED:-270,FILE_CANCELLED:-280,UPLOAD_STOPPED:-290};SWFUpload.FILE_STATUS={QUEUED:-1,IN_PROGRESS:-2,ERROR:-3,COMPLETE:-4,CANCELLED:-5};SWFUpload.BUTTON_ACTION={SELECT_FILE:-100,SELECT_FILES:-110,START_UPLOAD:-120};SWFUpload.CURSOR={ARROW:-1,HAND:-2};SWFUpload.WINDOW_MODE={WINDOW:"window",TRANSPARENT:"transparent",OPAQUE:"opaque"};SWFUpload.completeURL=function(url){if(typeof(url)!=="string"||url.match(/^https?:\/\//i)||url.match(/^\//)){return url;}
var currentURL=window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"");var indexSlash=window.location.pathname.lastIndexOf("/");if(indexSlash<=0){path="/";}else{path=window.location.pathname.substr(0,indexSlash)+"/";}
return path+url;};SWFUpload.prototype.initSettings=function(){this.ensureDefault=function(settingName,defaultValue){this.settings[settingName]=(this.settings[settingName]==undefined)?defaultValue:this.settings[settingName];};this.ensureDefault("upload_url","");this.ensureDefault("preserve_relative_urls",false);this.ensureDefault("file_post_name","Filedata");this.ensureDefault("post_params",{});this.ensureDefault("use_query_string",false);this.ensureDefault("requeue_on_error",false);this.ensureDefault("http_success",[]);this.ensureDefault("assume_success_timeout",0);this.ensureDefault("file_types","*.*");this.ensureDefault("file_types_description","All Files");this.ensureDefault("file_size_limit",0);this.ensureDefault("file_upload_limit",0);this.ensureDefault("file_queue_limit",0);this.ensureDefault("flash_url","swfupload.swf");this.ensureDefault("prevent_swf_caching",true);this.ensureDefault("button_image_url","");this.ensureDefault("button_width",1);this.ensureDefault("button_height",1);this.ensureDefault("button_text","");this.ensureDefault("button_text_style","color: #000000; font-size: 16pt;");this.ensureDefault("button_text_top_padding",0);this.ensureDefault("button_text_left_padding",0);this.ensureDefault("button_action",SWFUpload.BUTTON_ACTION.SELECT_FILES);this.ensureDefault("button_disabled",false);this.ensureDefault("button_placeholder_id","");this.ensureDefault("button_placeholder",null);this.ensureDefault("button_cursor",SWFUpload.CURSOR.ARROW);this.ensureDefault("button_window_mode",SWFUpload.WINDOW_MODE.WINDOW);this.ensureDefault("debug",false);this.settings.debug_enabled=this.settings.debug;this.settings.return_upload_start_handler=this.returnUploadStart;this.ensureDefault("swfupload_loaded_handler",null);this.ensureDefault("file_dialog_start_handler",null);this.ensureDefault("file_queued_handler",null);this.ensureDefault("file_queue_error_handler",null);this.ensureDefault("file_dialog_complete_handler",null);this.ensureDefault("upload_start_handler",null);this.ensureDefault("upload_progress_handler",null);this.ensureDefault("upload_error_handler",null);this.ensureDefault("upload_success_handler",null);this.ensureDefault("upload_complete_handler",null);this.ensureDefault("debug_handler",this.debugMessage);this.ensureDefault("custom_settings",{});this.customSettings=this.settings.custom_settings;if(!!this.settings.prevent_swf_caching){this.settings.flash_url=this.settings.flash_url+(this.settings.flash_url.indexOf("?")<0?"?":"&")+"preventswfcaching="+new Date().getTime();}
if(!this.settings.preserve_relative_urls){this.settings.upload_url=SWFUpload.completeURL(this.settings.upload_url);this.settings.button_image_url=SWFUpload.completeURL(this.settings.button_image_url);}
delete this.ensureDefault;};SWFUpload.prototype.loadFlash=function(){var targetElement,tempParent;if(document.getElementById(this.movieName)!==null){throw"ID "+this.movieName+" is already in use. The Flash Object could not be added";}
targetElement=document.getElementById(this.settings.button_placeholder_id)||this.settings.button_placeholder;if(targetElement==undefined){throw"Could not find the placeholder element: "+this.settings.button_placeholder_id;}
tempParent=document.createElement("div");tempParent.innerHTML=this.getFlashHTML();targetElement.parentNode.replaceChild(tempParent.firstChild,targetElement);if(window[this.movieName]==undefined){window[this.movieName]=this.getMovieElement();}};SWFUpload.prototype.getFlashHTML=function(){return['<object id="',this.movieName,'" type="application/x-shockwave-flash" data="',this.settings.flash_url,'" width="',this.settings.button_width,'" height="',this.settings.button_height,'" class="swfupload">','<param name="wmode" value="',this.settings.button_window_mode,'" />','<param name="movie" value="',this.settings.flash_url,'" />','<param name="quality" value="high" />','<param name="menu" value="false" />','<param name="allowScriptAccess" value="always" />','<param name="flashvars" value="'+this.getFlashVars()+'" />','</object>'].join("");};SWFUpload.prototype.getFlashVars=function(){var paramString=this.buildParamString();var httpSuccessString=this.settings.http_success.join(",");return["movieName=",encodeURIComponent(this.movieName),"&amp;uploadURL=",encodeURIComponent(this.settings.upload_url),"&amp;useQueryString=",encodeURIComponent(this.settings.use_query_string),"&amp;requeueOnError=",encodeURIComponent(this.settings.requeue_on_error),"&amp;httpSuccess=",encodeURIComponent(httpSuccessString),"&amp;assumeSuccessTimeout=",encodeURIComponent(this.settings.assume_success_timeout),"&amp;params=",encodeURIComponent(paramString),"&amp;filePostName=",encodeURIComponent(this.settings.file_post_name),"&amp;fileTypes=",encodeURIComponent(this.settings.file_types),"&amp;fileTypesDescription=",encodeURIComponent(this.settings.file_types_description),"&amp;fileSizeLimit=",encodeURIComponent(this.settings.file_size_limit),"&amp;fileUploadLimit=",encodeURIComponent(this.settings.file_upload_limit),"&amp;fileQueueLimit=",encodeURIComponent(this.settings.file_queue_limit),"&amp;debugEnabled=",encodeURIComponent(this.settings.debug_enabled),"&amp;buttonImageURL=",encodeURIComponent(this.settings.button_image_url),"&amp;buttonWidth=",encodeURIComponent(this.settings.button_width),"&amp;buttonHeight=",encodeURIComponent(this.settings.button_height),"&amp;buttonText=",encodeURIComponent(this.settings.button_text),"&amp;buttonTextTopPadding=",encodeURIComponent(this.settings.button_text_top_padding),"&amp;buttonTextLeftPadding=",encodeURIComponent(this.settings.button_text_left_padding),"&amp;buttonTextStyle=",encodeURIComponent(this.settings.button_text_style),"&amp;buttonAction=",encodeURIComponent(this.settings.button_action),"&amp;buttonDisabled=",encodeURIComponent(this.settings.button_disabled),"&amp;buttonCursor=",encodeURIComponent(this.settings.button_cursor)].join("");};SWFUpload.prototype.getMovieElement=function(){if(this.movieElement==undefined){this.movieElement=document.getElementById(this.movieName);}
if(this.movieElement===null){throw"Could not find Flash element";}
return this.movieElement;};SWFUpload.prototype.buildParamString=function(){var postParams=this.settings.post_params;var paramStringPairs=[];if(typeof(postParams)==="object"){for(var name in postParams){if(postParams.hasOwnProperty(name)){paramStringPairs.push(encodeURIComponent(name.toString())+"="+encodeURIComponent(postParams[name].toString()));}}}
return paramStringPairs.join("&amp;");};SWFUpload.prototype.destroy=function(){try{this.cancelUpload(null,false);var movieElement=null;movieElement=this.getMovieElement();if(movieElement&&typeof(movieElement.CallFunction)==="unknown"){for(var i in movieElement){try{if(typeof(movieElement[i])==="function"){movieElement[i]=null;}}catch(ex1){}}
try{movieElement.parentNode.removeChild(movieElement);}catch(ex){}}
window[this.movieName]=null;SWFUpload.instances[this.movieName]=null;delete SWFUpload.instances[this.movieName];this.movieElement=null;this.settings=null;this.customSettings=null;this.eventQueue=null;this.movieName=null;return true;}catch(ex2){return false;}};SWFUpload.prototype.displayDebugInfo=function(){this.debug(["---SWFUpload Instance Info---\n","Version: ",SWFUpload.version,"\n","Movie Name: ",this.movieName,"\n","Settings:\n","\t","upload_url:               ",this.settings.upload_url,"\n","\t","flash_url:                ",this.settings.flash_url,"\n","\t","use_query_string:         ",this.settings.use_query_string.toString(),"\n","\t","requeue_on_error:         ",this.settings.requeue_on_error.toString(),"\n","\t","http_success:             ",this.settings.http_success.join(", "),"\n","\t","assume_success_timeout:   ",this.settings.assume_success_timeout,"\n","\t","file_post_name:           ",this.settings.file_post_name,"\n","\t","post_params:              ",this.settings.post_params.toString(),"\n","\t","file_types:               ",this.settings.file_types,"\n","\t","file_types_description:   ",this.settings.file_types_description,"\n","\t","file_size_limit:          ",this.settings.file_size_limit,"\n","\t","file_upload_limit:        ",this.settings.file_upload_limit,"\n","\t","file_queue_limit:         ",this.settings.file_queue_limit,"\n","\t","debug:                    ",this.settings.debug.toString(),"\n","\t","prevent_swf_caching:      ",this.settings.prevent_swf_caching.toString(),"\n","\t","button_placeholder_id:    ",this.settings.button_placeholder_id.toString(),"\n","\t","button_placeholder:       ",(this.settings.button_placeholder?"Set":"Not Set"),"\n","\t","button_image_url:         ",this.settings.button_image_url.toString(),"\n","\t","button_width:             ",this.settings.button_width.toString(),"\n","\t","button_height:            ",this.settings.button_height.toString(),"\n","\t","button_text:              ",this.settings.button_text.toString(),"\n","\t","button_text_style:        ",this.settings.button_text_style.toString(),"\n","\t","button_text_top_padding:  ",this.settings.button_text_top_padding.toString(),"\n","\t","button_text_left_padding: ",this.settings.button_text_left_padding.toString(),"\n","\t","button_action:            ",this.settings.button_action.toString(),"\n","\t","button_disabled:          ",this.settings.button_disabled.toString(),"\n","\t","custom_settings:          ",this.settings.custom_settings.toString(),"\n","Event Handlers:\n","\t","swfupload_loaded_handler assigned:  ",(typeof this.settings.swfupload_loaded_handler==="function").toString(),"\n","\t","file_dialog_start_handler assigned: ",(typeof this.settings.file_dialog_start_handler==="function").toString(),"\n","\t","file_queued_handler assigned:       ",(typeof this.settings.file_queued_handler==="function").toString(),"\n","\t","file_queue_error_handler assigned:  ",(typeof this.settings.file_queue_error_handler==="function").toString(),"\n","\t","upload_start_handler assigned:      ",(typeof this.settings.upload_start_handler==="function").toString(),"\n","\t","upload_progress_handler assigned:   ",(typeof this.settings.upload_progress_handler==="function").toString(),"\n","\t","upload_error_handler assigned:      ",(typeof this.settings.upload_error_handler==="function").toString(),"\n","\t","upload_success_handler assigned:    ",(typeof this.settings.upload_success_handler==="function").toString(),"\n","\t","upload_complete_handler assigned:   ",(typeof this.settings.upload_complete_handler==="function").toString(),"\n","\t","debug_handler assigned:             ",(typeof this.settings.debug_handler==="function").toString(),"\n"].join(""));};SWFUpload.prototype.addSetting=function(name,value,default_value){if(value==undefined){return(this.settings[name]=default_value);}else{return(this.settings[name]=value);}};SWFUpload.prototype.getSetting=function(name){if(this.settings[name]!=undefined){return this.settings[name];}
return"";};SWFUpload.prototype.callFlash=function(functionName,argumentArray){argumentArray=argumentArray||[];var movieElement=this.getMovieElement();var returnValue,returnString;try{returnString=movieElement.CallFunction('<invoke name="'+functionName+'" returntype="javascript">'+__flash__argumentsToXML(argumentArray,0)+'</invoke>');returnValue=eval(returnString);}catch(ex){throw"Call to "+functionName+" failed";}
if(returnValue!=undefined&&typeof returnValue.post==="object"){returnValue=this.unescapeFilePostParams(returnValue);}
return returnValue;};SWFUpload.prototype.selectFile=function(){this.callFlash("SelectFile");};SWFUpload.prototype.selectFiles=function(){this.callFlash("SelectFiles");};SWFUpload.prototype.startUpload=function(fileID){this.callFlash("StartUpload",[fileID]);};SWFUpload.prototype.cancelUpload=function(fileID,triggerErrorEvent){if(triggerErrorEvent!==false){triggerErrorEvent=true;}
this.callFlash("CancelUpload",[fileID,triggerErrorEvent]);};SWFUpload.prototype.stopUpload=function(){this.callFlash("StopUpload");};SWFUpload.prototype.getStats=function(){return this.callFlash("GetStats");};SWFUpload.prototype.setStats=function(statsObject){this.callFlash("SetStats",[statsObject]);};SWFUpload.prototype.getFile=function(fileID){if(typeof(fileID)==="number"){return this.callFlash("GetFileByIndex",[fileID]);}else{return this.callFlash("GetFile",[fileID]);}};SWFUpload.prototype.addFileParam=function(fileID,name,value){return this.callFlash("AddFileParam",[fileID,name,value]);};SWFUpload.prototype.removeFileParam=function(fileID,name){this.callFlash("RemoveFileParam",[fileID,name]);};SWFUpload.prototype.setUploadURL=function(url){this.settings.upload_url=url.toString();this.callFlash("SetUploadURL",[url]);};SWFUpload.prototype.setPostParams=function(paramsObject){this.settings.post_params=paramsObject;this.callFlash("SetPostParams",[paramsObject]);};SWFUpload.prototype.addPostParam=function(name,value){this.settings.post_params[name]=value;this.callFlash("SetPostParams",[this.settings.post_params]);};SWFUpload.prototype.removePostParam=function(name){delete this.settings.post_params[name];this.callFlash("SetPostParams",[this.settings.post_params]);};SWFUpload.prototype.setFileTypes=function(types,description){this.settings.file_types=types;this.settings.file_types_description=description;this.callFlash("SetFileTypes",[types,description]);};SWFUpload.prototype.setFileSizeLimit=function(fileSizeLimit){this.settings.file_size_limit=fileSizeLimit;this.callFlash("SetFileSizeLimit",[fileSizeLimit]);};SWFUpload.prototype.setFileUploadLimit=function(fileUploadLimit){this.settings.file_upload_limit=fileUploadLimit;this.callFlash("SetFileUploadLimit",[fileUploadLimit]);};SWFUpload.prototype.setFileQueueLimit=function(fileQueueLimit){this.settings.file_queue_limit=fileQueueLimit;this.callFlash("SetFileQueueLimit",[fileQueueLimit]);};SWFUpload.prototype.setFilePostName=function(filePostName){this.settings.file_post_name=filePostName;this.callFlash("SetFilePostName",[filePostName]);};SWFUpload.prototype.setUseQueryString=function(useQueryString){this.settings.use_query_string=useQueryString;this.callFlash("SetUseQueryString",[useQueryString]);};SWFUpload.prototype.setRequeueOnError=function(requeueOnError){this.settings.requeue_on_error=requeueOnError;this.callFlash("SetRequeueOnError",[requeueOnError]);};SWFUpload.prototype.setHTTPSuccess=function(http_status_codes){if(typeof http_status_codes==="string"){http_status_codes=http_status_codes.replace(" ","").split(",");}
this.settings.http_success=http_status_codes;this.callFlash("SetHTTPSuccess",[http_status_codes]);};SWFUpload.prototype.setAssumeSuccessTimeout=function(timeout_seconds){this.settings.assume_success_timeout=timeout_seconds;this.callFlash("SetAssumeSuccessTimeout",[timeout_seconds]);};SWFUpload.prototype.setDebugEnabled=function(debugEnabled){this.settings.debug_enabled=debugEnabled;this.callFlash("SetDebugEnabled",[debugEnabled]);};SWFUpload.prototype.setButtonImageURL=function(buttonImageURL){if(buttonImageURL==undefined){buttonImageURL="";}
this.settings.button_image_url=buttonImageURL;this.callFlash("SetButtonImageURL",[buttonImageURL]);};SWFUpload.prototype.setButtonDimensions=function(width,height){this.settings.button_width=width;this.settings.button_height=height;var movie=this.getMovieElement();if(movie!=undefined){movie.style.width=width+"px";movie.style.height=height+"px";}
this.callFlash("SetButtonDimensions",[width,height]);};SWFUpload.prototype.setButtonText=function(html){this.settings.button_text=html;this.callFlash("SetButtonText",[html]);};SWFUpload.prototype.setButtonTextPadding=function(left,top){this.settings.button_text_top_padding=top;this.settings.button_text_left_padding=left;this.callFlash("SetButtonTextPadding",[left,top]);};SWFUpload.prototype.setButtonTextStyle=function(css){this.settings.button_text_style=css;this.callFlash("SetButtonTextStyle",[css]);};SWFUpload.prototype.setButtonDisabled=function(isDisabled){this.settings.button_disabled=isDisabled;this.callFlash("SetButtonDisabled",[isDisabled]);};SWFUpload.prototype.setButtonAction=function(buttonAction){this.settings.button_action=buttonAction;this.callFlash("SetButtonAction",[buttonAction]);};SWFUpload.prototype.setButtonCursor=function(cursor){this.settings.button_cursor=cursor;this.callFlash("SetButtonCursor",[cursor]);};SWFUpload.prototype.queueEvent=function(handlerName,argumentArray){if(argumentArray==undefined){argumentArray=[];}else if(!(argumentArray instanceof Array)){argumentArray=[argumentArray];}
var self=this;if(typeof this.settings[handlerName]==="function"){this.eventQueue.push(function(){this.settings[handlerName].apply(this,argumentArray);});setTimeout(function(){self.executeNextEvent();},0);}else if(this.settings[handlerName]!==null){throw"Event handler "+handlerName+" is unknown or is not a function";}};SWFUpload.prototype.executeNextEvent=function(){var f=this.eventQueue?this.eventQueue.shift():null;if(typeof(f)==="function"){f.apply(this);}};SWFUpload.prototype.unescapeFilePostParams=function(file){var reg=/[$]([0-9a-f]{4})/i;var unescapedPost={};var uk;if(file!=undefined){for(var k in file.post){if(file.post.hasOwnProperty(k)){uk=k;var match;while((match=reg.exec(uk))!==null){uk=uk.replace(match[0],String.fromCharCode(parseInt("0x"+match[1],16)));}
unescapedPost[uk]=file.post[k];}}
file.post=unescapedPost;}
return file;};SWFUpload.prototype.testExternalInterface=function(){try{return this.callFlash("TestExternalInterface");}catch(ex){return false;}};SWFUpload.prototype.flashReady=function(){var movieElement=this.getMovieElement();if(!movieElement){this.debug("Flash called back ready but the flash movie can't be found.");return;}
this.cleanUp(movieElement);this.queueEvent("swfupload_loaded_handler");};SWFUpload.prototype.cleanUp=function(movieElement){try{if(this.movieElement&&typeof(movieElement.CallFunction)==="unknown"){this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");for(var key in movieElement){try{if(typeof(movieElement[key])==="function"){movieElement[key]=null;}}catch(ex){}}}}catch(ex1){}
window["__flash__removeCallback"]=function(instance,name){try{if(instance){instance[name]=null;}}catch(flashEx){}};};SWFUpload.prototype.fileDialogStart=function(){this.queueEvent("file_dialog_start_handler");};SWFUpload.prototype.fileQueued=function(file){file=this.unescapeFilePostParams(file);this.queueEvent("file_queued_handler",file);};SWFUpload.prototype.fileQueueError=function(file,errorCode,message){file=this.unescapeFilePostParams(file);this.queueEvent("file_queue_error_handler",[file,errorCode,message]);};SWFUpload.prototype.fileDialogComplete=function(numFilesSelected,numFilesQueued,numFilesInQueue){this.queueEvent("file_dialog_complete_handler",[numFilesSelected,numFilesQueued,numFilesInQueue]);};SWFUpload.prototype.uploadStart=function(file){file=this.unescapeFilePostParams(file);this.queueEvent("return_upload_start_handler",file);};SWFUpload.prototype.returnUploadStart=function(file){var returnValue;if(typeof this.settings.upload_start_handler==="function"){file=this.unescapeFilePostParams(file);returnValue=this.settings.upload_start_handler.call(this,file);}else if(this.settings.upload_start_handler!=undefined){throw"upload_start_handler must be a function";}
if(returnValue===undefined){returnValue=true;}
returnValue=!!returnValue;this.callFlash("ReturnUploadStart",[returnValue]);};SWFUpload.prototype.uploadProgress=function(file,bytesComplete,bytesTotal){file=this.unescapeFilePostParams(file);this.queueEvent("upload_progress_handler",[file,bytesComplete,bytesTotal]);};SWFUpload.prototype.uploadError=function(file,errorCode,message){file=this.unescapeFilePostParams(file);this.queueEvent("upload_error_handler",[file,errorCode,message]);};SWFUpload.prototype.uploadSuccess=function(file,serverData,responseReceived){file=this.unescapeFilePostParams(file);this.queueEvent("upload_success_handler",[file,serverData,responseReceived]);};SWFUpload.prototype.uploadComplete=function(file){file=this.unescapeFilePostParams(file);this.queueEvent("upload_complete_handler",file);};SWFUpload.prototype.debug=function(message){this.queueEvent("debug_handler",message);};SWFUpload.prototype.debugMessage=function(message){if(this.settings.debug){var exceptionMessage,exceptionValues=[];if(typeof message==="object"&&typeof message.name==="string"&&typeof message.message==="string"){for(var key in message){if(message.hasOwnProperty(key)){exceptionValues.push(key+": "+message[key]);}}
exceptionMessage=exceptionValues.join("\n")||"";exceptionValues=exceptionMessage.split("\n");exceptionMessage="EXCEPTION: "+exceptionValues.join("\nEXCEPTION: ");SWFUpload.Console.writeLine(exceptionMessage);}else{SWFUpload.Console.writeLine(message);}}};SWFUpload.Console={};SWFUpload.Console.writeLine=function(message){var console,documentForm;try{console=document.getElementById("SWFUpload_Console");if(!console){documentForm=document.createElement("form");document.getElementsByTagName("body")[0].appendChild(documentForm);console=document.createElement("textarea");console.id="SWFUpload_Console";console.style.fontFamily="monospace";console.setAttribute("wrap","off");console.wrap="off";console.style.overflow="auto";console.style.width="700px";console.style.height="350px";console.style.margin="5px";documentForm.appendChild(console);}
console.value+=message+"\n";console.scrollTop=console.scrollHeight-console.clientHeight;}catch(ex){alert("Exception: "+ex.name+" Message: "+ex.message);}};var SWFUpload;if(typeof(SWFUpload)==="function"){SWFUpload.queue={};SWFUpload.prototype.initSettings=(function(oldInitSettings){return function(){if(typeof(oldInitSettings)==="function"){oldInitSettings.call(this);}
this.queueSettings={};this.queueSettings.queue_cancelled_flag=false;this.queueSettings.queue_upload_count=0;this.queueSettings.user_upload_complete_handler=this.settings.upload_complete_handler;this.queueSettings.user_upload_start_handler=this.settings.upload_start_handler;this.settings.upload_complete_handler=SWFUpload.queue.uploadCompleteHandler;this.settings.upload_start_handler=SWFUpload.queue.uploadStartHandler;this.settings.queue_complete_handler=this.settings.queue_complete_handler||null;};})(SWFUpload.prototype.initSettings);SWFUpload.prototype.startUpload=function(fileID){this.queueSettings.queue_cancelled_flag=false;this.callFlash("StartUpload",[fileID]);};SWFUpload.prototype.cancelQueue=function(){this.queueSettings.queue_cancelled_flag=true;this.stopUpload();var stats=this.getStats();while(stats.files_queued>0){this.cancelUpload();stats=this.getStats();}};SWFUpload.queue.uploadStartHandler=function(file){var returnValue;if(typeof(this.queueSettings.user_upload_start_handler)==="function"){returnValue=this.queueSettings.user_upload_start_handler.call(this,file);}
returnValue=(returnValue===false)?false:true;this.queueSettings.queue_cancelled_flag=!returnValue;return returnValue;};SWFUpload.queue.uploadCompleteHandler=function(file){var user_upload_complete_handler=this.queueSettings.user_upload_complete_handler;var continueUpload;if(file.filestatus===SWFUpload.FILE_STATUS.COMPLETE){this.queueSettings.queue_upload_count++;}
if(typeof(user_upload_complete_handler)==="function"){continueUpload=(user_upload_complete_handler.call(this,file)===false)?false:true;}else if(file.filestatus===SWFUpload.FILE_STATUS.QUEUED){continueUpload=false;}else{continueUpload=true;}
if(continueUpload){var stats=this.getStats();if(stats.files_queued>0&&this.queueSettings.queue_cancelled_flag===false){this.startUpload();}else if(this.queueSettings.queue_cancelled_flag===false){this.queueEvent("queue_complete_handler",[this.queueSettings.queue_upload_count]);this.queueSettings.queue_upload_count=0;}else{this.queueSettings.queue_cancelled_flag=false;this.queueSettings.queue_upload_count=0;}}};}WIB.Component.AboutMe={init:function(){$('.about-me a.read-more').click(function(){$('.about-me .about-me-remainder').toggle();});}};WIB.Component.Actions={render:function(){var classes=['like','share','write-review','report','edit-thumbnail','edit-interests','upload-video','record-video','upload-photo','tag-photo','make-profile-photo','edit-photo','delete-photo','add-friend','view-photos','view-geo','view-profile','cancel-friend','send-message','edit-profile','edit-settings','remove-friend','compare','edit-review'];for(i=0;i<classes.length;i++){$('.action-'+classes[i]).each(function(i,n){var object=$(this).attr('title').split('_');if(object.length==2){$(this).removeAttr('title').attr('objectType',object[0]).attr('objectID',object[1]);}});}},init:function(){$('.action-like[objectType]').live('click',function(){var objectType=$(this).attr('objectType');var objectID=$(this).attr('objectID');that=this;WIB.requireLogin(function(){WIB.addLike(objectType,objectID,that);},' to mark this as something you like');});$('.action-report[objectType]').live('click',function(){params={objectType:$(this).attr('objectType'),objectID:$(this).attr('objectID')};WIB.requireLogin(function(){WIB.showPopup('report',params);},' to mark this as something you like');});$('.action-share[objectType]').live('click',function(){params={objectType:$(this).attr('objectType'),objectID:$(this).attr('objectID')};WIB.requireLogin(function(){WIB.showPopup('compose_message',params);},' to share this');});$('.action-write-review[objectType]').live('click',function(){WIB.showPopup('review_creator',{objectType:$(this).attr('objectType'),objectID:$(this).attr('objectID')});});$('.action-edit-review[objectType]').live('click',function(){WIB.showPopup('review_editor',{objectType:$(this).attr('objectType'),objectID:$(this).attr('objectID')});});$('.action-upload-photo[objectType]').live('click',function(){params={objectType:$(this).attr('objectType'),objectID:$(this).attr('objectID')};WIB.requireLogin(function(){WIB.showPopup('create_album',params);},' to upload a photo');});$('.action-create-album').live('click',function(){params={};WIB.requireLogin(function(){WIB.showPopup('create_album',params);},' to create an album');});$('.action-record-video[objectType]').live('click',function(){params={objectType:$(this).attr('objectType'),objectID:$(this).attr('objectID')};WIB.requireLogin(function(){WIB.showPopup('upload_record_video',params);},' to upload or record a video');});$('.action-tag-photo[objectType]').live('click',function(){});$('.action-view-photos[objectType]').live('click',function(){location.href='/user/'+$(this).attr('objectID')+'/photos';});$('.action-view-profile[objectType]').live('click',function(){location.href='/user/'+$(this).attr('objectID');});$('.action-view-geo[objectType]').live('click',function(){location.href='/'+$(this).attr('objectType')+'/'+$(this).attr('objectID')+'_actionlink/';});$('.action-make-profile-photo[objectType]').live('click',function(){WIB.Component.Actions.setProfilePhoto($(this).attr('objectType'),$(this).attr('objectID'));});$('.action-edit-photo[objectType]').live('click',function(){WIB.showPopup('photo_editor',{photoID:$(this).attr('objectID')});});$('.action-edit-thumbnail[objectType]').live('click',function(){WIB.showPopup('thumbnail_uploader');});$('.action-delete-photo[objectType]').live('click',function(){WIB.showConfirmBox('You are about to delete your picture, this is permanent.  Are you sure?',{okText:'Yes',cancelText:'No',okCallback:function(){WIB.Component.PhotoView.deletePhoto();WIB.hideConfirmBox();}});});$('.action-delete-video[objectType]').live('click',function(){WIB.showConfirmBox('You are about to delete your picture, this is permanent.  Are you sure?',{okText:'Yes',cancelText:'No',okCallback:function(){WIB.Component.Videos.deleteVideo();WIB.hideConfirmBox();}});});$('.action-add-friend[objectType]').live('click',function(){that=this;WIB.requireLogin(function(){WIB.showPopup('friend_request',{friendID:$(that).attr('objectID')});},' to add this friend');});$('.action-compare[objectType]').live('click',function(){location.href='/user/'+$(this).attr('objectID')+'/compare';});$('.action-remove-friend[objectType]').live('click',function(){friendID=$(this).attr('objectID')
WIB.showConfirmBox('Do you really want to remove this friend?',{okText:'Yes',cancelText:'No',okCallback:function(){$.get(WIB.apiURL+'?method=friend.remove',{friendID:friendID},function(data){if(typeof(data.success)!='undefined'&&data.success==1){WIB.hideConfirmBox();WIB.showMessage(data.message,'notice');WIB.reload();}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error');}},'json');}});return false;});$('.action-cancel-friend[objectType]').live('click',function(){WIB.Component.Actions.cancelFriendRequest($(this).attr('objectID'));});$('.action-send-message[objectType]').live('click',function(){WIB.showPopup('compose_message',{to_personID:$(this).attr('objectID')});});$('.action-edit-profile[objectType]').live('click',function(){WIB.showPopup('profile_editor');});$('.action-edit-interests[objectType]').live('click',function(){WIB.showPopup('travel_interests_editor');});$('.action-edit-settings[objectType]').live('click',function(){WIB.showPopup('settings_editor');});},setProfilePhoto:function(objectType,objectID){$stamp=$('.chalkline.component .stamp img');$.get(WIB.apiURL+'?method=user.account.setphoto',{objectType:objectType,objectID:objectID},function(data){if(typeof(data.success)!='undefined'&&data.success==1){WIB.tooltip(data.message);if(typeof(data.stamp)!='undefined'&&data.update){$stamp.attr('src',data.stamp);}}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.tooltip(msgText);}},'json');},cancelFriendRequest:function(friendID){$.get(WIB.apiURL+'?method=friend.requestCancel',{friendID:friendID},function(data){if(typeof(data.success)!='undefined'&&data.success==1){WIB.tooltip(data.message);WIB.reload();}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.tooltip(msgText);}},'json');}};WIB.Component.AmazerTwo={getAffinityFeed:function(){$.get(WIB.apiURL+'?method=feed.getRecentFeedItem',{typeID:14},function(data){if(typeof(data.feed_item)!='undefined'&&data.feed_item){WIB.facebookShowFeed(data.feed_item);return true;}
WIB.showConfirmBox('You must fill out your map first, go to your map?',{okText:'Yes',cancelText:'No',okCallback:function(){location.href='/profile/wib/countries';WIB.hideConfirmBox();}});},'json');},render:function(){$('.amazer-two.component .tabs li[title]').each(function(){var tabID=$(this).attr('title').replace(/^tab-/,'');$(this).attr('tabID',tabID).removeAttr('title');});$('.amazer-two.component .content[title]').each(function(){var contentID=$(this).attr('title').replace(/^content-/,'');$(this).attr('contentID',contentID).removeAttr('title');});},init:function(){FB.ensureInit(function(){$('.amazer-two.component .tabs li.facebook-feed').show();});$('.amazer-two.component .wib-intro img').live('click',function(){WIB.requireLogin(function(){});});$('.amazer-two.component .tabs li').live('click',function(){var tabID=$(this).attr('tabID')
if(tabID==5){FB.Connect.requireSession(function(){WIB.Component.AmazerTwo.getAffinityFeed();});}else{if(tabID==1||tabID==6||WIB.loggedIn()){$(this).parents('.tabs').find('li').removeClass('active');$(this).addClass('active');$(this).parents('.amazer-two.component').find('.content').hide();$(this).parents('.amazer-two.component').find('.content[contentID='+$(this).attr('tabID')+']').show();}else{WIB.requireLogin(function(){location.href='/?active='+tabID;},' to setup your map');}}});}};WIB.Component.AnswerableQuestion={init:function(){$('.answerable-questions.component .answerable-question .comment a').live('click',function(e){var $question=$(this).parents('.answerable-question');var params={wallPostID:$question.attr('id').replace(/^answerable-question-/,''),wallPostType:$question.find('.wallPostType').val()};WIB.showPopup('wall_comment',params);});}};WIB.Component.AppsList={removeApp:function(appID){$.get(WIB.apiURL+'?method=mapplication.uninstall',{appID:appID},function(data){if(typeof(data.success)!='undefined'&&data.success==1){$('#app-'+appID).fadeOut(null,function(){$(this).remove();if($('.my-apps .app').length<1){$('.my-apps').addClass('empty');}});WIB.showMessage(data.message,'notice');}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error');}},'json');},init:function(){$('.my-apps a.remove').click(function(){appID=$(this).parent().parent().attr('id').replace(/^app-/,'');options={okCallback:function(){WIB.Component.AppsList.removeApp(appID);WIB.hidePopup();}};WIB.showConfirmBox(REMOVE_APP_TEXT,options);return false;});$app=$('#app-to-authorize');if($app.is('div')){WIB.showConfirmBox($app.html(),{okCallback:function(){url=location.href.replace(/#none$/,'')+'&response=yes';location.href=url;},okText:'Yes',cancelText:'No'});}}};WIB.Component.BookingBuddy={init:function(){Date.firstDayOfWeek=7;Date.format='mm/dd/yyyy';$('.booking-buddy.component .date-picker').datePicker({clickInput:true});$('.booking-buddy.component .start-date').bind('dpClosed',function(e,selectedDates){var d=selectedDates[0];if(d){d=new Date(d);$('.booking-buddy.component .end-date').dpSetStartDate(d.addDays(1).asString());}});$('.booking-buddy.component .end-date').bind('dpClosed',function(e,selectedDates){var d=selectedDates[0];if(d){d=new Date(d);$('.booking-buddy.component .start-date').dpSetEndDate(d.addDays(-1).asString());}});$('.booking-buddy.component form').livequery('submit',function(){$(this).find('.departure_month').val('');$(this).find('.departure_day').val('');$(this).find('.return_month').val('');$(this).find('.return_day').val('');var departure_date=$(this).find('.departure_date').val().split('/');if(departure_date.length==3){$(this).find('.departure_month').val(departure_date[0]+' '+departure_date[2]);$(this).find('.departure_day').val(departure_date[1]);}
var return_date=$(this).find('.return_date').val().split('/');if(return_date.length==3){$(this).find('.return_month').val(return_date[0]+' '+return_date[2]);$(this).find('.return_day').val(return_date[1]);}
var button_name=$(this).find('input[type="submit"]').val();WIB.clickTrack('Component','BookingBuddyComponent','clicked '+button_name,null);});}};WIB.Component.Bucks={isLoaded:false,isVisible:false,bucksInHand:0,updateBucks:function(){if(!WIB.Component.Bucks.isVisible){var url=WIB.ajaxURL+'?action=update_bucks&uID='+Person.uID+'&sID='+Person.sID+'&network='+CURRENT_NETWORK;$("#Bucks").load(url,null,function(data){var oldBucks=WIB.Component.Bucks.bucksInHand;if(WIB.Component.Bucks.bucksInHand!=oldBucks){$('#tb-my-bucks').fadeOut('fast',function(){$(this).css({backgroundColor:'#f7d23b'}).fadeIn('slow').animate({backgroundColor:'#333333'},'slow');});}});}},buyItem:function(inventoryID){$('.tb-content-box').hide();$('#tb-extended-content').slideUp('fast',function(){$.get(WIB.apiURL+'?method=bucks.buyitem',{inventoryID:inventoryID},function(data){WIB.clickTrack('site','travelbucks','buy',null);if(typeof(data.success)!='undefined'&&data.success==1){$.get(WIB.apiURL+'?method=component.get',{component:'Bucks',visible:1},function(data){if(typeof(data.content)!='undefined'){$('#travel-bucks').html(data.content);$('.tb-result.approved').show();WIB.Component.Bucks.showContentBox('thx');WIB.clickTrack('site','travelbucks','buy approved',null);}},'json');}
else{$('.tb-result.declined').show();WIB.Component.Bucks.showContentBox('thx');WIB.clickTrack('site','travelbucks','buy denied',null);}},'json');});},loadBucks:function(){WIB.Component.Bucks.isLoaded=true;$('#travel-bucks-loading').html($('#loading-graphic').html()).show();$.get(WIB.apiURL+'?method=component.get',{component:'Bucks',visible:1},function(data){if(typeof(data.content)!='undefined'){$('#travel-bucks').html(data.content);WIB.clickTrack('site','travelbucks','buy approved',null);}},'json');},showContentBox:function(box){$('.tb-content-box').hide();$('#tb-'+box+'-content').show();if(!WIB.Component.Bucks.isVisible){$.scrollTo($('#travel-bucks'));$('#tb-extended-content').show();$('#tb-content').slideDown('fast');$('#tb-backdrop').show();}
else{$('#tb-extended-content').slideDown('fast');}
if(box=='bonus'){$('#tb-bonus-content .tb-rewards-container').html('<iframe src="http://apps.kitnmedia.com/superrewards/offersdirect.php?h=kjhec&amp;uid='+
CURRENT_UID+'" frameborder="0" width="100%" height="600" scrolling="auto"></iframe>');}},hideExtendedContent:function(){$('#tb-extended-content').slideUp('fast',function(){$('.tb-content-box').hide();});},toggleContentBox:function(box){if($('#tb-'+box+'-content').css('display')==='none'){WIB.Component.Bucks.showContentBox(box);}
else{WIB.Component.Bucks.hideExtendedContent();}},toggle:function(){if($.url.param("action")=="showBucks"){$('#tb-nav').toggle();$('#tb-goals-menu').toggle();}
$('#tb-about-blurb').hide();if($('#tb-content').css('display')==='none'){right=$('body').width()-$('#content').width()-$('#content').position().left;$('#travel-bucks').css({position:'absolute',right:right,top:'20px'}).show();$('#tb-content').show();$('#tb-backdrop').show();WIB.clickTrack('site','travelbucks','show',null);}
else{$('#travel-bucks').hide();$('#tb-content').hide();$('#tb-backdrop').hide();WIB.clickTrack('site','travelbucks','hide',null);}
if($('#tb-content').css('display')=='none'){WIB.Component.Bucks.isVisible=false;$('#travel-bucks').removeClass('expanded');}
else{WIB.Component.Bucks.isVisible=true;$('#travel-bucks').addClass('expanded');}},render:function(isVisible){if(typeof(TRAVEL_BUCKS_EXPANDED)!='undefined'){isVisible=TRAVEL_BUCKS_EXPANDED;}
if(typeof(isVisible)!='undefined'){WIB.Component.Bucks.isVisble=isVisible?true:false;}
if(WIB.Component.Bucks.isVisible){$('#tb-content').show();$('#tb-backdrop').show();}
else{$('#tb-content').hide();$('#tb-backdrop').hide();}
WIB.Component.Bucks.bucksInHand=parseInt($('#tb-main .tb-box .tb-content-button').text().replace(/\W/,''));},init:function(isVisible){$('.tb-box, #tb-close-btn').live('click',function(){WIB.requireLogin(function(){WIB.hidePopup();WIB.Component.Bucks.toggle();if(!WIB.Component.Bucks.isLoaded){WIB.Component.Bucks.loadBucks();}},' to use Travel Bucks');});$('#tb-tips-close').live('click',function(){$('#tb-tips-content').toggle();$('#tb-content').toggle();$('#tb-backdrop').toggle();});$('#tb-help-link').live('click',function(){WIB.clickTrack('site','travelbucks','show help',null);WIB.Component.Bucks.toggleContentBox('help');});$('#tb-history-link').live('click',function(){WIB.clickTrack('site','travelbucks','show history',null);WIB.Component.Bucks.toggleContentBox('history');});$('#tb-earnings-link').live('click',function(){WIB.clickTrack('site','travelbucks','show earnings',null);WIB.Component.Bucks.toggleContentBox('earnings');});$('#tb-bonus-bucks').live('click',function(){WIB.Component.Bucks.toggleContentBox('bonus');});$('#tb-goals-menu a').live('click',function(){var goalID=this.id.replace(/^tb-goal-/,'');var divID='tb-goal-content-'+goalID;$('#tb-goals-content').html($('#'+divID).html());WIB.Component.Bucks.showContentBox('goals');WIB.clickTrack('site','travelbucks','show product',goalID);});$('#tb-extended-content-close-button').live('click',function(){WIB.clickTrack('site','travelbucks','hide extended content',null);WIB.Component.Bucks.hideExtendedContent();});if($.url.param("action")=="showBucks"){$('#tb-nav').hide();$('#tb-goals-menu').hide();$('#tb-content').show();$('#tb-backdrop').show();$('#tb-tips-content').show();}}};WIB.Component.Cms={collect:function(key,elt,mode){$(elt).html($('#loading-graphic').html());$.get(WIB.apiURL+'?method=component.get&component=cms',{key:key,mode:mode},function(data){if(typeof(data.content)!='undefined'){$(elt).html($(data.content));}},'json');},init:function(){$('.cms.component .edit-content').live('click',function(){var elt=$(this).parents('.cms-container');var key=$(this).parents('.cms-container').find('.key').val();WIB.Component.Cms.collect(key,elt,'edit');});$('.cms.component .actions .cancel').live('click',function(){var elt=$(this).parents('.cms-container');var key=$(this).parents('.cms-container').find('.key').val();WIB.Component.Cms.collect(key,elt,'');});$('.cms-edit-form').livequery('submit',function(){FCKeditorAPI.GetInstance('content').UpdateLinkedField();that=this;var elt=$(this).parents('.cms-container');var key=$(this).find('.key').val();$.post(WIB.apiURL+'?method=cms.save',$(that).serialize(),function(data){if(typeof(data.success)!='undefined'&&data.success==1){WIB.showMessage(data.message,'success','.cms-edit-form .messages',WIB.Component.Cms.collect(key,elt,''));}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','.cms-edit-form .messages');}},'json');return false;});}};WIB.Component.ComposeMessage={render:function(){$('.compose-message.component .api-form').each(function(){this.onSuccess=function(){WIB.ugcLog('inbox','message','compose');}});},init:function(){}};WIB.Component.ContentSwitch={render:function(){$('.content-switch .tabs li[title]').each(function(){var tabID=$(this).attr('title').replace(/^tab-/,'');$(this).attr('tabID',tabID).removeAttr('title');});$('.content-switch .content[title]').each(function(){var contentID=$(this).attr('title').replace(/^content-/,'');$(this).attr('contentID',contentID).removeAttr('title');});},init:function(){$('.content-switch .tabs li').live('click',function(){$(this).parents('.tabs').find('li').removeClass('active');$(this).addClass('active');$(this).parents('.content-switch').find('.contents .content').removeClass('active');$(this).parents('.content-switch').find('.contents .content[contentID='+$(this).attr('tabID')+']').addClass('active');});}};WIB.Component.ContestPromo={init:function(){$('.contest-promo.component .action-links .close-link').live('click',function(){WIB.hidePopup();});}};WIB.Component.CountryMap={init:function(){$('.country-map.component .publish-link').live('click',function(){FB.Connect.requireSession(function(){WIB.Component.AmazerTwo.getAffinityFeed();});});if(!WIB.inFacebook()){FB.ensureInit(function(){$('.country-map.component .fb-add-profile').each(function(){FB.Connect.showAddSectionButton('profile',this);});});}}};WIB.Component.CreateAlbum={uploaderSettings:{upload_url:window.location.protocol+'//'+window.location.hostname+WIB.apiURL+'?method=photo.upload',flash_url:'http://assets.whereivebeen.com/flash_common/swfupload.swf',file_size_limit:'10 MB',button_placeholder_id:'swf_upload_button',button_image_url:'http://assets.whereivebeen.com/images/XPButtonUploadText_61x22.png',button_width:61,button_height:22,file_post_name:'file',post_params:{},file_types:"*.jpg;*.gif;*.png",file_types_description:"Image Files"},init:function(){$('.component.create-album .save-btn').live('click',WIB.Component.CreateAlbum.saveAlbum);$('.component.create-album #file-upload-queue li[id]').live('click',function(){$.swfupload.getInstance('.multi-uploader').cancelUpload($(this).fadeOut(300,function(){$(this).remove();}).attr('id'));});$('.component.create-album select[name="albumID"]').livequery('change',function(){if($(this).val()){$('.component.create-album .album-create-select, .component.create-album .title-switch').removeClass('create-new');}else{$('.component.create-album .album-create-select, .component.create-album .title-switch').addClass('create-new');}});$('.component.create-album .cancel').live('click',function(){WIB.Component.CreateAlbum.cleanup();});},render:function(){var progressBar=$('<span>').addClass('progress');$('.multi-uploader').swfupload(WIB.Component.CreateAlbum.uploaderSettings).bind('fileQueued',function(event,file){var $a=$('<li>').text(file.name).attr('id',file.id);$('#file-upload-queue').append($a);}).bind('fileQueueError',function(event,file,errorCode,message){WIB.showMessage(message+": "+file.name,'error','.component.create-album .messages');}).bind('uploadStart',function(event,file){$('li#'+file.id).addClass('active').append(progressBar.text('0%'));}).bind('uploadProgress',function(event,file,bytesLoaded,totalBytes){var r=(bytesLoaded/totalBytes);var p=Math.round(100*r)+'%';var x=Math.round(20*r)*-30+'px 0';$('li#'+file.id+' .progress').text(p).css({backgroundPosition:x});}).bind('uploadSuccess',function(event,file,serverData){WIB.showMessage('File upload complete: '+file.name,'success','.component.create-album .messages');$('li#'+file.id).remove();}).bind('uploadComplete',function(event,file){var swfu=$.swfupload.getInstance(this);if(swfu.getStats().files_queued==0){var $redirect=$('.component.create-album input[name="redirect"]');var redirect=$redirect.size()?$redirect.val():null;WIB.Component.CreateAlbum.cleanup('Uploads complete!',redirect);return;}else{swfu.startUpload();}}).bind('uploadError',function(event,file,errorCode,message){WIB.showMessage(message+': '+file.name,'error','.component.create-album .messages');});},saveAlbum:function(){if(!$(this).hasClass('save-btn'))return;$(this).removeClass('save-btn');var $select=$('.component.create-album select[name="albumID"] option:selected');var $album=$('.component.create-album input[name="name"]');if($select.size()&&$select.val()){WIB.Component.CreateAlbum.finalize($select.text(),$select.val(),$select.attr('title'));}else if($album.val()&&$album.val()!=$album.attr('title')){$.get(WIB.apiURL+'?method=album.create',{name:$album.val()},function(data){if(typeof(data.success)!='undefined'&&data.success){WIB.Component.CreateAlbum.finalize($album.val(),data.albumID,data.redirect);}},'json');}else{WIB.showMessage('Select album or enter a name','error','.component.create-album .messages');$(this).addClass('save-btn');}},finalize:function(name,id,redirect){var swfu=$.swfupload.getInstance('.multi-uploader');var $a=$('.component.create-album .album-create-select');swfu.addPostParam('albumID',id);for(var $input=$('.component.create-album input[name]'),j=$input.size(),i=0;i<j;i++){swfu.addPostParam($input.eq(i).attr('name'),$input.eq(i).val());}
$a.empty().append($('<input>').attr({type:'hidden',name:'albumID'}).val(id)).append($('<input>').attr({type:'hidden',name:'redirect'}).val(redirect)).append($('<h1>').text(name));if(swfu.getStats().files_queued>0){swfu.startUpload();}else{WIB.Component.CreateAlbum.cleanup('Album created',redirect);}},cleanup:function(msg,redirect){var swfu=$.swfupload.getInstance('.multi-uploader');swfu.destroy();if(msg){WIB.showMessage(msg,'success','.component.create-album .messages',function(){WIB.hidePopup();if(redirect){window.location.href=redirect;}});}}};WIB.Component.Destinations={init:function(){$('.destinations .tags select').change(function(){$('#search-filter-form').submit();});$('.destinations .tags input[type="checkbox"]').change(function(){$('#search-filter-form').submit();});$('.destinations.component .search-filter .tags .hide-tags-btn').live('click',function(){$('.destinations.component .search-filter .tags .tag-holder').toggle(function(){if($(this).css('display')=='none'){$('.destinations.component .search-filter .tags .hide-tags-btn').html('+ Show Filters');}else{$('.destinations.component .search-filter .tags .hide-tags-btn').html('- Hide Filters');}});});$('.destinations a.read-more').live('click',function(){$(this).parents('.description').find('.content-remainder').toggle();});}};WIB.Component.DeveloperAppEditor={init:function(){$('#app-form').livequery('submit',function(){$form=$(this);try{$.each($form.find('input.req'),function(){$obj=$(this);if($obj.val()==''){throw"Missing required field: "+$obj.siblings('label').text().replace(/:$/,'');}});}
catch(msgText){WIB.showMessage(msgText,'error','.popup-box .messages');return false;}
$.post(WIB.apiURL+'?method=mapplication.save',$form.serialize(),function(data){if(typeof(data.success)!='undefined'&&data.success==1){msgText=data.message;$.get(WIB.apiURL+'?method=component.get',{component:'developer_apps_list'},function(data){WIB.hidePopup();$('.component.developer-apps-list').html(data.content);WIB.showMessage(msgText,'notice');},'json');}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','.popup-box .messages');}},'json');return false;});}};WIB.Component.DeveloperAppsList={deleteApp:function(appID){$.get(WIB.apiURL+'?method=mapplication.delete',{appID:appID},function(data){WIB.hideConfirmBox();if(typeof(data.success)!='undefined'&&data.success==1){$('#app-'+appID).fadeOut('normal',function(){$(this).remove();if($('.my-apps .app').length<1){$('.my-apps').addClass('empty');}});WIB.showMessage(data.message,'notice');}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error');}},'json');},init:function(){$('.my-apps a.create').live('click',function(){WIB.showPopup('DeveloperAppEditor');});$('.my-apps table .actions a.edit').live('click',function(){appID=$(this).parent().parent().attr('id').replace(/^app-/,'');WIB.showPopup('DeveloperAppEditor',{appID:appID});});$('.my-apps table .actions a.delete').live('click',function(){appID=$(this).parent().parent().attr('id').replace(/^app-/,'');WIB.showConfirmBox(DELETE_APP_TEXT,{okText:'Yes',cancelText:'No',okCallback:function(){WIB.Component.DeveloperAppsList.deleteApp(appID);}});});}};WIB.Component.ExtendedPermission={init:function(){FB.ensureInit(function(){$('.extended-permission.component .fb-add-profile').each(function(){FB.Connect.showAddSectionButton('profile',this);});});}};WIB.Component.FacebookConnect={render:function(){FB.ensureInit(function(){$(".facebook-connect.component .name").each(function(){FB.XFBML.Host.addElement(new FB.XFBML.Name(this));});$(".facebook-connect.component .profile-pic").each(function(){FB.XFBML.Host.addElement(new FB.XFBML.ProfilePic(this));});$(".facebook-connect.component .user-status").each(function(){FB.XFBML.Host.addElement(new FB.XFBML.UserStatus(this));});});},init:function(){$('#new-connect-account-form').livequery('submit',function(){var params=$(this).serialize();var user_object=WIB.Networks.Facebook.facebookSessionData();params+='&network=facebook';params+='&connect_user='+user_object.uid;params+='&connect_session_key='+user_object.session_key;WIB.out('connectRegister with uid '+user_object.uid+' and session_key '+user_object.session_key);$.get(WIB.apiURL+'?method=user.account.connectRegister',params,function(data){if(typeof(data.success)!='undefined'&&data.success==1){WIB.out(data.message);if(typeof(WIB.onLoginCallback)=='function'){WIB.onLogin();}else{WIB.reload();}}else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error');WIB.errorLog(msgText);}},'json');return false;});$('.facebook-connect.component .switch').live('click',function(){WIB.Networks.Facebook.connectLogin();WIB.hidePopup();return false;});$('.facebook-connect.component .connect').live('click',function(){WIB.Networks.Facebook.connectAttach();WIB.hidePopup();return false;});}};WIB.Component.FacebookFanBox={showBox:function(){FB.ensureInit(function(){$(".facebook-fan-box.component .facebook-fan-box").each(function(){FB.XFBML.Host.addElement(new FB.XFBML.Fan(this));});});},init:function(){setTimeout('WIB.Component.FacebookFanBox.showBox();',3000);}}
WIB.Component.FacebookInvite={init:function(){FB.ensureInit(function(){FB.Connect.ifUserConnected(function(){$(".facebook-invite.component .facebook-invite-form").each(function(){FB.XFBML.Host.addElement(new FB.XFBML.ServerFbml(this));});});});}}
WIB.Component.FeaturedDestinations={init:function(){$('.featured-destinations.component .header-title').live('click',function(){$('.featured-destinations.component .header-title').removeClass('active');$('.featured-destinations.component .inside').hide();$(this).addClass('active').next().show();});}};WIB.Component.Feed={getFeedItem:function(itemID){$.get(WIB.apiURL+'?method=feed.getFeedItem',{itemID:itemID},function(data){if(typeof(data.feed_item)!='undefined'&&data.feed_item){WIB.facebookShowFeed(data.feed_item);return true;}},'json');},getRecentFeedItem:function(typeID){$.get(WIB.apiURL+'?method=feed.getRecentFeedItem',{typeID:typeID},function(data){if(typeof(data.feed_item)!='undefined'&&data.feed_item){WIB.facebookShowFeed(data.feed_item);return true;}},'json');},init:function(){$(document).ready(function(){pf='.feed.component ';$(pf+'.feed-item-container .remove').live('click',function(){$a=$(this);itemID=$a.attr('id').replace(/^item-id-/,'');$div=$a.closest('.feed-item-container');WIB.showConfirmBox('Do you really want to delete this feed item?',{okText:'Yes',cancelText:'No',okCallback:function(){$.get(WIB.apiURL+'?method=feed.delete',{itemID:itemID},function(data){if(typeof(data.success)!='undefined'&&data.success==1){$div.fadeOut('normal',function(){$div.remove();if($(pf+'.inside .feed-item-container').length<1){$(pf+'.inside').addClass('empty');}});}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error');}},'json');WIB.hideConfirmBox();}});});$('.feed.component a.add-comment').live('click',function(){$(this).hide();$(this).parents('.comment-container').find('.new-comment-container .message').hide();$(this).parents('.comment-container').find('.new-comment-container').fadeIn(200,function(){$(this).find('textarea:first').focus();});return false;});$('.feed.component .new-comment-container a.cancel').live('click',function(){$(this).parents('.new-comment-container').fadeOut(200,function(){$(this).parents('.comment-container').find('a.add-comment').show();});return false;});$('.feed.component .comments .comment a.delete').live('click',function(){$(this).parents('.comment').fadeOut();$.get(WIB.apiURL+'?method=feed.comment.delete',{commentID:$(this).attr('id').replace(/^comment-id-/,'')},null,'json');});$('.feed.component .new-comment-container a.save').live('click',function(){that=this;comment=$(this).parents('.comment').find('.new-comment').val();params={comment:comment,itemID:$(this).attr('id').replace(/^item-id-/,'')};if(comment){WIB.requireLogin(function(){$.get(WIB.apiURL+'?method=feed.comment',params,function(data){if(typeof(data.success)!='undefined'&&data.success==1){$(that).parents('.comment-container').html(data.html)}},'json');},' to comment on this feed item');}else{$(this).parents('.comment').find('.message').show().html('Please enter a comment');}
return false;});});}};WIB.Component.Flaggrab={init:function(){$('.flaggrab.component a.login').live('click',function(){WIB.requireLogin(function(){location.reload();},'to play FlagGrab');});}};WIB.Component.FriendFinder={init:function(){$('#friend-finder-form').livequery('submit',function(){var emails=$('#friend_emails').val();if(emails==''){WIB.showMessage("Please enter at least one email address",'error','#content .messages');return false;}
$div=$('.friend-finder.component');$div.html($('#loading-graphic').html());$.get(WIB.apiURL+'?method=component.get',{component:'FriendFinder',emails:emails},function(data){if(typeof(data.content)!='undefined'){$div.html(data.content);}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','#content .messages');}},'json');return false;});$('#friend-finder-invite-form').livequery('submit',function(){$div=$('.friend-finder.component .invite');$div.html($('#loading-graphic').html());$.get(WIB.apiURL+'?method=message.sendInvite',$(this).serialize(),function(data){if(typeof(data.success)!='undefined'&&data.success==1){$div.html('<p class="success">'+data.message+'</p>');}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','#content .messages');}},'json');return false;});}};WIB.Component.FriendRequest={init:function(){$('#friend_request_add_message').live('click',function(){$box=$('#friend_request_message');$(this).attr('checked')?$box.show():$box.hide().val('');});$('.friend-request.component input[type="submit"].close').live('click',function(){WIB.hidePopup();});}};WIB.Component.FriendsBox={init:function(){$.each($('.friends-box.component .page-nav a'),function(i,obj){var page=$(this).attr('href').replace(/\?page=/,'');$(this).attr('href','#none').click(function(){$box=$('.friends-box.component');var height=$box.height()-50;$box.html($('#loading-graphic').html());$box.find('.loading').height(height);$.get(WIB.apiURL+'?method=component.get',{component:'friends-box',page:page},function(data){if(typeof(data.content)!='undefined'){$box.html($(data.content).html());}
else if(typeof(data.message)!='undefined'){$box.html(data.message);}
else{$box.html("Unknown error");}},'json');});});}};WIB.Component.FriendsList={removeFriend:function(friendID){$.get(WIB.apiURL+'?method=friend.remove',{friendID:friendID},function(data){if(typeof(data.success)!='undefined'&&data.success==1){$('#friend-'+friendID).fadeOut('normal',function(){$(this).remove();if($('.friends-list .friend').length<1){$('.friends-container').addClass('empty');}});}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error');}},'json');},init:function(){$('.friends-list.component li.send-message a').live('click',function(){var personID=$(this).parents('.friend').attr('id').replace(/^friend-/,'');WIB.showPopup('compose_message',{to_personID:personID});return false;});$('.friends-list.component li.remove-friend a').live('click',function(){friendID=$(this).closest('.friend').attr('id').replace(/^friend-/,'');WIB.showConfirmBox('Do you really want to remove this friend?',{okText:'Yes',cancelText:'No',okCallback:function(){WIB.Component.FriendsList.removeFriend(friendID);WIB.hideConfirmBox();}});});$('.friends-list.component li.add-friend a').live('click',function(){var personID=$(this).parents('.friend').attr('id').replace(/^friend-/,'');WIB.showPopup('friend_request',{friendID:personID});return false;});}};WIB.Component.HeaderNav={objectType:0,objectID:0,init:function(){$('.header-nav .actions li.upload-video a').click(function(e){WIB.showPopup('videos_upload',{objectType:WIB.Component.HeaderNav.objectType,objectID:WIB.Component.HeaderNav.objectID});});$('.header-nav .actions li.record-video a').click(function(e){WIB.showPopup('videos_record',{objectType:WIB.Component.HeaderNav.objectType,objectID:WIB.Component.HeaderNav.objectID});});$('.chalkline.component .actions li.compose a').click(function(e){WIB.showPopup('compose_message');});}};WIB.Component.Inbox={type:'to',firstID:null,lastID:null,getFirstID:function(){return $('.inbox-message:first').attr('id').replace(/^inbox-message-/,'');},getLastID:function(){return $('.inbox-message:last').attr('id').replace(/^inbox-message-/,'');},showLoadingMessage:function(){var $messages=$('.inbox-messages');var top=$messages.height()+$messages.offset().top;var left=$messages.offset().left;$('#inbox-loading').css({position:'absolute',top:top,left:left}).show();},hideLoadingMessage:function(){$('#inbox-loading').hide();},openMessage:function(messageID){$('.inbox-messages').scrollTo('#inbox-message-'+messageID);$('#inbox-message-'+messageID).addClass('open').removeClass('unread').addClass('read');if(WIB.Component.Inbox.type!='request'){WIB.Component.Inbox.setReadState(messageID,1);}},updateUnreadCount:function(count){if(count==0){$('.chalkline.component ul li.inbox span.red-notice').hide();}
else{$('.chalkline.component ul li.inbox span.red-notice').text(count).show();}},setReadState:function(messageID,state){state=typeof(state)!='undefined'?state:1;var params={messageID:messageID,state:state};$.get(WIB.apiURL+'?method=message.setreadstate',params,function(data){if(typeof(data.success)=='undefined'||!data.success){var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','#content .messages');}
if(typeof(data.unreadCount)!='undefined'){WIB.Component.Inbox.updateUnreadCount(data.unreadCount);}},'json');},deleteMessage:function(messageID){$.get(WIB.apiURL+'?method=message.delete',{messageID:messageID},function(data){if(typeof(data.success)=='undefined'||!data.success){var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','#content .messages');}},'json');},deleteNotification:function(notificationID){$.get(WIB.apiURL+'?method=notification.delete',{notificationID:notificationID},function(data){if(typeof(data.success)=='undefined'||!data.success){var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','#content .messages');}},'json');},denyFriendRequest:function(friendRequestID){$.get(WIB.apiURL+'?method=friend.deny',{friendRequestID:friendRequestID},function(data){if(typeof(data.success)=='undefined'||!data.success){var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','#content .messages');}},'json');},approveFriendRequest:function(friendRequestID){$.get(WIB.apiURL+'?method=friend.approve',{friendRequestID:friendRequestID},function(data){if(typeof(data.success)=='undefined'||!data.success){var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','#content .messages');}},'json');},removeMessageBox:function(messageID){$('#inbox-message-'+messageID).fadeOut('normal',function(){$(this).remove();count=0;$.each($('.inbox .inbox-message'),function(i,input){count=count+1;});if(count==0){$('.inbox .none').show();}});},init:function(){$('.inbox-message.to.unread').live('click',function(){var messageID=$(this).attr('id').replace(/^inbox-message-/,'');WIB.Component.Inbox.setReadState(messageID,1);$(this).removeClass('unread').addClass('read');});$('.inbox-message.to.read .mark-unread a').live('click',function(){var $message=$(this).parents('.inbox-message');var messageID=$message.attr('id').replace(/^inbox-message-/,'');WIB.Component.Inbox.setReadState(messageID,0);$message.removeClass('read').addClass('unread');});$('.compose').live('click',function(e){WIB.showPopup('compose_message');});$('.inbox-message.to .reply').live('click',function(e){var $message=$(this).parents('.inbox-message');var messageID=$message.attr('id').replace(/^inbox-message-/,'');WIB.showPopup('compose_message',{reply_to:messageID});});$('.inbox-message a.delete').live('click',function(){var $message=$(this).parents('.inbox-message');var messageID=$message.attr('id').replace(/^inbox-message-/,'');if(WIB.Component.Inbox.type=='request'){WIB.Component.Inbox.denyFriendRequest(messageID);}
else if(WIB.Component.Inbox.type=='notification'){WIB.Component.Inbox.deleteNotification(messageID);}
else{WIB.Component.Inbox.deleteMessage(messageID);}
WIB.Component.Inbox.removeMessageBox(messageID);});$('.inbox-message .read-more a').live('click',function(){$(this).parents('.inbox-message').addClass('open');});$('.inbox-message .read-less a').live('click',function(){$(this).parents('.inbox-message').removeClass('open');});$('.inbox-message.request a.approve').live('click',function(){var messageID=$(this).parents('.inbox-message').attr('id').replace(/^inbox-message-/,'');WIB.Component.Inbox.approveFriendRequest(messageID);WIB.Component.Inbox.removeMessageBox(messageID);});$('.inbox-message.request a.deny').live('click',function(){var messageID=$(this).parents('.inbox-message').attr('id').replace(/^inbox-message-/,'');WIB.Component.Inbox.denyFriendRequest(messageID);WIB.Component.Inbox.removeMessageBox(messageID);});$('.inbox-message.request .send-message a').live('click',function(e){var $message=$(this).parents('.inbox-message');var messageID=$message.attr('id').replace(/^inbox-message-/,'');var to_personID=$('#message_personID_'+messageID).val();var subject='RE: '+$message.find('.subject').text();WIB.showPopup('compose_message',{to_personID:to_personID,subject:subject});});if(typeof(INBOX_TYPE)!='undefined'){WIB.Component.Inbox.type=INBOX_TYPE;}
if(typeof(OPEN_MESSAGE)!='undefined'&&OPEN_MESSAGE!=''){WIB.Component.Inbox.openMessage(OPEN_MESSAGE);}}};WIB.Component.Invitation={init:function(){$('#invite_add_message').live('click',function(){$('#invite_message').toggle();});}};WIB.Component.KayakHotel={init:function(){Date.firstDayOfWeek=7;Date.format='mm/dd/yyyy';$('.kayak-hotel.component .date-picker').datePicker({clickInput:true});$('.kayak-hotel.component .start-date').bind('dpClosed',function(e,selectedDates){var d=selectedDates[0];if(d){d=new Date(d);$('.kayak-hotel.component .end-date').dpSetStartDate(d.addDays(1).asString());}});$('.kayak-hotel.component .end-date').bind('dpClosed',function(e,selectedDates){var d=selectedDates[0];if(d){d=new Date(d);$('.kayak-hotel.component .start-date').dpSetEndDate(d.addDays(-1).asString());}});}};WIB.Component.Like={collect:function(page,type,elt){$(elt).html($('#loading-graphic').html());$.get(WIB.apiURL+'?method=component.get&component=like',{page:page,type:type},function(data){if(typeof(data.content)!='undefined'){$(elt).html($(data.content));}},'json');},init:function(){$('.like.component .pagination.component a').live('click',function(){page=$(this).attr('title');type=$(this).parents('.like').find('input[type="hidden"].type').val();elt=$(this).parents('.like');WIB.Component.Like.collect(page,type,elt);return false;});}};WIB.Component.LoginRegister={waiting:false,jumptab:function(i){$('.login-register.component').find('.tabs li').removeClass('active');$('.login-register.component .content-switch').find('.tabs li[tabID='+i+']').addClass('active');$('.login-register.component .content-switch').find('.contents .content').removeClass('active');$('.login-register.component .content-switch').find('.contents .content[contentID='+i+']').addClass('active');},init:function(){$('.login-register.component .have-a-code, .login-register.component .get-a-code').live('click',function(){$('.login-register.component .password-form').toggle();return false;});$('.login-register.component a.login-switch').live('click',function(){WIB.Component.LoginRegister.jumptab(0);});$('.login-register.component a.signup-switch').live('click',function(){WIB.Component.LoginRegister.jumptab(1);});$('.login-register.component div.forgot-pw').live('click',function(){WIB.Component.LoginRegister.jumptab(2);});$('.login-register.component form').livequery('submit',function(){var msgPath='.login-register.component .messages';loginRegisterForm=this;WIB.clickTrack('site',$(loginRegisterForm).attr('id'),'submit');if(WIB.Component.LoginRegister.waiting){WIB.showMessage('Please only click the button once','notice',msgPath);return false;}
WIB.Component.LoginRegister.waiting=true;$.get(WIB.apiURL,$(this).serialize(),function(data){WIB.Component.LoginRegister.waiting=false;if(typeof(data.success)!='undefined'&&data.success==1){WIB.clickTrack('site',$(loginRegisterForm).attr('id'),'succes');if($(loginRegisterForm).attr('id')=='forgot-password-form'){email=$('.login-register.component #forgot_email').val();$('.login-register.component #reset_email').val(email);$(loginRegisterForm).fadeOut(300,function(){$('.login-register.component form#reset-password-form').fadeIn(300);});}else{WIB.justLoggedIn=true;if(typeof(WIB.onLoginCallback)=='function'){WIB.showMessage(data.message,'notice',msgPath);WIB.onLogin();}else{WIB.showMessage(data.message,'notice',msgPath);if(typeof(REDIRECT_URL)!='undefined'&&REDIRECT_URL!=''){location.href=REDIRECT_URL;}
else{WIB.reload();}}}}
else{WIB.clickTrack('site',$(loginRegisterForm).attr('id'),'fail');var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error',msgPath);}},'json');return false;});}};WIB.Component.LufthansaBooking={init:function(){Date.firstDayOfWeek=7;Date.format='mm.dd.yyyy';$('.lufthansa-booking.component .date-picker').datePicker({clickInput:true});$('.lufthansa-booking.component .start-date').bind('dpClosed',function(e,selectedDates){var d=selectedDates[0];if(d){d=new Date(d);$('.lufthansa-booking.component .end-date').dpSetStartDate(d.addDays(1).asString());}});$('.lufthansa-booking.component .end-date').bind('dpClosed',function(e,selectedDates){var d=selectedDates[0];if(d){d=new Date(d);$('.lufthansa-booking.component .start-date').dpSetEndDate(d.addDays(-1).asString());}});$('#quickbook').submit(function(){params=$(this).serialize();location.href='http://ad.doubleclick.net/clk;215581521;37041888;i?http://ad.doubleclick.net/clk;215752630;37704465;g?http://lh-booking.c24design.com/?'+params;return false;});}};WIB.Component.LufthansaFanDriver={init:function(){$('.lufthansa-fan-driver.component .close').click(function(){$('.lufthansa-fan-driver.component').fadeOut();});}};WIB.Component.Map={init:function(){},share:function(objectID,objectType){params={objectType:objectType,objectID:objectID};WIB.requireLogin(function(){WIB.showPopup(100,'compose_message',params);},' to share this');},writeReview:function(objectID,objectType){WIB.showPopup(100,'review_editor',{objectType:objectType,objectID:objectID});},favorite:function(objectID,objectType){WIB.requireLogin(function(){WIB.addFavourite(objectType,objectID);},' to mark this as a favorite');},viewReview:function(objectID,objectType){},lived:function(objectID,objectType){},been:function(objectID,objectType){},want:function(objectID,objectType){},friendsSeeAll:function(objectID,objectType){},uploadPhoto:function(objectID,objectType){params={objectType:objectType,objectID:objectID};WIB.requireLogin(function(){WIB.showPopup(100,'photo_editor',params);},' to upload a photo');}};WIB.Component.MobileSignup={init:function(){$('.mobile-signup.component a.terms-link').live('click',function(){WIB.showPopup('terms_and_conditions',{section:'mobile'});});$('.mobile-signup.component .signup-btn').click(function(){$('.mobile-signup.component form').submit();});$('.mobile-signup.component form').submit(function(){WIB.requireLogin(function(){var mobile=$('.mobile-signup.component input[type="text"]').val();$.get(WIB.apiURL+'?method=user.account.addMobile',{mobile:mobile},function(data){if(typeof(data.success)!='undefined'&&data.success==1){WIB.clickTrack('Component','MobileSignupComponent','added number',null);WIB.showMessage(data.message,'success','.mobile-signup.component .messages',WIB.hidePopup);}
else{WIB.clickTrack('Component','MobileSignupComponent','add number failed',null);var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','.mobile-signup.component .messages',WIB.hidePopup);}},'json');});return false;});}};WIB.Component.PhotoBox={photos:[],currentIndex:0,photoURL:null,updatePhoto:function(n){i=WIB.Component.PhotoBox.currentIndex+n;if(i<0){i=WIB.Component.PhotoBox.photos.length-1;}
else if(i>=WIB.Component.PhotoBox.photos.length){i=0;}
WIB.Component.PhotoBox.photoURL=WIB.Component.PhotoBox.photos[i].URL;var caption='';if(WIB.Component.PhotoBox.photos[i].caption){caption='<span>'+WIB.Component.PhotoBox.photos[i].caption+'</span>';}
$('.photo-box.component .caption').html(caption);$('.photo-box.component .photo').attr('src',WIB.Component.PhotoBox.photos[i].src);WIB.Component.PhotoBox.currentIndex=i;},init:function(){if(WIB.Component.PhotoBox.photos[0]){WIB.Component.PhotoBox.photoURL=WIB.Component.PhotoBox.photos[0].URL;}
$('.photo-box.component .photo').live('click',function(){if(WIB.Component.PhotoBox.photoURL){location.href=WIB.Component.PhotoBox.photoURL;}});$('.photo-box.component a.prev').live('click',function(){WIB.Component.PhotoBox.updatePhoto(-1);});$('.photo-box.component a.next').live('click',function(){WIB.Component.PhotoBox.updatePhoto(1);});}};WIB.Component.PhotoComments={init:function(){$(document).ready(function(){$('.photo-comments.component .comments .delete-comment a').live('click',function(){$a=$(this);commentID=$a.attr('id').replace(/^delete-comment-/,'');photoType=$('.photo-comments.component .api-form .photoType').val();photoID=$('.photo-comments.component .api-form .photoID').val();WIB.showConfirmBox('Do you really want to delete this review?',{okText:'Yes',cancelText:'No',okCallback:function(){$.get(WIB.apiURL+'?method=photo.comment.delete',{'photoType':photoType,'photoID':photoID,'commentID':commentID},function(data){if(typeof(data.success)!='undefined'&&data.success==1){WIB.showMessage('comment deleted','tooltip');}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','.photo-comments.component .api-form .messages');}},'json');$a.parents('.comment').fadeOut('normal',function(){$(this).remove();if($('.photo-comments.component .comment').length<1){$('.photo-comments.component').addClass('empty');}});WIB.hideConfirmBox();}});});});}};WIB.Component.PhotoEditor={init:function(){$(document).ready(function(){$('.photo-editor .photo-upload .tip a').live('click',function(){$('.photo-editor .photo-upload').toggle();});$('#photo-add-form').livequery('submit',function(){var objectType=$(this).find('input[name="objectType"]').val();$('#photo-add-target').unbind('load');$('#photo-add-target').load(function(){json_string=$(this).contents().find('#json-response').val();eval('var data='+json_string);if(typeof(data.success)!='undefined'&&data.success==1){if(typeof(data.feed_item)!='undefined'&&data.feed_item){WIB.facebookShowFeed(data.feed_item);}
WIB.ugcLog('photo',objectType);WIB.showMessage(data.message,'success','.photo-editor .messages',WIB.hidePopup);}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','.photo-editor .messages');}});});});}};WIB.Component.PhotoList={init:function(){$(document).ready(function(){$.each($('.image'),function(i,obj){var $image=$(obj);var height=parseInt($image.height());if(height<125){var marginTop=(125-height)/2;}});});$('.photo-list.component .confirm-delete-album').live('click',function(){WIB.showConfirmBox('Delete this album?',{okCallback:WIB.Component.PhotoList.deleteAlbum})});$('.photo-list.component .action-edit-album').live('click',function(){params={albumID:$('.photo-list.component input[name="albumID"]').val()};WIB.showPopup('edit-album',params);});$('.photo-list.component .action-import-photos').live('click',WIB.Component.PhotoList.importAll);$('.photo-list.component .action-import-photo').live('click',function(){WIB.Component.PhotoList.importPhoto(this);});$('.photo-list.component .action-upload-photos').live('click',function(){params={albumID:$('.photo-list.component input[name="albumID"]').val()};WIB.showPopup('CreateAlbum',params);});},importAll:function(){var params={albumID:$('.photo-list.component input[name="albumID"]').val()};$.get(WIB.apiURL+'?method=album.import',params,function(data){if(typeof(data.success)!='undefined'&&data.success!=0){WIB.showMessage('Your photos will be imported','notice',null,function(){if(!(params.albumID>0)){window.location.href=data.redirect;}});}else{WIB.showMessage(data.message||'Unknown Error','error');}},'json');},importPhoto:function(dom){var id=$(dom).text('').removeClass().addClass('loading-busy').attr('title');var params={albumID:$('.photo-list.component input[name="albumID"]').val(),pID:id};$.get(WIB.apiURL+'?method=album.importPhoto',params,function(data){if(typeof(data.success)!='undefined'&&data.success){if(!(params.albumID>0)){window.location.href=data.redirect;}
$(dom).parent().find('a.photoViewer').removeClass().attr('href',data.href).end().end().remove();}},'json');},deleteAlbum:function(){var params={albumID:$('.photo-list.component input[name="albumID"]').val()};WIB.clickTrack('site','photoList','album deleted');$.get(WIB.apiURL+'?method=album.delete',params,function(data){WIB.hideConfirmBox();if(typeof(data.message)!='undefined'&&data.success){WIB.showMessage(data.message,'success',null,WIB.reload);}else{WIB.showMessage(typeof(data.message)=='undefined'?'Unknown Error':data.message,'error');}},'json');}};WIB.Component.PhotoView={photoID:null,deletePhoto:function(){$.get(WIB.apiURL+'?method=photo.delete',{photoID:WIB.Component.PhotoView.photoID},function(data){if(typeof(data.success)!='undefined'&&data.success==1){WIB.showMessage(data.message,'notice','#content .messages');var $nav=$('.photo-view.component .album-nav a.next');if($nav.is('a')){var url=$nav.attr('href');}
else{var url=$('.photo-view.component .photo .album a').attr('href');}
location.href=url;}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','#content .messages');}},'json');},init:function(){$('#photo_url').click(function(){$(this).select();});if(typeof(PHOTO_ID)!='undefined'){WIB.Component.PhotoView.photoID=PHOTO_ID;}}};WIB.Component.Poll={questionID:null,prevID:null,nextID:null,answerQuestion:function(answer){$('.poll.component .poll-box>.inside').html($('#loading-graphic').html());if(window.location.pathname.indexOf('home')>-1){window.location.href='/community/poll?p='+answer+'&pollID='+WIB.Component.Poll.pollID;}else{$.get(WIB.apiURL+'?method=poll.answer',{pollID:WIB.Component.Poll.pollID,answer:answer},function(data){if(typeof(data.success)!='undefined'&&data.success==1){WIB.Component.Poll.loadQuestion(WIB.Component.Poll.pollID);if(typeof(data.feed_item)!='undefined'&&data.feed_item){WIB.facebookShowFeed(data.feed_item);}}else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','#content .messages');}},'json');}},loadQuestion:function(pollID){$qotd=$('.poll.component');$qotd.find('.poll-box>.inside').html($('#loading-graphic').html());$.get(WIB.apiURL+'?method=component.get',{component:'poll',pollID:pollID},function(data){if(typeof(data.content)!='undefined'){$qotd.replaceWith(data.content);WIB.Component.Poll.render();}
else if(typeof(data.message)!='undefined'){$qotd.html(data.message);}
else{$qotd.html('Unknown error');}},'json');},prevQuestion:function(){if(WIB.Component.Poll.prevID){WIB.Component.Poll.loadQuestion(WIB.Component.Poll.prevID);}},nextQuestion:function(){if(WIB.Component.Poll.nextID){WIB.Component.Poll.loadQuestion(WIB.Component.Poll.nextID);}},render:function(){$(document).ready(function(){if(!$('.poll.component .poll-box').hasClass('rendered')){$('.poll.component .poll-box').addClass('rendered');}});},init:function(){$('.poll.component .nav a.prev').live('click',function(){WIB.Component.Poll.prevQuestion();});$('.poll.component .nav a.next').live('click',function(){WIB.Component.Poll.nextQuestion();});$.each(['A','B','C','D'],function(i,choice){$('.poll.component li.choice-'+choice+' a').live('click',function(){if(!$('.poll.component li.my-answer').is('li')){WIB.requireLogin(function(){WIB.Component.Poll.answerQuestion(choice);},' to answer this poll');}});});}};WIB.Component.PollResults={questionID:null,prevID:null,nextID:null,loadQuestion:function(pollID){$qotd=$('.poll-results.component');$qotd.find('.poll-box>.inside').html($('#loading-graphic').html());$.get(WIB.apiURL+'?method=component.get',{component:'pollResults',p:pollID},function(data){if(typeof(data.content)!='undefined'){$qotd.replaceWith(data.content);WIB.Component.poll-results.render();}
else if(typeof(data.message)!='undefined'){$qotd.html(data.message);}
else{$qotd.html('Unknown error');}},'json');},prevQuestion:function(){if(WIB.Component.PollResults.prevID){WIB.Component.PollResults.loadQuestion(WIB.Component.PollResults.prevID);}},nextQuestion:function(){if(WIB.Component.PollResults.nextID){WIB.Component.PollResults.loadQuestion(WIB.Component.PollResults.nextID);}},render:function(){$(document).ready(function(){if(!$('.poll-results.component .poll-box').hasClass('rendered')){$('.poll-results.component .poll-box').addClass('rendered');}});},init:function(){$('.poll-results.component .nav a.prev').live('click',function(){WIB.Component.PollResults.prevQuestion();});$('.poll-results.component .nav a.next').live('click',function(){WIB.Component.PollResults.nextQuestion();});}};WIB.Component.ProfileBox={init:function(){$(document).ready(function(){$('.profile-box .about-me a.read-more').click(function(){$('.profile-box .about-me').toggle();});$('.profile-box a.edit').click(function(e){WIB.showPopup('profile_editor');});});}};WIB.Component.ProfileEditor={setDefaultText:function(){$('#profile-view span.value:empty').html($('#empty-value-text').html());},showFormSection:function(section){$('.profile-editor.component .api-form .form-section').hide();$('.profile-editor.component .api-form #'+section+'-section').show();$('.sub-nav.component li a').removeClass('active');$('#'+section+'-section-link').addClass('active');},render:function(){$('#profile_aboutMeNetwork, #profile_statusNetwork').each(function(i,n){if($(this).val()){$(this).parents('.form-item-group').find('.form-item:eq(1)').hide();}else{$(this).parents('.form-item-group').find('.form-item:eq(1)').show();}});$('.profile-editor.component .api-form input[type="text"].suggester').each(function(i,input){if(!$(this).hasClass('active-suggestor')){$(this).addClass('active-suggestor');var $input=$(input);var types=['city','country','airport','currency','language'];for(i=0;i<types.length;i++){if($input.hasClass('suggest-'+types[i])){var type=types[i];break;}}
if(typeof(type)!='undefined'){WIB.addSuggester($(input).attr('id').replace(/_text$/,''),type);}}});},init:function(){$('.profile-editor.component .api-form .add-input-box').live('click',function(){var idArray=$(this).parent().parent().children('.form-item:last').attr('id').split('_');var divID=idArray[0]+'_'+(parseInt(idArray[1])+1).toString();var $div=$(this).parent().clone().attr({id:divID}).addClass('additional');$div.find('input[type="text"]').attr({id:divID+'_text',value:''});$div.find('input[type="hidden"]').attr({id:divID+'_value',value:''});$(this).parent().parent().append($div);var $textBox=$div.find('input[type="text"]');if($textBox.hasClass('suggest-country')){WIB.addSuggester(divID,'country');}
else if($textBox.hasClass('suggest-language')){WIB.addSuggester(divID,'language');}
$div.find('a.remove-input-box').live('click',function(){$(this).parent().remove();});});$('.profile-editor.component .api-form a.remove-input-box').live('click',function(){$(this).parent().remove();});$('.profile-editor.component .api-form input.suggester').livequery('focus',function(){$(this).select();});$('.profile-editor.component .delete-account').livequery('click',function(){WIB.showConfirmBox('You are about to delete your account, this is permanent.  Are you sure?',{okText:'Yes, Delete it now',cancelText:'No',okCallback:function(){$.get(WIB.apiURL+'?method=user.account.delete',{},function(data){if(typeof(data.success)!='undefined'&&data.success==1){WIB.showMessage(data.message,'success');WIB.clickTrack('site','Delete Account','deleted',null);location.href="/message.php?msg=Thank you for using Where I've Been";}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error');}},'json');WIB.hideConfirmBox();}});});$('#profile_url').live('keyup',function(){$(this).val($(this).val().replace(/[^0-9a-zA-Z]/,''));$(this).parent().find('span.tip strong').text($(this).val());});$('#profile_aboutMeNetwork, #profile_statusNetwork').livequery('change',function(){if($(this).val()){$(this).parents('.form-item-group').find('.form-item:eq(1)').hide();}else{$(this).parents('.form-item-group').find('.form-item:eq(1)').show();}});$('.profile-editor.component .api-form .sub-nav li a').live('click',function(){$('.profile-editor.component .api-form .form-section').hide();$('.profile-editor.component .api-form #'+$(this).attr('id').replace(/-link$/,'')).show();});}};WIB.Component.ProfileInfo={init:function(){$('.profile-info.component .edit-profile').live('click',function(){WIB.showPopup('profile_editor');});}};WIB.Component.PromoBox={init:function(){$(document).ready(function(){$(".promo-box.component #lufthansa-contest-terms-and-conditions").live('click',function(){WIB.showPopup('contest_promo',{active_tab:'0'});});$('.promo-box.component .promo-form').livequery('submit',function(){WIB.requireLogin(function(){if($('.promo-box.component .promo-form #terms_agree').attr('checked')){$.get(WIB.apiURL+'?method=promo.enter',$('.promo-box.component .promo-form').serialize(),function(data){if(typeof(data.success)!='undefined'&&data.success==1){WIB.showMessage('Your email has been entered','notice');}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','.where-ive-been.component .messages');}},'json');}else{$('.promo-box.component .promo-form label[for="terms_agree"]').css({fontWeight:'bold',backgroundColor:'red'})}},' to enter the contest');return false;});});}};WIB.Component.Qotd={questionID:null,prevID:null,nextID:null,answerQuestion:function(answer){$('.qotd.component .qotd-box>.inside').html($('#loading-graphic').html());$.get(WIB.apiURL+'?method=trivia.answer',{questionID:WIB.Component.Qotd.questionID,answer:answer},function(data){if(typeof(data.success)!='undefined'&&data.success==1){WIB.Component.Qotd.loadQuestion(WIB.Component.Qotd.questionID);if(typeof(data.feed_item)!='undefined'&&data.feed_item){WIB.facebookShowFeed(data.feed_item);}
if(typeof(data.stats)!='undefined'){$('.qotd-stats .correct-score').text(data.stats.totalCorrect);$('.qotd-stats .incorrect-score').text(data.stats.totalIncorrect);}}else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','#content .messages');}},'json');},loadQuestion:function(questionID){$qotd=$('.qotd.component');$qotd.find('.qotd-box>.inside').html($('#loading-graphic').html());$.get(WIB.apiURL+'?method=component.get',{component:'qotd',q:questionID},function(data){if(typeof(data.content)!='undefined'){$qotd.replaceWith(data.content);WIB.Component.Qotd.render();}
else if(typeof(data.message)!='undefined'){$qotd.html(data.message);}
else{$qotd.html('Unknown error');}},'json');},prevQuestion:function(){if(WIB.Component.Qotd.prevID){WIB.Component.Qotd.loadQuestion(WIB.Component.Qotd.prevID);}},nextQuestion:function(){if(WIB.Component.Qotd.nextID){WIB.Component.Qotd.loadQuestion(WIB.Component.Qotd.nextID);}},render:function(){$(document).ready(function(){if(!$('.qotd.component .qotd-box').hasClass('rendered')){$('.qotd.component .qotd-box').addClass('rendered');$('.qotd.component li.my-answer.correct a').append(' <span class="correct-answer">You got it right!</span> ');if($('.qotd.component li.my-answer').hasClass('incorrect')){$('.qotd.component li.my-answer.incorrect a').append(' <span class="incorrect-answer">(your answer)</span> ')
$('.qotd.component li.correct a').append(' <span class="correct-answer">(correct answer)</span> ');}}});},init:function(){$('.qotd.component .nav a.prev').live('click',function(){WIB.Component.Qotd.prevQuestion();});$('.qotd.component .nav a.next').live('click',function(){WIB.Component.Qotd.nextQuestion();});$.each(['A','B','C','D'],function(i,choice){$('.qotd.component li.choice-'+choice+' a').live('click',function(){if(!$('.qotd.component li.my-answer').is('li')){WIB.requireLogin(function(){WIB.Component.Qotd.answerQuestion(choice);},' to answer this question of the day');}});});}};WIB.Component.QotdStats={showStatsView:function(className){$('.qotd-stats-view').hide();$('.'+className).show();},init:function(){$('.qotd-stats.component').live('click',function(){location.href='/community/trivia';});$.each($('.qotd-stats.component .qotd-stats-nav a'),function(i,obj){$a=$(obj);if(!$a.is('.active')){$a.click(function(){var viewClass=$(this).attr('class').replace(/-activator$/,'');$('.qotd-stats-view').hide();$('.'+viewClass).show();return false;});}});$('.qotd-stats.component .qotd-stats-nav a.active').click(function(){return false;});}};WIB.Component.Questions={defaultInputHeight:0,dontChangeSize:false,boxToggle:function(size){if(size=='expand'){$(".questions.component textarea.ask-question").css("height","150px");$('.questions.component .cancel').show();$('.questions.component .see-all').hide();}else if(!WIB.Component.Questions.dontChangeSize){$(".questions.component textarea.ask-question").css("height",WIB.Component.Questions.defaultInputHeight);$('.questions.component .cancel').hide();$('.questions.component .see-all').show();}},render:function(){$('.questions.component .api-form').each(function(){this.onSuccess=function(){var objectType=$('.questions.component .api-form input[name="objectType"]').val();WIB.ugcLog('question',objectType);}});},init:function(){WIB.Component.Questions.defaultInputHeight=$('.questions.component textarea.ask-question').height();$('.questions.component textarea.ask-question').livequery('focus',function(){WIB.Component.Questions.boxToggle('expand');});$('.questions.component textarea.ask-question').livequery('blur',function(){WIB.Component.Questions.boxToggle('contract');});$('.questions.component .cancel span').live('click',function(){WIB.Component.Questions.boxToggle('contract');});$('.questions.component input[type="submit"]').live('mouseover',function(){WIB.Component.Questions.dontChangeSize=true;}).live('mouseout',function(){WIB.Component.Questions.dontChangeSize=false;});}};WIB.Component.ReviewCreator={render:function(){$(".review-creator.component .thumbs-overview .thumbs .thumb-up").css({backgroundPosition:'0px 0px'});$(".review-creator.component .thumbs-overview .thumbs .thumb-down").css({backgroundPosition:'111px 0px'});switch($(".review-creator.component input[name=rating]").val()){case'1':$(".review-creator.component .thumbs-overview .thumbs .thumb-up").css({backgroundPosition:'0px 220px'});$(".review-creator.component .thumbs-overview .thumbs .thumb-down").css({backgroundPosition:'111px 440px'});break;case'-1':$(".review-creator.component .thumbs-overview .thumbs .thumb-down").css({backgroundPosition:'111px 220px'});$(".review-creator.component .thumbs-overview .thumbs .thumb-up").css({backgroundPosition:'0px 440px'});}},init:function(){$('.review-creator .thumbs .thumb-up').live('mouseover',function(){$(this).css({backgroundPosition:'0px 220px'});}).live('mouseout',function(){WIB.Component.ReviewCreator.render();}).live('click',function(){$(".review-creator.component input[name=rating]").val(1);});$('.review-creator .thumbs .thumb-down').live('mouseover',function(){$(this).css({backgroundPosition:'111px 220px'});}).live('mouseout',function(){WIB.Component.ReviewCreator.render();}).live('click',function(){$('.review-creator.component input[name="rating"]').val(-1);});$('.review-creator.component .api-form').each(function(){this.onSuccess=function(){var objectType=$('.review-creator.component .api-form .objectType').val();WIB.ugcLog('review',objectType);}});}};WIB.Component.ReviewEditor={render:function(){$(".review-editor.component .api-form .thumbs-overview .thumbs .thumb-up").css({backgroundPosition:'0px 0px'});$(".review-editor.component .api-form .thumbs-overview .thumbs .thumb-down").css({backgroundPosition:'111px 0px'});switch($(".review-editor.component .api-form input[name=rating]").val()){case'1':$(".review-editor.component .api-form .thumbs-overview .thumbs .thumb-up").css({backgroundPosition:'0px 220px'});$(".review-editor.component .api-form .thumbs-overview .thumbs .thumb-down").css({backgroundPosition:'111px 440px'});break;case'-1':$(".review-editor.component .api-form .thumbs-overview .thumbs .thumb-down").css({backgroundPosition:'111px 220px'});$(".review-editor.component .api-form .thumbs-overview .thumbs .thumb-up").css({backgroundPosition:'0px 440px'});}},init:function(){$('.review-editor .thumbs .thumb-up').live('mouseover',function(){$(this).css({backgroundPosition:'0px 220px'});}).live('mouseout',function(){WIB.Component.ReviewEditor.render();}).live('click',function(){$(".review-editor.component .api-form input[name=rating]").val(1);});$('.review-editor .thumbs .thumb-down').live('mouseover',function(){$(this).css({backgroundPosition:'111px 220px'});}).live('mouseout',function(){WIB.Component.ReviewEditor.render();}).live('click',function(){$(".review-editor.component .api-form input[name=rating]").val(-1);});$('.review-editor.component .api-form .del-btn').live('click',function(){that=this;var reviewType=$('.review-editor.component .api-form .objectType').val();var reviewID=$('.review-editor.component .api-form .objectID').val();var placeType=$('.review-editor.component .api-form .placeType').val();WIB.showConfirmBox('You are about to delete your review, this is permanent.  Are you sure?',{okText:'Yes',cancelText:'No',okCallback:function(){$.get(WIB.apiURL+'?method=review.delete',{reviewType:reviewType,reviewID:reviewID,placeType:placeType},function(data){if(typeof(data.success)!='undefined'&&data.success==1){WIB.showMessage(data.message,'success','.review-editor.component .api-form .messages',WIB.hidePopup);}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','.review-editor.component .api-form .messages');}},'json');WIB.hideConfirmBox();}});});$('.review-editor.component .api-form').each(function(){this.onSuccess=function(){var placeType=$('.review-editor.component .api-form .placeType').val();WIB.ugcLog('review',placeType,'edit');}});}};WIB.Component.Reviews={getObjectID:function($a){return $a.closest('.review').attr('id').replace(/^review-/,'');},getObjectType:function($a){return $a.closest('.review').attr('class').replace(/^(.*)\s/,'').replace(/-type$/,'');},deleteReview:function(reviewID,reviewType){placeType=reviewType.replace(/review/i,'');params={reviewType:reviewType,reviewID:reviewID};$.get(WIB.apiURL+'?method=review.delete',params,function(data){if(typeof(data.success)!='undefined'&&data.success==1){$('#review-'+reviewID).fadeOut('normal',function(){$(this).remove();if($('.reviews-container .review').length<1){$('.reviews-container').addClass('empty');}});WIB.showMessage(data.message,'success');}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error');}},'json');},init:function(){pf='.reviews.component ';$(pf+'a.edit-review').live('click',function(){$a=$(this);WIB.showPopup('review_editor',{objectType:WIB.Component.Reviews.getObjectType($a),objectID:WIB.Component.Reviews.getObjectID($a)});});$(pf+'a.report-review').live('click',function(){$a=$(this);WIB.requireLogin(function(){WIB.showPopup('report',{objectID:WIB.Component.Reviews.getObjectID($a),objectType:WIB.Component.Reviews.getObjectType($a)});},' to report this review');});$(pf+'a.like-review').live('click',function(){$a=$(this);WIB.requireLogin(function(){WIB.addLike(WIB.Component.Reviews.getObjectType($a),WIB.Component.Reviews.getObjectID($a),$a);},' to mark this as something you like');});$(pf+'a.delete-review').live('click',function(){$a=$(this);WIB.showConfirmBox('Do you really want to delete this review?',{okText:'Yes',cancelText:'No',okCallback:function(){WIB.Component.Reviews.deleteReview(WIB.Component.Reviews.getObjectID($a),WIB.Component.Reviews.getObjectType($a));WIB.hideConfirmBox();}});});}};WIB.Component.SearchActions={init:function(){$('.search-actions.component ul li').live('mouseover',function(){$(this).css({backgroundColor:'#A9E4FD'});}).live('mouseout',function(){$(this).css({backgroundColor:''});});}};WIB.Component.SearchBar={jumpTo:function(li){var ro=li.extra?li.extra[0]:li.selectValue;var placeParts=ro.split(':');var url='/'+placeParts[0]+'/'+placeParts[1]+'_fromSearch/';location.href=url;},render:function(){$('.search-bar.component input[type="text"].suggester').each(function(i,input){if(!$(this).hasClass('active-suggestor')){$(this).addClass('active-suggestor');$(this).autocomplete(WIB.apiURL,{extraParams:{method:'autocomplete.place'},onItemSelect:function(li){WIB.Component.SearchBar.jumpTo(li);},onFindValue:function(li){WIB.Component.SearchBar.jumpTo(li);},dataFormat:'json',matchSubset:false,minChars:2,width:300});$(this).change(function(){if($(this).val()==''){$(this).parents('.search-bar.component').find('.searchPlace_value').attr({value:''});}});}});},init:function(){$('.search-bar.component .search-button').live('click',function(){$(this).parents('.search-bar.component').find('.search-form').submit();}).live('mouseover',function(){$(this).css({backgroundPosition:'0 -31px'});$(this).parents('.search-bar.component').find('.search-box').css({borderColor:'#158BE2'});}).live('mouseout',function(){$(this).css({backgroundPosition:'0 0'});$(this).parents('.search-bar.component').find('.search-box').css({borderColor:'#D5952F'});});$('.search-bar.component .search-form').livequery('submit',function(){$(this).parents('.search-bar.component').find('.search-box').css({backgroundImage:"url('http://assets.whereivebeen.com/images/site/loading-on-white.gif')"});});}};WIB.Component.SearchResults={init:function(){$('.search-results a.read-more').click(function(){$(this).parents('.description').find('.content-remainder').toggle();});$('.search-results .actions-dropdown').click(function(){$(this).find('.actions-list').toggle();});}};WIB.Component.SettingsEditor={render:function(){$('#settings_nameNetwork, #settings_sexNetwork').each(function(i,n){if($(this).val()){$(this).parents('.form-item-group').find('.form-item:eq(1)').hide();}else{$(this).parents('.form-item-group').find('.form-item:eq(1)').show();}});},init:function(){$('#settings_change_password').live('click',function(){if($(this).attr('checked')){$('#change-password').show();}
else{$('#change-password input[type="password"]').attr('value','');$('#change-password').hide();}});$('#settings_nameNetwork, #settings_sexNetwork').livequery('change',function(){if($(this).val()){$(this).parents('.form-item-group').find('.form-item:eq(1)').hide();}else{$(this).parents('.form-item-group').find('.form-item:eq(1)').show();}});$('#settings_url').live('keyup',function(){$(this).val($(this).val().replace(/[^0-9a-zA-Z]/,''));if($(this).val()==''){$(this).parent().find('span.tip strong').text($(this).parent().find('#original_settings_url').val());}else{$(this).parent().find('span.tip strong').text($(this).val());}});$('.settings-editor.component .api-form').each(function(){this.validate=function(){if($("#settings_url").val()){$(this).addClass('use-confirm-message');}else{$(this).removeClass('use-confirm-message');}
return true;};});}};WIB.Component.Shop={init:function(){$('.shop select[name="categoryID"]').livequery('change',function(){var t=$(this).val();if(t>0){window.location.href=window.location.pathname+'?categoryID='+t;}});}};WIB.Component.SignInUp={init:function(){$('.sign-in-up a.logout').live('click',function(){$.get(WIB.apiURL,{method:'user.account.logout'},function(data){FB.ensureInit(function(){FB.Connect.logout(function(){location.href='/';})})},'json');});$('.fb-login').live('click',function(){FB.Connect.requireSession();});$('.sign-in-up a.login').live('click',function(){WIB.showPopup('login_register',{active_tab:'0'});});$('.sign-in-up a.register').live('click',function(){WIB.showPopup('login_register',{active_tab:'1'});});}};WIB.Component.Spotlight={switchPlace:function(li){var ro=li.extra?li.extra[0]:li.selectValue;$('.spotlight.component').each(function(){var content=$(this).find('.content').val();$(this).html($('#loading-graphic').html());$(this).load(WIB.apiURL+'?method=component.get&component=spotlight&format=html&place='+ro+'&content='+content+' .container',{},function(){WIB.init("Component.Spotlight");});});},render:function(){$('.spotlight.component input[type="text"].suggester').each(function(i,input){if(!$(this).hasClass('active-suggestor')){$(this).addClass('active-suggestor');WIB.addSuggester($(this).attr('id').replace(/_text$/,''),'place',function(li){WIB.Component.Spotlight.switchPlace(li);});}});},init:function(){$('.spotlight.component .add-photo').live('click',function(){WIB.out($(this).parents('.spotlight.component'));var place=$(this).parents('.spotlight.component').find('.spotlightPlace_value').val();params={place:place};WIB.requireLogin(function(){WIB.showPopup('photo_editor',params);},' to upload a photo');});$('.spotlight.component .add-video').live('click',function(){var place=$(this).parents('.spotlight.component').find('.spotlightPlace_value').val();params={place:place};WIB.requireLogin(function(){WIB.showPopup('upload_record_video',params);},' to upload or record a video');});$('.spotlight.component .add-review').live('click',function(){var place=$(this).parents('.spotlight.component').find('.spotlightPlace_value').val();params={place:place};WIB.showPopup('review_creator',params);});}};WIB.Component.SubNav={init:function(){$('.sub-nav.component li a').live('click',function(){$('.sub-nav.component li a').removeClass('active');$(this).addClass('active');});$('.sub-nav.component .dropdown .sub-nav-jump').livequery('change',function(){if($(this).val()){location.href=$(this).val();}});}};WIB.Component.ThumbnailUploader={render:function(){$('#profilePhotoNetwork').each(function(i,n){if($(this).val()){$(this).parents('.upload-thumbnail').find('.form-item:eq(1)').hide();}else{$(this).parents('.upload-thumbnail').find('.form-item:eq(1)').show();}});},init:function(){$('.thumbnail-uploader .photo-upload .tip a').live('click',function(){$('.thumbnail-uploader .photo-upload').toggle();});$('#profilePhotoNetwork').livequery('change',function(){if($(this).val()){$(this).parents('.upload-thumbnail').find('.form-item:eq(1)').hide();}else{$(this).parents('.upload-thumbnail').find('.form-item:eq(1)').show();}});$('#thumbnail-form').livequery('submit',function(){$('#thumbnail-target').unbind('load');$('#thumbnail-target').load(function(){json_string=$(this).contents().find('#json-response').val();eval('var data='+json_string);if(typeof(data.success)!='undefined'&&data.success==1){if(typeof(data.feed_item)!='undefined'&&data.feed_item){WIB.facebookShowFeed(data.feed_item,true);}
WIB.showMessage(data.message,'success','.thumbnail-uploader .messages',WIB.hidePopup);}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','.thumbnail-uploader .messages');}});});}};WIB.Component.TravelInterestsEditor={saveInterests:function(){params='';$.each($('#selected-interests-list li'),function(i,obj){var rank=i+1;params+='&interests['+rank+']='+$(obj).attr('id').replace(/^selected-interest-/,'');});$.get(WIB.apiURL+'?method=user.account.updateInterests'+params,{},function(data){if(typeof(data.success)!='undefined'&&data.success==1){WIB.showMessage(data.message,'notice','#content .messages');}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','#content .messages');}},'json');},selectInterest:function(interestID){var name=$('#interest-'+interestID+' label').text();$('#interest_'+interestID).attr('checked',true);$('#interest-'+interestID).addClass('selected');$('#selected-interests-list').append('<li id="selected-interest-'+interestID+'"><span class="number"></span><span class="name">'+name+'</span><div class="clr"></div></li>');},unselectInterest:function(interestID){$('#interest-'+interestID).removeClass('selected');$('#selected-interests-list li#selected-interest-'+interestID).remove();},renumber:function(){var $interests=$('#selected-interests-list li');$.each($interests,function(i,obj){$(this).find('.number').text((i+1));});$none=$('.travel-interests-editor.component .selected-interests p.none');if($interests.length>0){$none.hide();}
else{$none.show();}},reset:function(){$('.travel-interests-editor.component .interest').removeClass('selected');$('.travel-interests-editor.component .interest input[type="checkbox"]').attr('checked',false);$('#selected-interests-list li').remove();WIB.Component.TravelInterestsEditor.renumber();},applyUI:function(intrestElt){var checkbox=$(intrestElt).find('input[type="checkbox"]');var interestID=$(checkbox).val();if($(checkbox).attr('checked')){WIB.Component.TravelInterestsEditor.selectInterest(interestID);}
else{WIB.Component.TravelInterestsEditor.unselectInterest(interestID);}
WIB.Component.TravelInterestsEditor.renumber();},render:function(){WIB.Component.TravelInterestsEditor.reset();if(typeof(SELECTED_INTERESTS)!='undefined'){for(i=0;i<SELECTED_INTERESTS.length;i++){WIB.Component.TravelInterestsEditor.selectInterest(SELECTED_INTERESTS[i].interestID);}
WIB.Component.TravelInterestsEditor.renumber();}},init:function(){$('.travel-interests-editor.component .interest input[type="checkbox"]').live('click',function(){WIB.Component.TravelInterestsEditor.applyUI($(this).parents('.interest'));});$('.travel-interests-editor.component .interest img').live('click',function(e){var checkbox=$(this).parents('.interest').find('input[type="checkbox"]');if($(checkbox).attr('checked')){$(checkbox).attr('checked',false);}else{$(checkbox).attr('checked',true);}
WIB.Component.TravelInterestsEditor.applyUI($(this).parents('.interest'));});$('.travel-interests-editor.component .selected-interests a.reset').live('click',function(){WIB.Component.TravelInterestsEditor.reset();});$('#interests-edit-form').livequery('submit',function(){params='';$.each($('#selected-interests-list li'),function(i,obj){var rank=i+1;params+='&interests['+rank+']='+$(obj).attr('id').replace(/^selected-interest-/,'');});$.get(WIB.apiURL+'?method=user.account.updateInterests'+params,{},function(data){if(typeof(data.success)!='undefined'&&data.success==1){WIB.showMessage(data.message,'notice','#interests-edit-form .messages',WIB.hidePopup);}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','#interests-edit-form .messages');}},'json');return false;});$('#setup-step3 a.next').live('click',function(){WIB.Component.TravelInterestsEditor.saveInterests();});}};WIB.Component.TravelNewsNav={init:function(){$('.travel-news-nav ul.months h3 a').click(function(){$(this).parents('li').toggleClass('active');});}};WIB.Component.TripIt={flashOptions:null,initTrips:function(){$.get(WIB.apiURL+'?method=tripit.gettrips',{'type':'both'},function(data){if(data.success){$('.trip-it-upcoming').html(data.content.upcoming);$('.trip-it-past').html(data.content.past);}},'json');},redraw:function(){$.get(WIB.apiURL+'?method=component.get',{'component':'TripIt','update':1},function(data){if(data.success){$('.trip-it.component').replaceWith(data.content);WIB.Component.TripIt.init();$('.trip-dropdown li a:first').click();}},'json');},loggedIn:function(){return $('.trip-it.component .trip-it-box').hasClass('logged-in');},init:function(){$(document).ready(function(){if(WIB.Component.TripIt.loggedIn()){$('.trip-it.component .header .user-thumb').click(function(){$.get(WIB.apiURL+'?method=tripit.signout',null,function(data){if(data.success){WIB.Component.TripIt.redraw();$('.trip-it.component .trip-it-box').removeClass('logged-in');$('.trip-it.component .header .user-thumb').expire();WIB.tooltipAnchored();}
else{}},'json');}).live('mousemove',function(e){WIB.tooltipAnchored('logout of TripIt',e.pageX,e.pageY);}).live('mouseout',function(){WIB.tooltipAnchored();});$('.trip-it.component .trip-list .delete-trip a').click(function(){if(confirm('Are you sure you want to delete this trip?')){var link=$(this);WIB.tooltipAnchored();link.parent().parent().fadeOut('fast',function(){$(this).remove();$.get(WIB.apiURL+'?method=tripit.delete',{'type':'trip','object_id':link.attr('title')},function(data){if(data.success){WIB.Component.TripIt.redraw();}},'json');});}}).live('mousemove',function(e){WIB.tooltipAnchored('delete trip',e.pageX,e.pageY);}).live('mouseout',function(){WIB.tooltipAnchored();});}
$('#trip-it-map-link').hover(function(){$('.trip-dropdown').show().css('background-position',(this.offsetLeft+10)+'px 2px');},function(){$('.trip-dropdown').hide();});$('.trip-dropdown').hover(function(){$(this).show();},function(){$(this).hide();}).click(function(){$(this).hide();});$('.trip-dropdown li a').click(function(){var link=this;$.get(WIB.apiURL+'?method=tripit.updatemap',{'trip_id':link.name,'trip_location':escape(link.title)},function(data){$('#trip-it-map #trip-map').html(data);});});$('#trip-it-search').autocomplete(WIB.apiURL,{extraParams:{method:'search.typeahead'},onItemSelect:function(li){},onFindValue:function(li){},dataFormat:'json',matchSubset:false,minChars:2,width:178});$('.trip-it-box .sub-nav li a').click(function(){$('.trip-it-box .trip-it-section').hide();$('.trip-it-box #'+$(this).attr('id').replace(/-link$/,'')).show();});Date.firstDayOfWeek=7;Date.format='mm/dd/yyyy';$('.trip-it-date-picker').datePicker({clickInput:true});$('#trip-it-start-date').bind('dpClosed',function(e,selectedDates)
{var d=selectedDates[0];if(d){d=new Date(d);$('#trip-it-end-date').dpSetStartDate(d.addDays(1).asString());}});$('#trip-it-end-date').bind('dpClosed',function(e,selectedDates){var d=selectedDates[0];if(d){d=new Date(d);$('#trip-it-start-date').dpSetEndDate(d.addDays(-1).asString());}});$('#trip-it-plan-form').submit(function(){var err='',date_format=/^\d{1,2}(\/)\d{1,2}\1\d{4}$/;if(this.display_name.value==''||this.display_name.value==this.display_name.title)
err='Enter a name for your trip.';else if(this.primary_location.value==''||this.primary_location.value==this.primary_location.title)
err='Choose a location for your trip.';else if(this.start_date.value==''||this.start_date.value==this.start_date.title||!date_format.test(this.start_date.value))
err='Choose a start date for your trip.';else if(this.end_date.value==''||this.end_date.value==this.end_date.title||!date_format.test(this.end_date.value))
err='Choose an end date for your trip.';if(err==''){$.get(WIB.apiURL+'?method=tripit.create',{'display_name':encodeURIComponent(this.display_name.value),'primary_location':encodeURIComponent(this.primary_location.value),'start_date':this.start_date.value,'end_date':this.end_date.value,'is_private':this.is_private.checked?'true':'false','is_traveler':this.is_traveler.checked?'true':'false'},function(data){if(data.success){$('#trip-it-plan-form').fadeOut('fast',function(){this.reset();$('#trip-it-plan-error').html('');$('#trip-it-plan-status').fadeIn('fast',function(){$(this).find('span').html(data.message);WIB.Component.TripIt.redraw();})});}
else{$('#trip-it-plan-error').html(data.message);}},'json');}
else{$('#trip-it-plan-error').html(err);}
return false;});$('.trip-list').click(function(){var self=$(this);if(!self.hasClass('active')){var remove=$('.trip-list.active');remove.find('.trip-items').slideUp('fast',function(){remove.removeClass('active');});self.addClass('active');self.find('.trip-items').css({display:'none'});self.find('.trip-items').slideDown('fast');}
else{self.find('.trip-items').slideUp('fast',function(){self.removeClass('active');});}});var classes=['favourite','share','write-review','upload-photo'];for(i=0;i<classes.length;i++){$('.trip-it.component .action-'+classes[i]).each(function(i,n){var object=$(this).attr('title').split('_');if(object.length==2){$(this).removeAttr('title').attr('objectType',object[0]).attr('objectID',object[1]);}});}
$('.trip-it.component .action-write-review[objectType]').live('click',function(){WIB.showPopup('review_editor',{objectType:$(this).attr('objectType'),objectID:$(this).attr('objectID')});});$('.trip-it.component .action-upload-photo[objectType]').live('click',function(){WIB.showPopup('photo_editor',{objectType:$(this).attr('objectType'),objectID:$(this).attr('objectID')});});});}};WIB.Component.Ugc={render:function(){$("#ugc-add-form .thumbs-overview .thumbs .thumb-up").css({backgroundPosition:'0px 0px'});$("#ugc-add-form .thumbs-overview .thumbs .thumb-down").css({backgroundPosition:'111px 0px'});switch($("#ugc-add-form input[name=rating]").val()){case'1':$("#ugc-add-form .thumbs-overview .thumbs .thumb-up").css({backgroundPosition:'0px 220px'});$("#ugc-add-form .thumbs-overview .thumbs .thumb-down").css({backgroundPosition:'111px 440px'});break;case'-1':$("#ugc-add-form .thumbs-overview .thumbs .thumb-down").css({backgroundPosition:'111px 220px'});$("#ugc-add-form .thumbs-overview .thumbs .thumb-up").css({backgroundPosition:'0px 440px'});}},init:function(){WIB.Component.Ugc.render();$('.ugc.component .thumbs .thumb-up').live('mouseover',function(){$(this).css({backgroundPosition:'0px 220px'});}).live('mouseout',function(){WIB.Component.Ugc.render();}).live('click',function(){$("#ugc-add-form input[name=rating]").val(1);});$('.ugc.component .thumbs .thumb-down').live('mouseover',function(){$(this).css({backgroundPosition:'111px 220px'});}).live('mouseout',function(){WIB.Component.Ugc.render();}).live('click',function(){$("#ugc-add-form input[name=rating]").val(-1);});$('#ugc-add-form').livequery('submit',function(){$('#ugc-add-target').unbind('load');$('#ugc-add-target').load(function(){json_string=$(this).contents().find('#json-response').val();eval('var data='+json_string);if(typeof(data.success)!='undefined'&&data.success==1){if(typeof(data.feed_item)!='undefined'&&data.feed_item){WIB.facebookShowFeed(data.feed_item);}
WIB.showMessage(data.message,'success','.ugc.component .messages',WIB.hidePopup);}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','.ugc.component .messages');}});});}};WIB.Component.Videos={videoID:null,render:function(){$('.videos.component .upload-video[title], .videos.component .record-video[title]').each(function(i,n){var object=$(this).attr('title').split('_');if(object.length==2){$(this).removeAttr('title').attr('objectType',object[0]).attr('objectID',object[1]);}});},deleteVideo:function(videoID,videoType){WIB.showConfirmBox('You are about to delete your video, this is permanent.  Are you sure?',{okText:'Yes, Delete it now',cancelText:'No',okCallback:function(){$.get(WIB.apiURL+'?method=video.delete',{'videoID':videoID,'videoType':videoType},function(data){if(typeof(data.success)!='undefined'&&data.success==1){WIB.showMessage(data.message,'notice','#content .messages');WIB.reload();}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','#content .messages');}},'json');WIB.hideConfirmBox();}});},init:function(){$('.videos.component .record-video').click(function(e){WIB.showPopup('videos_record',{objectType:$(this).attr('objectType'),objectID:$(this).attr('objectID')});});$('.videos.component .upload-video').click(function(e){WIB.showPopup('videos_upload',{objectType:$(this).attr('objectType'),objectID:$(this).attr('objectID')});});if(typeof(VIDEO_ID)!='undefined'){WIB.Component.Videos.videoID=VIDEO_ID;}
$('#photo_url').click(function(){$(this).select();});$('.action-delete-video').live('click',function(){var $videocomp=$(this).parents('.video-container');var videoID=$videocomp.find('.videoid').val();var videoType=$videocomp.find('.videoType').val();WIB.Component.Videos.deleteVideo(videoID,videoType);$videocomp.fadeOut();});}};WIB.Component.VideosRecord={done:false,started:false,init:function(){$(document).ready(function(){$('#video-recorder-form').livequery('submit',function(){that=this;if(WIB.Component.VideosRecord.done){WIB.requireLogin(function(){$.get(WIB.apiURL+'?method=video.add',$(that).serialize(),function(data){if(typeof(data.success)!='undefined'&&data.success==1){var objectType=$('#video-recorder-form input[name="objectType"]').val();WIB.ugcLog('video',objectType,'record');WIB.showMessage(data.message,'success','.videos-record.component .messages',WIB.hidePopup);if(typeof(data.feed_item)!='undefined'&&data.feed_item){WIB.facebookShowFeed(data.feed_item);}}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','.videos-record.component .messages');}},'json');},' to save this video');}else{WIB.showMessage("If you're finished recording your video, click save in the video recorder.",'error','.videos-record.component .messages');}
return false;});});},recordStarted:function(){WIB.Component.VideosRecord.started=true;},recordDone:function(username,userVideoNumber,videoID){$('#video-recorder-form input#viddler-id').val(videoID);WIB.Component.VideosRecord.done=true;}};var recordDone=WIB.Component.VideosRecord.recordDone;var recordStarted=WIB.Component.VideosRecord.recordStarted;WIB.Component.VideosUpload={UPDATE_FREQUENCY:500,init:function(){$('#video-form textarea.clickClear').live('click',WIB.Component.VideosUpload.clickDescription);$('#video-form').livequery('submit',WIB.Component.VideosUpload.submitForm);},niceFilesize:function(bytes){var units=['kb','mb','gb'];var unit='bytes';while(bytes>1024&&units.length>0){bytes/=1024.0;unit=units[0];units=units.slice(1);}
return bytes.toFixed(1)+' '+unit;},startUpload:function(){$('#video-form').hide();$('#upload-status').show();$('#upload-message').text('Starting upload...');WIB.Component.VideosUpload.setupUpdate();},processUpload:function(){$('#upload-status').hide();$('#upload-processing').show();},finishUpload:function(){$('#upload-status').hide();$('#upload-processing').hide();$('#upload-finished').show();var objectType=$('#video-form input[name="objectType"]').val();WIB.ugcLog('video',objectType,'upload');},updateProgress:function(uploadKey){var uploadKey=$('input#upload-key').val();$.getJSON(WIB.apiURL+'?method=video.upload.status&uploadKey='+uploadKey,function(data){var progress=parseInt(data['progress']);var current=WIB.Component.VideosUpload.niceFilesize(parseInt(data['current']));var total=WIB.Component.VideosUpload.niceFilesize(parseInt(data['total']));if(progress>=0&&progress<100){var msg=data.progress.toString()+'% ('+current+' of '+total+')';$('#upload-message').text(msg);$('.videos-upload.component .progress-bar').width(progress.toString()+"%");WIB.Component.VideosUpload.setupUpdate();}else if(progress==100){WIB.Component.VideosUpload.processUpload();}});},setupUpdate:function(){setTimeout(WIB.Component.VideosUpload.updateProgress,WIB.Component.VideosUpload.UPDATE_FREQUENCY);},submitForm:function(){$(this).attr('action',WIB.apiURL+'?method=video.upload');WIB.Component.VideosUpload.startUpload();$('#blank-iframe').load(WIB.Component.VideosUpload.finishUpload);return true;},clickDescription:function(){$(this).removeClass('clickClear');$(this).empty();this.focus();}};WIB.Component.Wall={currentPage:1,refresh:function(){$('.wall.component .wall-posts').html($('#loading-graphic').html());var params={component:'wall',page:WIB.Component.Wall.currentPage,objectType:$('.wall.component .wall-post-container input[name=objectType]').val(),objectID:$('.wall.component .wall-post-container input[name=objectID]').val()};$.get(WIB.apiURL+'?method=component.get',params,function(data){if(typeof(data.content)!='undefined'){$('.wall.component .wall-posts').html($(data.content).find('.wall-posts .post'));}
WIB.Component.Wall.updateRecordCount(1);},'json');},deletePost:function(postID,postType){$.get(WIB.apiURL+'?method=wall.delete',{'wallPostType':postType,'wallPostID':postID},function(data){if(typeof(data.success)!='undefined'&&data.success==1){WIB.Component.Wall.updateRecordCount(-1);}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','#wall-post-form .messages');}},'json');},updateRecordCount:function(i){var $countDiv=$('.wall.component .pagination .record-count');if($countDiv.is('div')){var total=parseInt($countDiv.find('.total').text().replace(',',''))+i;var last=parseInt($countDiv.find('.last').text().replace(',',''))+i;var first=parseInt($countDiv.find('.first').text().replace(',',''));if(last<first){WIB.reload();}
else{$countDiv.find('.total').text(total);if(i<0||last==total){$countDiv.find('.last').text(last);}}}},render:function(){$('.wall.component .questions.component .api-form').each(function(){this.onSuccess=function(){WIB.Component.Wall.refresh();}});},init:function(){$('.wall.component .post .meta .delete a').live('click',function(){var $post=$(this).parents('.post');var postID=$post.attr('id').replace(/^wall-post-/,'');var postType=$post.find('.wallPostType').val();WIB.showConfirmBox('Do you really want to delete this question?',{okText:'Yes',cancelText:'No',okCallback:function(){WIB.Component.Wall.deletePost(postID,postType);$post.fadeOut('normal',function(){$post.remove();if($('.wall-post-container .post').length<1){$('.wall-post-container').addClass('empty');}});WIB.hideConfirmBox();}});});$('.wall.component .meta .comment a').live('click',function(e){var $post=$(this).parents('.post');var params={wallPostID:$post.attr('id').replace(/^wall-post-/,''),wallPostType:$post.find('.wallPostType').val()};WIB.showPopup('wall_comment',params);});$('.wall.component .comments .delete-comment a').live('click',function(){var $post=$(this).parents('.post');var postID=$post.attr('id').replace(/^wall-post-/,'');var commentID=$(this).attr('id').replace(/^delete-comment-/,'');var postType=$(this).parents('.post').find('.wallPostType').val();WIB.showConfirmBox('Do you really want to delete this question?',{okText:'Yes',cancelText:'No',okCallback:function(){$.get(WIB.apiURL+'?method=wall.comment.delete',{'wallPostType':postType,'commentID':commentID,'wallPostID':postID},function(data){if(typeof(data.success)!='undefined'&&data.success==1){WIB.Component.Wall.updateRecordCount(-1);}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','#wall-post-form .messages');}},'json');$('#delete-comment-'+commentID).closest('.comment').fadeOut();WIB.hideConfirmBox();}});});if(typeof(WALL_PAGE)!='undefined'){WIB.Component.Wall.currentPage=WALL_PAGE;}}};WIB.Component.WallComment={render:function(){$('.wall-comment.component .api-form').each(function(){this.onSuccess=function(){var wallPostType=$('.wall-comment.component .api-form input[name="wallPostType"]').val();WIB.ugcLog('question_answer',wallPostType);WIB.Component.Wall.refresh();}});},init:function(){}};WIB.Component.WhereIveBeen={render:function(){$('.where-ive-been.component .affinity[title]').each(function(i,n){var object=$(this).attr('title').split('_');if(object.length==2){$(this).removeAttr('title').attr('objectType',object[0]).attr('objectID',object[1]);}});},init:function(){$(document).ready(function(){$('.where-ive-been.component .affinity a').live('click',function(){that=this;WIB.requireLogin(function(){if($(that).hasClass('selected')){$(that).parents('.affinity').find('a').removeClass('selected').removeClass('deselected');var affinity='none';}else{$(that).parents('.affinity').find('a').removeClass('selected').addClass('deselected');$(that).addClass('selected').removeClass('deselected');var affinity=$(that).attr('title');}
var objectType=$(that).parents('.affinity').attr('objectType');var objectID=$(that).parents('.affinity').attr('objectID');var params={'objectType':objectType,'objectID':objectID,place:objectType+':'+objectID,'affinity':affinity};if(affinity=='been'||affinity=='lived'){WIB.showPopup('ugc',params);}else if(affinity=='want'){WIB.showPopup('askquestion',params);}
$.get(WIB.apiURL+'?method=affinity.save',params,function(data){if(typeof(data.success)!='undefined'&&data.success==1){}
else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error','.where-ive-been.component .messages');}},'json');},' to save your affinity with this place');});});}};WIB.Component.WhereIveBeenList={render:function(){$('.where-ive-been-list.component .action-write-review').each(function(i,n){var object=$(this).attr('title').split('_');if(object.length==2){$(this).removeAttr('title').attr('objectType',object[0]).attr('objectID',object[1]);}});},init:function(){$(document).ready(function(){});}};WIB.Component.WibSetup={collect:function(page,elt){$(elt).html($('#loading-graphic').html());$.get(WIB.apiURL+'?method=component.get&component=wib_setup',{page:page},function(data){if(typeof(data.content)!='undefined'){$(elt).html($(data.content).find('.container'));}},'json');},init:function(){$('.wib-setup.component .pagination.component a').live('click',function(){page=$(this).attr('title');elt=$(this).parents('.wib-setup');WIB.clickTrack('Component','WibSetupComponent','get-page',page);WIB.Component.WibSetup.collect(page,elt);return false;});}};WIB.Component.WikiBox={init:function(){$(document).ready(function(){$('.wiki-box a.read-more').click(function(){$(this).parents('.wiki-box').find('.content-remainder').toggle();});$('.wiki-box a.edit').click(function(e){var objectType=$(this).parents('.wiki-box').find('input[name=objectType]').val();var objectID=$(this).parents('.wiki-box').find('input[name=objectID]').val();var detail=$(this).parents('.wiki-box').find('input[name=detail]').val();WIB.showPopup('wiki_box_edit',{'objectType':objectType,'objectID':objectID,'detail':detail});});});}};WIB.FeedItem.Affinity={init:function(){$(document).ready(function(){$('.affinity.feed-item .user-links .send-message').live('click',function(){var personID=$(this).parents('.user-links').attr('title').replace(/^user-/,'');WIB.showPopup('compose_message',{to_personID:personID});});$('.affinity.feed-item .user-links .add-friend').live('click',function(){var personID=$(this).parents('.user-links').attr('title').replace(/^user-/,'');WIB.showPopup('friend_request',{friendID:personID});});});}};WIB.FeedItem.NewSiteUser={init:function(){$(document).ready(function(){$('.new-site-user.feed-item .user-links .send-message').live('click',function(){var personID=$(this).parents('.user-links').attr('title').replace(/^user-/,'');WIB.showPopup('compose_message',{to_personID:personID});});$('.new-site-user.feed-item .user-links .add-friend').live('click',function(){var personID=$(this).parents('.user-links').attr('title').replace(/^user-/,'');WIB.showPopup('friend_request',{friendID:personID});});});}};WIB.CombinedFeedItem.AddedLikedPhoto={init:function(){$(document).ready(function(){$('.combined-added-liked-photo .thumb-photo').mouseover(function(){src=$(this).attr('src');href=$(this).parents('a').attr('href');$(this).parents('.feed-item').find('.photo').attr('src',src);$(this).parents('.feed-item').find('.photo').parents('a').attr('href',href);});});}};WIB.CombinedFeedItem.NewAffiliatePhoto={init:function(){$(document).ready(function(){$('.combined-new-affiliate-photo .thumb-photo').mouseover(function(){src=$(this).attr('src');href=$(this).parents('a').attr('href');$(this).parents('.feed-item').find('.photo').attr('src',src);$(this).parents('.feed-item').find('.photo').parents('a').attr('href',href);});});}};WIB.CombinedFeedItem.UploadedPhoto={init:function(){$(document).ready(function(){$('.combined-uploaded-photo .thumb-photo').mouseover(function(){src=$(this).attr('src');href=$(this).parents('a').attr('href');$(this).parents('.feed-item').find('.photo').attr('src',src);$(this).parents('.feed-item').find('.photo').parents('a').attr('href',href);});});}};WIB.API.Forms={init:function(){$('.api-form').livequery('submit',function(){form=this;if(typeof(form.validate)=='function'){if(!form.validate()){return false;}}
if($(form).hasClass('submitting')){return false;}
if($(form).hasClass('require-login')){var prompt_message=$(form).find('.require-login-prompt').val();if(!prompt_message){prompt_message='to use this feature';}
WIB.requireLogin(function(){if($(form).hasClass('use-confirm-message')){var message=$(form).find('.confirm-message').val();WIB.showConfirmBox(message,{okText:'Yes',cancelText:'No',okCallback:function(){WIB.API.Forms.post(form);WIB.hideConfirmBox();}});}else{WIB.API.Forms.post(form);}},' '+prompt_message);}else{if($(form).hasClass('use-confirm-message')){var message=$(form).find('.confirm-message').val();WIB.showConfirmBox(message,{okText:'Yes',cancelText:'No',okCallback:function(){WIB.API.Forms.post(form);WIB.hideConfirmBox();}});}else{WIB.API.Forms.post(form);}}
return false;});},post:function(form){$(form).addClass('submitting');params=$(form).serialize();var method=$(form).attr('action');formMessageElt=$(form).find('.messages');$.post(WIB.apiURL+'?method='+method,params,function(data){if(typeof(data.success)!='undefined'&&data.success==1){if(typeof(data.feed_item)!='undefined'&&data.feed_item){WIB.facebookShowFeed(data.feed_item);}
WIB.showMessage(data.message,'success',formMessageElt,WIB.API.Forms.postComplete);if(typeof(form.onSuccess)=='function'){form.onSuccess();}}
else{$(form).removeClass('submitting');var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error',formMessageElt);if(typeof(form.onFail)=='function'){form.onFail();}}},'json');},postComplete:function(){WIB.hidePopup();}};WIB.API.PhotoViewer={init:function(){$('a.photoViewer').live('click',function(){var fullSrc=$(this).attr('href');var thumbSrc=$(this).find('img').size()>0?$(this).find('img').attr('src'):$(this).find("*[style]").css('backgroundImage').match(/^url\((['"]?)(.*)\1\)$/)[2];var title='Photo';if($(this).find('img[alt]').size()>0){title=$(this).find('img[alt]').attr('alt');}
if($(this).attr('title')){title=$(this).attr('title');}
WIB.showPopupHTML('<div class="popup-title">'+title+'</div><img src="'+thumbSrc+'" /><div class="progress-indicator"></div><div class="actions"><a class="fake-submit cancel" href="#none"><span>Close</span></a><div class="clr"></div></div>','photo');$('<img>').load(function(){$('#photo-overlay .popup-box-content img').attr('src',fullSrc);$('#photo-overlay .popup-box-content .progress-indicator').remove();}).attr('src',fullSrc);return false;});$('#photo-overlay').live('click',function(){$('#photo-overlay').hide();});}};WIB.Networks.Facebook={expectedFacebookID:null,expectedFacebookSessionKey:null,onConnectedRun:false,init:function(){FB_RequireFeatures(["XFBML","IntlTag"],function(){FB.Facebook.init("d1d9b9e37b948dcd3014c52733c2dadd","/xd_receiver.htm",{doNotUseCachedConnectState:true});FB.ensureInit(function(){WIB.out('facebook has been initiated');FB.Connect.ifUserConnected(WIB.Networks.Facebook.onConnected,WIB.Networks.Facebook.onNotConnected);if(WIB.inFacebook()){FB.CanvasClient.startTimerToSizeToContent();}});});},onConnected:function(){if(!WIB.Networks.Facebook.onConnectedRun){WIB.Networks.Facebook.onConnectedRun=true;$(document).ready(function(){$('.fb-connected').show();$('.fb-connect').hide();WIB.out('onConnectedInit');var user_object=WIB.Networks.Facebook.facebookSessionData();if(WIB.loggedIn()){if(WIB.inFacebook()&&$('html').attr('lang')!=FB.locale.replace('_','-')){WIB.out('Facebook language mismatch - reloading');window.location.href=window.location.pathname+'?language='+FB.locale;return;};WIB.out('wib user logged in');if(WIB.Networks.Facebook.expectedFacebookID){WIB.out('wib user does have a facebook id');if(user_object.uid==WIB.Networks.Facebook.expectedFacebookID){WIB.out('connect facebook id matches expected wib facebook id');WIB.Networks.Facebook.refreshToken();}else{WIB.out('connect facebook id and expected wib facebook id do not match');$.get(WIB.apiURL,{method:'user.account.logout'},function(data){location.href='/';});}}else{WIB.out('wib user does not have a facebook id yet');var params={network:'facebook',connect_user:user_object.uid,connect_session_key:user_object.session_key};WIB.showPopup('facebook_connect',params,function(){FB.Connect.logout();WIB.Networks.Facebook.onConnectedRun=false;});}}else{WIB.out('wib user not logged in');WIB.Networks.Facebook.connectLogin();}});}},onNotConnected:function(){$(document).ready(function(){if(WIB.inFacebook()){if(WIB.loggedIn()){WIB.out('logged in wib, but not fb');$.get(WIB.apiURL,{method:'user.account.logout'},function(data){location.href='/';});}}
$('.fb-connect').show();$('.fb-connected').hide();WIB.out('onNotConnectedInit');});},refreshToken:function(){var user_object=WIB.Networks.Facebook.facebookSessionData();if(user_object.session_key!=WIB.Networks.Facebook.expectedFacebookSessionKey){WIB.out('refreshToken required '+WIB.Networks.Facebook.expectedFacebookSessionKey+' doesnt match '+user_object.session_key);var params={network:'facebook',connect_user:user_object.uid,connect_session_key:user_object.session_key};$.get(WIB.apiURL+'?method=user.account.freshenNetworkToken',params,function(data){if(typeof(data.success)=='undefined'||data.success!=1){WIB.clickTrack('site','facebook connect','refreshToken fail',null);WIB.out('could not refresh token');}else{WIB.clickTrack('site','facebook connect','refreshToken success',null);WIB.Networks.Facebook.expectedFacebookSessionKey=user_object.session_key;WIB.out('refreshed token successfully');}},'json');}else{WIB.out('refreshToken not needed current and expected are both : '+user_object.session_key);}},connectAttach:function(){var user_object=WIB.Networks.Facebook.facebookSessionData();WIB.out('attaching facebook account to user account');var params={network:'facebook',connect_user:user_object.uid,connect_session_key:user_object.session_key};$.get(WIB.apiURL+'?method=user.account.connectAttach',params,function(data){if(typeof(data.success)=='undefined'||data.success!=1){WIB.clickTrack('site','facebook connect','connectAttach fail',null);WIB.out('could not attach account');}else{WIB.clickTrack('site','facebook connect','connectAttach success',null);WIB.Networks.Facebook.expectedFacebookSessionKey=user_object.session_key;WIB.Networks.Facebook.expectedFacebookID=user_object.uid;WIB.out('account attached successfully');}},'json');},connectLogin:function(){var user_object=WIB.Networks.Facebook.facebookSessionData();WIB.out('connectLogin with uid '+user_object.uid+' and session_key '+user_object.session_key);var params={network:'facebook',connect_user:user_object.uid,connect_session_key:user_object.session_key};$.get(WIB.apiURL+'?method=user.account.connectLogin',params,function(data){if(typeof(data.success)!='undefined'&&data.success==1){WIB.clickTrack('site','facebook connect','connectLogin success',null);WIB.out(data.message);WIB.showMessage(data.message,'notice');WIB.justLoggedIn=true;WIB.onLogin();}else{WIB.errorLog('user was not logged in, this must be a new user');var params={network:'facebook',connect_user:user_object.uid,connect_session_key:user_object.session_key};WIB.showPopup('facebook_connect',params,function(){FB.Connect.logout();WIB.Networks.Facebook.onConnectedRun=false;});}},'json');},connectRegister:function(){var user_object=WIB.Networks.Facebook.facebookSessionData();WIB.out('connectRegister with uid '+user_object.uid+' and session_key '+user_object.session_key);var params={network:'facebook',connect_user:user_object.uid,connect_session_key:user_object.session_key};$.get(WIB.apiURL+'?method=user.account.connectRegister',params,function(data){if(typeof(data.success)!='undefined'&&data.success==1){WIB.clickTrack('site','facebook connect','connectRegister success',null);WIB.out(data.message);if(typeof(WIB.onLoginCallback)=='function'){WIB.onLogin();}else{if(typeof(REDIRECT_URL)!='undefined'&&REDIRECT_URL!=''){location.href=REDIRECT_URL;}
else{WIB.reload();}}}else{var msgText=typeof(data.message)!='undefined'?data.message:'Unknown error';WIB.showMessage(msgText,'error');WIB.clickTrack('site','facebook connect','connectRegister fail',null);WIB.errorLog(msgText);}},'json');},facebookSessionData:function(){var user_object=FB.Facebook.apiClient.get_session();if(!user_object){WIB.errorLog('requested facebookSessionData before facebook connect was ready');}
if(!user_object.uid){WIB.errorLog('uid is blank, this shouldnt be possible');}
if(!user_object.session_key){WIB.errorLog('session_key is blank, this shouldnt be possible');}
return user_object;},showFrontierFeed:function(animal){animal+='';var f=animal.charAt(0).toUpperCase();animal=f+animal.substr(1);var item={"title":"  has completed the Frontier quiz and is most like "+animal+" ","body":"You can <a href=\"http:\/\/apps.facebook.com\/whereivebeen\/?entrySource=frontier\">click here</a> if you want to play the Frontier quiz and find out who your most like!","target":[],"comments_xid":"","href1":"http:\/\/apps.facebook.com\/whereivebeen\/?entrySource=frontier","link1":"Where I've Been","video":{"video_src":"http://www.youtube.com/v/cHBpkeqr_So","preview_img":"http://i.ytimg.com/vi/cHBpkeqr_So/2.jpg"}}
if(animal=='Larry'){item.body=item.body+"\n<br>\n<br>"+animal+': You’re a bit of a loner. Don’t like to stir things up, or cause trouble. Very relaxed and chilled out. Your motto: Live and let live.';}
if(animal=='Flip'){item.body=item.body+"\n<br>\n<br>"+animal+': You never seem to get a break. Not the luckiest person, but you’re kind-hearted and extremely likable because you find the humor in everything. Your motto: When life gives you lemons, make lemonade.';}
if(animal=='Griz'){item.body=item.body+"\n<br>\n<br>"+animal+': You live for the moment. Never shy, and rarely quiet. Generous, fun-loving and gregarious, you’re always ready for a good time. Your motto: Seize the day!';}
if(animal=='Sal'){item.body=item.body+"\n<br>\n<br>"+animal+': You have style and panache, and enjoy the spotlight. Both at work and at play, you’re a risk taker and play to win. Your motto is: Roll the dice and let the chips fall where they may.';}
if(animal=='Hector'){item.body=item.body+"\n<br>\n<br>"+animal+': You live life off the beaten path and have no time for the rat race. You prefer sun, sand and surf to the city life. And you forgo material pursuits for simple pleasures.';}
WIB.facebookShowFeed(item,null,null,null,true);WIB.out(animal);}};