var _bbgoldjq=null;if(window.$){_bbgoldjq=$; /* * jQuery JavaScript Library v1.3.2 * http://jquery.com/ * * Copyright (c) 2009 John Resig * Dual licensed under the MIT and GPL licenses. * http://docs.jquery.com/License * * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) * Revision: 6246 */ }(function(){var m=this,h,z=m.jQuery,q=m.$,p=m.jQuery=m.$=function(F,G){return new p.fn.init(F,G)},E=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,g=/^.[^:#\[\.,]*$/;p.fn=p.prototype={init:function(F,I){F=F||document;if(F.nodeType){this[0]=F;this.length=1;this.context=F;return this}if(typeof F==="string"){var H=E.exec(F);if(H&&(H[1]||!I)){if(H[1]){F=p.clean([H[1]],I)}else{var J=document.getElementById(H[3]);if(J&&J.id!=H[3]){return p().find(F)}var G=p(J||[]);G.context=document;G.selector=F;return G}}else{return p(I).find(F)}}else{if(p.isFunction(F)){return p(document).ready(F)}}if(F.selector&&F.context){this.selector=F.selector;this.context=F.context}return this.setArray(p.isArray(F)?F:p.makeArray(F))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(F){return F===h?Array.prototype.slice.call(this):this[F]},pushStack:function(G,I,F){var H=p(G);H.prevObject=this;H.context=this.context;if(I==="find"){H.selector=this.selector+(this.selector?" ":"")+F}else{if(I){H.selector=this.selector+"."+I+"("+F+")"}}return H},setArray:function(F){this.length=0;Array.prototype.push.apply(this,F);return this},each:function(G,F){return p.each(this,G,F)},index:function(F){return p.inArray(F&&F.jquery?F[0]:F,this)},attr:function(G,I,H){var F=G;if(typeof G==="string"){if(I===h){return this[0]&&p[H||"attr"](this[0],G)}else{F={};F[G]=I}}return this.each(function(J){for(G in F){p.attr(H?this.style:this,G,p.prop(this,F[G],H,J,G))}})},css:function(F,G){if((F=="width"||F=="height")&&parseFloat(G)<0){G=h}return this.attr(F,G,"curCSS")},text:function(G){if(typeof G!=="object"&&G!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(G))}var F="";p.each(G||this,function(){p.each(this.childNodes,function(){if(this.nodeType!=8){F+=this.nodeType!=1?this.nodeValue:p.fn.text([this])}})});return F},wrapAll:function(F){if(this[0]){var G=p(F,this[0].ownerDocument).clone();if(this[0].parentNode){G.insertBefore(this[0])}G.map(function(){var H=this;while(H.firstChild){H=H.firstChild}return H}).append(this)}return this},wrapInner:function(F){return this.each(function(){p(this).contents().wrapAll(F)})},wrap:function(F){return this.each(function(){p(this).wrapAll(F)})},append:function(){return this.domManip(arguments,true,function(F){if(this.nodeType==1){this.appendChild(F)}})},prepend:function(){return this.domManip(arguments,true,function(F){if(this.nodeType==1){this.insertBefore(F,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(F){this.parentNode.insertBefore(F,this)})},after:function(){return this.domManip(arguments,false,function(F){this.parentNode.insertBefore(F,this.nextSibling)})},end:function(){return this.prevObject||p([])},push:[].push,sort:[].sort,splice:[].splice,find:function(F){if(this.length===1){var G=this.pushStack([],"find",F);G.length=0;p.find(F,this[0],G);return G}else{return this.pushStack(p.unique(p.map(this,function(H){return p.find(F,H)})),"find",F)}},clone:function(H){var F=this.map(function(){if(!p.support.noCloneEvent&&!p.isXMLDoc(this)){var J=this.outerHTML;if(!J){var K=this.ownerDocument.createElement("div");K.appendChild(this.cloneNode(true));J=K.innerHTML}return p.clean([J.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(H===true){var I=this.find("*").andSelf(),G=0;F.find("*").andSelf().each(function(){if(this.nodeName!==I[G].nodeName){return}var J=p.data(I[G],"events");for(var L in J){for(var K in J[L]){p.event.add(this,L,J[L][K],J[L][K].data)}}G++})}return F},filter:function(F){return this.pushStack(p.isFunction(F)&&p.grep(this,function(H,G){return F.call(H,G)})||p.multiFilter(F,p.grep(this,function(G){return G.nodeType===1})),"filter",F)},closest:function(F){var H=p.expr.match.POS.test(F)?p(F):null,G=0;return this.map(function(){var I=this;while(I&&I.ownerDocument){if(H?H.index(I)>-1:p(I).is(F)){p.data(I,"closest",G);return I}I=I.parentNode;G++}})},not:function(F){if(typeof F==="string"){if(g.test(F)){return this.pushStack(p.multiFilter(F,this,true),"not",F)}else{F=p.multiFilter(F,this)}}var G=F.length&&F[F.length-1]!==h&&!F.nodeType;return this.filter(function(){return G?p.inArray(this,F)<0:this!=F})},add:function(F){return this.pushStack(p.unique(p.merge(this.get(),typeof F==="string"?p(F):p.makeArray(F))))},is:function(F){return !!F&&p.multiFilter(F,this).length>0},hasClass:function(F){return !!F&&this.is("."+F)},val:function(L){if(L===h){var F=this[0];if(F){if(p.nodeName(F,"option")){return(F.attributes.value||{}).specified?F.value:F.text}if(p.nodeName(F,"select")){var J=F.selectedIndex,M=[],N=F.options,I=F.type=="select-one";if(J<0){return null}for(var G=I?J:0,K=I?J+1:N.length;G=0||p.inArray(this.name,L)>=0)}else{if(p.nodeName(this,"select")){var O=p.makeArray(L);p("option",this).each(function(){this.selected=(p.inArray(this.value,O)>=0||p.inArray(this.text,O)>=0)});if(!O.length){this.selectedIndex=-1}}else{this.value=L}}})},html:function(F){return F===h?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(F)},replaceWith:function(F){return this.after(F).remove()},eq:function(F){return this.slice(F,+F+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(F){return this.pushStack(p.map(this,function(H,G){return F.call(H,G,H)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(K,N,M){if(this[0]){var J=(this[0].ownerDocument||this[0]).createDocumentFragment(),G=p.clean(K,(this[0].ownerDocument||this[0]),J),I=J.firstChild;if(I){for(var H=0,F=this.length;H1||H>0?J.cloneNode(true):J)}}if(G){p.each(G,A)}}return this;function L(O,P){return N&&p.nodeName(O,"table")&&p.nodeName(P,"tr")?(O.getElementsByTagName("tbody")[0]||O.appendChild(O.ownerDocument.createElement("tbody"))):O}}};p.fn.init.prototype=p.fn;function A(F,G){if(G.src){p.ajax({url:G.src,async:false,dataType:"script"})}else{p.globalEval(G.text||G.textContent||G.innerHTML||"")}if(G.parentNode){G.parentNode.removeChild(G)}}function f(){return +new Date}p.extend=p.fn.extend=function(){var K=arguments[0]||{},I=1,J=arguments.length,F=false,H;if(typeof K==="boolean"){F=K;K=arguments[1]||{};I=2}if(typeof K!=="object"&&!p.isFunction(K)){K={}}if(J==I){K=this;--I}for(;I-1}},swap:function(I,H,J){var F={};for(var G in H){F[G]=I.style[G];I.style[G]=H[G]}J.call(I);for(var G in H){I.style[G]=F[G]}},css:function(I,G,K,F){if(G=="width"||G=="height"){var M,H={position:"absolute",visibility:"hidden",display:"block"},L=G=="width"?["Left","Right"]:["Top","Bottom"];function J(){M=G=="width"?I.offsetWidth:I.offsetHeight;if(F==="border"){return}p.each(L,function(){if(!F){M-=parseFloat(p.curCSS(I,"padding"+this,true))||0}if(F==="margin"){M+=parseFloat(p.curCSS(I,"margin"+this,true))||0}else{M-=parseFloat(p.curCSS(I,"border"+this+"Width",true))||0}})}if(I.offsetWidth!==0){J()}else{p.swap(I,H,J)}return Math.max(0,Math.round(M))}return p.curCSS(I,G,K)},curCSS:function(J,G,H){var M,F=J.style;if(G=="opacity"&&!p.support.opacity){M=p.attr(F,"opacity");return M==""?"1":M}if(G.match(/float/i)){G=x}if(!H&&F&&F[G]){M=F[G]}else{if(r.getComputedStyle){if(G.match(/float/i)){G="float"}G=G.replace(/([A-Z])/g,"-$1").toLowerCase();var N=r.getComputedStyle(J,null);if(N){M=N.getPropertyValue(G)}if(G=="opacity"&&M==""){M="1"}}else{if(J.currentStyle){var K=G.replace(/\-(\w)/g,function(O,P){return P.toUpperCase()});M=J.currentStyle[G]||J.currentStyle[K];if(!/^\d+(px)?$/i.test(M)&&/^\d/.test(M)){var I=F.left,L=J.runtimeStyle.left;J.runtimeStyle.left=J.currentStyle.left;F.left=M||0;M=F.pixelLeft+"px";F.left=I;J.runtimeStyle.left=L}}}}return M},clean:function(G,L,J){L=L||document;if(typeof L.createElement==="undefined"){L=L.ownerDocument||L[0]&&L[0].ownerDocument||document}if(!J&&G.length===1&&typeof G[0]==="string"){var I=/^<(\w+)\s*\/?>$/.exec(G[0]);if(I){return[L.createElement(I[1])]}}var H=[],F=[],M=L.createElement("div");p.each(G,function(Q,T){if(typeof T==="number"){T+=""}if(!T){return}if(typeof T==="string"){T=T.replace(/(<(\w+)[^>]*?)\/>/g,function(V,W,U){return U.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?V:W+">"});var P=T.replace(/^\s+/,"").substring(0,10).toLowerCase();var R=!P.indexOf("",""]||!P.indexOf("",""]||P.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!P.indexOf("",""]||(!P.indexOf("",""]||!P.indexOf("",""]||!p.support.htmlSerialize&&[1,"div
","
"]||[0,"",""];M.innerHTML=R[1]+T+R[2];while(R[0]--){M=M.lastChild}if(!p.support.tbody){var S=/"&&!S?M.childNodes:[];for(var N=O.length-1;N>=0;--N){if(p.nodeName(O[N],"tbody")&&!O[N].childNodes.length){O[N].parentNode.removeChild(O[N])}}}if(!p.support.leadingWhitespace&&/^\s/.test(T)){M.insertBefore(L.createTextNode(T.match(/^\s*/)[0]),M.firstChild)}T=p.makeArray(M.childNodes)}if(T.nodeType){H.push(T)}else{H=p.merge(H,T)}});if(J){for(var K=0;H[K];K++){if(p.nodeName(H[K],"script")&&(!H[K].type||H[K].type.toLowerCase()==="text/javascript")){F.push(H[K].parentNode?H[K].parentNode.removeChild(H[K]):H[K])}else{if(H[K].nodeType===1){H.splice.apply(H,[K+1,0].concat(p.makeArray(H[K].getElementsByTagName("script"))))}J.appendChild(H[K])}}return F}return H},attr:function(K,H,L){if(!K||K.nodeType==3||K.nodeType==8){return h}var I=!p.isXMLDoc(K),M=L!==h;H=I&&p.props[H]||H;if(K.tagName){var G=/href|src|style/.test(H);if(H=="selected"&&K.parentNode){K.parentNode.selectedIndex}if(H in K&&I&&!G){if(M){if(H=="type"&&p.nodeName(K,"input")&&K.parentNode){throw"type property can't be changed"}K[H]=L}if(p.nodeName(K,"form")&&K.getAttributeNode(H)){return K.getAttributeNode(H).nodeValue}if(H=="tabIndex"){var J=K.getAttributeNode("tabIndex");return J&&J.specified?J.value:K.nodeName.match(/(button|input|object|select|textarea)/i)?0:K.nodeName.match(/^(a|area)$/i)&&K.href?0:h}return K[H]}if(!p.support.style&&I&&H=="style"){return p.attr(K.style,"cssText",L)}if(M){K.setAttribute(H,""+L)}var F=!p.support.hrefNormalized&&I&&G?K.getAttribute(H,2):K.getAttribute(H);return F===null?h:F}if(!p.support.opacity&&H=="opacity"){if(M){K.zoom=1;K.filter=(K.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(L)+""=="NaN"?"":"alpha(opacity="+L*100+")")}return K.filter&&K.filter.indexOf("opacity=")>=0?(parseFloat(K.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}H=H.replace(/-([a-z])/ig,function(N,O){return O.toUpperCase()});if(M){K[H]=L}return K[H]},trim:function(F){return(F||"").replace(/^\s+|\s+$/g,"")},makeArray:function(H){var F=[];if(H!=null){var G=H.length;if(G==null||typeof H==="string"||p.isFunction(H)||H.setInterval){F[0]=H}else{while(G){F[--G]=H[G]}}}return F},inArray:function(H,I){for(var F=0,G=I.length;F0?this.clone(true):this).get();p.fn[G].apply(p(M[L]),J);K=K.concat(J)}return this.pushStack(K,F,H)}});p.each({removeAttr:function(F){p.attr(this,F,"");if(this.nodeType==1){this.removeAttribute(F)}},addClass:function(F){p.className.add(this,F)},removeClass:function(F){p.className.remove(this,F)},toggleClass:function(G,F){if(typeof F!=="boolean"){F=!p.className.has(this,G)}p.className[F?"add":"remove"](this,G)},remove:function(F){if(!F||p.filter(F,[this]).length){p("*",this).add([this]).each(function(){p.event.remove(this);p.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){p(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(F,G){p.fn[F]=function(){return this.each(G,arguments)}});function k(F,G){return F[0]&&parseInt(p.curCSS(F[0],G,true),10)||0}var i="jQuery"+f(),w=0,B={};p.extend({cache:{},data:function(G,F,H){G=G==m?B:G;var I=G[i];if(!I){I=G[i]=++w}if(F&&!p.cache[I]){p.cache[I]={}}if(H!==h){p.cache[I][F]=H}return F?p.cache[I][F]:I},removeData:function(G,F){G=G==m?B:G;var I=G[i];if(F){if(p.cache[I]){delete p.cache[I][F];F="";for(F in p.cache[I]){break}if(!F){p.removeData(G)}}}else{try{delete G[i]}catch(H){if(G.removeAttribute){G.removeAttribute(i)}}delete p.cache[I]}},queue:function(G,F,I){if(G){F=(F||"fx")+"queue";var H=p.data(G,F);if(!H||p.isArray(I)){H=p.data(G,F,p.makeArray(I))}else{if(I){H.push(I)}}}return H},dequeue:function(I,H){var F=p.queue(I,H),G=F.shift();if(!H||H==="fx"){G=F[0]}if(G!==h){G.call(I)}}});p.fn.extend({data:function(F,H){var I=F.split(".");I[1]=I[1]?"."+I[1]:"";if(H===h){var G=this.triggerHandler("getData"+I[1]+"!",[I[0]]);if(G===h&&this.length){G=p.data(this[0],F)}return G===h&&I[1]?this.data(I[0]):G}else{return this.trigger("setData"+I[1]+"!",[I[0],H]).each(function(){p.data(this,F,H)})}},removeData:function(F){return this.each(function(){p.removeData(this,F)})},queue:function(F,G){if(typeof F!=="string"){G=F;F="fx"}if(G===h){return p.queue(this[0],F)}return this.each(function(){var H=p.queue(this,F,G);if(F=="fx"&&H.length==1){H[0].call(this)}})},dequeue:function(F){return this.each(function(){p.dequeue(this,F)})}}); /* * Sizzle CSS Selector Engine - v0.9.3 * Copyright 2009, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * More information: http://sizzlejs.com/ */ (function(){var S=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,M=0,I=Object.prototype.toString;var G=function(Z,V,ac,ad){ac=ac||[];V=V||document;if(V.nodeType!==1&&V.nodeType!==9){return[]}if(!Z||typeof Z!=="string"){return ac}var aa=[],X,ag,aj,U,ae,W,Y=true;S.lastIndex=0;while((X=S.exec(Z))!==null){aa.push(X[1]);if(X[2]){W=RegExp.rightContext;break}}if(aa.length>1&&N.exec(Z)){if(aa.length===2&&J.relative[aa[0]]){ag=K(aa[0]+aa[1],V)}else{ag=J.relative[aa[0]]?[V]:G(aa.shift(),V);while(aa.length){Z=aa.shift();if(J.relative[Z]){Z+=aa.shift()}ag=K(Z,ag)}}}else{var af=ad?{expr:aa.pop(),set:F(ad)}:G.find(aa.pop(),aa.length===1&&V.parentNode?V.parentNode:V,R(V));ag=G.filter(af.expr,af.set);if(aa.length>0){aj=F(ag)}else{Y=false}while(aa.length){var ai=aa.pop(),ah=ai;if(!J.relative[ai]){ai=""}else{ah=aa.pop()}if(ah==null){ah=V}J.relative[ai](aj,ah,R(V))}}if(!aj){aj=ag}if(!aj){throw"Syntax error, unrecognized expression: "+(ai||Z)}if(I.call(aj)==="[object Array]"){if(!Y){ac.push.apply(ac,aj)}else{if(V.nodeType===1){for(var ab=0;aj[ab]!=null;ab++){if(aj[ab]&&(aj[ab]===true||aj[ab].nodeType===1&&L(V,aj[ab]))){ac.push(ag[ab])}}}else{for(var ab=0;aj[ab]!=null;ab++){if(aj[ab]&&aj[ab].nodeType===1){ac.push(ag[ab])}}}}}else{F(aj,ac)}if(W){G(W,V,ac,ad);if(H){hasDuplicate=false;ac.sort(H);if(hasDuplicate){for(var ab=1;ab":function(aa,V,ab){var Y=typeof V==="string";if(Y&&!/\W/.test(V)){V=ab?V:V.toUpperCase();for(var W=0,U=aa.length;W=0)){if(!W){U.push(Z)}}else{if(W){V[Y]=false}}}}return false},ID:function(U){return U[1].replace(/\\/g,"")},TAG:function(V,U){for(var W=0;U[W]===false;W++){}return U[W]&&R(U[W])?V[1]:V[1].toUpperCase()},CHILD:function(U){if(U[1]=="nth"){var V=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(U[2]=="even"&&"2n"||U[2]=="odd"&&"2n+1"||!/\D/.test(U[2])&&"0n+"+U[2]||U[2]);U[2]=(V[1]+(V[2]||1))-0;U[3]=V[3]-0}U[0]=M++;return U},ATTR:function(Y,V,W,U,Z,aa){var X=Y[1].replace(/\\/g,"");if(!aa&&J.attrMap[X]){Y[1]=J.attrMap[X]}if(Y[2]==="~="){Y[4]=" "+Y[4]+" "}return Y},PSEUDO:function(Y,V,W,U,Z){if(Y[1]==="not"){if(Y[3].match(S).length>1||/^\w/.test(Y[3])){Y[3]=G(Y[3],null,null,V)}else{var X=G.filter(Y[3],V,W,true^Z);if(!W){U.push.apply(U,X)}return false}}else{if(J.match.POS.test(Y[0])||J.match.CHILD.test(Y[0])){return true}}return Y},POS:function(U){U.unshift(true);return U}},filters:{enabled:function(U){return U.disabled===false&&U.type!=="hidden"},disabled:function(U){return U.disabled===true},checked:function(U){return U.checked===true},selected:function(U){U.parentNode.selectedIndex;return U.selected===true},parent:function(U){return !!U.firstChild},empty:function(U){return !U.firstChild},has:function(W,V,U){return !!G(U[3],W).length},header:function(U){return/h\d/i.test(U.nodeName)},text:function(U){return"text"===U.type},radio:function(U){return"radio"===U.type},checkbox:function(U){return"checkbox"===U.type},file:function(U){return"file"===U.type},password:function(U){return"password"===U.type},submit:function(U){return"submit"===U.type},image:function(U){return"image"===U.type},reset:function(U){return"reset"===U.type},button:function(U){return"button"===U.type||U.nodeName.toUpperCase()==="BUTTON"},input:function(U){return/input|select|textarea|button/i.test(U.nodeName)}},setFilters:{first:function(V,U){return U===0},last:function(W,V,U,X){return V===X.length-1},even:function(V,U){return U%2===0},odd:function(V,U){return U%2===1},lt:function(W,V,U){return VU[3]-0},nth:function(W,V,U){return U[3]-0==V},eq:function(W,V,U){return U[3]-0==V}},filter:{PSEUDO:function(aa,W,X,ab){var V=W[1],Y=J.filters[V];if(Y){return Y(aa,X,W,ab)}else{if(V==="contains"){return(aa.textContent||aa.innerText||"").indexOf(W[3])>=0}else{if(V==="not"){var Z=W[3];for(var X=0,U=Z.length;X=0)}}},ID:function(V,U){return V.nodeType===1&&V.getAttribute("id")===U},TAG:function(V,U){return(U==="*"&&V.nodeType===1)||V.nodeName===U},CLASS:function(V,U){return(" "+(V.className||V.getAttribute("class"))+" ").indexOf(U)>-1},ATTR:function(Z,X){var W=X[1],U=J.attrHandle[W]?J.attrHandle[W](Z):Z[W]!=null?Z[W]:Z.getAttribute(W),aa=U+"",Y=X[2],V=X[4];return U==null?Y==="!=":Y==="="?aa===V:Y==="*="?aa.indexOf(V)>=0:Y==="~="?(" "+aa+" ").indexOf(V)>=0:!V?aa&&U!==false:Y==="!="?aa!=V:Y==="^="?aa.indexOf(V)===0:Y==="$="?aa.substr(aa.length-V.length)===V:Y==="|="?aa===V||aa.substr(0,V.length+1)===V+"-":false},POS:function(Y,V,W,Z){var U=V[2],X=J.setFilters[U];if(X){return X(Y,W,V,Z)}}}};var N=J.match.POS;for(var P in J.match){J.match[P]=RegExp(J.match[P].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var F=function(V,U){V=Array.prototype.slice.call(V);if(U){U.push.apply(U,V);return U}return V};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(O){F=function(Y,X){var V=X||[];if(I.call(Y)==="[object Array]"){Array.prototype.push.apply(V,Y)}else{if(typeof Y.length==="number"){for(var W=0,U=Y.length;W";var U=document.documentElement;U.insertBefore(V,U.firstChild);if(!!document.getElementById(W)){J.find.ID=function(Y,Z,aa){if(typeof Z.getElementById!=="undefined"&&!aa){var X=Z.getElementById(Y[1]);return X?X.id===Y[1]||typeof X.getAttributeNode!=="undefined"&&X.getAttributeNode("id").nodeValue===Y[1]?[X]:h:[]}};J.filter.ID=function(Z,X){var Y=typeof Z.getAttributeNode!=="undefined"&&Z.getAttributeNode("id");return Z.nodeType===1&&Y&&Y.nodeValue===X}}U.removeChild(V)})();(function(){var U=document.createElement("div");U.appendChild(document.createComment(""));if(U.getElementsByTagName("*").length>0){J.find.TAG=function(V,Z){var Y=Z.getElementsByTagName(V[1]);if(V[1]==="*"){var X=[];for(var W=0;Y[W];W++){if(Y[W].nodeType===1){X.push(Y[W])}}Y=X}return Y}}U.innerHTML="";if(U.firstChild&&typeof U.firstChild.getAttribute!=="undefined"&&U.firstChild.getAttribute("href")!=="#"){J.attrHandle.href=function(V){return V.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var U=G,V=document.createElement("div");V.innerHTML="

";if(V.querySelectorAll&&V.querySelectorAll(".TEST").length===0){return}G=function(Z,Y,W,X){Y=Y||document;if(!X&&Y.nodeType===9&&!R(Y)){try{return F(Y.querySelectorAll(Z),W)}catch(aa){}}return U(Z,Y,W,X)};G.find=U.find;G.filter=U.filter;G.selectors=U.selectors;G.matches=U.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var U=document.createElement("div");U.innerHTML="
";if(U.getElementsByClassName("e").length===0){return}U.lastChild.className="e";if(U.getElementsByClassName("e").length===1){return}J.order.splice(1,0,"CLASS");J.find.CLASS=function(V,W,X){if(typeof W.getElementsByClassName!=="undefined"&&!X){return W.getElementsByClassName(V[1])}}})()}function Q(V,aa,Z,ae,ab,ad){var ac=V=="previousSibling"&&!ad;for(var X=0,W=ae.length;X0){Y=U;break}}}U=U[V]}ae[X]=Y}}}var L=document.compareDocumentPosition?function(V,U){return V.compareDocumentPosition(U)&16}:function(V,U){return V!==U&&(V.contains?V.contains(U):true)};var R=function(U){return U.nodeType===9&&U.documentElement.nodeName!=="HTML"||!!U.ownerDocument&&R(U.ownerDocument)};var K=function(U,ab){var X=[],Y="",Z,W=ab.nodeType?[ab]:ab;while((Z=J.match.PSEUDO.exec(U))){Y+=Z[0];U=U.replace(J.match.PSEUDO,"")}U=J.relative[U]?U+"*":U;for(var aa=0,V=W.length;aa0||U.offsetHeight>0};G.selectors.filters.animated=function(U){return p.grep(p.timers,function(V){return U===V.elem}).length};p.multiFilter=function(W,U,V){if(V){W=":not("+W+")"}return G.matches(W,U)};p.dir=function(W,V){var U=[],X=W[V];while(X&&X!=document){if(X.nodeType==1){U.push(X)}X=X[V]}return U};p.nth=function(Y,U,W,X){U=U||1;var V=0;for(;Y;Y=Y[W]){if(Y.nodeType==1&&++V==U){break}}return Y};p.sibling=function(W,V){var U=[];for(;W;W=W.nextSibling){if(W.nodeType==1&&W!=V){U.push(W)}}return U};return;m.Sizzle=G})();p.event={add:function(J,G,I,L){if(J.nodeType==3||J.nodeType==8){return}if(J.setInterval&&J!=m){J=m}if(!I.guid){I.guid=this.guid++}if(L!==h){var H=I;I=this.proxy(H);I.data=L}var F=p.data(J,"events")||p.data(J,"events",{}),K=p.data(J,"handle")||p.data(J,"handle",function(){return typeof p!=="undefined"&&!p.event.triggered?p.event.handle.apply(arguments.callee.elem,arguments):h});K.elem=J;p.each(G.split(/\s+/),function(N,O){var P=O.split(".");O=P.shift();I.type=P.slice().sort().join(".");var M=F[O];if(p.event.specialAll[O]){p.event.specialAll[O].setup.call(J,L,P)}if(!M){M=F[O]={};if(!p.event.special[O]||p.event.special[O].setup.call(J,L,P)===false){if(J.addEventListener){J.addEventListener(O,K,false)}else{if(J.attachEvent){J.attachEvent("on"+O,K)}}}}M[I.guid]=I;p.event.global[O]=true});J=null},guid:1,global:{},remove:function(L,I,K){if(L.nodeType==3||L.nodeType==8){return}var H=p.data(L,"events"),G,F;if(H){if(I===h||(typeof I==="string"&&I.charAt(0)==".")){for(var J in H){this.remove(L,J+(I||""))}}else{if(I.type){K=I.handler;I=I.type}p.each(I.split(/\s+/),function(N,P){var R=P.split(".");P=R.shift();var O=RegExp("(^|\\.)"+R.slice().sort().join(".*\\.")+"(\\.|$)");if(H[P]){if(K){delete H[P][K.guid]}else{for(var Q in H[P]){if(O.test(H[P][Q].type)){delete H[P][Q]}}}if(p.event.specialAll[P]){p.event.specialAll[P].teardown.call(L,R)}for(G in H[P]){break}if(!G){if(!p.event.special[P]||p.event.special[P].teardown.call(L,R)===false){if(L.removeEventListener){L.removeEventListener(P,p.data(L,"handle"),false)}else{if(L.detachEvent){L.detachEvent("on"+P,p.data(L,"handle"))}}}G=null;delete H[P]}}})}for(G in H){break}if(!G){var M=p.data(L,"handle");if(M){M.elem=null}p.removeData(L,"events");p.removeData(L,"handle")}}},trigger:function(J,L,I,F){var H=J.type||J;if(!F){J=typeof J==="object"?J[i]?J:p.extend(p.Event(H),J):p.Event(H);if(H.indexOf("!")>=0){J.type=H=H.slice(0,-1);J.exclusive=true}if(!I){J.stopPropagation();if(this.global[H]){p.each(p.cache,function(){if(this.events&&this.events[H]){p.event.trigger(J,L,this.handle.elem)}})}}if(!I||I.nodeType==3||I.nodeType==8){return h}J.result=h;J.target=I;L=p.makeArray(L);L.unshift(J)}J.currentTarget=I;var K=p.data(I,"handle");if(K){K.apply(I,L)}if((!I[H]||(p.nodeName(I,"a")&&H=="click"))&&I["on"+H]&&I["on"+H].apply(I,L)===false){J.result=false}if(!F&&I[H]&&!J.isDefaultPrevented()&&!(p.nodeName(I,"a")&&H=="click")){this.triggered=true;try{I[H]()}catch(M){}}this.triggered=false;if(!J.isPropagationStopped()){var G=I.parentNode||I.ownerDocument;if(G){p.event.trigger(J,L,G,true)}}},handle:function(L){var K,F;L=arguments[0]=p.event.fix(L||m.event);L.currentTarget=this;var M=L.type.split(".");L.type=M.shift();K=!M.length&&!L.exclusive;var J=RegExp("(^|\\.)"+M.slice().sort().join(".*\\.")+"(\\.|$)");F=(p.data(this,"events")||{})[L.type];for(var H in F){var I=F[H];if(K||J.test(I.type)){L.handler=I;L.data=I.data;var G=I.apply(this,arguments);if(G!==h){L.result=G;if(G===false){L.preventDefault();L.stopPropagation()}}if(L.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(I){if(I[i]){return I}var G=I;I=p.Event(G);for(var H=this.props.length,K;H;){K=this.props[--H];I[K]=G[K]}if(!I.target){I.target=I.srcElement||document}if(I.target.nodeType==3){I.target=I.target.parentNode}if(!I.relatedTarget&&I.fromElement){I.relatedTarget=I.fromElement==I.target?I.toElement:I.fromElement}if(I.pageX==null&&I.clientX!=null){var J=document.documentElement,F=document.body;I.pageX=I.clientX+(J&&J.scrollLeft||F&&F.scrollLeft||0)-(J.clientLeft||0);I.pageY=I.clientY+(J&&J.scrollTop||F&&F.scrollTop||0)-(J.clientTop||0)}if(!I.which&&((I.charCode||I.charCode===0)?I.charCode:I.keyCode)){I.which=I.charCode||I.keyCode}if(!I.metaKey&&I.ctrlKey){I.metaKey=I.ctrlKey}if(!I.which&&I.button){I.which=(I.button&1?1:(I.button&2?3:(I.button&4?2:0)))}return I},proxy:function(G,F){F=F||function(){return G.apply(this,arguments)};F.guid=G.guid=G.guid||F.guid||this.guid++;return F},special:{ready:{setup:C,teardown:function(){}}},specialAll:{live:{setup:function(F,G){p.event.add(this,G[0],c)},teardown:function(H){if(H.length){var F=0,G=RegExp("(^|\\.)"+H[0]+"(\\.|$)");p.each((p.data(this,"events").live||{}),function(){if(G.test(this.type)){F++}});if(F<1){p.event.remove(this,H[0],c)}}}}}};p.Event=function(F){if(!this.preventDefault){return new p.Event(F)}if(F&&F.type){this.originalEvent=F;this.type=F.type}else{this.type=F}this.timeStamp=f();this[i]=true};function l(){return false}function v(){return true}p.Event.prototype={preventDefault:function(){this.isDefaultPrevented=v;var F=this.originalEvent;if(!F){return}if(F.preventDefault){F.preventDefault()}F.returnValue=false},stopPropagation:function(){this.isPropagationStopped=v;var F=this.originalEvent;if(!F){return}if(F.stopPropagation){F.stopPropagation()}F.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=v;this.stopPropagation()},isDefaultPrevented:l,isPropagationStopped:l,isImmediatePropagationStopped:l};var a=function(G){var F=G.relatedTarget;while(F&&F!=this){try{F=F.parentNode}catch(H){F=this}}if(F!=this){G.type=G.data;p.event.handle.apply(this,arguments)}};p.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(G,F){p.event.special[F]={setup:function(){p.event.add(this,G,a,F)},teardown:function(){p.event.remove(this,G,a)}}});p.fn.extend({bind:function(G,H,F){return G=="unload"?this.one(G,H,F):this.each(function(){p.event.add(this,G,F||H,F&&H)})},one:function(H,I,G){var F=p.event.proxy(G||I,function(J){p(this).unbind(J,F);return(G||I).apply(this,arguments)});return this.each(function(){p.event.add(this,H,F,G&&I)})},unbind:function(G,F){return this.each(function(){p.event.remove(this,G,F)})},trigger:function(F,G){return this.each(function(){p.event.trigger(F,G,this)})},triggerHandler:function(F,H){if(this[0]){var G=p.Event(F);G.preventDefault();G.stopPropagation();p.event.trigger(G,H,this[0]);return G.result}},toggle:function(H){var F=arguments,G=1;while(G=0){var F=H.slice(J,H.length);H=H.slice(0,J)}var I="GET";if(K){if(p.isFunction(K)){L=K;K=null}else{if(typeof K==="object"){K=p.param(K);I="POST"}}}var G=this;p.ajax({url:H,type:I,dataType:"html",data:K,complete:function(N,M){if(M=="success"||M=="notmodified"){G.html(F?p("
").append(N.responseText.replace(//g,"")).find(F):N.responseText)}if(L){G.each(L,[N.responseText,M,N])}}});return this},serialize:function(){return p.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?p.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(F,G){var H=p(this).val();return H==null?null:p.isArray(H)?p.map(H,function(J,I){return{name:G.name,value:J}}):{name:G.name,value:H}}).get()}});p.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(F,G){p.fn[G]=function(H){return this.bind(G,H)}});var s=f();p.extend({get:function(F,H,I,G){if(p.isFunction(H)){I=H;H=null}return p.ajax({type:"GET",url:F,data:H,success:I,dataType:G})},getScript:function(F,G){return p.get(F,null,G,"script")},getJSON:function(F,G,H){return p.get(F,G,H,"json")},post:function(F,H,I,G){if(p.isFunction(H)){I=H;H={}}return p.ajax({type:"POST",url:F,data:H,success:I,dataType:G})},ajaxSetup:function(F){p.extend(p.ajaxSettings,F)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return m.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(N){N=p.extend(true,N,p.extend(true,{},p.ajaxSettings,N));var X,G=/=\?(&|$)/g,S,W,H=N.type.toUpperCase();if(N.data&&N.processData&&typeof N.data!=="string"){N.data=p.param(N.data)}if(N.dataType=="jsonp"){if(H=="GET"){if(!N.url.match(G)){N.url+=(N.url.match(/\?/)?"&":"?")+(N.jsonp||"callback")+"=?"}}else{if(!N.data||!N.data.match(G)){N.data=(N.data?N.data+"&":"")+(N.jsonp||"callback")+"=?"}}N.dataType="json"}if(N.dataType=="json"&&(N.data&&N.data.match(G)||N.url.match(G))){X="jsonp"+s++;if(N.data){N.data=(N.data+"").replace(G,"="+X+"$1")}N.url=N.url.replace(G,"="+X+"$1");N.dataType="script";m[X]=function(Y){W=Y;J();M();m[X]=h;try{delete m[X]}catch(Z){}if(I){I.removeChild(U)}}}if(N.dataType=="script"&&N.cache==null){N.cache=false}if(N.cache===false&&H=="GET"){var F=f();var V=N.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+F+"$2");N.url=V+((V==N.url)?(N.url.match(/\?/)?"&":"?")+"_="+F:"")}if(N.data&&H=="GET"){N.url+=(N.url.match(/\?/)?"&":"?")+N.data;N.data=null}if(N.global&&!p.active++){p.event.trigger("ajaxStart")}var R=/^(\w+:)?\/\/([^\/?#]+)/.exec(N.url);if(N.dataType=="script"&&H=="GET"&&R&&(R[1]&&R[1]!=location.protocol||R[2]!=location.host)){var I=document.getElementsByTagName("head")[0];var U=document.createElement("script");U.src=N.url;if(N.scriptCharset){U.charset=N.scriptCharset}if(!X){var P=false;U.onload=U.onreadystatechange=function(){if(!P&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){P=true;J();M();U.onload=U.onreadystatechange=null;I.removeChild(U)}}}I.appendChild(U);return h}var L=false;var K=N.xhr();if(N.username){K.open(H,N.url,N.async,N.username,N.password)}else{K.open(H,N.url,N.async)}try{if(N.data){K.setRequestHeader("Content-Type",N.contentType)}if(N.ifModified){K.setRequestHeader("If-Modified-Since",p.lastModified[N.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}K.setRequestHeader("X-Requested-With","XMLHttpRequest");K.setRequestHeader("Accept",N.dataType&&N.accepts[N.dataType]?N.accepts[N.dataType]+", */*":N.accepts._default)}catch(T){}if(N.beforeSend&&N.beforeSend(K,N)===false){if(N.global&&!--p.active){p.event.trigger("ajaxStop")}K.abort();return false}if(N.global){p.event.trigger("ajaxSend",[K,N])}var O=function(Y){if(K.readyState==0){if(Q){clearInterval(Q);Q=null;if(N.global&&!--p.active){p.event.trigger("ajaxStop")}}}else{if(!L&&K&&(K.readyState==4||Y=="timeout")){L=true;if(Q){clearInterval(Q);Q=null}S=Y=="timeout"?"timeout":!p.httpSuccess(K)?"error":N.ifModified&&p.httpNotModified(K,N.url)?"notmodified":"success";if(S=="success"){try{W=p.httpData(K,N.dataType,N)}catch(aa){S="parsererror"}}if(S=="success"){var Z;try{Z=K.getResponseHeader("Last-Modified")}catch(aa){}if(N.ifModified&&Z){p.lastModified[N.url]=Z}if(!X){J()}}else{p.handleError(N,K,S)}M();if(Y){K.abort()}if(N.async){K=null}}}};if(N.async){var Q=setInterval(O,13);if(N.timeout>0){setTimeout(function(){if(K&&!L){O("timeout")}},N.timeout)}}try{K.send(N.data)}catch(T){p.handleError(N,K,null,T)}if(!N.async){O()}function J(){if(N.success){N.success(W,S)}if(N.global){p.event.trigger("ajaxSuccess",[K,N])}}function M(){if(N.complete){N.complete(K,S)}if(N.global){p.event.trigger("ajaxComplete",[K,N])}if(N.global&&!--p.active){p.event.trigger("ajaxStop")}}return K},handleError:function(G,I,F,H){if(G.error){G.error(I,F,H)}if(G.global){p.event.trigger("ajaxError",[I,G,H])}},active:0,httpSuccess:function(G){try{return !G.status&&location.protocol=="file:"||(G.status>=200&&G.status<300)||G.status==304||G.status==1223}catch(F){}return false},httpNotModified:function(H,F){try{var I=H.getResponseHeader("Last-Modified");return H.status==304||I==p.lastModified[F]}catch(G){}return false},httpData:function(K,I,H){var G=K.getResponseHeader("content-type"),F=I=="xml"||!I&&G&&G.indexOf("xml")>=0,J=F?K.responseXML:K.responseText;if(F&&J.documentElement.tagName=="parsererror"){throw"parsererror"}if(H&&H.dataFilter){J=H.dataFilter(J,I)}if(typeof J==="string"){if(I=="script"){p.globalEval(J)}if(I=="json"){J=m["eval"]("("+J+")")}}return J},param:function(F){var H=[];function I(J,K){H[H.length]=encodeURIComponent(J)+"="+encodeURIComponent(K)}if(p.isArray(F)||F.jquery){p.each(F,function(){I(this.name,this.value)})}else{for(var G in F){if(p.isArray(F[G])){p.each(F[G],function(){I(G,this)})}else{I(G,p.isFunction(F[G])?F[G]():F[G])}}}return H.join("&").replace(/%20/g,"+")}});var n={},o,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function u(G,F){var H={};p.each(d.concat.apply([],d.slice(0,F)),function(){H[this]=G});return H}p.fn.extend({show:function(K,M){if(K){return this.animate(u("show",3),K,M)}else{for(var I=0,G=this.length;I").appendTo("body");L=J.css("display");if(L==="none"){L="block"}J.remove();n[H]=L}p.data(this[I],"olddisplay",L)}}for(var I=0,G=this.length;I=0;I--){if(H[I].elem==this){if(F){H[I](true)}H.splice(I,1)}}});if(!F){this.dequeue()}return this}});p.each({slideDown:u("show",1),slideUp:u("hide",1),slideToggle:u("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(F,G){p.fn[F]=function(H,I){return this.animate(G,H,I)}});p.extend({speed:function(H,I,G){var F=typeof H==="object"?H:{complete:G||!G&&I||p.isFunction(H)&&H,duration:H,easing:G&&I||I&&!p.isFunction(I)&&I};F.duration=p.fx.off?0:typeof F.duration==="number"?F.duration:p.fx.speeds[F.duration]||p.fx.speeds._default;F.old=F.complete;F.complete=function(){if(F.queue!==false){p(this).dequeue()}if(p.isFunction(F.old)){F.old.call(this)}};return F},easing:{linear:function(H,I,F,G){return F+G*H},swing:function(H,I,F,G){return((-Math.cos(H*Math.PI)/2)+0.5)*G+F}},timers:[],fx:function(G,F,H){this.options=F;this.elem=G;this.prop=H;if(!F.orig){F.orig={}}}});p.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(p.fx.step[this.prop]||p.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(G){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var F=parseFloat(p.css(this.elem,this.prop,G));return F&&F>-10000?F:parseFloat(p.curCSS(this.elem,this.prop))||0},custom:function(J,I,H){this.startTime=f();this.start=J;this.end=I;this.unit=H||this.unit||"px";this.now=this.start;this.pos=this.state=0;var F=this;function G(K){return F.step(K)}G.elem=this.elem;if(G()&&p.timers.push(G)&&!o){o=setInterval(function(){var L=p.timers;for(var K=0;K=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var F=true;for(var G in this.options.curAnim){if(this.options.curAnim[G]!==true){F=false}}if(F){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(p.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){p(this.elem).hide()}if(this.options.hide||this.options.show){for(var J in this.options.curAnim){p.attr(this.elem.style,J,this.options.orig[J])}}this.options.complete.call(this.elem)}return false}else{var K=H-this.startTime;this.state=K/this.options.duration;this.pos=p.easing[this.options.easing||(p.easing.swing?"swing":"linear")](this.state,K,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};p.extend(p.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(F){p.attr(F.elem.style,"opacity",F.now)},_default:function(F){if(F.elem.style&&F.elem.style[F.prop]!=null){F.elem.style[F.prop]=F.now+F.unit}else{F.elem[F.prop]=F.now}}}});if(document.documentElement.getBoundingClientRect){p.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return p.offset.bodyOffset(this[0])}var H=this[0].getBoundingClientRect(),K=this[0].ownerDocument,G=K.body,F=K.documentElement,M=F.clientTop||G.clientTop||0,L=F.clientLeft||G.clientLeft||0,J=H.top+(self.pageYOffset||p.boxModel&&F.scrollTop||G.scrollTop)-M,I=H.left+(self.pageXOffset||p.boxModel&&F.scrollLeft||G.scrollLeft)-L;return{top:J,left:I}}}else{p.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return p.offset.bodyOffset(this[0])}p.offset.initialized||p.offset.initialize();var K=this[0],H=K.offsetParent,G=K,P=K.ownerDocument,N,I=P.documentElement,L=P.body,M=P.defaultView,F=M.getComputedStyle(K,null),O=K.offsetTop,J=K.offsetLeft;while((K=K.parentNode)&&K!==L&&K!==I){N=M.getComputedStyle(K,null);O-=K.scrollTop,J-=K.scrollLeft;if(K===H){O+=K.offsetTop,J+=K.offsetLeft;if(p.offset.doesNotAddBorder&&!(p.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(K.tagName))){O+=parseInt(N.borderTopWidth,10)||0,J+=parseInt(N.borderLeftWidth,10)||0}G=H,H=K.offsetParent}if(p.offset.subtractsBorderForOverflowNotVisible&&N.overflow!=="visible"){O+=parseInt(N.borderTopWidth,10)||0,J+=parseInt(N.borderLeftWidth,10)||0}F=N}if(F.position==="relative"||F.position==="static"){O+=L.offsetTop,J+=L.offsetLeft}if(F.position==="fixed"){O+=Math.max(I.scrollTop,L.scrollTop),J+=Math.max(I.scrollLeft,L.scrollLeft)}return{top:O,left:J}}}p.offset={initialize:function(){if(this.initialized){return}var M=document.body,G=document.createElement("div"),I,H,O,J,N,F,K=M.style.marginTop,L='
';N={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(F in N){G.style[F]=N[F]}G.innerHTML=L;M.insertBefore(G,M.firstChild);I=G.firstChild,H=I.firstChild,J=I.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(H.offsetTop!==5);this.doesAddBorderForTableAndCells=(J.offsetTop===5);I.style.overflow="hidden",I.style.position="relative";this.subtractsBorderForOverflowNotVisible=(H.offsetTop===-5);M.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(M.offsetTop===0);M.style.marginTop=K;M.removeChild(G);this.initialized=true},bodyOffset:function(F){p.offset.initialized||p.offset.initialize();var H=F.offsetTop,G=F.offsetLeft;if(p.offset.doesNotIncludeMarginInBodyOffset){H+=parseInt(p.curCSS(F,"marginTop",true),10)||0,G+=parseInt(p.curCSS(F,"marginLeft",true),10)||0}return{top:H,left:G}}};p.fn.extend({position:function(){var J=0,I=0,G;if(this[0]){var H=this.offsetParent(),K=this.offset(),F=/^body|html$/i.test(H[0].tagName)?{top:0,left:0}:H.offset();K.top-=k(this,"marginTop");K.left-=k(this,"marginLeft");F.top+=k(H,"borderTopWidth");F.left+=k(H,"borderLeftWidth");G={top:K.top-F.top,left:K.left-F.left}}return G},offsetParent:function(){var F=this[0].offsetParent||document.body;while(F&&(!/^body|html$/i.test(F.tagName)&&p.css(F,"position")=="static")){F=F.offsetParent}return p(F)}});p.each(["Left","Top"],function(G,F){var H="scroll"+F;p.fn[H]=function(I){if(!this[0]){return null}return I!==h?this.each(function(){this==m||this==document?m.scrollTo(!G?I:p(m).scrollLeft(),G?I:p(m).scrollTop()):this[H]=I}):this[0]==m||this[0]==document?self[G?"pageYOffset":"pageXOffset"]||p.boxModel&&document.documentElement[H]||document.body[H]:this[0][H]}});p.each(["Height","Width"],function(J,H){var F=J?"Left":"Top",I=J?"Right":"Bottom",G=H.toLowerCase();p.fn["inner"+H]=function(){return this[0]?p.css(this[0],G,false,"padding"):null};p.fn["outer"+H]=function(L){return this[0]?p.css(this[0],G,false,L?"margin":"border"):null};var K=H.toLowerCase();p.fn[K]=function(L){return this[0]==m?document.compatMode=="CSS1Compat"&&document.documentElement["client"+H]||document.body["client"+H]:this[0]==document?Math.max(document.documentElement["client"+H],document.body["scroll"+H],document.documentElement["scroll"+H],document.body["offset"+H],document.documentElement["offset"+H]):L===h?(this.length?p.css(this[0],K):null):this.css(K,typeof L==="string"?L:L+"px")}})})();(function(c){var j=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.6rc6",plugin:{add:function(l,m,o){var n=c.ui[l].prototype;for(var k in o){n.plugins[k]=n.plugins[k]||[];n.plugins[k].push([m,o[k]])}},call:function(k,m,l){var o=k.plugins[m];if(!o){return}for(var n=0;n
').addClass(k).css({position:"absolute",top:"-5000px",left:"-5000px",display:"block"}).appendTo("body");c.ui.cssCache[k]=!!((!(/auto|default/).test(l.css("cursor"))||(/^[1-9]/).test(l.css("height"))||(/^[1-9]/).test(l.css("width"))||!(/none/).test(l.css("backgroundImage"))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(l.css("backgroundColor"))));try{c("body").get(0).removeChild(l.get(0))}catch(m){}return c.ui.cssCache[k]},hasScroll:function(n,l){if(c(n).css("overflow")=="hidden"){return false}var k=(l&&l=="left")?"scrollLeft":"scrollTop",m=false;if(n[k]>0){return true}n[k]=1;m=(n[k]>0);n[k]=0;return m},isOverAxis:function(l,k,m){return(l>k)&&(l<(k+m))},isOver:function(p,l,o,n,k,m){return c.ui.isOverAxis(p,o,k)&&c.ui.isOverAxis(l,n,m)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var g=c.attr,f=c.fn.removeAttr,i="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(l,k,m){var n=m!==undefined;return(k=="role"?(n?g.call(this,l,k,"wairole:"+m):(g.apply(this,arguments)||"").replace(b,"")):(a.test(k)?(n?l.setAttributeNS(i,k.replace(a,"aaa:"),m):g.call(this,l,k.replace(a,"aaa:"))):g.apply(this,arguments)))};c.fn.removeAttr=function(k){return(a.test(k)?this.each(function(){this.removeAttributeNS(i,k.replace(a,""))}):f.call(this,k))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return j.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var k;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){k=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{k=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!k.length?c(document):k}});c.extend(c.expr[":"],{data:function(m,l,k){return !!c.data(m,k[3])},focusable:function(l){var m=l.nodeName.toLowerCase(),k=c.attr(l,"tabindex");return(/input|select|textarea|button|object/.test(m)?!l.disabled:"a"==m||"area"==m?l.href||!isNaN(k):!isNaN(k))&&!c(l)["area"==m?"parents":"closest"](":hidden").length},tabbable:function(l){var k=c.attr(l,"tabindex");return(isNaN(k)||k>=0)&&c(l).is(":focusable")}});function h(n,o,p,m){function l(r){var q=c[n][o][r]||[];return(typeof q=="string"?q.split(/,?\s+/):q)}var k=l("getter");if(m.length==1&&typeof m[0]=="string"){k=k.concat(l("getterSetter"))}return(c.inArray(p,k)!=-1)}c.widget=function(l,k){var m=l.split(".")[0];l=l.split(".")[1];c.fn[l]=function(q){var o=(typeof q=="string"),p=Array.prototype.slice.call(arguments,1);if(o&&q.substring(0,1)=="_"){return this}if(o&&h(m,l,q,p)){var n=c.data(this[0],l);return(n?n[q].apply(n,p):undefined)}return this.each(function(){var r=c.data(this,l);(!r&&!o&&c.data(this,l,new c[m][l](this,q))._init());(r&&o&&c.isFunction(r[q])&&r[q].apply(r,p))})};c[m]=c[m]||{};c[m][l]=function(p,o){var n=this;this.namespace=m;this.widgetName=l;this.widgetEventPrefix=c[m][l].eventPrefix||l;this.widgetBaseClass=m+"-"+l;this.options=c.extend({},c.widget.defaults,c[m][l].defaults,c.metadata&&c.metadata.get(p)[l],o);this.element=c(p).bind("setData."+l,function(r,q,s){if(r.target==p){return n._setData(q,s)}}).bind("getData."+l,function(r,q){if(r.target==p){return n._getData(q)}}).bind("remove."+l,function(){return n.destroy()})};c[m][l].prototype=c.extend({},c.widget.prototype,k);c[m][l].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(m,n){var l=m,k=this;if(typeof m=="string"){if(n===undefined){return this._getData(m)}l={};l[m]=n}c.each(l,function(o,p){k._setData(o,p)})},_getData:function(k){return this.options[k]},_setData:function(k,l){this.options[k]=l;if(k=="disabled"){this.element[l?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",l)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(m,n,o){var q=this.options[m],k=(m==this.widgetEventPrefix?m:this.widgetEventPrefix+m);n=c.Event(n);n.type=k;if(n.originalEvent){for(var l=c.event.props.length,p;l;){p=c.event.props[--l];n[p]=n.originalEvent[p]}}this.element.trigger(n,o);return !(c.isFunction(q)&&q.call(this.element[0],n,o)===false||n.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var k=this;this.element.bind("mousedown."+this.widgetName,function(l){return k._mouseDown(l)}).bind("click."+this.widgetName,function(l){if(k._preventClickEvent){k._preventClickEvent=false;return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(m){if(m.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(m));this._mouseDownEvent=m;var l=this,n=(m.which==1),k=(typeof this.options.cancel=="string"?c(m.target).parents().add(m.target).filter(this.options.cancel).length:false);if(!n||k||!this._mouseCapture(m)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){l.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(m)&&this._mouseDelayMet(m)){this._mouseStarted=(this._mouseStart(m)!==false);if(!this._mouseStarted){m.preventDefault();return true}}this._mouseMoveDelegate=function(o){return l._mouseMove(o)};this._mouseUpDelegate=function(o){return l._mouseUp(o)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||m.preventDefault());m.originalEvent.mouseHandled=true;return true},_mouseMove:function(k){if(c.browser.msie&&!k.button){return this._mouseUp(k)}if(this._mouseStarted){this._mouseDrag(k);return k.preventDefault()}if(this._mouseDistanceMet(k)&&this._mouseDelayMet(k)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,k)!==false);(this._mouseStarted?this._mouseDrag(k):this._mouseUp(k))}return !this._mouseStarted},_mouseUp:function(k){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=true;this._mouseStop(k)}return false},_mouseDistanceMet:function(k){return(Math.max(Math.abs(this._mouseDownEvent.pageX-k.pageX),Math.abs(this._mouseDownEvent.pageY-k.pageY))>=this.options.distance)},_mouseDelayMet:function(k){return this.mouseDelayMet},_mouseStart:function(k){},_mouseDrag:function(k){},_mouseStop:function(k){},_mouseCapture:function(k){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);(function(a){a.widget("ui.draggable",a.extend({},a.ui.mouse,{_init:function(){if(this.options.helper=="original"&&!(/^(?:r|a|f)/).test(this.element.css("position"))){this.element[0].style.position="relative"}(this.options.cssNamespace&&this.element.addClass(this.options.cssNamespace+"-draggable"));(this.options.disabled&&this.element.addClass(this.options.cssNamespace+"-draggable-disabled"));this._mouseInit()},destroy:function(){if(!this.element.data("draggable")){return}this.element.removeData("draggable").unbind(".draggable").removeClass(this.options.cssNamespace+"-draggable "+this.options.cssNamespace+"-draggable-dragging "+this.options.cssNamespace+"-draggable-disabled");this._mouseDestroy()},_mouseCapture:function(b){var c=this.options;if(this.helper||c.disabled||a(b.target).is("."+this.options.cssNamespace+"-resizable-handle")){return false}this.handle=this._getHandle(b);if(!this.handle){return false}return true},_mouseStart:function(b){var c=this.options;this.helper=this._createHelper(b);this._cacheHelperProportions();if(a.ui.ddmanager){a.ui.ddmanager.current=this}this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(b);this.originalPageX=b.pageX;this.originalPageY=b.pageY;if(c.cursorAt){this._adjustOffsetFromHelper(c.cursorAt)}if(c.containment){this._setContainment()}this._trigger("start",b);this._cacheHelperProportions();if(a.ui.ddmanager&&!c.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,b)}this.helper.addClass(c.cssNamespace+"-draggable-dragging");this._mouseDrag(b,true);return true},_mouseDrag:function(b,d){this.position=this._generatePosition(b);this.positionAbs=this._convertPositionTo("absolute");if(!d){var c=this._uiHash();this._trigger("drag",b,c);this.position=c.position}if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}if(a.ui.ddmanager){a.ui.ddmanager.drag(this,b)}return false},_mouseStop:function(c){var d=false;if(a.ui.ddmanager&&!this.options.dropBehaviour){d=a.ui.ddmanager.drop(this,c)}if(this.dropped){d=this.dropped;this.dropped=false}if((this.options.revert=="invalid"&&!d)||(this.options.revert=="valid"&&d)||this.options.revert===true||(a.isFunction(this.options.revert)&&this.options.revert.call(this.element,d))){var b=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){b._trigger("stop",c);b._clear()})}else{this._trigger("stop",c);this._clear()}return false},_getHandle:function(b){var c=!this.options.handle||!a(this.options.handle,this.element).length?true:false;a(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==b.target){c=true}});return c},_createHelper:function(c){var d=this.options;var b=a.isFunction(d.helper)?a(d.helper.apply(this.element[0],[c])):(d.helper=="clone"?this.element.clone():this.element);if(!b.parents("body").length){b.appendTo((d.appendTo=="parent"?this.element[0].parentNode:d.appendTo))}if(b[0]!=this.element[0]&&!(/(fixed|absolute)/).test(b.css("position"))){b.css("position","absolute")}return b},_adjustOffsetFromHelper:function(b){if(b.left!=undefined){this.offset.click.left=b.left+this.margins.left}if(b.right!=undefined){this.offset.click.left=this.helperProportions.width-b.right+this.margins.left}if(b.top!=undefined){this.offset.click.top=b.top+this.margins.top}if(b.bottom!=undefined){this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])){b.left+=this.scrollParent.scrollLeft();b.top+=this.scrollParent.scrollTop()}if((this.offsetParent[0]==document.body&&a.browser.mozilla)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)){b={top:0,left:0}}return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var b=this.element.position();return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var f=this.options;if(f.containment=="parent"){f.containment=this.helper[0].parentNode}if(f.containment=="document"||f.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(f.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(f.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(f.containment)&&f.containment.constructor!=Array){var c=a(f.containment)[0];if(!c){return}var d=a(f.containment).offset();var b=(a(c).css("overflow")!="hidden");this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(b?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}else{if(f.containment.constructor==Array){this.containment=f.containment}}},_convertPositionTo:function(g,i){if(!i){i=this.position}var c=g=="absolute"?1:-1;var f=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,h=(/(html|body)/i).test(b[0].tagName);return{top:(i.top+this.offset.relative.top*c+this.offset.parent.top*c-(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(h?0:b.scrollTop()))*c),left:(i.left+this.offset.relative.left*c+this.offset.parent.left*c-(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():h?0:b.scrollLeft())*c)}},_generatePosition:function(f){var i=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,j=(/(html|body)/i).test(b[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}var d=f.pageX;var c=f.pageY;if(this.originalPosition){if(this.containment){if(f.pageX-this.offset.click.leftthis.containment[2]){d=this.containment[2]+this.offset.click.left}if(f.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(i.grid){var h=this.originalPageY+Math.round((c-this.originalPageY)/i.grid[1])*i.grid[1];c=this.containment?(!(h-this.offset.click.topthis.containment[3])?h:(!(h-this.offset.click.topthis.containment[2])?g:(!(g-this.offset.click.left').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(a(this).offset()).appendTo("body")})},stop:function(b,c){a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});a.ui.plugin.add("draggable","opacity",{start:function(c,d){var b=a(d.helper),f=a(this).data("draggable").options;if(b.css("opacity")){f._opacity=b.css("opacity")}b.css("opacity",f.opacity)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._opacity){a(c.helper).css("opacity",d._opacity)}}});a.ui.plugin.add("draggable","scroll",{start:function(c,d){var b=a(this).data("draggable");if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){b.overflowOffset=b.scrollParent.offset()}},drag:function(d,f){var c=a(this).data("draggable"),g=c.options,b=false;if(c.scrollParent[0]!=document&&c.scrollParent[0].tagName!="HTML"){if(!g.axis||g.axis!="x"){if((c.overflowOffset.top+c.scrollParent[0].offsetHeight)-d.pageY=0;w--){var u=h.snapElements[w].left,p=u+h.snapElements[w].width,n=h.snapElements[w].top,B=n+h.snapElements[w].height;if(!((u-z=q&&o<=m)||(n>=q&&n<=m)||(om))&&((f>=h&&f<=c)||(d>=h&&d<=c)||(fc));break;default:return false;break}};a.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(f,h){var b=a.ui.ddmanager.droppables[f.options.scope];var g=h?h.type:null;var k=(f.currentItem||f.element).find(":data(droppable)").andSelf();droppablesLoop:for(var d=0;d').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent();this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});if(b.browser.safari&&j.preventDefault){this.originalElement.css("resize","none")}this.proportionallyResize.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=j.handles||(!b(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw"}var k=this.handles.split(",");this.handles={};for(var f=0;f');if(/sw|se|ne|nw/.test(h)){g.css({zIndex:++j.zIndex})}if("se"==h){g.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[h]=".ui-resizable-"+h;this.element.append(g)}}this._renderAxis=function(p){p=p||this.element;for(var m in this.handles){if(this.handles[m].constructor==String){this.handles[m]=b(this.handles[m],this.element).show()}if(j.transparent){this.handles[m].css({opacity:0})}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var n=b(this.handles[m],this.element),o=0;o=/sw|ne|nw|se|n|s/.test(m)?n.outerHeight():n.outerWidth();var l=["padding",/ne|nw|n/.test(m)?"Top":/se|sw|s/.test(m)?"Bottom":/^e$/.test(m)?"Right":"Left"].join("");if(!j.transparent){p.css(l,o)}this._proportionallyResize()}if(!b(this.handles[m]).length){continue}}};this._renderAxis(this.element);this._handles=b(".ui-resizable-handle",this.element);if(j.disableSelection){this._handles.disableSelection()}this._handles.mouseover(function(){if(!d.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}d.axis=i&&i[1]?i[1]:"se"}});if(j.autoHide){this._handles.hide();b(this.element).addClass("ui-resizable-autohide").hover(function(){b(this).removeClass("ui-resizable-autohide");d._handles.show()},function(){if(!d.resizing){b(this).addClass("ui-resizable-autohide");d._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var c=function(d){b(d).removeClass("ui-resizable ui-resizable-disabled").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){c(this.element);this.wrapper.parent().append(this.originalElement.css({position:this.wrapper.css("position"),width:this.wrapper.outerWidth(),height:this.wrapper.outerHeight(),top:this.wrapper.css("top"),left:this.wrapper.css("left")})).end().remove()}c(this.originalElement)},_mouseCapture:function(d){var f=false;for(var c in this.handles){if(b(this.handles[c])[0]==d.target){f=true}}return this.options.disabled||!!f},_mouseStart:function(f){var i=this.options,d=this.element.position(),c=this.element;this.resizing=true;this.documentScroll={top:b(document).scrollTop(),left:b(document).scrollLeft()};if(c.is(".ui-draggable")||(/absolute/).test(c.css("position"))){c.css({position:"absolute",top:d.top,left:d.left})}if(b.browser.opera&&(/relative/).test(c.css("position"))){c.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var j=a(this.helper.css("left")),g=a(this.helper.css("top"));if(i.containment){j+=b(i.containment).scrollLeft()||0;g+=b(i.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:j,top:g};this.size=this._helper?{width:c.outerWidth(),height:c.outerHeight()}:{width:c.width(),height:c.height()};this.originalSize=this._helper?{width:c.outerWidth(),height:c.outerHeight()}:{width:c.width(),height:c.height()};this.originalPosition={left:j,top:g};this.sizeDiff={width:c.outerWidth()-c.width(),height:c.outerHeight()-c.height()};this.originalMousePosition={left:f.pageX,top:f.pageY};this.aspectRatio=(typeof i.aspectRatio=="number")?i.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);if(i.preserveCursor){var h=b(".ui-resizable-"+this.axis).css("cursor");b("body").css("cursor",h=="auto"?this.axis+"-resize":h)}this._propagate("start",f);return true},_mouseDrag:function(c){var g=this.helper,f=this.options,l={},p=this,i=this.originalMousePosition,m=this.axis;var q=(c.pageX-i.left)||0,n=(c.pageY-i.top)||0;var h=this._change[m];if(!h){return false}var k=h.apply(this,[c,q,n]),j=b.browser.msie&&b.browser.version<7,d=this.sizeDiff;if(this._aspectRatio||c.shiftKey){k=this._updateRatio(k,c)}k=this._respectSize(k,c);this._propagate("resize",c);g.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this.proportionallyResize.length){this._proportionallyResize()}this._updateCache(k);this._trigger("resize",c,this.ui());return false},_mouseStop:function(g){this.resizing=false;var h=this.options,l=this;if(this._helper){var f=this.proportionallyResize,c=f.length&&(/textarea/i).test(f[0].nodeName),d=c&&b.ui.hasScroll(f[0],"left")?0:l.sizeDiff.height,j=c?0:l.sizeDiff.width;var m={width:(l.size.width-j),height:(l.size.height-d)},i=(parseInt(l.element.css("left"),10)+(l.position.left-l.originalPosition.left))||null,k=(parseInt(l.element.css("top"),10)+(l.position.top-l.originalPosition.top))||null;if(!h.animate){this.element.css(b.extend(m,{top:k,left:i}))}if(this._helper&&!h.animate){this._proportionallyResize()}}if(h.preserveCursor){b("body").css("cursor","auto")}this._propagate("stop",g);if(this._helper){this.helper.remove()}return false},_updateCache:function(c){var d=this.options;this.offset=this.helper.offset();if(c.left){this.position.left=c.left}if(c.top){this.position.top=c.top}if(c.height){this.size.height=c.height}if(c.width){this.size.width=c.width}},_updateRatio:function(g,f){var h=this.options,i=this.position,d=this.size,c=this.axis;if(g.height){g.width=(d.height*this.aspectRatio)}else{if(g.width){g.height=(d.width/this.aspectRatio)}}if(c=="sw"){g.left=i.left+(d.width-g.width);g.top=null}if(c=="nw"){g.top=i.top+(d.height-g.height);g.left=i.left+(d.width-g.width)}return g},_respectSize:function(k,f){var s=function(o){return !isNaN(parseInt(o,10))};var i=this.helper,h=this.options,q=this._aspectRatio||f.shiftKey,p=this.axis,t=s(k.width)&&h.maxWidth&&(h.maxWidthk.width),r=s(k.height)&&h.minHeight&&(h.minHeight>k.height);if(g){k.width=h.minWidth}if(r){k.height=h.minHeight}if(t){k.width=h.maxWidth}if(l){k.height=h.maxHeight}var d=this.originalPosition.left+this.originalSize.width,n=this.position.top+this.size.height;var j=/sw|nw|w/.test(p),c=/nw|ne|n/.test(p);if(g&&j){k.left=d-h.minWidth}if(t&&j){k.left=d-h.maxWidth}if(r&&c){k.top=n-h.minHeight}if(l&&c){k.top=n-h.maxHeight}var m=!k.width&&!k.height;if(m&&!k.left&&k.top){k.top=null}else{if(m&&!k.top&&k.left){k.left=null}}return k},_proportionallyResize:function(){var j=this.options;if(!this.proportionallyResize.length){return}var f=this.helper||this.element;for(var d=0;d');var c=b.browser.msie&&b.browser.version<7,f=(c?1:0),g=(c?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+g,height:this.element.outerHeight()+g,position:"absolute",left:this.elementOffset.left-f+"px",top:this.elementOffset.top-f+"px",zIndex:++h.zIndex});this.helper.appendTo("body");if(h.disableSelection){this.helper.disableSelection()}}else{this.helper=this.element}},_change:{e:function(f,d,c){return{width:this.originalSize.width+d}},w:function(g,d,c){var i=this.options,f=this.originalSize,h=this.originalPosition;return{left:h.left+d,width:f.width-d}},n:function(g,d,c){var i=this.options,f=this.originalSize,h=this.originalPosition;return{top:h.top+c,height:f.height-c}},s:function(f,d,c){return{height:this.originalSize.height+c}},se:function(f,d,c){return b.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[f,d,c]))},sw:function(f,d,c){return b.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[f,d,c]))},ne:function(f,d,c){return b.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[f,d,c]))},nw:function(f,d,c){return b.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[f,d,c]))}},_propagate:function(d,c){b.ui.plugin.call(this,d,[c,this.ui()]);(d!="resize"&&this._trigger(d,c,this.ui()))},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}));b.extend(b.ui.resizable,{version:"1.6rc6",eventPrefix:"resize",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input,option",containment:false,delay:0,disableSelection:true,distance:1,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,preserveCursor:true,preventDefault:true,proportionallyResize:false,transparent:false,zIndex:1000}});b.ui.plugin.add("resizable","alsoResize",{start:function(d,f){var c=b(this).data("resizable"),g=c.options;_store=function(h){b(h).each(function(){b(this).data("resizable-alsoresize",{width:parseInt(b(this).width(),10),height:parseInt(b(this).height(),10),left:parseInt(b(this).css("left"),10),top:parseInt(b(this).css("top"),10)})})};if(typeof(g.alsoResize)=="object"&&!g.alsoResize.parentNode){if(g.alsoResize.length){g.alsoResize=g.alsoResize[0];_store(g.alsoResize)}else{b.each(g.alsoResize,function(h,i){_store(h)})}}else{_store(g.alsoResize)}},resize:function(f,h){var d=b(this).data("resizable"),i=d.options,g=d.originalSize,k=d.originalPosition;var j={height:(d.size.height-g.height)||0,width:(d.size.width-g.width)||0,top:(d.position.top-k.top)||0,left:(d.position.left-k.left)||0},c=function(l,m){b(l).each(function(){var p=b(this),q=b(this).data("resizable-alsoresize"),o={},n=m&&m.length?m:["width","height","top","left"];b.each(n||["width","height","top","left"],function(r,t){var s=(q[t]||0)+(j[t]||0);if(s&&s>=0){o[t]=s||null}});if(/relative/.test(p.css("position"))&&b.browser.opera){d._revertToRelativePosition=true;p.css({position:"absolute",top:"auto",left:"auto"})}p.css(o)})};if(typeof(i.alsoResize)=="object"&&!i.alsoResize.nodeType){b.each(i.alsoResize,function(l,m){c(l,m)})}else{c(i.alsoResize)}},stop:function(d,f){var c=b(this).data("resizable");if(c._revertToRelativePosition&&b.browser.opera){c._revertToRelativePosition=false;el.css({position:"relative"})}b(this).removeData("resizable-alsoresize-start")}});b.ui.plugin.add("resizable","animate",{stop:function(h,m){var n=b(this).data("resizable"),i=n.options;var g=i.proportionallyResize,c=g&&(/textarea/i).test(g.get(0).nodeName),d=c&&b.ui.hasScroll(g.get(0),"left")?0:n.sizeDiff.height,k=c?0:n.sizeDiff.width;var f={width:(n.size.width-k),height:(n.size.height-d)},j=(parseInt(n.element.css("left"),10)+(n.position.left-n.originalPosition.left))||null,l=(parseInt(n.element.css("top"),10)+(n.position.top-n.originalPosition.top))||null;n.element.animate(b.extend(f,l&&j?{top:l,left:j}:{}),{duration:i.animateDuration,easing:i.animateEasing,step:function(){var o={width:parseInt(n.element.css("width"),10),height:parseInt(n.element.css("height"),10),top:parseInt(n.element.css("top"),10),left:parseInt(n.element.css("left"),10)};if(g){g.css({width:o.width,height:o.height})}n._updateCache(o);n._propagate("resize",h)}})}});b.ui.plugin.add("resizable","containment",{start:function(d,q){var s=b(this).data("resizable"),i=s.options,k=s.element;var f=i.containment,j=(f instanceof b)?f.get(0):(/parent/.test(f))?k.parent().get(0):f;if(!j){return}s.containerElement=b(j);if(/document/.test(f)||f==document){s.containerOffset={left:0,top:0};s.containerPosition={left:0,top:0};s.parentData={element:b(document),left:0,top:0,width:b(document).width(),height:b(document).height()||document.body.parentNode.scrollHeight}}else{var m=b(j),h=[];b(["Top","Right","Left","Bottom"]).each(function(p,o){h[p]=a(m.css("padding"+o))});s.containerOffset=m.offset();s.containerPosition=m.position();s.containerSize={height:(m.innerHeight()-h[3]),width:(m.innerWidth()-h[1])};var n=s.containerOffset,c=s.containerSize.height,l=s.containerSize.width,g=(b.ui.hasScroll(j,"left")?j.scrollWidth:l),r=(b.ui.hasScroll(j)?j.scrollHeight:c);s.parentData={element:j,left:n.left,top:n.top,width:g,height:r}}},resize:function(f,m){var q=b(this).data("resizable"),h=q.options,d=q.containerSize,l=q.containerOffset,j=q.size,k=q.position,n=h._aspectRatio||f.shiftKey,c={top:0,left:0},g=q.containerElement;if(g[0]!=document&&(/static/).test(g.css("position"))){c=l}if(k.left<(q._helper?l.left:0)){q.size.width=q.size.width+(q._helper?(q.position.left-l.left):(q.position.left-c.left));if(n){q.size.height=q.size.width/h.aspectRatio}q.position.left=h.helper?l.left:0}if(k.top<(q._helper?l.top:0)){q.size.height=q.size.height+(q._helper?(q.position.top-l.top):q.position.top);if(n){q.size.width=q.size.height*h.aspectRatio}q.position.top=q._helper?l.top:0}var i=Math.abs((q._helper?q.offset.left-c.left:(q.offset.left-c.left))+q.sizeDiff.width),p=Math.abs((q._helper?q.offset.top-c.top:(q.offset.top-l.top))+q.sizeDiff.height);if(i+q.size.width>=q.parentData.width){q.size.width=q.parentData.width-i;if(n){q.size.height=q.size.width/h.aspectRatio}}if(p+q.size.height>=q.parentData.height){q.size.height=q.parentData.height-p;if(n){q.size.width=q.size.height*h.aspectRatio}}},stop:function(d,m){var p=b(this).data("resizable"),f=p.options,k=p.position,l=p.containerOffset,c=p.containerPosition,g=p.containerElement;var i=b(p.helper),q=i.offset(),n=i.outerWidth()-p.sizeDiff.width,j=i.outerHeight()-p.sizeDiff.height;if(p._helper&&!f.animate&&(/relative/).test(g.css("position"))){b(this).css({left:q.left-c.left-l.left,width:n,height:j})}if(p._helper&&!f.animate&&(/static/).test(g.css("position"))){b(this).css({left:q.left-c.left-l.left,width:n,height:j})}}});b.ui.plugin.add("resizable","ghost",{start:function(f,g){var c=b(this).data("resizable"),h=c.options,i=h.proportionallyResize,d=c.size;c.ghost=c.originalElement.clone();c.ghost.css({opacity:0.25,display:"block",position:"relative",height:d.height,width:d.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof h.ghost=="string"?h.ghost:"");c.ghost.appendTo(c.helper)},resize:function(d,f){var c=b(this).data("resizable"),g=c.options;if(c.ghost){c.ghost.css({position:"relative",height:c.size.height,width:c.size.width})}},stop:function(d,f){var c=b(this).data("resizable"),g=c.options;if(c.ghost&&c.helper){c.helper.get(0).removeChild(c.ghost.get(0))}}});b.ui.plugin.add("resizable","grid",{resize:function(c,l){var n=b(this).data("resizable"),g=n.options,j=n.size,h=n.originalSize,i=n.originalPosition,m=n.axis,k=g._aspectRatio||c.shiftKey;g.grid=typeof g.grid=="number"?[g.grid,g.grid]:g.grid;var f=Math.round((j.width-h.width)/(g.grid[0]||1))*(g.grid[0]||1),d=Math.round((j.height-h.height)/(g.grid[1]||1))*(g.grid[1]||1);if(/^(se|s|e)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+d}else{if(/^(ne)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+d;n.position.top=i.top-d}else{if(/^(sw)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+d;n.position.left=i.left-f}else{n.size.width=h.width+f;n.size.height=h.height+d;n.position.top=i.top-d;n.position.left=i.left-f}}}}});var a=function(c){return parseInt(c,10)||0}})(jQuery);(function(a){a.widget("ui.selectable",a.extend({},a.ui.mouse,{_init:function(){var b=this;this.element.addClass("ui-selectable");this.dragged=false;var c;this.refresh=function(){c=a(b.options.filter,b.element[0]);c.each(function(){var d=a(this);var f=d.offset();a.data(this,"selectable-item",{element:this,$element:d,left:f.left,top:f.top,right:f.left+d.outerWidth(),bottom:f.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"),selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=c.addClass("ui-selectee");this._mouseInit();this.helper=a(document.createElement("div")).css({border:"1px dotted black"}).addClass("ui-selectable-helper")},destroy:function(){this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy()},_mouseStart:function(d){var b=this;this.opos=[d.pageX,d.pageY];if(this.options.disabled){return}var c=this.options;this.selectees=a(c.filter,this.element[0]);this._trigger("start",d);a("body").append(this.helper);this.helper.css({"z-index":100,position:"absolute",left:d.clientX,top:d.clientY,width:0,height:0});if(c.autoRefresh){this.refresh()}this.selectees.filter(".ui-selected").each(function(){var f=a.data(this,"selectable-item");f.startselected=true;if(!d.metaKey){f.$element.removeClass("ui-selected");f.selected=false;f.$element.addClass("ui-unselecting");f.unselecting=true;b._trigger("unselecting",d,{unselecting:f.element})}});a(d.target).parents().andSelf().each(function(){var f=a.data(this,"selectable-item");if(f){f.$element.removeClass("ui-unselecting").addClass("ui-selecting");f.unselecting=false;f.selecting=true;f.selected=true;b._trigger("selecting",d,{selecting:f.element});return false}})},_mouseDrag:function(j){var c=this;this.dragged=true;if(this.options.disabled){return}var f=this.options;var d=this.opos[0],i=this.opos[1],b=j.pageX,h=j.pageY;if(d>b){var g=b;b=d;d=g}if(i>h){var g=h;h=i;i=g}this.helper.css({left:d,top:i,width:b-d,height:h-i});this.selectees.each(function(){var k=a.data(this,"selectable-item");if(!k||k.element==c.element[0]){return}var l=false;if(f.tolerance=="touch"){l=(!(k.left>b||k.righth||k.bottomd&&k.righti&&k.bottom=0;b--){this.items[b].item.removeData("sortable-item")}},_mouseCapture:function(f,g){if(this.reverting){return false}if(this.options.disabled||this.options.type=="static"){return false}this._refreshItems(f);var d=null,c=this,b=a(f.target).parents().each(function(){if(a.data(this,"sortable-item")==c){d=a(this);return false}});if(a.data(f.target,"sortable-item")==c){d=a(f.target)}if(!d){return false}if(this.options.handle&&!g){var h=false;a(this.options.handle,d).find("*").andSelf().each(function(){if(this==f.target){h=true}});if(!h){return false}}this.currentItem=d;this._removeCurrentsFromItems();return true},_mouseStart:function(f,g,b){var h=this.options,c=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(f);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");a.extend(this.offset,{click:{left:f.pageX-this.offset.left,top:f.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(f);this.originalPageX=f.pageX;this.originalPageY=f.pageY;if(h.cursorAt){this._adjustOffsetFromHelper(h.cursorAt)}this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!=this.currentItem[0]){this.currentItem.hide()}this._createPlaceholder();if(h.containment){this._setContainment()}if(h.cursor){if(a("body").css("cursor")){this._storedCursor=a("body").css("cursor")}a("body").css("cursor",h.cursor)}if(h.opacity){if(this.helper.css("opacity")){this._storedOpacity=this.helper.css("opacity")}this.helper.css("opacity",h.opacity)}if(h.zIndex){if(this.helper.css("zIndex")){this._storedZIndex=this.helper.css("zIndex")}this.helper.css("zIndex",h.zIndex)}if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){this.overflowOffset=this.scrollParent.offset()}this._trigger("start",f,this._uiHash());if(!this._preserveHelperProportions){this._cacheHelperProportions()}if(!b){for(var d=this.containers.length-1;d>=0;d--){this.containers[d]._trigger("activate",f,c._uiHash(this))}}if(a.ui.ddmanager){a.ui.ddmanager.current=this}if(a.ui.ddmanager&&!h.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,f)}this.dragging=true;this.helper.addClass(h.cssNamespace+"-sortable-helper");this._mouseDrag(f);return true},_mouseDrag:function(g){this.position=this._generatePosition(g);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs}if(this.options.scroll){var h=this.options,b=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if((this.overflowOffset.top+this.scrollParent[0].offsetHeight)-g.pageY=0;d--){var f=this.items[d],c=f.item[0],j=this._intersectsWithPointer(f);if(!j){continue}if(c!=this.currentItem[0]&&this.placeholder[j==1?"next":"prev"]()[0]!=c&&!a.ui.contains(this.placeholder[0],c)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],c):true)){this.direction=j==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(f)){this.options.sortIndicator.call(this,g,f)}else{break}this._trigger("change",g,this._uiHash());break}}this._contactContainers(g);if(a.ui.ddmanager){a.ui.ddmanager.drag(this,g)}this._trigger("sort",g,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(c,d){if(!c){return}if(a.ui.ddmanager&&!this.options.dropBehaviour){a.ui.ddmanager.drop(this,c)}if(this.options.revert){var b=this;var f=b.placeholder.offset();b.reverting=true;a(this.helper).animate({left:f.left-this.offset.parent.left-b.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:f.top-this.offset.parent.top-b.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){b._clear(c)})}else{this._clear(c,d)}return false},cancel:function(){var b=this;if(this.dragging){this._mouseUp();if(this.options.helper=="original"){this.currentItem.css(this._storedCSS).removeClass(this.options.cssNamespace+"-sortable-helper")}else{this.currentItem.show()}for(var c=this.containers.length-1;c>=0;c--){this.containers[c]._trigger("deactivate",null,b._uiHash(this));if(this.containers[c].containerCache.over){this.containers[c]._trigger("out",null,b._uiHash(this));this.containers[c].containerCache.over=0}}}if(this.placeholder[0].parentNode){this.placeholder[0].parentNode.removeChild(this.placeholder[0])}if(this.options.helper!="original"&&this.helper&&this.helper[0].parentNode){this.helper.remove()}a.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){a(this.domPosition.prev).after(this.currentItem)}else{a(this.domPosition.parent).prepend(this.currentItem)}return true},serialize:function(d){var b=this._getItemsAsjQuery(d&&d.connected);var c=[];d=d||{};a(b).each(function(){var f=(a(d.item||this).attr(d.attribute||"id")||"").match(d.expression||(/(.+)[-=_](.+)/));if(f){c.push((d.key||f[1]+"[]")+"="+(d.key&&d.expression?f[1]:f[2]))}});return c.join("&")},toArray:function(d){var b=this._getItemsAsjQuery(d&&d.connected);var c=[];d=d||{};b.each(function(){c.push(a(d.item||this).attr(d.attribute||"id")||"")});return c},_intersectsWith:function(n){var f=this.positionAbs.left,d=f+this.helperProportions.width,m=this.positionAbs.top,k=m+this.helperProportions.height;var g=n.left,c=g+n.width,o=n.top,j=o+n.height;var p=this.offset.click.top,i=this.offset.click.left;var h=(m+p)>o&&(m+p)g&&(f+i)n[this.floating?"width":"height"])){return h}else{return(g0?"down":"up")},_getDragHorizontalDirection:function(){var b=this.positionAbs.left-this.lastPositionAbs.left;return b!=0&&(b>0?"right":"left")},refresh:function(b){this._refreshItems(b);this.refreshPositions()},_getItemsAsjQuery:function(b){var m=this;var h=[];var f=[];if(this.options.connectWith&&b){var k=this.options.connectWith.constructor==String?[this.options.connectWith]:this.options.connectWith;for(var d=k.length-1;d>=0;d--){var l=a(k[d]);for(var c=l.length-1;c>=0;c--){var g=a.data(l[c],"sortable");if(g&&g!=this&&!g.options.disabled){f.push([a.isFunction(g.options.items)?g.options.items.call(g.element):a(g.options.items,g.element).not("."+g.options.cssNamespace+"-sortable-helper"),g])}}}}f.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not("."+this.options.cssNamespace+"-sortable-helper"),this]);for(var d=f.length-1;d>=0;d--){f[d][0].each(function(){h.push(this)})}return a(h)},_removeCurrentsFromItems:function(){var d=this.currentItem.find(":data(sortable-item)");for(var c=0;c=0;f--){var m=a(this.options.connectWith[f]);for(var d=m.length-1;d>=0;d--){var h=a.data(m[d],"sortable");if(h&&h!=this&&!h.options.disabled){g.push([a.isFunction(h.options.items)?h.options.items.call(h.element[0],b,{item:this.currentItem}):a(h.options.items,h.element),h]);this.containers.push(h)}}}}for(var f=g.length-1;f>=0;f--){var l=g[f][1];var c=g[f][0];for(var d=0,n=c.length;d=0;d--){var f=this.items[d];if(f.instance!=this.currentContainer&&this.currentContainer&&f.item[0]!=this.currentItem[0]){continue}var c=this.options.toleranceElement?a(this.options.toleranceElement,f.item):f.item;if(!b){if(this.options.accurateIntersection){f.width=c.outerWidth();f.height=c.outerHeight()}else{f.width=c[0].offsetWidth;f.height=c[0].offsetHeight}}var g=c.offset();f.left=g.left;f.top=g.top}if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this)}else{for(var d=this.containers.length-1;d>=0;d--){var g=this.containers[d].element.offset();this.containers[d].containerCache.left=g.left;this.containers[d].containerCache.top=g.top;this.containers[d].containerCache.width=this.containers[d].element.outerWidth();this.containers[d].containerCache.height=this.containers[d].element.outerHeight()}}},_createPlaceholder:function(d){var b=d||this,f=b.options;if(!f.placeholder||f.placeholder.constructor==String){var c=f.placeholder;f.placeholder={element:function(){var g=a(document.createElement(b.currentItem[0].nodeName)).addClass(c||b.currentItem[0].className+" "+b.options.cssNamespace+"-sortable-placeholder").removeClass(b.options.cssNamespace+"-sortable-helper")[0];if(!c){g.style.visibility="hidden"}return g},update:function(g,h){if(c&&!f.forcePlaceholderSize){return}if(!h.height()){h.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10))}if(!h.width()){h.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10))}}}}b.placeholder=a(f.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);f.placeholder.update(b,b.placeholder)},_contactContainers:function(d){for(var c=this.containers.length-1;c>=0;c--){if(this._intersectsWith(this.containers[c].containerCache)){if(!this.containers[c].containerCache.over){if(this.currentContainer!=this.containers[c]){var k=10000;var h=null;var f=this.positionAbs[this.containers[c].floating?"left":"top"];for(var b=this.items.length-1;b>=0;b--){if(!a.ui.contains(this.containers[c].element[0],this.items[b].item[0])){continue}var g=this.items[b][this.containers[c].floating?"left":"top"];if(Math.abs(g-f)this.containment[2]){d=this.containment[2]+this.offset.click.left}if(f.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(i.grid){var h=this.originalPageY+Math.round((c-this.originalPageY)/i.grid[1])*i.grid[1];c=this.containment?(!(h-this.offset.click.topthis.containment[3])?h:(!(h-this.offset.click.topthis.containment[2])?g:(!(g-this.offset.click.left=0;c--){if(a.ui.contains(this.containers[c].element[0],this.currentItem[0])&&!f){g.push((function(h){return function(i){h._trigger("receive",i,this._uiHash(this))}}).call(this,this.containers[c]));g.push((function(h){return function(i){h._trigger("update",i,this._uiHash(this))}}).call(this,this.containers[c]))}}}for(var c=this.containers.length-1;c>=0;c--){if(!f){g.push((function(h){return function(i){h._trigger("deactivate",i,this._uiHash(this))}}).call(this,this.containers[c]))}if(this.containers[c].containerCache.over){g.push((function(h){return function(i){h._trigger("out",i,this._uiHash(this))}}).call(this,this.containers[c]));this.containers[c].containerCache.over=0}}if(this._storedCursor){a("body").css("cursor",this._storedCursor)}if(this._storedOpacity){this.helper.css("opacity",this._storedCursor)}if(this._storedZIndex){this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex)}this.dragging=false;if(this.cancelHelperRemoval){if(!f){this._trigger("beforeStop",d,this._uiHash());for(var c=0;c *",placeholder:false,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,sortIndicator:a.ui.sortable.prototype._rearrange,tolerance:"intersect",zIndex:1000}})})(jQuery);(function(a){a.widget("ui.accordion",{_init:function(){var d=this.options,b=this;this.running=0;if(d.navigation){var c=this.element.find("a").filter(d.navigationFilter);if(c.length){if(c.filter(d.header).length){this.active=c}else{this.active=c.parent().parent().prev();c.addClass("ui-accordion-content-active")}}}this.element.addClass("ui-accordion ui-widget ui-helper-reset");this.headers=this.element.find(d.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){a(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){a(this).removeClass("ui-state-hover")});this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");this.active=this._findActive(this.active||d.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");this.active.next().addClass("ui-accordion-content-active");a("").addClass("ui-icon "+d.icons.header).prependTo(this.headers);this.active.find(".ui-icon").toggleClass(d.icons.header).toggleClass(d.icons.headerSelected);if(a.browser.msie){this.element.find("a").css("zoom","1")}this.resize();this.element.attr("role","tablist");this.headers.attr("role","tab").bind("keydown",function(f){return b._keydown(f)}).next().attr("role","tabpanel");this.headers.not(this.active||"").attr("aria-expanded","false").attr("tabIndex","-1").next().hide();if(!this.active.length){this.headers.eq(0).attr("tabIndex","0")}else{this.active.attr("aria-expanded","true").attr("tabIndex","0")}if(!a.browser.safari){this.headers.find("a").attr("tabIndex","-1")}if(d.event){this.element.bind((d.event)+".accordion",function(f){return b._clickHandler.call(b,f)})}},destroy:function(){this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role").unbind(".accordion").removeData("accordion");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");this.headers.find("a").removeAttr("tabindex");this.headers.children(".ui-icon").remove();this.headers.next().removeClass("ui-accordion-content ui-accordion-content-active")},_keydown:function(f){var h=this.options,g=a.ui.keyCode;if(h.disabled||f.altKey||f.ctrlKey){return}var d=this.headers.length;var b=this.headers.index(f.target);var c=false;switch(f.keyCode){case g.RIGHT:case g.DOWN:c=this.headers[(b+1)%d];break;case g.LEFT:case g.UP:c=this.headers[(b-1+d)%d];break;case g.SPACE:case g.ENTER:return this._clickHandler({target:f.target})}if(c){a(f.target).attr("tabIndex","-1");a(c).attr("tabIndex","0");c.focus();return false}return true},resize:function(){var f=this.options,d;if(f.fillSpace){if(a.browser.msie){var b=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}d=this.element.parent().height();if(a.browser.msie){this.element.parent().css("overflow",b)}this.headers.each(function(){d-=a(this).outerHeight()});var c=0;this.headers.next().each(function(){c=Math.max(c,a(this).innerHeight()-a(this).height())}).height(d-c).css("overflow","auto")}else{if(f.autoHeight){d=0;this.headers.next().each(function(){d=Math.max(d,a(this).outerHeight())}).height(d)}}},activate:function(b){this._clickHandler({target:this._findActive(b)[0]})},_findActive:function(b){return b?typeof b=="number"?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):b===false?a([]):this.headers.filter(":eq(0)")},_clickHandler:function(g){var i=this.options;if(i.disabled){return false}if(!g.target&&!i.alwaysOpen){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(i.icons.headerSelected).addClass(i.icons.header);this.active.next().addClass("ui-accordion-content-active");var c=this.active.next(),h={options:i,newHeader:a([]),oldHeader:i.active,newContent:a([]),oldContent:c},b=(this.active=a([]));this._toggle(b,c,h);return false}var d=a(g.target);d=a(d.parents(i.header)[0]||d);var f=d[0]==this.active[0];if(this.running||(i.alwaysOpen&&f)){return false}if(!d.is(i.header)){return}this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(i.icons.headerSelected).addClass(i.icons.header);this.active.next().addClass("ui-accordion-content-active");if(!f){d.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").find(".ui-icon").removeClass(i.icons.header).addClass(i.icons.headerSelected);d.next().addClass("ui-accordion-content-active")}var b=d.next(),c=this.active.next(),h={options:i,newHeader:f&&!i.alwaysOpen?a([]):d,oldHeader:this.active,newContent:f&&!i.alwaysOpen?a([]):b.find("> *"),oldContent:c.find("> *")},j=this.headers.index(this.active[0])>this.headers.index(d[0]);this.active=f?a([]):d;this._toggle(b,c,h,f,j);return false},_toggle:function(b,j,h,k,l){var d=this.options,n=this;this.toShow=b;this.toHide=j;this.data=h;var c=function(){if(!n){return}return n._completed.apply(n,arguments)};this._trigger("changestart",null,this.data);this.running=j.size()===0?b.size():j.size();if(d.animated){var g={};if(!d.alwaysOpen&&k){g={toShow:a([]),toHide:j,complete:c,down:l,autoHeight:d.autoHeight||d.fillSpace}}else{g={toShow:b,toHide:j,complete:c,down:l,autoHeight:d.autoHeight||d.fillSpace}}if(!d.proxied){d.proxied=d.animated}if(!d.proxiedDuration){d.proxiedDuration=d.duration}d.animated=a.isFunction(d.proxied)?d.proxied(g):d.proxied;d.duration=a.isFunction(d.proxiedDuration)?d.proxiedDuration(g):d.proxiedDuration;var m=a.ui.accordion.animations,f=d.duration,i=d.animated;if(!m[i]){m[i]=function(o){this.slide(o,{easing:i,duration:f||700})}}m[i](g)}else{if(!d.alwaysOpen&&k){b.toggle()}else{j.hide();b.show()}c(true)}j.prev().attr("aria-expanded","false").attr("tabIndex","-1");b.prev().attr("aria-expanded","true").attr("tabIndex","0").focus()},_completed:function(b){var c=this.options;this.running=b?0:--this.running;if(this.running){return}if(c.clearStyle){this.toShow.add(this.toHide).css({height:"",overflow:""})}this._trigger("change",null,this.data)}});a.extend(a.ui.accordion,{version:"1.6rc6",defaults:{active:null,autoHeight:true,alwaysOpen:true,animated:"slide",clearStyle:false,event:"click",fillSpace:false,header:"a",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase()}},animations:{slide:function(k,i){k=a.extend({easing:"swing",duration:300},k,i);if(!k.toHide.size()){k.toShow.animate({height:"show"},k);return}var b=k.toHide.height(),j=k.toShow.height(),c=j/b,d=k.toShow.css("overflow"),f={},h={},g=["height","paddingTop","paddingBottom"];a.each(g,function(l,m){h[m]="hide";f[m]=parseFloat(k.toShow.css(m))});k.toShow.css({height:0,overflow:"hidden"}).show();k.toHide.filter(":hidden").each(k.complete).end().filter(":visible").animate(h,{step:function(m,n){if(!k.toShow[0]){return}var l=n.start!=n.end?(n.now-n.start)/(n.end-n.start):0,o=l*f[n.prop];if(a.browser.msie||a.browser.opera){o=Math.ceil(o)}k.toShow[0].style[n.prop]=o+"px"},duration:k.duration,easing:k.easing,complete:function(){if(!k.autoHeight){k.toShow.css("height","auto")}k.toShow.css({overflow:d});k.complete()}})},bounceslide:function(b){this.slide(b,{easing:b.down?"easeOutBounce":"swing",duration:b.down?1000:200})},easeslide:function(b){this.slide(b,{easing:"easeinout",duration:700})}}})})(jQuery);(function(b){var a={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"};b.widget("ui.dialog",{_init:function(){this.originalTitle=this.element.attr("title");var l=this,m=this.options,j=m.title||this.originalTitle||" ",d=b.ui.dialog.getTitleId(this.element),k=(this.uiDialog=b("
")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+m.dialogClass).css({position:"absolute",overflow:"hidden",zIndex:m.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(n){(m.closeOnEscape&&n.keyCode&&n.keyCode==b.ui.keyCode.ESCAPE&&l.close(n))}).attr({role:"dialog","aria-labelledby":d}).mousedown(function(n){l.moveToTop(n)}),g=this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(k),f=(this.uiDialogTitlebar=b("
")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(k),i=b('').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){i.addClass("ui-state-hover")},function(){i.removeClass("ui-state-hover")}).focus(function(){i.addClass("ui-state-focus")}).blur(function(){i.removeClass("ui-state-focus")}).mousedown(function(n){n.stopPropagation()}).click(function(n){l.close(n);return false}).appendTo(f),h=(this.uiDialogTitlebarCloseText=b("")).addClass("ui-icon ui-icon-closethick").text(m.closeText).appendTo(i),c=b("").addClass("ui-dialog-title").attr("id",d).html(j).prependTo(f);f.find("*").add(f).disableSelection();(m.draggable&&b.fn.draggable&&this._makeDraggable());(m.resizable&&b.fn.resizable&&this._makeResizable());this._createButtons(m.buttons);this._isOpen=false;(m.bgiframe&&b.fn.bgiframe&&k.bgiframe());(m.autoOpen&&this.open())},destroy:function(){(this.overlay&&this.overlay.destroy());(this.shadow&&this._destroyShadow());this.uiDialog.hide();this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");this.uiDialog.remove();(this.originalTitle&&this.element.attr("title",this.originalTitle))},close:function(c){if(false===this._trigger("beforeclose",c)){return}(this.overlay&&this.overlay.destroy());(this.shadow&&this._destroyShadow());this.uiDialog.hide(this.options.hide).unbind("keypress.ui-dialog");this._trigger("close",c);b.ui.dialog.overlay.resize();this._isOpen=false},isOpen:function(){return this._isOpen},moveToTop:function(h,g){if((this.options.modal&&!h)||(!this.options.stack&&!this.options.modal)){return this._trigger("focus",g)}var f=this.options.zIndex,d=this.options;b(".ui-dialog:visible").each(function(){f=Math.max(f,parseInt(b(this).css("z-index"),10)||d.zIndex)});(this.overlay&&this.overlay.$el.css("z-index",++f));(this.shadow&&this.shadow.css("z-index",++f));var c={scrollTop:this.element.attr("scrollTop"),scrollLeft:this.element.attr("scrollLeft")};this.uiDialog.css("z-index",++f);this.element.attr(c);this._trigger("focus",g)},open:function(f){if(this._isOpen){return}var d=this.options,c=this.uiDialog;this.overlay=d.modal?new b.ui.dialog.overlay(this):null;(c.next().length&&c.appendTo("body"));this._size();this._position(d.position);c.show(d.show);this.moveToTop(true,f);(d.modal&&c.bind("keypress.ui-dialog",function(i){if(i.keyCode!=b.ui.keyCode.TAB){return}var h=b(":tabbable",this),j=h.filter(":first")[0],g=h.filter(":last")[0];if(i.target==g&&!i.shiftKey){setTimeout(function(){j.focus()},1)}else{if(i.target==j&&i.shiftKey){setTimeout(function(){g.focus()},1)}}}));b([]).add(c.find(".ui-dialog-content :tabbable:first")).add(c.find(".ui-dialog-buttonpane :tabbable:first")).add(c.find(".ui-dialog-titlebar :tabbable:first")).filter(":first").focus();if(d.shadow){this._createShadow()}this._trigger("open",f);this._isOpen=true},_createButtons:function(g){var f=this,c=false,d=b("
").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");this.uiDialog.find(".ui-dialog-buttonpane").remove();(typeof g=="object"&&g!==null&&b.each(g,function(){return !(c=true)}));if(c){b.each(g,function(h,i){b('').addClass("ui-state-default ui-corner-all").text(h).click(function(){i.apply(f.element[0],arguments)}).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")}).focus(function(){b(this).addClass("ui-state-focus")}).blur(function(){b(this).removeClass("ui-state-focus")}).appendTo(d)});d.appendTo(this.uiDialog)}},_makeDraggable:function(){var c=this,d=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content",helper:d.dragHelper,handle:".ui-dialog-titlebar",containment:"document",start:function(){(d.dragStart&&d.dragStart.apply(c.element[0],arguments));if(b.browser.msie&&b.browser.version<7&&c.shadow){c.shadow.hide()}},drag:function(){(d.drag&&d.drag.apply(c.element[0],arguments));c._refreshShadow(1)},stop:function(){(d.dragStop&&d.dragStop.apply(c.element[0],arguments));b.ui.dialog.overlay.resize();if(b.browser.msie&&b.browser.version<7&&c.shadow){c.shadow.show()}c._refreshShadow()}})},_makeResizable:function(g){g=(g===undefined?this.options.resizable:g);var c=this,f=this.options,d=typeof g=="string"?g:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",alsoResize:this.element,helper:f.resizeHelper,maxWidth:f.maxWidth,maxHeight:f.maxHeight,minWidth:f.minWidth,minHeight:f.minHeight,start:function(){(f.resizeStart&&f.resizeStart.apply(c.element[0],arguments));if(b.browser.msie&&b.browser.version<7&&c.shadow){c.shadow.hide()}},resize:function(){(f.resize&&f.resize.apply(c.element[0],arguments));c._refreshShadow(1)},handles:d,stop:function(){(f.resizeStop&&f.resizeStop.apply(c.element[0],arguments));b.ui.dialog.overlay.resize();if(b.browser.msie&&b.browser.version<7&&c.shadow){c.shadow.show()}c._refreshShadow()}}).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_position:function(i){var d=b(window),f=b(document),g=f.scrollTop(),c=f.scrollLeft(),h=g;if(b.inArray(i,["center","top","right","bottom","left"])>=0){i=[i=="right"||i=="left"?i:"center",i=="top"||i=="bottom"?i:"middle"]}if(i.constructor!=Array){i=["center","middle"]}if(i[0].constructor==Number){c+=i[0]}else{switch(i[0]){case"left":c+=0;break;case"right":c+=d.width()-this.uiDialog.outerWidth();break;default:case"center":c+=(d.width()-this.uiDialog.outerWidth())/2}}if(i[1].constructor==Number){g+=i[1]}else{switch(i[1]){case"top":g+=0;break;case"bottom":g+=d.height()-this.uiDialog.outerHeight();break;default:case"middle":g+=(d.height()-this.uiDialog.outerHeight())/2}}g=Math.max(g,h);this.uiDialog.css({top:g,left:c})},_setData:function(d,f){(a[d]&&this.uiDialog.data(a[d],f));switch(d){case"buttons":this._createButtons(f);break;case"closeText":this.uiDialogTitlebarCloseText.text(f);break;case"draggable":(f?this._makeDraggable():this.uiDialog.draggable("destroy"));break;case"height":this.uiDialog.height(f);break;case"position":this._position(f);break;case"resizable":var c=this.uiDialog,g=this.uiDialog.is(":data(resizable)");(g&&!f&&c.resizable("destroy"));(g&&typeof f=="string"&&c.resizable("option","handles",f));(g||this._makeResizable(f));break;case"title":b(".ui-dialog-title",this.uiDialogTitlebar).html(f||" ");break;case"width":this.uiDialog.width(f);break}b.widget.prototype._setData.apply(this,arguments)},_size:function(){var d=this.options;this.element.css({height:0,minHeight:0,width:"auto"});var c=this.uiDialog.css({height:"auto",width:d.width}).height();this.element.css({minHeight:Math.max(d.minHeight-c,0),height:d.height=="auto"?"auto":d.height-c})},_createShadow:function(){this.shadow=b('
').css("position","absolute").appendTo(document.body);this._refreshShadow();return this.shadow},_refreshShadow:function(c){if(c&&b.browser.msie&&b.browser.version<7){return}var d=this.uiDialog.offset();this.shadow.css({left:d.left,top:d.top,width:this.uiDialog.outerWidth(),height:this.uiDialog.outerHeight()})},_destroyShadow:function(){this.shadow.remove();this.shadow=null}});b.extend(b.ui.dialog,{version:"1.6rc6",defaults:{autoOpen:true,bgiframe:false,buttons:{},closeOnEscape:true,closeText:"close",draggable:true,height:"auto",minHeight:150,minWidth:150,modal:false,position:"center",resizable:true,shadow:true,stack:true,title:"",width:300,zIndex:1000},getter:"isOpen",uuid:0,getTitleId:function(c){return"ui-dialog-title-"+(c.attr("id")||++this.uuid)},overlay:function(c){this.$el=b.ui.dialog.overlay.create(c)}});b.extend(b.ui.dialog.overlay,{instances:[],events:b.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(c){return c+".dialog-overlay"}).join(" "),create:function(d){if(this.instances.length===0){setTimeout(function(){b("a, :input").bind(b.ui.dialog.overlay.events,function(){var g=false;var i=b(this).parents(".ui-dialog");if(i.length){var f=b(".ui-dialog-overlay");if(f.length){var h=parseInt(f.css("z-index"),10);f.each(function(){h=Math.max(h,parseInt(b(this).css("z-index"),10))});g=parseInt(i.css("z-index"),10)>h}else{g=true}}return g})},1);b(document).bind("keydown.dialog-overlay",function(f){(d.options.closeOnEscape&&f.keyCode&&f.keyCode==b.ui.keyCode.ESCAPE&&d.close(f))});b(window).bind("resize.dialog-overlay",b.ui.dialog.overlay.resize)}var c=b("
").appendTo(document.body).addClass("ui-widget-overlay").css({width:this.width(),height:this.height()});(d.options.bgiframe&&b.fn.bgiframe&&c.bgiframe());this.instances.push(c);return c},destroy:function(c){this.instances.splice(b.inArray(this.instances,c),1);if(this.instances.length===0){b("a, :input").add([document,window]).unbind(".dialog-overlay")}c.remove()},height:function(){if(b.browser.msie&&b.browser.version<7){var d=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);var c=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(d
");if(!c.values){c.values=[this._valueMin(),this._valueMin()]}if(c.values.length&&c.values.length!=2){c.values=[c.values[0],c.values[0]]}}else{this.range=a("
")}this.range.appendTo(this.element).addClass("ui-slider-range ui-widget-header");(c.range=="min")&&(this.orientation=="horizontal")&&this.range.css({left:0});(c.range=="max")&&(this.orientation=="horizontal")&&this.range.css({right:0});(c.range=="min")&&(this.orientation=="vertical")&&this.range.css({bottom:0});(c.range=="max")&&(this.orientation=="vertical")&&this.range.css({top:0})}if(a(".ui-slider-handle",this.element).length==0){a('
').appendTo(this.element).addClass("ui-slider-handle")}if(c.values&&c.values.length){while(a(".ui-slider-handle",this.element).length').appendTo(this.element).addClass("ui-slider-handle")}}this.handles=a(".ui-slider-handle",this.element).addClass("ui-state-default ui-corner-all");this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(d){d.preventDefault()}).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}).focus(function(){b.handles.removeClass("ui-state-focus");a(this).addClass("ui-state-focus")}).blur(function(){a(this).removeClass("ui-state-focus")});this.handles.each(function(d){a(this).data("index.ui-slider-handle",d)});this.handles.keydown(function(i){var f=a(this).data("index.ui-slider-handle");if(b.options.disabled){return}switch(i.keyCode){case a.ui.keyCode.HOME:case a.ui.keyCode.END:case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:if(!b._keySliding){b._keySliding=true;a(this).addClass("ui-state-active");b._start(i)}break}var g,d,h=b._step();if(b.options.values&&b.options.values.length){g=d=b.values(f)}else{g=d=b.value()}switch(i.keyCode){case a.ui.keyCode.HOME:d=b._valueMin();break;case a.ui.keyCode.END:d=b._valueMax();break;case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:if(g==b._valueMax()){return}d=g+h;break;case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:if(g==b._valueMin()){return}d=g-h;break}b._slide(i,f,d)}).keyup(function(d){if(b._keySliding){b._stop(d);b._change(d);b._keySliding=false;a(this).removeClass("ui-state-active")}});this._refreshValue()},destroy:function(){this.handles.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy()},_mouseCapture:function(d){var f=this.options;if(f.disabled){return false}this._start(d);this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();var i={x:d.pageX,y:d.pageY};var k=this._normValueFromMouse(i);var c=this._valueMax()+1,g;var l=this,j;this.handles.each(function(m){var n=Math.abs(k-l.values(m));if(c>n){c=n;g=a(this);j=m}});if(f.range&&(this.values(0)+this.values(1))==0){g=a(this.handles[++j])}l._handleIndex=j;g.addClass("ui-state-active").focus();var h=g.offset();var b=!a(d.target).parents().andSelf().is(".ui-slider-handle");this._clickOffset=b?{left:0,top:0}:{left:d.pageX-h.left+(parseInt(g.css("marginLeft"),10)||0),top:d.pageY-h.top+(parseInt(g.css("marginTop"),10)||0)};k=this._normValueFromMouse(i);this._slide(d,j,k);return true},_mouseStart:function(b){return true},_mouseDrag:function(d){var b={x:d.pageX,y:d.pageY};var c=this._normValueFromMouse(b);this._slide(d,this._handleIndex,c);return false},_mouseStop:function(b){this.handles.removeClass("ui-state-active");this._stop(b);this._change(b);this._handleIndex=null;this._clickOffset=null;return false},_detectOrientation:function(){this.orientation=this.options.orientation=="auto"?(this.element[0].offsetWidth/this.element[0].offsetHeight>1?"horizontal":"vertical"):this.options.orientation},_normValueFromMouse:function(d){var c,i;if("horizontal"==this.orientation){c=this.elementSize.width;i=d.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{c=this.elementSize.height;i=d.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}var g=(i/c);if(g>1){g=1}if(g<0){g=0}if("vertical"==this.orientation){g=1-g}var f=this._valueMax()-this._valueMin(),j=g*f,b=j%this.options.step,h=this._valueMin()+j-b;if(b>(this.options.step/2)){h+=this.options.step}return h},_start:function(b){this._trigger("start",b,{value:this.value()})},_slide:function(g,f,d){var h=this.handles[f];if(this.options.values&&this.options.values.length){var b=this.values(f?0:1);if((f==0&&d>=b)||(f==1&&d<=b)){d=b}if(d!=this.values(f)){var c=this.values();c[f]=d;var i=this._trigger("slide",g,{handle:h,value:d,values:c});var b=this.values(f?0:1);if(i!==false){this.values(f,d,!(g.type=="mousedown"&&this.options.animate))}}}else{if(d!=this.value()){var i=this._trigger("slide",g,{handle:h,value:d});if(i!==false){this._setData("value",d,(g.type=="mousedown"&&this.options.animate))}}}},_stop:function(b){this._trigger("stop",b,{value:this.value()})},_change:function(b){this._trigger("change",b,{value:this.value()})},value:function(b){if(arguments.length){this._setData("value",b);this._change()}return this._value()},values:function(c,d,b){if(!this.options.animate){b=true}if(arguments.length>1){this.options.values[c]=d;this._refreshValue(!b);this._change()}if(arguments.length){if(this.options.values&&this.options.values.length){return this._values(c)}else{return this.value()}}else{return this._values()}},_setData:function(b,c){a.widget.prototype._setData.apply(this,arguments);switch(b){case"orientation":this._detectOrientation();this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue();break;case"value":this._refreshValue();break}},_step:function(){var b=this.options.step;return b},_value:function(){var b=this.options.value;if(bthis._valueMax()){b=this._valueMax()}return b},_values:function(b){if(arguments.length){var c=this.options.values[b];if(cthis._valueMax()){c=this._valueMax()}return c}else{return this.options.values}},_valueMin:function(){var b=this.options.min;return b},_valueMax:function(){var b=this.options.max;return b},_refreshValue:function(f){var i=this.options.range,h=this.options,d=this;if(this.options.values&&this.options.values.length){var c,j;this.handles.each(function(n,l){var m=(d.values(n)-d._valueMin())/(d._valueMax()-d._valueMin())*100;var k={};k[d.orientation=="horizontal"?"left":"bottom"]=m+"%";a(this).stop(1,1)[f?"animate":"css"](k,h.animate);if(d.options.range===true){if(d.orientation=="horizontal"){(n==0)&&d.range.stop(1,1)[f?"animate":"css"]({left:m+"%"},h.animate);(n==1)&&d.range[f?"animate":"css"]({width:(m-lastValPercent)+"%"},{queue:false,duration:h.animate})}else{(n==0)&&d.range.stop(1,1)[f?"animate":"css"]({bottom:(m)+"%"},h.animate);(n==1)&&d.range[f?"animate":"css"]({height:(m-lastValPercent)+"%"},{queue:false,duration:h.animate})}}lastValPercent=m})}else{var g=(this.value()-this._valueMin())/(this._valueMax()-this._valueMin())*100;var b={};b[d.orientation=="horizontal"?"left":"bottom"]=g+"%";this.handle.stop(1,1)[f?"animate":"css"](b,h.animate);(i=="min")&&(this.orientation=="horizontal")&&this.range.stop(1,1)[f?"animate":"css"]({left:0,width:g+"%"},h.animate);(i=="max")&&(this.orientation=="horizontal")&&this.range[f?"animate":"css"]({left:g+"%",width:(100-g)+"%"},{queue:false,duration:h.animate});(i=="min")&&(this.orientation=="vertical")&&this.range.stop(1,1)[f?"animate":"css"]({top:(100-g)+"%",height:g+"%"},h.animate);(i=="max")&&(this.orientation=="vertical")&&this.range[f?"animate":"css"]({bottom:g+"%",height:(100-g)+"%"},{queue:false,duration:h.animate})}}}));a.extend(a.ui.slider,{getter:"value values",version:"1.6rc6",eventPrefix:"slide",defaults:{animate:false,delay:0,distance:0,max:100,min:0,orientation:"auto",range:false,step:1,value:0,values:null}})})(jQuery);(function(a){a.widget("ui.tabs",{_init:function(){this._tabify(true)},_setData:function(b,c){if((/^selected/).test(b)){this.select(c)}else{this.options[b]=c;this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^A-Za-z0-9\-_:\.]/g,"")||this.options.idPrefix+a.data(b)},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+a.data(this.list[0]));return a.cookie.apply(null,[b].concat(a.makeArray(arguments)))},_ui:function(c,b){return{tab:c,panel:b,index:this.$tabs.index(c)}},_tabify:function(r){this.list=this.element.is("div")?this.element.children("ul:first, ol:first").eq(0):this.element;this.$lis=a("li:has(a[href])",this.list);this.$tabs=this.$lis.map(function(){return a("a",this)[0]});this.$panels=a([]);var s=this,d=this.options;var c=/^#.+/;this.$tabs.each(function(u,o){var t=a(o).attr("href");if(c.test(t)){s.$panels=s.$panels.add(s._sanitizeSelector(t))}else{if(t!="#"){a.data(o,"href.tabs",t);a.data(o,"load.tabs",t.replace(/#.*$/,""));var w=s._tabId(o);o.href="#"+w;var v=a("#"+w);if(!v.length){v=a(d.panelTemplate).attr("id",w).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(s.$panels[u-1]||s.list);v.data("destroy.tabs",true)}s.$panels=s.$panels.add(v)}else{d.disabled.push(u+1)}}});if(r){if(this.element.is("div")){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all")}this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.$lis.addClass("ui-state-default ui-corner-top");this.$panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(d.selected===undefined){if(location.hash){this.$tabs.each(function(t,o){if(o.hash==location.hash){d.selected=t;return false}})}else{if(d.cookie){d.selected=parseInt(s._cookie(),10)}else{if(this.$lis.filter(".ui-tabs-selected").length){d.selected=this.$lis.index(this.$lis.filter(".ui-tabs-selected"))}else{d.selected=0}}}}else{if(d.selected===null){d.selected=-1}}d.selected=((d.selected>=0&&this.$tabs[d.selected])||d.selected<0)?d.selected:0;d.disabled=a.unique(d.disabled.concat(a.map(this.$lis.filter(".ui-state-disabled"),function(t,o){return s.$lis.index(t)}))).sort();if(a.inArray(d.selected,d.disabled)!=-1){d.disabled.splice(a.inArray(d.selected,d.disabled),1)}this.$panels.addClass("ui-tabs-hide");this.$lis.removeClass("ui-tabs-selected ui-state-active");if(d.selected>=0&&this.$tabs.length){this.$panels.eq(d.selected).removeClass("ui-tabs-hide");var g=["ui-tabs-selected ui-state-active"];if(d.deselectable){g.push("ui-tabs-deselectable")}this.$lis.eq(d.selected).addClass(g.join(" "));var l=function(){s._trigger("show",null,s._ui(s.$tabs[d.selected],s.$panels[d.selected]))};if(a.data(this.$tabs[d.selected],"load.tabs")){this.load(d.selected,l)}else{l()}}if(d.event!="mouseover"){var m=function(o,i){if(i.is(":not(.ui-state-disabled)")){i.toggleClass("ui-state-"+o)}};this.$lis.bind("mouseover.tabs mouseout.tabs",function(){m("hover",a(this))});this.$tabs.bind("focus.tabs blur.tabs",function(){m("focus",a(this).parents("li:first"))})}a(window).bind("unload",function(){s.$lis.add(s.$tabs).unbind(".tabs");s.$lis=s.$tabs=s.$panels=null})}else{d.selected=this.$lis.index(this.$lis.filter(".ui-tabs-selected"))}if(d.cookie){this._cookie(d.selected,d.cookie)}for(var j=0,q;q=this.$lis[j];j++){a(q)[a.inArray(j,d.disabled)!=-1&&!a(q).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled")}if(d.cache===false){this.$tabs.removeData("cache.tabs")}var b,k;if(d.fx){if(a.isArray(d.fx)){b=d.fx[0];k=d.fx[1]}else{b=k=d.fx}}function f(i,o){i.css({display:""});if(a.browser.msie&&o.opacity){i[0].style.removeAttribute("filter")}}var n=k?function(i,o){o.hide().removeClass("ui-tabs-hide").animate(k,500,function(){f(o,k);s._trigger("show",null,s._ui(i,o[0]))})}:function(i,o){o.removeClass("ui-tabs-hide");s._trigger("show",null,s._ui(i,o[0]))};var p=b?function(o,i,t){i.animate(b,b.duration||"normal",function(){i.addClass("ui-tabs-hide");f(i,b);if(t){n(o,t)}})}:function(o,i,t){i.addClass("ui-tabs-hide");if(t){n(o,t)}};function h(t,v,i,u){var o=["ui-tabs-selected ui-state-active"];if(d.deselectable){o.push("ui-tabs-deselectable")}v.removeClass("ui-state-default").addClass(o.join(" ")).siblings().removeClass(o.join(" ")).addClass("ui-state-default");p(t,i,u)}this.$tabs.unbind(".tabs").bind(d.event+".tabs",function(){var u=a(this).parents("li:eq(0)"),i=s.$panels.filter(":visible"),t=a(s._sanitizeSelector(this.hash));if((u.hasClass("ui-state-active")&&!d.deselectable)||u.hasClass("ui-state-disabled")||a(this).hasClass("ui-tabs-loading")||s._trigger("select",null,s._ui(this,t[0]))===false){this.blur();return false}d.selected=s.$tabs.index(this);if(d.deselectable){if(u.hasClass("ui-state-active")){d.selected=-1;if(d.cookie){s._cookie(d.selected,d.cookie)}u.removeClass("ui-tabs-selected ui-state-active ui-tabs-deselectable").addClass("ui-state-default");s.$panels.stop();p(this,i);this.blur();return false}else{if(!i.length){if(d.cookie){s._cookie(d.selected,d.cookie)}s.$panels.stop();var o=this;s.load(s.$tabs.index(this),function(){u.addClass("ui-tabs-selected ui-state-active ui-tabs-deselectable").removeClass("ui-state-default");n(o,t)});this.blur();return false}}}if(d.cookie){s._cookie(d.selected,d.cookie)}s.$panels.stop();if(t.length){var o=this;s.load(s.$tabs.index(this),i.length?function(){h(o,u,i,t)}:function(){u.addClass("ui-tabs-selected ui-state-active").removeClass("ui-state-default");n(o,t)})}else{throw"jQuery UI Tabs: Mismatching fragment identifier."}if(a.browser.msie){this.blur()}return false});if(d.event!="click"){this.$tabs.bind("click.tabs",function(){return false})}},destroy:function(){var b=this.options;this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all");this.list.unbind(".tabs").removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeData("tabs");this.$tabs.each(function(){var c=a.data(this,"href.tabs");if(c){this.href=c}var d=a(this).unbind(".tabs");a.each(["href","load","cache"],function(f,g){d.removeData(g+".tabs")})});this.$lis.unbind(".tabs").add(this.$panels).each(function(){if(a.data(this,"destroy.tabs")){a(this).remove()}else{a(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-tabs-deselectable ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")}});if(b.cookie){this._cookie(null,b.cookie)}},add:function(c,i,g){if(g==undefined){g=this.$tabs.length}var j=this,f=this.options;var h=a(f.tabTemplate.replace(/#\{href\}/g,c).replace(/#\{label\}/g,i));h.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var d=c.indexOf("#")==0?c.replace("#",""):this._tabId(a("a:first-child",h)[0]);var k=a("#"+d);if(!k.length){k=a(f.panelTemplate).attr("id",d).data("destroy.tabs",true)}k.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(g>=this.$lis.length){h.appendTo(this.list);k.appendTo(this.list[0].parentNode)}else{h.insertBefore(this.$lis[g]);k.insertBefore(this.$panels[g])}f.disabled=a.map(f.disabled,function(m,l){return m>=g?++m:m});this._tabify();if(this.$tabs.length==1){h.addClass("ui-tabs-selected ui-state-active");k.removeClass("ui-tabs-hide");var b=a.data(this.$tabs[0],"load.tabs");if(b){this.load(0,function(){j._trigger("show",null,j._ui(j.$tabs[0],j.$panels[0]))})}}this._trigger("add",null,this._ui(this.$tabs[g],this.$panels[g]))},remove:function(b){var d=this.options,f=this.$lis.eq(b).remove(),c=this.$panels.eq(b).remove();if(f.hasClass("ui-tabs-selected")&&this.$tabs.length>1){this.select(b+(b+1=b?--h:h});this._tabify();this._trigger("remove",null,this._ui(f.find("a")[0],c[0]))},enable:function(b){var c=this.options;if(a.inArray(b,c.disabled)==-1){return}this.$lis.eq(b).removeClass("ui-state-disabled");c.disabled=a.grep(c.disabled,function(f,d){return f!=b});this._trigger("enable",null,this._ui(this.$tabs[b],this.$panels[b]))},disable:function(c){var b=this,d=this.options;if(c!=d.selected){this.$lis.eq(c).addClass("ui-state-disabled");d.disabled.push(c);d.disabled.sort();this._trigger("disable",null,this._ui(this.$tabs[c],this.$panels[c]))}},select:function(b){if(typeof b=="string"){b=this.$tabs.index(this.$tabs.filter("[href$="+b+"]"))}this.$tabs.eq(b).trigger(this.options.event+".tabs")},load:function(h,l){var m=this,d=this.options,f=this.$tabs.eq(h),k=f[0],i=l==undefined||l===false,b=f.data("load.tabs");l=l||function(){};if(!b||!i&&a.data(k,"cache.tabs")){l();return}var n=function(o){var p=a(o),q=p.find("*:last");return q.length&&q.is(":not(img)")&&q||p};var c=function(){m.$tabs.filter(".ui-tabs-loading").removeClass("ui-tabs-loading").each(function(){if(d.spinner){n(this).parent().html(n(this).data("label.tabs"))}});m.xhr=null};if(d.spinner){var j=n(k).html();n(k).wrapInner("").find("em").data("label.tabs",j).html(d.spinner)}var g=a.extend({},d.ajaxOptions,{url:b,success:function(p,o){a(m._sanitizeSelector(k.hash)).html(p);c();if(d.cache){a.data(k,"cache.tabs",true)}m._trigger("load",null,m._ui(m.$tabs[h],m.$panels[h]));try{d.ajaxOptions.success(p,o)}catch(q){}l()}});if(this.xhr){this.xhr.abort();c()}f.addClass("ui-tabs-loading");m.xhr=a.ajax(g)},url:function(c,b){this.$tabs.eq(c).removeData("cache.tabs").data("load.tabs",b)},length:function(){return this.$tabs.length}});a.extend(a.ui.tabs,{version:"1.6rc6",getter:"length",defaults:{ajaxOptions:null,cache:false,cookie:null,deselectable:false,disabled:[],event:"click",fx:null,idPrefix:"ui-tabs-",panelTemplate:"
",spinner:"Loading…",tabTemplate:'
  • #{label}
  • '}});a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(d,g){var b=this,f=this.options.selected;function c(){clearTimeout(b.rotation);b.rotation=setTimeout(function(){f=++f')}$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",log:function(){if(this.debug){console.log.apply("",arguments)}},setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase();var inline=(nodeName=="div"||nodeName=="span");if(!target.id){target.id="dp"+(++this.uuid)}var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{});if(nodeName=="input"){this._connectDatepicker(target,inst)}else{if(inline){this._inlineDatepicker(target,inst)}}},_newInst:function(target,inline){var id=target[0].id.replace(/([:\[\]\.])/g,"\\\\$1");return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:$('
    '))}},_connectDatepicker:function(target,inst){var input=$(target);if(input.hasClass(this.markerClassName)){return}var appendText=this._get(inst,"appendText");var isRTL=this._get(inst,"isRTL");if(appendText){input[isRTL?"before":"after"](''+appendText+"")}var showOn=this._get(inst,"showOn");if(showOn=="focus"||showOn=="both"){input.focus(this._showDatepicker)}if(showOn=="button"||showOn=="both"){var buttonText=this._get(inst,"buttonText");var buttonImage=this._get(inst,"buttonImage");var trigger=$(this._get(inst,"buttonImageOnly")?$("").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$('').addClass(this._triggerClass).html(buttonImage==""?buttonText:$("").attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?"before":"after"](trigger);trigger.click(function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput==target){$.datepicker._hideDatepicker()}else{$.datepicker._showDatepicker(target)}return false})}input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst)},_inlineDatepicker:function(target,inst){var divSpan=$(target);if(divSpan.hasClass(this.markerClassName)){return}divSpan.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst));this._updateDatepicker(inst);this._updateAlternate(inst)},_dialogDatepicker:function(input,dateText,onSelect,settings,pos){var inst=this._dialogInst;if(!inst){var id="dp"+(++this.uuid);this._dialogInput=$('');this._dialogInput.keydown(this._doKeyDown);$("body").append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],PROP_NAME,inst)}extendRemove(inst.settings,settings||{});this._dialogInput.val(dateText);this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);if(!this._pos){var browserWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;var browserHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY]}this._dialogInput.css("left",this._pos[0]+"px").css("top",this._pos[1]+"px");inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI){$.blockUI(this.dpDiv)}$.data(this._dialogInput[0],PROP_NAME,inst);return this},_destroyDatepicker:function(target){var $target=$(target);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();$.removeData(target,PROP_NAME);if(nodeName=="input"){$target.siblings("."+this._appendClass).remove().end().siblings("."+this._triggerClass).remove().end().removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress)}else{if(nodeName=="div"||nodeName=="span"){$target.removeClass(this.markerClassName).empty()}}},_enableDatepicker:function(target){var $target=$(target);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=false;$target.siblings("button."+this._triggerClass).each(function(){this.disabled=false}).end().siblings("img."+this._triggerClass).css({opacity:"1.0",cursor:""})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().removeClass("ui-state-disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)})},_disableDatepicker:function(target){var $target=$(target);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=true;$target.siblings("button."+this._triggerClass).each(function(){this.disabled=true}).end().siblings("img."+this._triggerClass).css({opacity:"0.5",cursor:"default"})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().addClass("ui-state-disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)});this._disabledInputs[this._disabledInputs.length]=target},_isDisabledDatepicker:function(target){if(!target){return false}for(var i=0;i-1)}},_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!="input"){input=$("input",input.parentNode)[0]}if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput==input){return}var inst=$.datepicker._getInst(input);var beforeShow=$.datepicker._get(inst,"beforeShow");extendRemove(inst.settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));$.datepicker._hideDatepicker(null,"");$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog){input.value=""}if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight}var isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css("position")=="fixed";return !isFixed});if(isFixed&&$.browser.opera){$.datepicker._pos[0]-=document.documentElement.scrollLeft;$.datepicker._pos[1]-=document.documentElement.scrollTop}var offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;inst.rangeStart=null;inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});$.datepicker._updateDatepicker(inst);offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:($.datepicker._inDialog&&$.blockUI?"static":(isFixed?"fixed":"absolute")),display:"none",left:offset.left+"px",top:offset.top+"px"});if(!inst.inline){var showAnim=$.datepicker._get(inst,"showAnim")||"show";var duration=$.datepicker._get(inst,"duration");var postProcess=function(){$.datepicker._datepickerShowing=true;if($.browser.msie&&parseInt($.browser.version,10)<7){$("iframe.ui-datepicker-cover").css({width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4})}};if($.effects&&$.effects[showAnim]){inst.dpDiv.show(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[showAnim](duration,postProcess)}if(duration==""){postProcess()}if(inst.input[0].type!="hidden"){inst.input[0].focus()}$.datepicker._curInst=inst}},_updateDatepicker:function(inst){var dims={width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4};var self=this;inst.dpDiv.empty().append(this._generateHTML(inst)).find("iframe.ui-datepicker-cover").css({width:dims.width,height:dims.height}).end().find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout",function(){$(this).removeClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).removeClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).removeClass("ui-datepicker-next-hover")}}).bind("mouseover",function(){if(!self._isDisabledDatepicker(inst.inline?inst.dpDiv.parent()[0]:inst.input[0])){$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");$(this).addClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).addClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).addClass("ui-datepicker-next-hover")}}}).end().find("."+this._dayOverClass+" a").trigger("mouseover").end();var numMonths=this._getNumberOfMonths(inst);var cols=numMonths[1];var width=17;if(cols>1){inst.dpDiv.addClass("ui-datepicker-multi-"+cols).css("width",(width*cols)+"em")}else{inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("")}inst.dpDiv[(numMonths[0]!=1||numMonths[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");if(inst.input&&inst.input[0].type!="hidden"&&inst==$.datepicker._curInst){$(inst.input[0]).focus()}},_checkOffset:function(inst,offset,isFixed){var dpWidth=inst.dpDiv.outerWidth();var dpHeight=inst.dpDiv.outerHeight();var inputWidth=inst.input?inst.input.outerWidth():0;var inputHeight=inst.input?inst.input.outerHeight():0;var viewWidth=(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)+$(document).scrollLeft();var viewHeight=(window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight)+$(document).scrollTop();offset.left-=(this._get(inst,"isRTL")?(dpWidth-inputWidth):0);offset.left-=(isFixed&&offset.left==inst.input.offset().left)?$(document).scrollLeft():0;offset.top-=(isFixed&&offset.top==(inst.input.offset().top+inputHeight))?$(document).scrollTop():0;offset.left-=(offset.left+dpWidth>viewWidth&&viewWidth>dpWidth)?Math.abs(offset.left+dpWidth-viewWidth):0;offset.top-=(offset.top+dpHeight>viewHeight&&viewHeight>dpHeight)?Math.abs(offset.top+dpHeight+inputHeight*2-viewHeight):0;return offset},_findPos:function(obj){while(obj&&(obj.type=="hidden"||obj.nodeType!=1)){obj=obj.nextSibling}var position=$(obj).offset();return[position.left,position.top]},_hideDatepicker:function(input,duration){var inst=this._curInst;if(!inst||(input&&inst!=$.data(input,PROP_NAME))){return}if(inst.stayOpen){this._selectDate("#"+inst.id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear))}inst.stayOpen=false;if(this._datepickerShowing){duration=(duration!=null?duration:this._get(inst,"duration"));var showAnim=this._get(inst,"showAnim");var postProcess=function(){$.datepicker._tidyDialog(inst)};if(duration!=""&&$.effects&&$.effects[showAnim]){inst.dpDiv.hide(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[(duration==""?"hide":(showAnim=="slideDown"?"slideUp":(showAnim=="fadeIn"?"fadeOut":"hide")))](duration,postProcess)}if(duration==""){this._tidyDialog(inst)}var onClose=this._get(inst,"onClose");if(onClose){onClose.apply((inst.input?inst.input[0]:null),[(inst.input?inst.input.val():""),inst])}this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if($.blockUI){$.unblockUI();$("body").append(this.dpDiv)}}this._inDialog=false}this._curInst=null},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(event){if(!$.datepicker._curInst){return}var $target=$(event.target);if(($target.parents("#"+$.datepicker._mainDivId).length==0)&&!$target.hasClass($.datepicker.markerClassName)&&!$target.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI)){$.datepicker._hideDatepicker(null,"")}},_adjustDate:function(id,offset,period){var target=$(id);var inst=this._getInst(target[0]);if(this._isDisabledDatepicker(target[0])){return}this._adjustInstDate(inst,offset+(period=="M"?this._get(inst,"showCurrentAtPos"):0),period);this._updateDatepicker(inst)},_gotoToday:function(id){var target=$(id);var inst=this._getInst(target[0]);if(this._get(inst,"gotoCurrent")&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear}else{var date=new Date();inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear()}this._notifyChange(inst);this._adjustDate(target)},_selectMonthYear:function(id,select,period){var target=$(id);var inst=this._getInst(target[0]);inst._selectingMonthYear=false;inst["selected"+(period=="M"?"Month":"Year")]=inst["draw"+(period=="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target)},_clickMonthYear:function(id){var target=$(id);var inst=this._getInst(target[0]);if(inst.input&&inst._selectingMonthYear&&!$.browser.msie){inst.input[0].focus()}inst._selectingMonthYear=!inst._selectingMonthYear},_selectDay:function(id,month,year,td){var target=$(id);if($(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[0])){return}var inst=this._getInst(target[0]);inst.selectedDay=inst.currentDay=$("a",td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;if(inst.stayOpen){inst.endDay=inst.endMonth=inst.endYear=null}this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear));if(inst.stayOpen){inst.rangeStart=this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));this._updateDatepicker(inst)}},_clearDate:function(id){var target=$(id);var inst=this._getInst(target[0]);inst.stayOpen=false;inst.endDay=inst.endMonth=inst.endYear=inst.rangeStart=null;this._selectDate(target,"")},_selectDate:function(id,dateStr){var target=$(id);var inst=this._getInst(target[0]);dateStr=(dateStr!=null?dateStr:this._formatDate(inst));if(inst.input){inst.input.val(dateStr)}this._updateAlternate(inst);var onSelect=this._get(inst,"onSelect");if(onSelect){onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst])}else{if(inst.input){inst.input.trigger("change")}}if(inst.inline){this._updateDatepicker(inst)}else{if(!inst.stayOpen){this._hideDatepicker(null,this._get(inst,"duration"));this._lastInput=inst.input[0];if(typeof(inst.input[0])!="object"){inst.input[0].focus()}this._lastInput=null}}},_updateAlternate:function(inst){var altField=this._get(inst,"altField");if(altField){var altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat");var date=this._getDate(inst);dateStr=this.formatDate(altFormat,date,this._getFormatConfig(inst));$(altField).each(function(){$(this).val(dateStr)})}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),""]},iso8601Week:function(date){var checkDate=new Date(date.getFullYear(),date.getMonth(),date.getDate());var firstMon=new Date(checkDate.getFullYear(),1-1,4);var firstDay=firstMon.getDay()||7;firstMon.setDate(firstMon.getDate()+1-firstDay);if(firstDay<4&&checkDatenew Date(checkDate.getFullYear(),12-1,28)){firstDay=new Date(checkDate.getFullYear()+1,1-1,4).getDay()||7;if(firstDay>4&&(checkDate.getDay()||7)0&&iValue="0"&&value.charAt(iValue)<="9"){num=num*10+parseInt(value.charAt(iValue++),10);size--}if(size==origSize){throw"Missing number at position "+iValue}return num};var getName=function(match,shortNames,longNames){var names=(lookAhead(match)?longNames:shortNames);var size=0;for(var j=0;j0&&iValue-1){month=1;day=doy;do{var dim=this._getDaysInMonth(year,month-1);if(day<=dim){break}month++;day-=dim}while(true)}var date=this._daylightSavingAdjust(new Date(year,month-1,day));if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day){throw"Invalid date"}return date},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TIMESTAMP:"@",W3C:"yy-mm-dd",formatDate:function(format,date,settings){if(!date){return""}var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var lookAhead=function(match){var matches=(iFormat+1=0;m--){doy+=this._getDaysInMonth(date.getFullYear(),m)}output+=formatNumber("o",doy,3);break;case"m":output+=formatNumber("m",date.getMonth()+1,2);break;case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);break;case"y":output+=(lookAhead("y")?date.getFullYear():(date.getYear()%100<10?"0":"")+date.getYear()%100);break;case"@":output+=date.getTime();break;case"'":if(lookAhead("'")){output+="'"}else{literal=true}break;default:output+=format.charAt(iFormat)}}}}return output},_possibleChars:function(format){var chars="";var literal=false;for(var iFormat=0;iFormatmaxDate?maxDate:date);return date},_determineDate:function(date,defaultDate){var offsetNumeric=function(offset){var date=new Date();date.setDate(date.getDate()+offset);return date};var offsetString=function(offset,getDaysInMonth){var date=new Date();var year=date.getFullYear();var month=date.getMonth();var day=date.getDate();var pattern=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;var matches=pattern.exec(offset);while(matches){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);break;case"w":case"W":day+=parseInt(matches[1],10)*7;break;case"m":case"M":month+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break;case"y":case"Y":year+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break}matches=pattern.exec(offset)}return new Date(year,month,day)};date=(date==null?defaultDate:(typeof date=="string"?offsetString(date,this._getDaysInMonth):(typeof date=="number"?(isNaN(date)?defaultDate:offsetNumeric(date)):date)));date=(date&&date.toString()=="Invalid Date"?defaultDate:date);if(date){date.setHours(0);date.setMinutes(0);date.setSeconds(0);date.setMilliseconds(0)}return this._daylightSavingAdjust(date)},_daylightSavingAdjust:function(date){if(!date){return null}date.setHours(date.getHours()>12?date.getHours()+2:0);return date},_setDate:function(inst,date,endDate){var clear=!(date);var origMonth=inst.selectedMonth;var origYear=inst.selectedYear;date=this._determineDate(date,new Date());inst.selectedDay=inst.currentDay=date.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=date.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=date.getFullYear();if(origMonth!=inst.selectedMonth||origYear!=inst.selectedYear){this._notifyChange(inst)}this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?"":this._formatDate(inst))}},_getDate:function(inst){var startDate=(!inst.currentYear||(inst.input&&inst.input.val()=="")?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return startDate},_generateHTML:function(inst){var today=new Date();today=this._daylightSavingAdjust(new Date(today.getFullYear(),today.getMonth(),today.getDate()));var isRTL=this._get(inst,"isRTL");var showButtonPanel=this._get(inst,"showButtonPanel");var hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext");var navigationAsDateFormat=this._get(inst,"navigationAsDateFormat");var numMonths=this._getNumberOfMonths(inst);var showCurrentAtPos=this._get(inst,"showCurrentAtPos");var stepMonths=this._get(inst,"stepMonths");var stepBigMonths=this._get(inst,"stepBigMonths");var isMultiMonth=(numMonths[0]!=1||numMonths[1]!=1);var currentDate=this._daylightSavingAdjust((!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");var drawMonth=inst.drawMonth-showCurrentAtPos;var drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--}if(maxDate){var maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-numMonths[1]+1,maxDate.getDate()));maxDraw=(minDate&&maxDrawmaxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--}}}inst.drawMonth=drawMonth;inst.drawYear=drawYear;var prevText=this._get(inst,"prevText");prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst)));var prev=(this._canAdjustMonth(inst,-1,drawYear,drawMonth)?''+prevText+"":(hideIfNoPrevNext?"":''+prevText+""));var nextText=this._get(inst,"nextText");nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst)));var next=(this._canAdjustMonth(inst,+1,drawYear,drawMonth)?''+nextText+"":(hideIfNoPrevNext?"":''+nextText+""));var currentText=this._get(inst,"currentText");var gotoDate=(this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today);currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst)));var controls='";var buttonPanel=(showButtonPanel)?'
    '+(isRTL?controls:"")+(this._isInRange(inst,gotoDate)?'":"")+(isRTL?"":controls)+"
    ":"";var firstDay=parseInt(this._get(inst,"firstDay"),10);firstDay=(isNaN(firstDay)?0:firstDay);var dayNames=this._get(inst,"dayNames");var dayNamesShort=this._get(inst,"dayNamesShort");var dayNamesMin=this._get(inst,"dayNamesMin");var monthNames=this._get(inst,"monthNames");var monthNamesShort=this._get(inst,"monthNamesShort");var beforeShowDay=this._get(inst,"beforeShowDay");var showOtherMonths=this._get(inst,"showOtherMonths");var calculateWeek=this._get(inst,"calculateWeek")||this.iso8601Week;var endDate=inst.endDay?this._daylightSavingAdjust(new Date(inst.endYear,inst.endMonth,inst.endDay)):currentDate;var defaultDate=this._getDefaultDate(inst);var html="";for(var row=0;row'+(/all|left/.test(cornerClass)&&row==0?(isRTL?next:prev):"")+(/all|right/.test(cornerClass)&&row==0?(isRTL?prev:next):"")+this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,row>0||col>0,monthNames,monthNamesShort)+'';var thead="";for(var dow=0;dow<7;dow++){var day=(dow+firstDay)%7;thead+="=5?' class="ui-datepicker-week-end"':"")+'>'+dayNamesMin[day]+""}calender+=thead+"";var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear==inst.selectedYear&&drawMonth==inst.selectedMonth){inst.selectedDay=Math.min(inst.selectedDay,daysInMonth)}var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var numRows=(isMultiMonth?6:Math.ceil((leadDays+daysInMonth)/7));var printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays));for(var dRow=0;dRow";var tbody="";for(var dow=0;dow<7;dow++){var daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,""]);var otherMonth=(printDate.getMonth()!=drawMonth);var unselectable=otherMonth||!daySettings[0]||(minDate&&printDatemaxDate);tbody+='";printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate)}calender+=tbody+""}drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++}calender+="
    =currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" "+this._currentClass:"")+(printDate.getTime()==today.getTime()?" ui-datepicker-today":""))+'"'+((!otherMonth||showOtherMonths)&&daySettings[2]?' title="'+daySettings[2]+'"':"")+(unselectable?"":" onclick=\"jQuery.datepicker._selectDay('#"+inst.id+"',"+drawMonth+","+drawYear+', this);return false;"')+">"+(otherMonth?(showOtherMonths?printDate.getDate():" "):(unselectable?''+printDate.getDate()+"":'=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" ui-state-active":"")+'" href="#">'+printDate.getDate()+""))+"
    "+(isMultiMonth?"":"");group+=calender}html+=group}html+=(!inst.inline?buttonPanel:"")+($.browser.msie&&parseInt($.browser.version,10)<7&&!inst.inline?'':"");inst._keyEvent=false;return html},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,secondary,monthNames,monthNamesShort){minDate=(inst.rangeStart&&minDate&&selectedDate "}else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);monthHtml+='"}if(!showMonthAfterYear){html+=monthHtml+((secondary||changeMonth||changeYear)&&(!(changeMonth&&changeYear))?" ":"")}if(secondary||!changeYear){html+=''+drawYear+""}else{var years=this._get(inst,"yearRange").split(":");var year=0;var endYear=0;if(years.length!=2){year=drawYear-10;endYear=drawYear+10}else{if(years[0].charAt(0)=="+"||years[0].charAt(0)=="-"){year=drawYear+parseInt(years[0],10);endYear=drawYear+parseInt(years[1],10)}else{year=parseInt(years[0],10);endYear=parseInt(years[1],10)}}year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);html+='"}if(showMonthAfterYear){html+=(secondary||changeMonth||changeYear?" ":"")+monthHtml}html+="";return html},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=="Y"?offset:0);var month=inst.drawMonth+(period=="M"?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period=="D"?offset:0);var date=this._daylightSavingAdjust(new Date(year,month,day));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&datemaxDate?maxDate:date);inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=="M"||period=="Y"){this._notifyChange(inst)}},_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange){onChange.apply((inst.input?inst.input[0]:null),[inst.selectedYear,inst.selectedMonth+1,inst])}},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return(numMonths==null?[1,1]:(typeof numMonths=="number"?[1,numMonths]:numMonths))},_getMinMaxDate:function(inst,minMax,checkRange){var date=this._determineDate(this._get(inst,minMax+"Date"),null);return(!checkRange||!inst.rangeStart?date:(!date||inst.rangeStart>date?inst.rangeStart:date))},_getDaysInMonth:function(year,month){return 32-new Date(year,month,32).getDate()},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay()},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);var date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[1]),1));if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()))}return this._isInRange(inst,date)},_isInRange:function(inst,date){var newMinDate=(!inst.rangeStart?null:this._daylightSavingAdjust(new Date(inst.selectedYear,inst.selectedMonth,inst.selectedDay)));newMinDate=(newMinDate&&inst.rangeStart=minDate)&&(!maxDate||date<=maxDate))},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear}var date=(day?(typeof day=="object"?day:this._daylightSavingAdjust(new Date(year,month,day))):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))}});function extendRemove(target,props){$.extend(target,props);for(var name in props){if(props[name]==null||props[name]==undefined){target[name]=props[name]}}return target}function isArray(a){return(a&&(($.browser.safari&&typeof a=="object"&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))))}$.fn.datepicker=function(options){if(!$.datepicker.initialized){$(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv);$.datepicker.initialized=true}var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=="string"&&(options=="isDisabled"||options=="getDate")){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}return this.each(function(){typeof options=="string"?$.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options)})};$.datepicker=new Datepicker();$.datepicker.initialized=false;$.datepicker.uuid=new Date().getTime();$.datepicker.version="1.6rc6"})(jQuery);(function(a){a.widget("ui.progressbar",{_init:function(){var b=this,c=this.options;this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this._valueMin(),"aria-valuemax":this._valueMax(),"aria-valuenow":this._value()});this.valueDiv=a('
    ').appendTo(this.element);this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow").removeData("progressbar").unbind(".progressbar");this.valueDiv.remove();a.widget.prototype.destroy.apply(this,arguments)},value:function(b){arguments.length&&this._setData("value",b);return this._value()},_setData:function(b,c){switch(b){case"value":this.options.value=c;this._refreshValue();this._trigger("change",null,{});break}a.widget.prototype._setData.apply(this,arguments)},_value:function(){var b=this.options.value;if(bthis._valueMax()){b=this._valueMax()}return b},_valueMin:function(){var b=0;return b},_valueMax:function(){var b=100;return b},_refreshValue:function(){var b=this.value();this.valueDiv[b==this._valueMax()?"addClass":"removeClass"]("ui-corner-right");this.valueDiv.width(b+"%");this.element.attr("aria-valuenow",b)}});a.extend(a.ui.progressbar,{version:"1.6rc6",defaults:{value:0}})})(jQuery);(function(d){d.effects=d.effects||{};d.extend(d.effects,{version:"1.6rc6",save:function(h,j){for(var g=0;g');var k=g.parent();if(g.css("position")=="static"){k.css({position:"relative"});g.css({position:"relative"})}else{var j=g.css("top");if(isNaN(parseInt(j,10))){j="auto"}var i=g.css("left");if(isNaN(parseInt(i,10))){i="auto"}k.css({position:g.css("position"),top:j,left:i,zIndex:g.css("z-index")}).show();g.css({position:"relative",top:0,left:0})}k.css(h);return k},removeWrapper:function(g){if(g.parent().is(".ui-effects-wrapper")){return g.parent().replaceWith(g)}return g},setTransition:function(h,j,g,i){i=i||{};d.each(j,function(l,k){unit=h.cssUnit(k);if(unit[0]>0){i[k]=unit[0]*g+unit[1]}});return i},animateClass:function(i,j,l,k){var g=(typeof l=="function"?l:(k?k:null));var h=(typeof l=="string"?l:null);return this.each(function(){var r={};var p=d(this);var q=p.attr("style")||"";if(typeof q=="object"){q=q.cssText}if(i.toggle){p.hasClass(i.toggle)?i.remove=i.toggle:i.add=i.toggle}var m=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(i.add){p.addClass(i.add)}if(i.remove){p.removeClass(i.remove)}var o=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(i.add){p.removeClass(i.add)}if(i.remove){p.addClass(i.remove)}for(var s in o){if(typeof o[s]!="function"&&o[s]&&s.indexOf("Moz")==-1&&s.indexOf("length")==-1&&o[s]!=m[s]&&(s.match(/color/i)||(!s.match(/color/i)&&!isNaN(parseInt(o[s],10))))&&(m.position!="static"||(m.position=="static"&&!s.match(/left|top|bottom|right/)))){r[s]=o[s]}}p.animate(r,j,h,function(){if(typeof d(this).attr("style")=="object"){d(this).attr("style")["cssText"]="";d(this).attr("style")["cssText"]=q}else{d(this).attr("style",q)}if(i.add){d(this).addClass(i.add)}if(i.remove){d(this).removeClass(i.remove)}if(g){g.apply(this,arguments)}})})}});function c(h,g){var j=h[1]&&h[1].constructor==Object?h[1]:{};if(g){j.mode=g}var i=h[1]&&h[1].constructor!=Object?h[1]:j.duration;i=d.fx.off?0:typeof i==="number"?i:d.fx.speeds[i]||d.fx.speeds._default;var k=j.callback||(d.isFunction(h[2])&&h[2])||(d.isFunction(h[3])&&h[3]);return[h[0],j,i,k]}d.fn.extend({_show:d.fn.show,_hide:d.fn.hide,__toggle:d.fn.toggle,_addClass:d.fn.addClass,_removeClass:d.fn.removeClass,_toggleClass:d.fn.toggleClass,effect:function(h,g,i,j){return d.effects[h]?d.effects[h].call(this,{method:h,options:g||{},duration:i,callback:j}):null},show:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._show.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"show"))}},hide:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._hide.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"hide"))}},toggle:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))||(arguments[0].constructor==Function)){return this.__toggle.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"toggle"))}},addClass:function(h,g,j,i){return g?d.effects.animateClass.apply(this,[{add:h},g,j,i]):this._addClass(h)},removeClass:function(h,g,j,i){return g?d.effects.animateClass.apply(this,[{remove:h},g,j,i]):this._removeClass(h)},toggleClass:function(h,g,j,i){return((typeof g!=="boolean")&&g)?d.effects.animateClass.apply(this,[{toggle:h},g,j,i]):this._toggleClass(h,g)},morph:function(g,i,h,k,j){return d.effects.animateClass.apply(this,[{add:i,remove:g},h,k,j])},switchClass:function(){return this.morph.apply(this,arguments)},cssUnit:function(g){var h=this.css(g),i=[];d.each(["em","px","%","pt"],function(j,k){if(h.indexOf(k)>0){i=[parseFloat(h),k]}});return i}});d.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(h,g){d.fx.step[g]=function(i){if(i.state==0){i.start=f(i.elem,g);i.end=b(i.end)}i.elem.style[g]="rgb("+[Math.max(Math.min(parseInt((i.pos*(i.end[0]-i.start[0]))+i.start[0],10),255),0),Math.max(Math.min(parseInt((i.pos*(i.end[1]-i.start[1]))+i.start[1],10),255),0),Math.max(Math.min(parseInt((i.pos*(i.end[2]-i.start[2]))+i.start[2],10),255),0)].join(",")+")"}});function b(h){var g;if(h&&h.constructor==Array&&h.length==3){return h}if(g=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(h)){return[parseInt(g[1],10),parseInt(g[2],10),parseInt(g[3],10)]}if(g=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(h)){return[parseFloat(g[1])*2.55,parseFloat(g[2])*2.55,parseFloat(g[3])*2.55]}if(g=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(h)){return[parseInt(g[1],16),parseInt(g[2],16),parseInt(g[3],16)]}if(g=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(h)){return[parseInt(g[1]+g[1],16),parseInt(g[2]+g[2],16),parseInt(g[3]+g[3],16)]}if(g=/rgba\(0, 0, 0, 0\)/.exec(h)){return a.transparent}return a[d.trim(h).toLowerCase()]}function f(i,g){var h;do{h=d.curCSS(i,g);if(h!=""&&h!="transparent"||d.nodeName(i,"body")){break}g="backgroundColor"}while(i=i.parentNode);return b(h)}var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};d.easing.jswing=d.easing.swing;d.extend(d.easing,{def:"easeOutQuad",swing:function(h,i,g,k,j){return d.easing[d.easing.def](h,i,g,k,j)},easeInQuad:function(h,i,g,k,j){return k*(i/=j)*i+g},easeOutQuad:function(h,i,g,k,j){return -k*(i/=j)*(i-2)+g},easeInOutQuad:function(h,i,g,k,j){if((i/=j/2)<1){return k/2*i*i+g}return -k/2*((--i)*(i-2)-1)+g},easeInCubic:function(h,i,g,k,j){return k*(i/=j)*i*i+g},easeOutCubic:function(h,i,g,k,j){return k*((i=i/j-1)*i*i+1)+g},easeInOutCubic:function(h,i,g,k,j){if((i/=j/2)<1){return k/2*i*i*i+g}return k/2*((i-=2)*i*i+2)+g},easeInQuart:function(h,i,g,k,j){return k*(i/=j)*i*i*i+g},easeOutQuart:function(h,i,g,k,j){return -k*((i=i/j-1)*i*i*i-1)+g},easeInOutQuart:function(h,i,g,k,j){if((i/=j/2)<1){return k/2*i*i*i*i+g}return -k/2*((i-=2)*i*i*i-2)+g},easeInQuint:function(h,i,g,k,j){return k*(i/=j)*i*i*i*i+g},easeOutQuint:function(h,i,g,k,j){return k*((i=i/j-1)*i*i*i*i+1)+g},easeInOutQuint:function(h,i,g,k,j){if((i/=j/2)<1){return k/2*i*i*i*i*i+g}return k/2*((i-=2)*i*i*i*i+2)+g},easeInSine:function(h,i,g,k,j){return -k*Math.cos(i/j*(Math.PI/2))+k+g},easeOutSine:function(h,i,g,k,j){return k*Math.sin(i/j*(Math.PI/2))+g},easeInOutSine:function(h,i,g,k,j){return -k/2*(Math.cos(Math.PI*i/j)-1)+g},easeInExpo:function(h,i,g,k,j){return(i==0)?g:k*Math.pow(2,10*(i/j-1))+g},easeOutExpo:function(h,i,g,k,j){return(i==j)?g+k:k*(-Math.pow(2,-10*i/j)+1)+g},easeInOutExpo:function(h,i,g,k,j){if(i==0){return g}if(i==j){return g+k}if((i/=j/2)<1){return k/2*Math.pow(2,10*(i-1))+g}return k/2*(-Math.pow(2,-10*--i)+2)+g},easeInCirc:function(h,i,g,k,j){return -k*(Math.sqrt(1-(i/=j)*i)-1)+g},easeOutCirc:function(h,i,g,k,j){return k*Math.sqrt(1-(i=i/j-1)*i)+g},easeInOutCirc:function(h,i,g,k,j){if((i/=j/2)<1){return -k/2*(Math.sqrt(1-i*i)-1)+g}return k/2*(Math.sqrt(1-(i-=2)*i)+1)+g},easeInElastic:function(h,j,g,n,m){var k=1.70158;var l=0;var i=n;if(j==0){return g}if((j/=m)==1){return g+n}if(!l){l=m*0.3}if(i").css({position:"absolute",visibility:"visible",left:-d*(h/f),top:-g*(c/l)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/f,height:c/l,left:m.left+d*(h/f)+(b.options.mode=="show"?(d-Math.floor(f/2))*(h/f):0),top:m.top+g*(c/l)+(b.options.mode=="show"?(g-Math.floor(l/2))*(c/l):0),opacity:b.options.mode=="show"?0:1}).animate({left:m.left+d*(h/f)+(b.options.mode=="show"?0:(d-Math.floor(f/2))*(h/f)),top:m.top+g*(c/l)+(b.options.mode=="show"?0:(g-Math.floor(l/2))*(c/l)),opacity:b.options.mode=="show"?1:0},b.duration||500)}}setTimeout(function(){b.options.mode=="show"?k.css({visibility:"visible"}):k.css({visibility:"visible"}).hide();if(b.callback){b.callback.apply(k[0])}k.dequeue();a("div.ui-effects-explode").remove()},b.duration||500)})}})(jQuery);(function(a){a.effects.fold=function(b){return this.queue(function(){var f=a(this),l=["position","top","left"];var i=a.effects.setMode(f,b.options.mode||"hide");var p=b.options.size||15;var o=!(!b.options.horizFirst);var h=b.duration?b.duration/2:a.fx.speeds._default/2;a.effects.save(f,l);f.show();var d=a.effects.createWrapper(f).css({overflow:"hidden"});var j=((i=="show")!=o);var g=j?["width","height"]:["height","width"];var c=j?[d.width(),d.height()]:[d.height(),d.width()];var k=/([0-9]+)%/.exec(p);if(k){p=parseInt(k[1])/100*c[i=="hide"?0:1]}if(i=="show"){d.css(o?{height:0,width:p}:{height:p,width:0})}var n={},m={};n[g[0]]=i=="show"?c[0]:p;m[g[1]]=i=="show"?c[1]:0;d.animate(n,h,b.options.easing).animate(m,h,b.options.easing,function(){if(i=="hide"){f.hide()}a.effects.restore(f,l);a.effects.removeWrapper(f);if(b.callback){b.callback.apply(f[0],arguments)}f.dequeue()})})}})(jQuery);(function(a){a.effects.highlight=function(b){return this.queue(function(){var f=a(this),d=["backgroundImage","backgroundColor","opacity"];var i=a.effects.setMode(f,b.options.mode||"show");var c=b.options.color||"#ffff99";var h=f.css("backgroundColor");a.effects.save(f,d);f.show();f.css({backgroundImage:"none",backgroundColor:c});var g={backgroundColor:h};if(i=="hide"){g.opacity=0}f.animate(g,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(i=="hide"){f.hide()}a.effects.restore(f,d);if(i=="show"&&a.browser.msie){this.style.removeAttribute("filter")}if(b.callback){b.callback.apply(this,arguments)}f.dequeue()}})})}})(jQuery);(function(a){a.effects.pulsate=function(b){return this.queue(function(){var d=a(this);var h=a.effects.setMode(d,b.options.mode||"show");var g=b.options.times||5;var f=b.duration?b.duration/2:a.fx.speeds._default/2;if(h=="hide"){g--}if(d.is(":hidden")){d.css("opacity",0);d.show();d.animate({opacity:1},f,b.options.easing);g=g-2}for(var c=0;c').appendTo(document.body);if(b.options.className){d.addClass(b.options.className)}d.addClass(b.options.className);d.css({top:c.top,left:c.left,height:f.outerHeight()-parseInt(d.css("borderTopWidth"))-parseInt(d.css("borderBottomWidth")),width:f.outerWidth()-parseInt(d.css("borderLeftWidth"))-parseInt(d.css("borderRightWidth")),position:"absolute"});c=g.offset();animation={top:c.top,left:c.left,height:g.outerHeight()-parseInt(d.css("borderTopWidth"))-parseInt(d.css("borderBottomWidth")),width:g.outerWidth()-parseInt(d.css("borderLeftWidth"))-parseInt(d.css("borderRightWidth"))};d.animate(animation,b.duration,b.options.easing,function(){d.remove();if(b.callback){b.callback.apply(f[0],arguments)}f.dequeue()})})}})(jQuery);jQuery.easing.jswing=jQuery.easing.swing;jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(f,g,a,i,h){return jQuery.easing[jQuery.easing.def](f,g,a,i,h)},easeInQuad:function(f,g,a,i,h){return i*(g/=h)*g+a},easeOutQuad:function(f,g,a,i,h){return -i*(g/=h)*(g-2)+a},easeInOutQuad:function(f,g,a,i,h){if((g/=h/2)<1){return i/2*g*g+a}return -i/2*((--g)*(g-2)-1)+a},easeInCubic:function(f,g,a,i,h){return i*(g/=h)*g*g+a},easeOutCubic:function(f,g,a,i,h){return i*((g=g/h-1)*g*g+1)+a},easeInOutCubic:function(f,g,a,i,h){if((g/=h/2)<1){return i/2*g*g*g+a}return i/2*((g-=2)*g*g+2)+a},easeInQuart:function(f,g,a,i,h){return i*(g/=h)*g*g*g+a},easeOutQuart:function(f,g,a,i,h){return -i*((g=g/h-1)*g*g*g-1)+a},easeInOutQuart:function(f,g,a,i,h){if((g/=h/2)<1){return i/2*g*g*g*g+a}return -i/2*((g-=2)*g*g*g-2)+a},easeInQuint:function(f,g,a,i,h){return i*(g/=h)*g*g*g*g+a},easeOutQuint:function(f,g,a,i,h){return i*((g=g/h-1)*g*g*g*g+1)+a},easeInOutQuint:function(f,g,a,i,h){if((g/=h/2)<1){return i/2*g*g*g*g*g+a}return i/2*((g-=2)*g*g*g*g+2)+a},easeInSine:function(f,g,a,i,h){return -i*Math.cos(g/h*(Math.PI/2))+i+a},easeOutSine:function(f,g,a,i,h){return i*Math.sin(g/h*(Math.PI/2))+a},easeInOutSine:function(f,g,a,i,h){return -i/2*(Math.cos(Math.PI*g/h)-1)+a},easeInExpo:function(f,g,a,i,h){return(g==0)?a:i*Math.pow(2,10*(g/h-1))+a},easeOutExpo:function(f,g,a,i,h){return(g==h)?a+i:i*(-Math.pow(2,-10*g/h)+1)+a},easeInOutExpo:function(f,g,a,i,h){if(g==0){return a}if(g==h){return a+i}if((g/=h/2)<1){return i/2*Math.pow(2,10*(g-1))+a}return i/2*(-Math.pow(2,-10*--g)+2)+a},easeInCirc:function(f,g,a,i,h){return -i*(Math.sqrt(1-(g/=h)*g)-1)+a},easeOutCirc:function(f,g,a,i,h){return i*Math.sqrt(1-(g=g/h-1)*g)+a},easeInOutCirc:function(f,g,a,i,h){if((g/=h/2)<1){return -i/2*(Math.sqrt(1-g*g)-1)+a}return i/2*(Math.sqrt(1-(g-=2)*g)+1)+a},easeInElastic:function(g,i,f,m,l){var j=1.70158;var k=0;var h=m;if(i==0){return f}if((i/=l)==1){return f+m}if(!k){k=l*0.3}if(h]*>)/g;var b=/(\w+)="([^"]*)"/g;return a.replace(c,function(g){var d={};g.replace(b,function(i,h,j){d[h]=j});var f=d.src;if(f&&(f.lastIndexOf(".png")==f.length-4||d.png=="1")){g="2){var args=new Array(arguments.length-2);for(var i=2;i/g,">")}};babelgum.json={parse:jsonParse,stringify:function(obj){if(obj===null){return"null"}switch(typeof obj){case"number":case"boolean":return obj;case"string":return'"'+obj.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"';case"object":with(babelgum.json){var str;if(obj.constructor===Array||typeof obj.callee!=="undefined"){str="[";var len=obj.length;if(len){for(var i=0;i=this._maxRequests){this._requests.push([url,jsonStr,completeFn,jsonpName])}else{this._callBackend(url,jsonStr,completeFn,jsonpName)}},_onRequestComplete:function(a,d,b){a(d,b);this._requestCount--;if(this._requests.length){var c=this._requests.shift();this._callBackend(c[0],c[1],c[2],c[3])}},_callBackend:function(a,b,g,i){if(!i){i="jsonp"}if(b){a+="?body="+encodeURIComponent(b)}var f=15000;var h=null;var k=this;var c=function(){if(!h){return}clearTimeout(h);h=null;k._onRequestComplete(g,"Server took too long to respond")};var j=function(l){if(!h){return}clearTimeout(h);h=null;k._onRequestComplete(g,"success",l)};var h=setTimeout(c,f);var d={type:"GET",dataType:"jsonp",jsonp:i,url:a,success:j};bbg_jQuery.ajax(d)}};babelgum.cookie={COOKIE_SIZE_LIMIT:2*1024,COOKIE_SIZE_TOLERANCE:0.25,COOKIE_SIZE_WARNING:1,COOKIE_SIZE_ERROR:2,getCookie:function(c,a){a=a||window;var h=null;var b=a.document.cookie;if(b&&b!=""){var g=b.split(";");for(var f=0;fCOOKIE_SIZE_LIMIT){return COOKIE_SIZE_ERROR}if(len>COOKIE_SIZE_LIMIT-COOKIE_SIZE_LIMIT*COOKIE_SIZE_TOLERANCE){return COOKIE_SIZE_WARNING}return 0}},setCookie:function(b,a){a=a||window;a.document.cookie=b},putCookie:function(name,value,options,mywindow){with(babelgum.cookie){setCookie(createCookie(name,value,options,mywindow))}}};function getRating(a){switch(a){case -3:return"/img/ratestars0.png";case -2:return"/img/ratestars1.png";case -1:return"/img/ratestars2.png";case 0:return"/img/ratestars3.png";case 1:return"/img/ratestars4.png";case 2:return"/img/ratestars5.png";default:return"/img/ratestars0.png"}}function getRatingClass(a){switch(a){case -3:return"rated0";case -2:return"rated1";case -1:return"rated2";case 0:return"rated3";case 1:return"rated4";case 2:return"rated5";default:return"rated0"}}function getStamp(){return(new Date()).getTime()}function loadClientId(d,b){var a=babelgum.cookie.getCookie("clientId");if(!a||a=="null"){var c=new JSON(d);c.method("Folks","generateClientID").call(function(f){if(f){babelgum.cookie.putCookie("clientId",f,{expires:365*10,path:"/"});b(f)}else{b(0)}},function(f){console.log("Unable to fetch clientId:",f);b(0)})}else{b(a)}}function isGeoBlocked(d,a){if(!d){return true}if(a==null){return true}if(d.drmSpatialConstraint==null){return false}var c=d.drmSpatialConstraint;if(d.drmSpatialConstraint!=null&&d.drmSpatialConstraint.length>a>>3){var b=d.drmSpatialConstraint[a>>3];if((b&(1<<((a)&7)))==0){return true}}return false}(function(a){babelgum.broadcast=function(c,b){var f,d;if(arguments.length==3){d=arguments[2]}else{if(arguments.length==4){f=arguments[2];d=arguments[3]}}if(!f){f=b+"_update"}c=a(c);if(c.hasClass(""+b+"_listener")){c.triggerHandler(f,d)}c.find("."+b+"_listener").each(function(g,h){a(h).triggerHandler(f,d)})};babelgum.trigger=function(d,b){var g,f;if(arguments.length==3){f=arguments[2]}else{if(arguments.length==4){g=arguments[2];f=arguments[3]}}if(!g){g=b+"_update"}d=a(d);if(d.hasClass(""+b+"_listener")){if(!d.triggerHandler(g,f)){return}}var c=d.parents("."+b+"_listener");if(!c.length){return}c.each(function(){return a(this).triggerHandler(g,f)})};babelgum.mergeConfiguration=function(g,b,c){var f={};for(var d in c){var h=c[d];if(typeof g[h]!="undefined"){f[h]=g[h]}}if(typeof g[b]!="undefined"){a.extend(f,g[b])}return f};a.fn.addListener=function(b){return this.addClass(""+b+"_listener")};a.fn.removeListener=function(b){return this.removeClass(""+b+"_listener")};a.fn.addContext=function(b){return this.addClass(""+b)};a.fn.removeContext=function(b){return this.removeClass(""+b)}})(bbg_jQuery);(function(a){a.ui.timer_manager={_initTimers:function(){this._timeouts={};this._timers={}},_destroyTimers:function(){for(var b in this._timers){window.clearInterval(this._timers[b])}this._timers=null;for(var b in this._timeouts){window.clearTimeout(this._timeouts[b])}this._timeouts=null},setTimeout:function(c,d,f){var b=this._timeouts;if(!b){return}if(b[c]){window.clearTimeout(b[c])}b[c]=window.setTimeout(function(){delete b[c];d()},f)},clearTimeout:function(c){var b=this._timeouts;if(!b){return}if(b[c]){window.clearTimeout(b[c])}delete b[c]},setInterval:function(b,c,f){var d=this._timers;if(!d){return}if(d[b]){window.clearInterval(d[b])}d[b]=window.setInterval(function(){c()},f)},clearInterval:function(b){var c=this._timers;if(!c){return}if(c[b]){window.clearTimeout(c[b])}delete c[b]}}})(jQuery);(function(a){a.widget("ui.user_settings",a.extend({},a.ui.timer_manager,{_init:function(){var c=this.options;this._initTimers();this.element.addContext("user_settings");this._settings={};var b=babelgum.cookie.getCookie("settings");if(b){this._settings=babelgum.json.parse(b)}},destroy:function(){this.element.removeContext("user_settings");this._settings=null;this._destroyTimers();a.widget.prototype.destroy.call(this)},put:function(){if(arguments.length==2){var d=arguments[0],f=arguments[1];if(this._settings[d]==f){return}this._settings[d]=f}else{var b=false;var c=arguments[0];for(var d in c){if(this._settings[d]==c[d]){continue}b=true;this._settings[d]=c[d]}if(!b){return}}this.setTimeout("update",hitch(this,this._updateCookie))},clear:function(c){var b=this._settings[c];if(typeof b=="undefined"){return}delete this._settings[c];this.setTimeout("update",hitch(this,this._updateCookie))},get:function(d,b){var c=this._settings[d];if(typeof c=="undefined"){return b}else{if(typeof b=="number"){return(typeof c=="number"&&isFinite(c))?c:b}else{return c}}},_updateCookie:function(){var d=babelgum.json.stringify(this._settings);var c=babelgum.cookie.createCookie("settings",d,{expires:365*10,path:"/"});var b=babelgum.cookie.checkCookieSize(c);if(b==babelgum.cookie.COOKIE_SIZE_ERROR){babelgum.broadcast(this.element,"user_settings","max_memory_reached",[babelgum.cookie.COOKIE_SIZE_LIMIT,c.length]);console.log("Too much data in cookie: settings. Dropping.");return}else{if(b==babelgum.cookie.COOKIE_SIZE_WARNING){babelgum.broadcast(this.element,"user_settings","memory_warning",[babelgum.cookie.COOKIE_SIZE_LIMIT,c.length]);console.log("Beware of the cookie: settings")}}babelgum.cookie.setCookie(c)}}));a.extend(a.ui.user_settings,{getter:"get",defaults:{}})})(jQuery);function BitSetBuilder(){}BitSetBuilder.prototype={_BASE_BITS:5,_BASE:1<<5,_BASE_DIGITS:"0123456789ABCDEFGHIJKLMNOPQRSTUV",_BASE_DIGIT_BITS_COUNT:[0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5],countBits:function(f){var c=0;var g=this._getBitSetDigitsSize(f);for(var b=0;b=100){a=p/100}else{a=this._DURATION_QUANTA}}var l=Math.round(f/a);var j=Math.max(Math.round(c/a)-1,l);for(var i=l;i<=j;i++){d=this._BIT_SET_BUILDER.setBit(d,i)}o.bits=d;var g=this._BIT_SET_BUILDER.countBits(d);var n=g*a;var m=n*100/p;if(m>=this._VIEW_PERCENT){this._markEntryViewed(o);this._updateCaches()}}};TmpHistory.prototype.constructor=TmpHistory;(function(a){function b(c){this.element=c;this._data={}}b.prototype={get:function(c){return this._data[c]},create:function(c,f){var d={count:-1,clips:[],pendingPages:{},channel:f};this._data[c]=d;return d},update:function(c){var d=this._data[c];if(d){babelgum.broadcast(this.element,"channel",[d.channel])}},updateAll:function(d){for(var c in this._data){if(!d||c.indexOf(d)==0){babelgum.broadcast(this.element,"channel",[this._data[c].channel])}}},clear:function(c){var d=this._data[c];if(d){delete this._data[c];babelgum.broadcast(this.element,"channel",[d.channel])}},clearAll:function(d){for(var c in this._data){if(!d||c.indexOf(d)==0){var f=this._data[c];delete this._data[c];babelgum.broadcast(this.element,"channel",[f.channel])}}},channelKey:function(f){var d=f.key;var g=f.type;for(var c in d){if(c.indexOf("hint_")!=0){g+=","+c+":"+d[c]}}return g}};a.widget("ui.backend",a.extend({},a.ui.timer_manager,{_init:function(){var c=this.options;this.WEBSITE_VIDEO_FORMAT=0;this.MOBILE_VIDEO_FORMATS=[1,3];this.USER_FIELDS=["login","token","userID","versionNumber","systemVersionNumber","drmCountryBitIndex","anonymous","orderParams","tokenValidityMs","rememberMeToken","emailPreferences"];if(this.options.affiliateId==null){throw new Error("Please provide an affiliateId")}this._initTimers();this._clientId=0;this._authUser=null;this._user=null;this._drmCountryBitIndex=null;this._needsAuth={RECOMMEND:true,PLAYLIST:true};this._favoriteClips=null;this._favoritePlaylist=null;this._ready=false;this._pendingBackendRequests=[];this._clipPageSize=64;this._clipListCache=new b(this.element);this._sysVersionNumber=0;this._json=new JSON(c.jsonUrl);this._userSettings=a.getContext(this.element,"user_settings");if(c.user!=null&&c.clientId==null){throw new Error("You can't give a user without giving a clientId")}if(c.clientId){this._clientId=c.clientId;this._logUser()}else{loadClientId(c.jsonUrl,hitch(this,function(d){this._clientId=d;this._logUser()}))}this._tmpHistory=new TmpHistory(this.element);this.element.addContext("backend");this.element.addListener("backend_request");this.element.bind("token_regeneration_required.backend",hitch(this,this._regenerateLogin));this.element.bind("taste_history_update.backend",hitch(this,this._onTasteHistoryUpdated))},destroy:function(){this.element.removeContext("backend");this.element.removeListener("backend_request");this.element.unbind(".backend");this._destroyTimers();a.widget.prototype.destroy.call(this)},getTmpHistory:function(){return this._tmpHistory},getCachedCredentials:function(){var g=this._userSettings.get("creds",null);if(!g){return null}try{var d={time:g.shift(),user:{}};for(var c=0;cgetStamp()){this._onLogin(c.user,true);var d=(c.time+c.tokenValidityMs)-getStamp();this.setTimeout("regenerateInterval",hitch(this,this._regenerateLogin),d);console.log("Scheduling regenerate in "+(d/1000)+" seconds");babelgum.broadcast(this.element,"login","login_successful",[])}else{if(c&&c.user){this._user=c.user;this._regenerateLogin()}else{console.log("login user,.. ");this.loginAnonymous()}}}},_onLogin:function(d,f){this._usertoken=d.token;this._drmCountryBitIndex=d.drmCountryBitIndex;if(d.systemVersionNumber){this._sysVersionNumber=d.systemVersionNumber}this._authUser=[this._usertoken,d.userID];this._user=d;if(!f){this.setCachedCredentials({time:getStamp(),user:d});var c=(d.tokenValidityMs-(d.tokenValidityMs/10));this.setInterval("regenerateInterval",hitch(this,this._regenerateLogin),c);console.log("Scheduling regenerate interval every "+(c/1000)+" seconds")}this._clipListCache.clearAll("RECOMMEND");this._favoriteClips=null;this._favoritePlaylist=null;if(!d.anonymous){babelgum.broadcast(this.element,"login","user_welcome",[]);this._json.method("MyVideo","getAllPlaylistsClips",this._authUser).call(hitch(this,this._onFavoriteClipsLoaded),hitch(this,this._onError));this._json.method("MyChannel","getFolderTree",this._authUser,d.versionNumber).call(hitch(this,this._onFolderTreeLoaded),hitch(this,this._onError))}else{this._clipListCache.clearAll("PLAYLIST");this._clipListCache.updateAll();this._backendReady()}},_backendReady:function(){this._ready=true;for(var c=0;c');g.error(function(i){g.remove();console.log("No internet connection, not usefull to yell")});g.bind("load",hitch(this,function(i){g.remove();this._triggerError(2003,"Sorry, cannot contact the server. Please try again later.",true)}));this.element.append(g)}}return}else{if(j&&j.type=="LoginFailed"){babelgum.broadcast(this.element,"login","login_failed",[]);return}else{if(j&&j.type=="CreateUserDuplicateError"){babelgum.broadcast(this.element,"login","signup_failed",[j.type]);this._triggerError(2101,"Login already used",false);return}else{if(j&&j.type=="NoSuchEmail"){babelgum.broadcast(this.element,"login","forgot_password_failed",[]);this._triggerError(2102,"Unknown email for password recovery",false);return}else{if(j&&j.type=="TokenExpired"){this._regenerateLogin();return}else{if(j&&j.type=="AddClipDuplicateError"){return}}}}}}if(j.toSource){this._triggerError(2200,"onError:"+j.toSource(),true)}else{var d=[],c="";for(var h in j){if(j.hasOwnProperty(h)){c=h+":";switch(typeof j[h]){case"object":if(!j[h]){c+="null"}else{c+=j[h].getSource()}break;case"string":c+='"'+j[h]+'"';break;default:c+=j[h]}d.push(c)}}this._triggerError(2200,"onError:"+d.join(),true)}},getAffiliateId:function(){return this.options.affiliateId},getClientAppId:function(){return this.options.clientAppId},getAuthUser:function(){return this._authUser},isUserAnonymous:function(){return this._user&&this._user.anonymous},getUser:function(){return this._user},getUserId:function(){return this._user.userID},getClientId:function(){return this._clientId},getDrmCountryBitIndex:function(){return this._drmCountryBitIndex},getFavoriteClips:function(){return this._favoriteClips},addToFavorites:function(c){if(!this._favoritePlaylist||(this._favoriteClips&&this._favoriteClips[c])){return}this._json.method("MyVideo","addClip",[this._authUser,this._favoritePlaylist.id,this._favoritePlaylist.versionNumber],c).call(babelgum.hitch(this,this._onFavoritesChanged,"added",c),babelgum.hitch(this,this._onError))},removeFromFavorites:function(c,d){if(!this._favoriteClips||!this._favoriteClips[d]){return}this._json.method("MyVideo","removeClip",[this._authUser,this._favoritePlaylist.id,this._favoritePlaylist.versionNumber],0,c).call(babelgum.hitch(this,this._onFavoritesChanged,"removed",d),babelgum.hitch(this,this._onError))},_onFavoritesChanged:function(c,g,h){if(!this._favoriteClips){return}if(c=="removed"){delete this._favoriteClips[g];var f=this._clipListCache.get(this._clipListCache.channelKey({type:"PLAYLIST",key:{order:"FEATURED"}}));if(f){for(var d=0;d=g.count){d=g.count-1}if(c>=g.count){c=g.count-1}}else{if(d-c>=this._clipPageSize){d=c+this._clipPageSize-1}}if(c==d){return}var m=parseInt(c/this._clipPageSize);var o=parseInt(d/this._clipPageSize);for(var r=m;r<=o;r++){if(!g.clips[r*this._clipPageSize]&&!g.pendingPages[r]){f.push(r)}}if(!f.length){return}var j=this._needsAuth[q.type]?this._authUser:null;var h=this._toServerChannel(q);var n=hitch(this,this._onError);for(var l=0;l=0)){return}var f=this._clipListCache.get(n);if(!f){return}delete f.pendingPages[l];this.fixMedia(k.clips);if(f.count<0){f.count=k.count;f.clips=new Array(k.count)}var g=a.getContext(this.element,"navigation_manager");var m=g==null?null:g.findChannelTopNavItem(j);var c=l*this._clipPageSize;for(var h=0;hl*this._clipPageSize+k.clips.length){f.count--;f.clips.pop()}}this._clipListCache.update(n)},fixMedia:function(d){var l={};for(var g=0;g1){if(n[1].substring(0,9).toLowerCase()=="channelid"){d=n[1].substring(10)}else{if(n[1].substring(0,11).toLowerCase()=="querystring"){j=n[1].substring(12);if(n.length>2){if(n[2].substring(6).length==m.length){try{s="search";this._category="search";console.log("GA: Virtual page view being sent: this._google._trackPageview(/html/search.php?keyword="+j+");");this._google._trackPageview(this._prepend+"/html/search.php?keyword="+j)}catch(g){console.log("google send error = ",g)}}}d=f.search}}}}if(d=="undefined"||d==u||this._category=="emptycategory"||c.channel.type.toLowerCase()!="search_similar"){console.log("GA: Before setting to home, this._category = "+this._category);console.log("GA: context.channel.type = "+c.channel.type);if(this._category=="emptycategory"||(c.channel.type.toLowerCase()!="search_similar"&&c.channel.type.toLowerCase()!="search")){this._category="home"}else{s=this._category}console.log("GA: After setting to home, this._category = "+this._category)}else{console.log("GA: looking for channelName(1), this._category = "+this._category);for(var q in f){if(d==f[q]){s=q;break}}console.log("GA: looking for channelName(2), this._category = "+this._category)}this._category=s}}}}}var b=this._contextClipId+"";if(this._category=="emptycategory"){this._category="home"}if(this._view=="video"&&this._contextClipId!=-1&&!o){try{if(this._trackEvents){var v=this._google._trackEvent(this._prepend+"/"+this._category+"/","clickonplay",b);console.log("GA: this._google._trackEvent(/"+this._category+"/,clickonplay,"+b+") sent succesfully = ",v)}console.log("GA: Virtual page view being sent: this._google._trackPageview(/virtual/"+this._category+"/clickonplay/"+b+");");this._google._trackPageview(this._prepend+"/virtual/"+this._category+"/clickonplay/"+b)}catch(g){console.log("google send error = ",g)}}if(n!=null&&n.length>2&&!c.channel.key.hint_editorial){if(c.channel.type.toLowerCase()=="search_similar"){if(n[2].substring(6).length==k.length){try{if(this._trackEvents){var v=this._google._trackEvent(this._prepend+"/"+this._category+"/"+this._subcategory+"/"+this._order+"/"+this._view+"/","showsimilarvideos",b);console.log("GA: this._google._trackEvent(/"+this._category+"/"+this._subcategory+"/"+this._order+"/"+this._view+"/,showsimilarvideos,"+b+") sent succesfully = ",v)}console.log("GA: Virtual page view being sent: this._google._trackPageview(/virtual/"+this._category+"/"+this._subcategory+"/"+this._order+"/"+this._view+"/showsimilarvideos);");this._google._trackPageview(this._prepend+"/virtual/"+this._category+"/"+this._subcategory+"/"+this._order+"/"+this._view+"/showsimilarvideos")}catch(g){console.log("google send error = ",g)}}}}if(this._category!="search"&&this._category!="emptycategory"){try{console.log("GA: Virtual page view being sent (navigation change): this._google._trackPageview(/virtual/"+this._category+"/"+this._subcategory+"/"+this._order+");");this._google._trackPageview(this._prepend+"/virtual/"+this._category+"/"+this._subcategory+"/"+this._order)}catch(g){console.log("google send error = ",g)}}},_onChannelUpdate:function(d,b){if(b._channel!=null){if(b._channel.type.toLowerCase()=="search"&&b._clipCount==0){if(b._channel.key.channelID==undefined){try{console.log("GA: Virtual page view being sent: this._google._trackPageview(/search/novideos/term="+b._channel.key.queryString+");");this._google._trackPageview(this._prepend+"/search/novideos/term="+b._channel.key.queryString)}catch(c){console.log("google send error = ",c)}}}}},_onPanelDisplayed:function(g,f,d){d="/"+d+"";if(f=="login"){f="logindialog";d=""}if(f=="signup"){f="signupdialog";d=""}try{if(this._trackEvents){var b=this._google._trackEvent(this._prepend+"/"+this._category+"/"+this._subcategory+"/"+this._order+"/"+this._view+"/",f,d);console.log("GA: this._google._trackEvent(/"+this._category+"/"+this._subcategory+"/"+this._order+"/"+this._view+"/,"+f+","+d+") sent succesfully = ",b)}console.log("GA: Virtual page view being sent: this._google._trackPageview(/virtual/"+this._category+"/"+this._subcategory+"/"+this._order+"/"+this._view+"/"+f+d+");");this._google._trackPageview(this._prepend+"/virtual/"+this._category+"/"+this._subcategory+"/"+this._order+"/"+this._view+"/"+f+d)}catch(c){console.log("google send error = ",c)}},_onClipFeedback:function(h,d,g){g=g+"";var b="/";if(d!="rate"||d!="vote"){b="share"}try{if(this._trackEvents){var c=this._google._trackEvent(this._prepend+"/"+this._category+"/"+this._subcategory+"/"+this._order+"/"+this._view+"/",b+"/"+d,g);console.log("GA: this._google._trackEvent(/"+this._category+"/"+this._subcategory+"/"+this._order+"/"+this._view+"/,"+b+"/"+d+","+g+") sent succesfully = ",c)}console.log("GA: Virtual page view being sent: this._google._trackPageview(/virtual/"+this._category+"/"+this._subcategory+"/"+this._order+"/"+this._view+"/"+b+"/"+d+"/"+g+");");this._google._trackPageview(this._prepend+"/virtual/"+this._category+"/"+this._subcategory+"/"+this._order+"/"+this._view+b+d+"/"+g)}catch(f){console.log("google send error = ",f)}},_onSessionFeedback:function(g,d,b){try{if(d=="login_success"&&b==false){return}if(this._trackEvents){var c=this._google._trackEvent(this._prepend+"/"+this._category+"/"+this._subcategory+"/"+this._order+"/"+this._view+"/",d,clipid);console.log("GA: this._google._trackEvent(/"+this._category+"/"+this._subcategory+"/"+this._order+"/"+this._view+"/,"+d+","+clipid+") sent succesfully = ",c)}console.log("GA: Virtual page view being sent: this._google._trackPageview(/virtual/"+this._category+"/"+this._subcategory+"/"+this._order+"/"+this._view+"/"+d+");");this._google._trackPageview(this._prepend+"/virtual/"+this._category+"/"+this._subcategory+"/"+this._order+"/"+this._view+"/"+d)}catch(f){console.log("google send error = ",f)}},_onErrorFeedback:function(i,g,c,f,d){var h="";c=c.toLowerCase();g=g+"";if(c=="video"){h=d.id+"";var b=this._google._trackEvent(this._prepend+"/"+this._category+"/"+this._subcategory+"/"+this._order+"/"+this._view+"/error_presented",g,h);console.log("GA: this._google._trackEvent(/"+this._category+"/"+this._subcategory+"/"+this._order+"/"+this._view+"/error_presented,"+g+","+h+") sent succesfully = ",b);console.log("GA: this._google._trackPageview(/virtual/"+this._category+"/"+this._subcategory+"/"+this._order+"/"+this._view+"/error_presented/"+c+"/"+g+"/clipId="+h+");");this._google._trackPageview(this._prepend+"/virtual/"+this._category+"/"+this._subcategory+"/"+this._order+"/"+this._view+"/error_presented/"+c+"/"+g+"/clipId="+h)}else{var b=this._google._trackEvent(this._prepend+"/"+this._category+"/"+this._subcategory+"/"+this._order+"/"+this._view+"/error_presented",g,null);console.log("GA: this._google._trackEvent(/"+this._category+"/"+this._subcategory+"/"+this._order+"/"+this._view+"/error_presented,"+g+","+null+") sent succesfully = ",b);console.log("GA: this._google._trackPageview(/virtual/"+this._category+"/"+this._subcategory+"/"+this._order+"/"+this._view+"/error_presented/"+c+"/"+g+");");this._google._trackPageview(this._prepend+"/virtual/"+this._category+"/"+this._subcategory+"/"+this._order+"/"+this._view+"/error_presented/"+c+"/"+g)}}}));a.extend(a.ui.ga_reporter,{defaults:{googleTracker:null,gaTrackingCode:null,trackEvents:false,channelsMatching:{}}})})(jQuery);(function(a){a.widget("ui.oas_manager",a.extend({},{_init:function(){var b=this.options;this.element.addContext("oas_manager");this._initAnalyticsData();this._initNavigationTracking()},destroy:function(){this.element.unbind(".oas_manager");this.element.removeListener("user_interaction");this.element.removeContext("oas_manager");a.widget.prototype.destroy.call(this)},_initNavigationTracking:function(){this._currentCat="All";this._currentSubCats="";this.element.addListener("user_interaction");this.element.bind("selection_changed.oas_manager",hitch(this,function(g,d,f,b){if(f.stack!=null&&f.stack.length>1){this._currentCat=f.stack[f.stack.length-1].label.toLowerCase().replace(/(&| )/g,"_");this._currentSubCats="";for(var c=f.stack.length-2;c>=0&&f.stack[c].label;c--){this._currentSubCats+=f.stack[c].label.toLowerCase().replace(/(&| )/g,"_")+(c?",":"")}this._currentCat=babelgum.text.trim(this._currentCat);this._currentSubCats=babelgum.text.trim(this._currentSubCats)}else{this._currentCat="All";this._currentSubCats=""}}))},_initAnalyticsData:function(){var k=document;var i="";var f="N";if((k.referrer)&&(k.referrer!="[unknown origin]")){if(k.referrer.indexOf("?")==-1){i+="&tax23_RefDocLoc="+k.referrer.toString()}else{var j=k.referrer;var h=j.indexOf("?");var g=j.substring(0,h);i+="&tax23_RefDocLoc="+g}}var c=function(l,d){var m=d.indexOf(l);if(m==-1){return""}m+=l.length;var n=d.indexOf(";",m);if(n==-1){n=d.length}return d.substring(m,n)};var b=function(){var o=new Date();var l=o.getTime();document.cookie="OAS_SC1="+l.toString()+";path=/;";var n=c("OAS_SC1=",document.cookie);if(n!=l.toString()){return false}o.setTime(l+3600000);return true};if(b()){f="Y"}this._OAS_rdl=i;this._OAS_CA=f},showOASAd:function(b,d){this.clearOASAd(b);var c=this.getOASAd(d);b.append(c)},getOASAd:function(d,b){if(!b){b="ad_"+Math.round(Math.random()*1000000)}var c=a('');return c},getAdUrl:function(b){var c=this.options.adUrlPrefix+(b=="GRID"?this.options.gridPosition:this.options.listPosition)+this._getAnalyticsQuery();return c},_getAnalyticsQuery:function(){var d=a.getContext(this.element,"backend").getAffiliateId();var c="emptycategory";var g="emptysubcategory";var f="status=live&afid="+d+"&maincat="+this._currentCat+"&subcat="+this._currentSubCats;var b="afid="+d+"&clipid=&maincat="+this._currentCat+"&subcat="+this._currentSubCats;b+="XE&"+f+this._OAS_rdl+"&if_nt_CookieAccept="+this._OAS_CA+"&XE";return"?"+b},loadOASAd:function(b){},clearOASAd:function(b){b.html("")}}));a.extend(a.ui.oas_manager,{getter:"",defaults:{adUrlPrefix:"http://oascentral.babelgum.com/RealMedia/ads/",listPosition:"adstream_jx.ads/www.bbgsite2.com/browseall/listview@Middle3",gridPosition:"adstream_jx.ads/www.bbgsite2.com/browseall/gridview@Middle2"}})})(jQuery);(function(a){a.widget("ui.video_player",a.extend({},a.ui.timer_manager,{_init:function(){var f=this.options;var c=this;if(this.options.playerKey==null){throw new Error("Please provide a playerKey")}this._initTimers();var b="

    Flash version 9,0,115 or greater is required

    Your flash plugin version is too old or you have no flash plugin installed

    Click here to download latest version

    Download latest version from here

    ";this.element.html('
    '+b+"
    ");this.element.addContext("video_player");this._bindEvents();this._json=new JSON(a.getContext(this.element,"backend").getJsonUrl());this._pendingClip=null;var d={log:{level:"warn",filter:"com.babelgum.*"},canvas:{backgroundColor:"#000000",backgroundGradient:[0,0]},plugins:c._getPlugins(),key:c.options.playerKey,onError:hitch(c,c._onError)};if(this.options.logoPath){d.logo={url:c.options.playerPath+c.options.logoPath,left:10,bottom:40,fullscreenOnly:false}}this._videoPlayer=$f("bbgInternal_"+this.options.playerId,{version:[9,115],src:this.options.playerPath+this.options.flowPlayerPath},d).babelgum(this._getBabelgumPluginConfiguration()).resize().load(hitch(this,this._onLoad))},_bindEvents:function(){this.element.addListener("login");this.element.bind("login_successful.video_player",hitch(this,function(){console.log("Got new token, passing it to flash");if(this._videoPlayer&&this._videoPlayer.isLoaded()){this._videoPlayer.getPlugin("reporter").setAuthUser(a.getContext(this.element,"backend").getAuthUser())}}));this.element.addListener("companion_reporting");this.element.bind("companion_clicked.video_player",hitch(this,function(c,b){this._videoPlayer.getPlugin("reporter").reportExternalAd("onAdClicked",b.id,"companion");babelgum.trigger(self.element,"ad_events","ad_clicked",[{advertId:b.id,format:"companion"}])}));this.element.bind("companion_presented.video_player",hitch(this,function(c,b){this._videoPlayer.getPlugin("reporter").reportExternalAd("onAdPresented",b.id,"companion");babelgum.trigger(self.element,"ad_events","ad_presented",[{advertId:b.id,format:"companion"}])}));this.element.bind("companion_closed_on_timeout.video_player",hitch(this,function(c,b){this._videoPlayer.getPlugin("reporter").reportExternalAd("onAdClosedOnTimeout",b.id,"companion");babelgum.trigger(self.element,"ad_events","ad_closed_on_timeout",[{advertId:b.id,format:"companion"}])}))},_getBabelgumPluginConfiguration:function(){var b=this;var c={videoPrefix:b.options.videoPrefix,navigationPathProvider:function(){return b._getTopCategory().toLowerCase().replace(/(&| )/g,"_")},channelKeyProvider:function(){return babelgum.json.stringify(a.getContext(b.element,"current_channel").getChannel())}};return c},destroy:function(){if(this._videoPlayer){if(this._videoPlayer.isPlaying()){this._videoPlayer.stop()}this._videoPlayer.unload()}this._videoPlayer=null;this._destroyTimers();this.element.unbind(".reporter_plugin");this.element.removeListener("login");this.element.unbind(".video_player");this.element.removeContext("video_player");this.element.empty();a.widget.prototype.destroy.call(this)},_getPlugins:function(){var f=this;var d={};d.controls=this.options.noUI?null:{all:true,playlist:false,autoHide:"fullscreen",progressColor:"#0",progressGradient:"none"};d.errors={url:"flowplayer.content-3.1.0.swf?"+Math.random(),closeButton:true,display:"none"};var g=a.getContext(this.element,"backend");d.reporter={url:"babelgum.reporter-1.0.swf?"+Math.random(),jsonUrl:g.getJsonUrl(),onTokenRegenerationRequired:function(){console.log("Flash Player requested a new token !",f.element);babelgum.trigger(f.element,"backend_request","token_regeneration_required",[])}};if(this.options.adsConfiguration.enabled){var h=function(k,m,n,l){n=n=="NONLINEAR"?"bottom":n;var o={advertId:m,format:n.toLowerCase(),error:l};console.log("triggering event "+k,o);babelgum.trigger(f.element,"ad_events",k,[o])};var c={enabled:false,nonLinearAdDelay:3*60,linearAdDelay:7*60,nonLinearAdDuration:1*60,adUrlPrefix:"http://oascentral.babelgum.com/RealMedia/ads/adstream_sx.ads/www.testbbgflply.com/generic@",prerollPosition:"x01",bottomBoardPosition:"Bottom",midrollPosition:"x02",onAdPresented:function(k,l){h("ad_presented",k,l)},onAdClosedOnTimeout:function(k,l){h("ad_closed_on_timeout",k,l)},onAdClosed:function(k,l){h("ad_closed",k,l)},onAdClicked:function(k,l){h("ad_clicked",k,l)},onAdError:function(l,m,k){h("ad_error",l,m,k)},onAdResourceNotFound:function(k,l){h("ad_resource_error",k,l)},onShowCompanions:function(k){babelgum.trigger(f.element,"companions","show_companions",[k])},onHideCompanions:function(k){babelgum.trigger(f.element,"companions","hide_companions",[k])}};var j=a.extend({},c,this.options.adsConfiguration);d.adManager={url:"babelgum.adManager-1.0.swf?"+Math.random(),adServerUrl:j.adUrlPrefix,prerollUrl:j.prerollPosition,midrollUrl:j.midrollPosition,nonLinearUrl:j.bottomBoardPosition,nonLinearAdDelay:j.nonLinearAdDelay,nonLinearAdDuration:j.nonLinearAdDuration,linearAdDelay:j.linearAdDelay,onAdPresented:j.onAdPresented,onAdClosedOnTimeout:j.onAdClosedOnTimeout,onAdClosed:j.onAdClosed,onAdClicked:j.onAdClicked,onAdError:j.onAdError,onAdResourceNotFound:j.onAdResourceNotFound,onShowCompanions:j.onShowCompanions,onHideCompanions:j.onHideCompanions}}if(this.options.comScoreConfiguration.enabled){var c={enabled:false,baseUrl:"http://beacon.securestudies.com/scripts/beacon.dll?C1=1%26C2=3000028%26C3=%26C4=%26C6=%26",clipValue:"C5=010000",adValue:"C5=020000"};var b=a.extend({},c,this.options.comScoreConfiguration);d.comscore={url:"babelgum.comscore-1.0.swf?"+Math.random(),baseUrl:b.baseUrl,clipValue:b.clipValue,adValue:b.adValue}}if(this.options.restrictedContentConfiguration.enabled){var c={url:"babelgum.restrictedContent-1.0.swf?"+Math.random(),image:"/img/videolock.png",text:"We're sorry, but login is required to play this exclusive content !
    Please go to www.babelgum.com to start watching !",isLoggedIn:g.getUserId()!=0,onPlayPrevented:function(){console.log("onPlayPrevented !")},onHide:function(){console.log("onHide")}};var i=a.extend({},c,this.options.restrictedContentConfiguration);d.restrictedContent=i;this.element.bind("login_successful.video_player signup_successful.video_player",hitch(this,function(){if(this._videoPlayer&&this._videoPlayer.isLoaded()&&this._videoPlayer.getPlugin("restrictedContent")){this._videoPlayer.getPlugin("restrictedContent").isLoggedIn(g.getUserId()!=0);if(this._videoPlayer.getTime()==0){this._videoPlayer.play()}}}))}console.log("Creating player with plugins ",this.options,d);return d},_getTopCategory:function(){var b=a.getContext(this.element,"navigation_selection");if(b&&b.getSelection()&&b.getSelection().stack!=null&&b.getSelection().stack.length>1){return b.getSelection().stack[b.getSelection().stack.length-1].label}else{return"None"}},_onLoad:function(){this._videoPlayer.getPlugin("reporter").setAuthUser(a.getContext(this.element,"backend").getAuthUser());if(this.options.onLoad){this.options.onLoad()}},_onError:function(d,b){var f=this.getClip();babelgum.trigger(this.element,"video_player","error",[f[0],f[1],d,b]);switch(d){case 1:b=this.options.naMessage;break;case 2:b=this.options.geoblockedMessage;break;case 3:b=this.options.mobileOnlyMessage;break;case 201:b=this.options.velocixMessage;break}babelgum.trigger(this.element,"error_events","error_feedback",[1000+d,"VIDEO",b,f[1]]);if(b){this.setTimeout("error_message",hitch(this,function(){var c=this._videoPlayer.getPlugin("errors");if(c.display=="block"){return}c.css({left:"50%",top:50,width:400,height:50,zIndex:9});c.setHtml(b);c.fadeIn(1000)}),500)}},_onBegin:function(b){if(this.options.noUI){this._videoPlayer.getPlugin("play").css({display:"none"})}},_onStart:function(b){this._videoPlayer.getPlugin("errors").css({display:"none"})},_onBeforePause:function(b){return !this.options.noUI},_onBeforeResume:function(b){return !this.options.noUI},setClip:function(b,d,f,h,g,c){console.log("Setting clip ",b,d);this.clearTimeout("error_message");this._videoPlayer.getPlugin("errors").css({display:"none"});babelgum.trigger(this.element,"video_player","clip_changed",d);this._loadAdData(d.id,hitch(this,function(i){console.log("loaded adData",i);this._videoPlayer.setBabelgumClip(b,d,i,f,h,g,c);this._videoPlayer.getPlugin("play").toggle();this._videoPlayer.getPlugin("play").toggle()}))},_loadAdData:function(d,b){console.log("Loading ad data...");try{this._json.method("Client","getClipDataNoKey",a.getContext(this.element,"backend").getAuthUser(),d,this._getTopCategory()).call(hitch(this,function(f){b({targetingQuery:f.advertisingTargetQuery,cuePoints:f.timeCodingsMs})}),hitch(this,function(f){console.log("Error while retrieving clip data",f);b({});if(f.type=="TokenExpired"){babelgum.trigger(this.element,"backend_request","token_regeneration_required",[])}}))}catch(c){log.error(c)}},getClip:function(){return this._videoPlayer.getBabelgumClip()},play:function(){if(this._videoPlayer.isPlaying()){return}if(this.options.noUI){this.options.noUI=false;this._videoPlayer.play();this.options.noUI=true}else{this._videoPlayer.play()}},pause:function(){if(this.options.noUI){this.options.noUI=false;this._videoPlayer.pause();this.options.noUI=true}},seek:function(b){this._videoPlayer.seek(b)},getTime:function(){return this._videoPlayer.getTime()},setPreventUnload:function(b){this._videoPlayer.setPreventUnload(b)},stop:function(){this._videoPlayer.stop()}}));a.extend(a.ui.video_player,{getter:"",defaults:{playerKey:null,playerId:"bbgPlayer",videoPrefix:"http://flash.velocix.com/c123/",logoPath:"img/logoplayer.png",playerPath:"/",flowPlayerPath:"flowplayer/flowplayer.babelgum-3.1.1.swf",naMessage:"This clip is not available on this platform",mobileOnlyMessage:"This clip is only available on Mobile",geoblockedMessage:"This clip is not available in your country",velocixMessage:"Sorry, this video cannot be found. Please try again later.",noUI:false,adsConfiguration:{enabled:false},comScoreConfiguration:{enabled:false},restrictedContentConfiguration:{enabled:false}}})})(jQuery);(function(b){function c(k){var h=b(k.target);if(h.attr("action")==null){h=h.parents("[action]").eq(0)}if(!h.length){return}var g=h.attr("action");var j=h.attr("actionParam");if(g=="none"){}else{if(g=="navigate"){b.getContext(h,"location").setLocation(h.get(0).href)}else{if(h.attr("id")!="clip_template"){h=h.parents("#clip_template").eq(0)}var d=parseInt(h.attr("index"));var i=parseInt(h.attr("clip_id"));if(!isNaN(i)){var f=b.getContext(h,"current_channel").getClip(d);babelgum.trigger(h,"clip",g,[d,f,j])}else{babelgum.trigger(h,"clip",g,[j])}}}k.preventDefault();return false}function a(d){this.clipTemplate=d}a.prototype={init:function(d,f){this.element=d;this.backend=b.getContext(d,"backend");this.currentChannel=b.getContext(d,"current_channel");this.currentUrl=null;b(this.element).bind("click",c)},destroy:function(){b(this.element).unbind("click",c)},getClipSize:function(){if(b.getContext(this.element,"main_page_controller")){this.currentUrl=b.getContext(this.element,"main_page_controller").getLocation("play",this.currentChannel.getChannel(),-1,-1)}var g=b(this.showClip(-1,null)).appendTo(this.element.find(".ui-scrolldiv"));var d=g.outerWidth(true);var f=g.outerHeight(true);g.remove();return{w:d,h:f}},replace:function(g,f){var h="";var i=0;var d=0;while((i=g.indexOf("{",d))>0){h+=g.substring(d,i);d=g.indexOf("}",i+1);h+=f(g.substring(i+1,d));d++}h+=g.substr(d);return h},showClip:function(m,g,j){var h=this.currentChannel;var k=this.currentUrl;var f=this.backend;var d=f.getFavoriteClips();if(j){var l=isGeoBlocked(j.media,f.getDrmCountryBitIndex());return this.replace(this.clipTemplate,function(i){switch(i){case"target":return k+"/"+g+","+j.id;case"pos":return"left:"+m.l+"px;top:"+m.t+"px";case"clip_id":return j.id;case"clip_index":return g;case"cls":var i=(g%2==0?"even":"odd");i+=(h.getCurrentClip()==g?" selected":"");i+=(l?" geoblocked":"");i+=(j.media==null&&j.isAvailableOnMobile?" mobileonly":"");if(j.navCategory){i+=" "+j.navCategory.color}if(j.festivalInfo){i+=(j.festivalInfo.voteOpen?" vote":" vote rate")}else{i+=" rate"}if(d&&d[j.id]){i+=" favorite"}i+=" "+(j.restricted?"restricted":"");i+=" "+(f.isUserAnonymous()?"locked":"unlocked");return i;case"thumb":return f.getThumbnailUrl(j);case"categoryLabel":return escapeHTML(j.navCategory.label);case"categoryUrl":return j.navCategory.url;case"title":return escapeHTML(j.title);case"description":return escapeHTML(j.description);case"rating":return getRating(j.userRating);case"duration":return durationAsString(j.duration);default:""}})}else{return this.replace(this.clipTemplate,function(i){switch(i){case"pos":return"left:"+m.l+"px;top:"+m.t+"px";case"clip_id":return -1;case"clip_index":return -1;case"cls":var i=(g%2==0?"even":"odd");i+=(h.getCurrentClip()==g?" selected":"");i+=" vote rate favorite";return i;case"thumb":return"./img/download.gif";case"title":return"";case"categoryLabel":return"";case"categoryUrl":return"";case"description":return"";case"rating":return getRating(0);case"duration":return durationAsString(0);default:""}})}}};b.ui.clip_template={_initClipTemplate:function(d){this._clipTemplate=null;this._currentChannel=b.getContext(this.element,"current_channel");this.element.addListener("clip");b.get(d,null,hitch(this,this._onClipTemplateLoaded))},_onClipTemplateLoaded:function(h,f){var g="__clip_template__";var i=h.indexOf(g);var d=h.lastIndexOf(g);this._clipTemplate=null;if(i>0&&d>0&&i').insertAfter(i);j[0].tabIndex=i[0].tabIndex;j[0].value=i.attr("emptyText");j.bind("focus."+this.widgetName,b);i.bind("blur."+this.widgetName,c);i.triggerHandler("blur")}}});this._dialogs=this.element.children(".dialog");this._updateLoginCommandsVisibility();var g=d.getContext(this.element,"navigation_selection");if(g){this.onNavigationSelectionUpdate(null,g.getSelection())}},_onClick:function(h){var g=d(h.target);if(g.attr("action")==null){g=g.parents("[action]").eq(0)}if(!g.length){return true}h.stopPropagation();h.preventDefault();var f=g.attr("action");if(f=="none"){}else{this[f]()}return true},_onKeyPress:function(h){if(h.keyCode!=13){return}var g=d(h.target);if(g.attr("actionReturn")==null){g=g.parents("[actionReturn]").eq(0)}if(!g.length){return}h.stopPropagation();h.preventDefault();var f=g.attr("actionReturn");if(f=="none"){}else{this[f]()}},_onVoteSuccess:function(g,f){this.thanks(f);babelgum.trigger(this.element,"user_interaction","clip_feedback",["vote",f])},_onRateSuccess:function(g,f){this.thanks(f);babelgum.trigger(this.element,"user_interaction","clip_feedback",["rate",f])},_onShareSuccess:function(h,f,g){babelgum.trigger(this.element,"user_interaction","clip_feedback",[f,g])},isPanelVisible:function(){return this._currentPanel},_swapPanels:function(i){var h=this.element.children(this._currentPanel);var f=this.element.children(i);var g=f.height();this._currentPanel=i;f.css({top:-g,zIndex:1,display:"block"});f.addClass("animating");h.css("z-index",0);f.animate({top:0},{duration:200,queue:false,complete:function(){h.css("top",-g);h.css("display","none");f.removeClass("animating")}})},_slidePanelIn:function(i){this.element.triggerHandler("startSlindingIn",i);if(this._currentPanel){if(this._currentPanel!=i){this._swapPanels(i)}return}var f=this.element.children(i);var g=f.height();var h=d(this._contentNode);this._currentPanel=i;f.css({display:"block",zIndex:1});f.addClass("animating");h.animate({top:g},{duration:100,queue:false,step:function(j,k){f.css("top",j-g);h.css("top",j)},complete:function(){f.removeClass("animating")}})},_slidePanelOut:function(){var f=this.element.children(this._currentPanel);var g=f.height();var h=d(this._contentNode);f.css("display","block");f.addClass("animating");this._currentPanel=null;this.element.triggerHandler("closeSliderMenu");h.animate({top:0},{duration:100,queue:false,step:function(i,j){f.css("top",i-g);h.css("top",i)},complete:function(){f.removeClass("animating")}})},close:function(){if(!this._currentPanel){return}if(this._currentPanel=="#branded_channel"){this._userSettings.put("showBrandedChannel",false)}this._currentPanelClipId=-1;this._slidePanelOut()},logout:function(){this._backend.loginAnonymous();this.close();babelgum.trigger(this.element,"user_interaction","session_feedback",["logout"]);babelgum.trigger(this.element,"login","logout_successful",[])},_clearErrors:function(){this.element.children(this._currentPanel).find(".textfield").removeClass("error")},_setError:function(h,f){var g=h.parent();if(f){g.find(".errortext > span").css("display","none");g.find(".errortext > #"+f).css("display","block")}g.addClass("error")},_checkMandatoryField:function(f){if(f.val().length==0){this._setError(f,"empty");return false}return true},_checkEmailField:function(f){if(!this._checkMandatoryField(f)){return false}if(!f.val().match(/^[a-z0-9._-]+@[a-z0-9._-]+$/gi)){this._setError(f,"invalid");return false}return true},_checkLoginField:function(f){if(!this._checkMandatoryField(f)){return false}var g=f.val();if(!g.match(/^[.a-z0-9_-]+$/gi)){this._setError(f,"invalid");return false}else{if(g.length<3){this._setError(f,"tooshort");return false}else{if(g.length>=50){this._setError(f,"toolong");return false}}}return true},_checkPasswordField:function(f){if(!this._checkMandatoryField(f)){return false}var g=f.val();if(!g.match(/^\S*$/g)){this._setError(f,"invalid");return false}else{if(g.length<3){this._setError(f,"tooshort");return false}else{if(g.length>=50){this._setError(f,"toolong");return false}}}return true},login:function(g){this._currentPanelClipId=-1;if(this._currentPanel=="#login"){this._slidePanelOut();return}var f=this.element.children("#login");if(!g){g="default"}f.find("#title").html(f.find("#title-"+g).html());this._slidePanelIn("#login");this._clearErrors();this.element.find("#login #useridfield").focus();babelgum.trigger(this.element,"user_interaction","panel_displayed",["login",-1])},submitLogin:function(){var h=this.element.find("#login #useridfield");var g=this.element.find("#login #passwordfield");this._clearErrors();var f=false;f=!this._checkLoginField(h)||f;f=!this._checkPasswordField(g)||f;if(!f){this._backend.login(h.val(),g.val())}},submitCompetition:function(){var f=this.element.find("#free_prize_competition #emailfield");var g=this.element.find("#free_prize_competition #competitionid");this._clearErrors();var h=false;h=!this._checkEmailField(f)||h;if(!h){this._backend.competition(g.val(),f.val())}},_onLoginSuccess:function(g,f){this._updateLoginCommandsVisibility();if(f=="login"){babelgum.trigger(this.element,"user_interaction","session_feedback",["login_success",this._currentPanel=="#login"]);this.genericMessage("#login")}else{if(f=="resetPassword"){if(!this._currentPanel){this.settings()}}}},_onLoginFailed:function(){if(this._currentPanel=="#login"){this._updateLoginCommandsVisibility();var g=this.element.find("#login #useridfield");var f=this.element.find("#login #passwordfield");this._setError(g,"wrong");this._setError(f,"wrong")}babelgum.trigger(this.element,"user_interaction","session_feedback",["login_failed",this._currentPanel=="#login"])},signup:function(){this._currentPanelClipId=-1;if(this._currentPanel=="#signup"){this._slidePanelOut();return}this._slidePanelIn("#signup");this._clearErrors();this.element.find("#signup #emailfield").focus();babelgum.trigger(this.element,"user_interaction","panel_displayed",["signup",-1])},submitSignup:function(){var f=this.element.find("#signup #emailfield");var j=this.element.find("#signup #useridfield");var i=this.element.find("#signup #passwordfield");var h=this.element.find("#signup #verifyfield");this._clearErrors();var g=false;g=!this._checkEmailField(f)||g;g=!this._checkLoginField(j)||g;g=!this._checkPasswordField(i)||g;if(h.val()!=i.val()){g=true;this._setError(h)}if(!g){this._backend.signup(j.val(),i.val(),null,f.val(),null,"UNKWOWN",null,"Unknown")}},_onSignupSuccess:function(){this._updateLoginCommandsVisibility();this.genericMessage("#signup");babelgum.trigger(this.element,"user_interaction","session_feedback",["signup_success"])},_onSignupFailed:function(h,f){if(this._currentPanel=="#signup"){this._updateLoginCommandsVisibility();var g=this.element.find("#signup #useridfield");if(f=="CreateUserDuplicateError"){this._setError(g,"duplicate");babelgum.trigger(this.element,"user_interaction","session_feedback",["signup_failed","duplicate"])}else{this._setError(g,"invalid");babelgum.trigger(this.element,"user_interaction","session_feedback",["signup_failed","invalid"])}}},settings:function(){this._currentPanelClipId=-1;if(this._currentPanel=="#settings"){this._slidePanelOut();return}babelgum.trigger(this.element,"backend_request","token_regeneration_required",[]);this._slidePanelIn("#settings");this._clearErrors();this.element.find("#settings #newsletterfield").attr("checked",this._backend.getUser().emailPreferences.receiveRegularUpdates);this.element.find("#settings #passwordfield").focus();babelgum.trigger(this.element,"user_interaction","panel_displayed",["settings",-1])},submitSettings:function(){var i=this.element.find("#settings #passwordfield");var g=this.element.find("#settings #verifyfield");var h=this.element.find("#settings #newsletterfield");this._clearErrors();var f=false;if(i.val()!=""){f=!this._checkPasswordField(i)||f}if(g.val()!=i.val()){f=true;this._setError(g,"nomatch")}if(!f){if(i.val()!=""){this._backend.updatePassword(i.val())}this._backend.updateEmailPreferences(h.attr("checked"))}},_onSettingsSuccess:function(){this.genericMessage("#settings_change");babelgum.trigger(this.element,"user_interaction","session_feedback",["change_setting_success"])},_onSettingsFailed:function(){if(this._currentPanel=="#settings"){var f=this.element.find("#settings #passwordfield");this._setError(f,"invalid")}babelgum.trigger(this.element,"user_interaction","session_feedback",["change_setting_failed"])},_updateLoginCommandsVisibility:function(){var g=this._backend.isUserAnonymous();var f=d("#header > #headerbar > #commands");if(!g){f.find("#welcome > #user").text(this._backend.getUser().login)}f.children("#welcome").css("display",g?"none":"inline");f.children("#login").css("display",g?"inline":"none");f.children("#signup").css("display",g?"inline":"none");f.children("#settings").css("display",g?"none":"inline");f.children("#logout").css("display",g?"none":"inline")},forgotlogin:function(){this._currentPanelClipId=-1;if(this._currentPanel=="#forgotlogin"){this._slidePanelOut();return}this._slidePanelIn("#forgotlogin");this._clearErrors();this.element.find("#forgotlogin #emailfield").focus();babelgum.trigger(this.element,"user_interaction","panel_displayed",["forgotlogin",-1])},submitForgotLogin:function(){var f=this.element.find("#forgotlogin #emailfield");this._clearErrors();var h=false;h=!this._checkEmailField(f)||h;if(!h){var g="http://"+window.location.host+"/browser.php#";this._backend.notifyForgotPassword(f.val(),g)}},_onForgotLoginSuccess:function(){this.genericMessage("#forgot_login");babelgum.trigger(this.element,"user_interaction","session_feedback",["forgot_password_success"])},_onForgotLoginFailed:function(){var f=this.element.find("#forgotlogin #emailfield");this._setError(f,"invalid");babelgum.trigger(this.element,"user_interaction","session_feedback",["forgot_password_failed"])},genericMessage:function(f){this._currentPanelClipId=-1;var g=this.element.find("#generic_message > #generic_messages");g.children().css("display","none");g.children(f).css("display","block");this._slidePanelIn("#generic_message")},competition:function(j){var g=this.element.find("#free_prize_competition");var f=this.element.find("#free_prize_competition #emailfield");var i=this.element.find("#free_prize_competition input.empty");g.find("#prizeIntro").html(j.launch);g.find("#rules").html(j.rules);g.find("#competitionid").val(j.competitionId);var h=d.getContext(this.element,"backend");if(h.getUser()&&h.getUser().email){i.hide();f.val(h.getUser().email).show()}if(this._currentPanel=="#free_prize_competition"){this._currentPanelClipId=-1;this._slidePanelOut();return}this._slidePanelIn("#free_prize_competition");babelgum.trigger(this.element,"user_interaction","panel_displayed",["competition",j])},share:function(f){if(this._currentPanel=="#videoshare"&&this._currentPanelClipId==f.id){this._currentPanelClipId=-1;this._slidePanelOut();return}this._currentPanelClipId=f.id;this.updateShare(f);this._slidePanelIn("#videoshare");babelgum.trigger(this.element,"user_interaction","panel_displayed",["share",f.id])},truncate:function(g,f){if(g.length>f){return g.substring(0,f)+"..."}else{return g}},permalink:function(j,i){var g="";var f=0;var h=null;i=i.toLowerCase();for(f=0;f="a"&&h<="z")||(h>="0"&&h<="9")){g+=h}else{if(h==" "){g+="-"}}}g=g.toString().replace(/-[a-z]{1,2}-/g,"-");g=g.replace(/^[a-z]{1,2}-/g,"");g=g.replace(/-{2,}/g,"-");return"http://www.babelgum.com/"+j+"/"+g+".html"},tinyPermalink:function(f){return"http://www.babelgum.com/"+f},updateShare:function(g){var p=this.permalink(g.id,g.title);var l=encodeURIComponent(p);var n=encodeURIComponent(g.title);var o=encodeURIComponent(g.description.substr(0,300));var f=this._backend.getThumbnailUrl(g);var j=encodeURIComponent(''+escapeHTML(g.description)+'
    ');var h=encodeURIComponent("I invite you to go to Babelgum");var q=encodeURIComponent('I enjoyed watching "'+g.title+'" on Babelgum and would like to share it with you.\n\nTo watch this video go to: \n\n\t'+p+"\n");var i=encodeURIComponent('Watching "'+this.truncate(g.title,56)+'" on Babelgum - '+this.tinyPermalink(g.id));var m=this.element.find("#videoshare");m.find("#digg").attr("href","http://digg.com/submit?url="+l+"&title="+n+"&bodytext="+o+"&media=video").unbind("click").click(hitch(this,this._onShareSuccess,null,"digg",g.id));m.find("#delicious").attr("href","http://del.icio.us/post?v5&jump=http%3A%2F%2Fdelicious.com&url="+l+"&title="+n+"&partner=babelgum").unbind("click").click(hitch(this,this._onShareSuccess,null,"delicious",g.id));m.find("#reddit").attr("href","http://reddit.com/submit?url="+l+"&title="+n).unbind("click").click(hitch(this,this._onShareSuccess,null,"reddit",g.id));m.find("#stumbleupon").attr("href","http://www.stumbleupon.com/submit?url="+l+"&title="+n).unbind("click").click(hitch(this,this._onShareSuccess,null,"stumbleupon",g.id));m.find("#myspace").attr("href","http://www.myspace.com/index.cfm?fuseaction=postto&t="+n+"&c="+j+"&u="+l).unbind("click").click(hitch(this,this._onShareSuccess,null,"myspace",g.id));m.find("#facebook").attr("href","http://www.facebook.com/share.php?src=bm&v=4&i=1229338490&u="+l+"&t="+n).unbind("click").click(hitch(this,this._onShareSuccess,null,"facebook",g.id));m.find("#twitter").attr("href","http://twitter.com/home?status="+i).unbind("click").click(hitch(this,this._onShareSuccess,null,"twitter",g.id));m.find("#copylinktext").attr("value",p);var k=m.find("#sendmail");k.find("#mailto").removeAttr("target").attr("href","mailto:?subject="+h+"&body="+q).unbind("click").click(hitch(this,this._onShareSuccess,null,"mail",g.id));k.find("#mailtogmail").attr("target","_blank").attr("href","https://mail.google.com/mail/?extsrc=mailto&url="+encodeURIComponent("mailto:?subject="+h+"&body="+q)).unbind("click").click(hitch(this,this._onShareSuccess,null,"gmail",g.id))},info:function(g,j){var f=this.element.find("#videoinfo");if(this._currentPanel=="#videoinfo"&&this._currentPanelClipId==j.id){this._currentPanelClipId=-1;this._slidePanelOut();return}this._currentPanelClipId=j.id;var k=f.children(".thumbnail");k.attr("clip_id",j.id);k.find(".imgbox > a").attr("href",this.getPlayUrl()+"/"+g+","+j.id);k.find(".imgbox > a > #icon").attr("src",this._backend.getThumbnailUrl(j));var m=k.children("#scrollarea");m.children(".title").text(j.title);var i=m.children(".rating");i.removeClass("rated0 rated1 rated2 rated3 rated4 rated5").addClass(getRatingClass(j.userRating));m.children(".duration").text(durationAsString(j.duration));m.children(".description").html(j.description);var l=j.geoblocked!=null?j.geoblocked:isGeoBlocked(j.media,this._backend.getDrmCountryBitIndex());k.removeClass("vote rate thanks geoblocked");if(l){k.addClass("geoblocked")}if(j.festivalInfo){if(j.festivalInfo.voteOpen){k.addClass("vote");var h=m.children(".voting");if(!l){h.vote("destroy");h.vote({clipId:j.id})}}else{k.addClass("vote rate")}}else{k.addClass("rate");if(i.data("rate")){i.rate("destroy")}if(!l){i.rate({clipId:j.id,userRating:j.userRating})}}this._slidePanelIn("#videoinfo");babelgum.trigger(this.element,"user_interaction","panel_displayed",["info",j.id])},vote:function(f){this._backend.saveVote(f.id,hitch(this,this._onVoteSuccessEvent),hitch(this,this._onVoteErrorEvent));this._onVoteSuccess(false,f.id)},_onVoteSuccessEvent:function(f,g){if(!f){alert("You already voted for this video today. Come back tomorrow to vote again!")}},thanks:function(g){var f=d("[clip_id="+g+"]");f.addClass("thanks");f.find(".imgbox").css("opacity",1);setTimeout(function(){f.removeClass("thanks")},3000)},favorite:function(f){if(this._backend.isUserAnonymous()){this.login("favorite");this.element.bind("favorites_channel_loaded."+this.widgetName,hitch(this,function(){this.element.unbind("favorites_channel_loaded."+this.widgetName);this._backend.addToFavorites(f.id)}));return}this._backend.addToFavorites(f.id)},removeFavorite:function(f,g){this._backend.removeFromFavorites(f,g.id)},_onFavoritesChanged:function(i,f,h){if(f=="added"){var g=d("[clip_id="+h+"]");g.addClass("addedtofavorites favorite");g.find(".imgbox").css("opacity",1);setTimeout(function(){g.removeClass("addedtofavorites")},3000);babelgum.trigger(this.element,"user_interaction","clip_feedback",["favorites_add",h])}else{if(f=="removed"){babelgum.trigger(this.element,"user_interaction","clip_feedback",["favorites_remove",h])}}},onBrandedChannelInfo:function(g){var f=this._currentPanel!="#branded_channel";this._userSettings.put("showBrandedChannel",f);if(f){this.showBrandedChannel(this._currentPanelChannel)}else{this._slidePanelOut()}},onNavigationSelectionUpdate:function(g,h){var f=d.getContext(this.element,"navigation_manager");this._currentPanelChannel=f.findBrandedChannelFromStack(h.stack);if(this._currentPanel=="#branded_channel"){if(this._currentPanelChannel){this.showBrandedChannel(this._currentPanelChannel)}else{this._slidePanelOut()}}else{if(this._userSettings.get("showBrandedChannel",true)&&this._currentPanelChannel){this.showBrandedChannel(this._currentPanelChannel)}}},showBrandedChannel:function(f){var h=this.element.find("#branded_channel > #title");h.empty();h.text(f.label);h=null;var g=this.element.find("#branded_channel_content");g.empty();this._slidePanelIn("#branded_channel");g=g.get(0);d.get("/channelId/"+parseInt(f.id),null,function(i){g.innerHTML=fixPNGs(i);g=null})}}})(jQuery);(function(b){function d(f,g){f.removeChild(g)}if(navigator.appVersion.indexOf("MSIE")!=-1){d=function(f,g){g.innerHTML="";f.removeChild(g)}}function c(f){this._elem=null;this._list=f;this._itemsPerLine=0}c.prototype={init:function(f){this._list.init(f);this._elem=f},destroy:function(){this._list.destroy()},update:function(){this._list.update();this._itemsPerLine=Math.floor(this._elem.get(0).clientWidth/this._list.itemSize().w)},willDisplay:function(g,f){if(this._itemsPerLine){this._list.willDisplay(g*this._itemsPerLine,f*this._itemsPerLine)}},count:function(){var f=this._list.count();if(f<0){return 0}if(!this._itemsPerLine){return 0}return Math.ceil(f/this._itemsPerLine)},itemCount:function(){return this._list.count()},itemSize:function(){var f=this._list.itemSize();return{w:f.w*this._itemsPerLine,h:f.h}},show:function(f){},get:function(k,f){var h='
    ';for(var g=0;g"}h+=j}return h+"
    "},getItemsPerLine:function(){return this._itemsPerLine}};function a(g,f){this._elem=null;this._list=g;this._adList=f;this._count=0;this._adItemRatio=0;this._itemSize={w:0,h:0};this._adMargin={w:0,h:0};this._linesPerAd=0}a.prototype={init:function(f){this._list.init(f);this._adList.init(f)},destroy:function(){this._list.destroy();this._adList.destroy()},update:function(){console.log("ItemListWithAds update");this._list.update();var h=this._list.itemSize();var f=this._adList.itemSize();this._count=this._list.count();this._addItemRatio=this._adList.adItemRatio();this._adCount=Math.floor(this._count/this._adList.adItemRatio());this._adList.prepare(this._adCount);var g=f.h/h.h;this._linesPerAd=(Math.floor(g)!=g)?Math.floor(g)+1:Math.floor(g);this._itemSize.w=(f.w>h.w)?f.w:h.w;this._itemSize.h=h.h;this._adMargin.w=(this._itemSize.w-f.w)/2;this._adMargin.h=(this._itemSize.h*this._linesPerAd-f.h)/2},willDisplay:function(i,f){var g=this._addItemRatio+this._linesPerAd;var h=Math.floor(i/g)*this._addItemRatio+i%g;this._list.willDisplay(h,f)},count:function(){return this._count+this._adCount*this._linesPerAd},itemCount:function(){return this._list.count()},itemSize:function(){return this._itemSize},getItemsPerLine:function(){return this._list.getItemsPerLine()},get:function(h,f){if(f>=this.count()){return null}var g=this._addItemRatio+this._linesPerAd;if(f%g>=this._addItemRatio){if(f%g>this._addItemRatio){return null}return this._adList.get({l:h.l+this._adMargin.w,t:h.t+this._adMargin.h},Math.floor(f/g))}else{return this._list.get(h,Math.floor(f/g)*this._addItemRatio+f%g)}return e}};b.widget("ui.scrolllist",b.extend({},b.ui.timer_manager,{_init:function(){var f=this.options;this._initTimers();if(f.layout=="grid"){this._list=new c(f.list);this._orientation="vertical"}else{this._list=f.list;this._orientation=f.layout}if(f.adList){this._list=new a(this._list,f.adList)}this._list.init(this.element);this._scrollDiv=this.element.find(".ui-scrolldiv").get(0);this._prependElement=f.prependElement;if(this._prependElement){this.element.find(".ui-scrolldiv").append(this._prependElement)}this.element.scrollTop(0).scrollLeft(0);this._firstVisibleItem=0;this._preferredIndex=f.preferredIndex?f.preferredIndex:-1;this.element.bind("scroll."+this.widgetName,hitch(this,this._onScroll));this.element.bind("update."+this.widgetName,hitch(this,this._onUpdate));b(window).bind("resize."+this.widgetName,hitch(this,this._onResize));this.element.triggerHandler("update");this._refreshInterval=f.refreshInterval},destroy:function(){this._destroyTimers();var f=this._scrollDiv;while(f.firstChild){d(f,f.firstChild)}this._scrollDiv=null;this._list.destroy();this._list=null;b(window).unbind("."+this.widgetName);this.element.unbind("."+this.widgetName);b.widget.prototype.destroy.call(this)},getFirstDisplayedIndex:function(){if(this._orientation=="horizontal"){return Math.floor(this.element.scrollLeft()/this._list.itemSize().w)*this._list.getItemsPerLine()}else{return Math.floor(this.element.scrollTop()/this._list.itemSize().h)*this._list.getItemsPerLine()}},scrollTo:function(f,h){var i=this._list.itemCount();if(i==-1){return}if(f>=i){f=i-1}if(f<0){f=0}if((this._orientation=="horizontal"&&this.element.scrollLeft()==this._list.itemSize().w*Math.floor(f/this._list.getItemsPerLine()))||(this._orientation=="vertical"&&this.element.scrollTop()==this._list.itemSize().h*Math.floor(f/this._list.getItemsPerLine()))){return}this._preferredIndex=-1;if(!h){h={duration:0,easing:"easeInOutSine"}}this.element.stop(true,false);var g={};if(this._orientation=="horizontal"){g.scrollLeft=this._list.itemSize().w*Math.floor(f/this._list.getItemsPerLine())}else{g.scrollTop=this._list.itemSize().h*Math.floor(f/this._list.getItemsPerLine())}this.element.animate(g,h)},_onResize:function(g){var f=this.element;this.setTimeout("_onResize",function(){f.triggerHandler("update")},this._refreshInterval)},_getHorizontal:function(g,j,f,k){var h=g.get({l:f*j+k.w,t:0},f);if(!h){h=""}return h},_getVertical:function(g,j,f,k){var h=g.get({l:0,t:f*j+k.h},f);if(!h){h=""}return h},_onScroll:function(){this._preferredIndex=-1;this.setTimeout("_onScroll",hitch(this,this._doScroll),5)},_getFirstScrollDivChild:function(){if(this._prependElement){return this._prependElement.next().get(0)}else{return this._scrollDiv.firstChild}},_doScroll:function(){var s=this._list;var f=this._orientation;var n=this._prependElement;var g=n?{w:n.width(),h:n.height()}:{w:0,h:0};var h=(f=="horizontal")?this.element.scrollLeft()-g.w:this.element.scrollTop()-g.h;var l=(f=="horizontal")?this.element.get(0).clientWidth+g.w:this.element.get(0).clientHeight+g.h;var w=(f=="horizontal")?s.itemSize().w:s.itemSize().h;var j=(f=="horizontal")?this._getHorizontal:this._getVertical;if(h<0){h=0}if(l<0){l=0}var u=Math.floor(h/w);var v=Math.ceil((h+l)/w);s.willDisplay(u,v-u);var q=this._scrollDiv;while(this._firstVisibleItemv&&q.lastChild){if(this._prependElement&&q.childNodes.length==1){break}q.lastChild.innerHTML="";d(q,q.lastChild)}if(!this._getFirstScrollDivChild()){this._firstVisibleItem=u}if(u==0&&this._prependElement){this._prependElement.css("display","block")}var t="";for(var p=u;po){t+=j(s,w,o++,g)}var k=document.createElement("div");k.innerHTML=t;while(k.firstChild){q.appendChild(k.removeChild(k.firstChild))}k=null},_onUpdate:function(){var f=this._list;f.update();var g=this._scrollDiv;while(this._getFirstScrollDivChild()){d(g,this._getFirstScrollDivChild())}if(this._orientation=="horizontal"){b(g).css("width",f.itemSize().w*f.count())}else{b(g).css("height",f.itemSize().h*f.count())}this._scrollDivPos={left:g.offsetLeft,top:g.offsetTop};this._doScroll();if(this._preferredIndex!=-1){this.scrollTo(this._preferredIndex)}}}));b.extend(b.ui.scrolllist,{getter:"getFirstDisplayedIndex",defaults:{list:null,layout:"horizontal",refreshInterval:200,prependElement:null}})})(jQuery);(function(b){function a(d,c){d.mousedown(function(h){h.preventDefault();d.click();var g=window.setInterval(function(){d.click()},c);var f=function(i){i.preventDefault();d.unbind(".clickRepeat");window.clearInterval(g)};d.bind("mouseleave.clickRepeat mouseup.clickRepeat",f)})}b.ui.clipstrip={_initClipStrip:function(){this._mouseOverClipStrip=false;this._resetSelectionTimer=null;var c=this._currentChannel.makeClipList(this._getClipList());this._list=b("#clipstrip_list");this._list.scrolllist({list:c,layout:"horizontal"});this._list.bind("mousewheel.video_controller",hitch(this,this._onMouseWheel)).bind("mouseenter.video_controller",hitch(this,function(){this._mouseOverClipStrip=true})).bind("mouseleave.video_controller",hitch(this,function(){this._mouseOverClipStrip=false;this.resetClipStrip()}));this._clipWidth=c.itemSize().w;var d=b("#clipstrip_left");var f=b("#clipstrip_right");a(d,150);a(f,150);d.click(hitch(this,this._onLeft));f.click(hitch(this,this._onRight));this.resetClipStrip()},_destroyClipStrip:function(){if(this._list){this._list.scrolllist("destroy");this._list.unbind(".video_controller");this._list=null}},_onLeft:function(){this.scrollTo(--this._scrollToTarget)},_onRight:function(){this.scrollTo(++this._scrollToTarget)},_onMouseWheel:function(c,d){this.scrollTo(this._scrollToTarget-d)},select:function(c){var d=b("#clipstrip_list > .ui-scrolldiv");d.find("#clip_template").removeClass("selected");d.find("#clip_template[index="+c+"]").addClass("selected");this.resetClipStrip()},resetClipStrip:function(){this.setTimeout("resetToSelection",hitch(this,this._resetToSelection),2000)},_resetToSelection:function(){if(this._mouseOverClipStrip){return}this.scrollTo(this._currentChannel.getCurrentClip()-3)},scrollTo:function(c){this.clearTimeout("resetToSelection");var f=(!this._fxRunning)?"easeInOutSine":"easeOutSine";this._fxRunning=true;var d=this._currentChannel.getClipCount();if(d!=-1&&c>=d){c=d-1}else{if(c<0){c=0}}this._scrollToTarget=c;animProperties={duration:1000,easing:f,complete:hitch(this,function(){this._fxRunning=false})};this._list.data("scrolllist").scrollTo(this._scrollToTarget,animProperties)},getFirstDisplayedIndex:function(){return this._list.data("scrolllist").getFirstDisplayedIndex()}}})(jQuery);(function(a){a.widget("ui.rate",{_init:function(){this._clipId=this.options.clipId;this._userRating=this.options.userRating;this.element.addContext("widget_rate");this.element.addClass("widget_rate");this.element.append('');this.element.children("a").bind("mouseover",hitch(this,this.overButton)).bind("click",hitch(this,this.clickButton));this.element.bind("mouseout.rate",hitch(this,this.outRating));this.element.addClass(getRatingClass(this.options.userRating))},destroy:function(){this.clearClasses();this.element.unbind(".rate");this.element.removeClass("widget_rate rated0 rated1 rated2 rated3 rated4 rated5");this.element.removeContext("widget_rate");this.element.empty();a.widget.prototype.destroy.call(this)},overButton:function(b){this.clearClasses();this.element.addClass("rate"+a(b.target).attr("rate"))},clickButton:function(d){d.preventDefault();d.stopPropagation();var c=a(d.target).attr("rate")-3;var b=a.getContext(this.element,"backend");b.rateClip(this._clipId,c);this._onRateSuccess(this._clipId,c)},outRating:function(b){this.clearClasses();this.element.addClass(getRatingClass(this.options.userRating))},clearClasses:function(){this.element.removeClass("rate0 rate1 rate2 rate3 rate4 rate5")},_onRateSuccess:function(c,b){this.element.removeClass("rated0 rated1 rated2 rated3 rated4 rated5");this.options.userRating=b;this.clearClasses()}})})(jQuery);(function(a){a.widget("ui.vote",{_init:function(){this._clipId=this.options.clipId;this.element.addContext("widget_vote");this.element.addClass("widget_vote");this.element.append('');this.element.children("a").click(hitch(this,this.clickButton))},destroy:function(){this.element.removeContext("widget_vote");this.element.removeClass("widget_vote");this.element.empty();a.widget.prototype.destroy.call(this)},clickButton:function(b){b.preventDefault();b.stopPropagation();babelgum.trigger(this.element,"clip","vote",[this._clipId,this._clipId])}})})(jQuery);(function(){function h(p){console.log("$f.fireEvent",[].slice.call(p))}function l(r){if(!r||typeof r!="object"){return r}var p=new r.constructor();for(var q in r){if(r.hasOwnProperty(q)){p[q]=l(r[q])}}return p}function n(u,r){if(!u){return}var p,q=0,s=u.length;if(s===undefined){for(p in u){if(r.call(u[p],p,u[p])===false){break}}}else{for(var t=u[0];q1){var s=arguments[1];var r=(arguments.length==3)?arguments[2]:{};if(typeof p=="string"){if(p.indexOf(".")!=-1){var u=[];n(o(p),function(){u.push(new b(this,l(s),l(r)))});return new d(u)}else{var t=c(p);return new b(t!==null?t:p,s,r)}}else{if(p){return new b(p,s,r)}}}return null};j(window.$f,{fireEvent:function(){var q=[].slice.call(arguments);var r=$f(q[0]);return r?r._fireEvent(q.slice(1)):null},addPlugin:function(p,q){b.prototype[p]=q;return $f},each:n,extend:j});if(document.all){window.onbeforeunload=function(){$f("*").each(function(){if(this.isLoaded()){this.close()}})}}if(typeof jQuery=="function"){jQuery.prototype.flowplayer=function(r,q){if(!arguments.length||typeof arguments[0]=="number"){var p=[];this.each(function(){var s=$f(this);if(s){p.push(s)}});return arguments.length?p[arguments[0]]:new d(p)}return this.each(function(){$f(this,l(r),q?l(q):{})})}}})();(function(){var f=typeof jQuery=="function";function j(){if(c.done){return false}var l=document;if(l&&l.getElementsByTagName&&l.getElementById&&l.body){clearInterval(c.timer);c.timer=null;for(var k=0;k'}q.width=q.height=q.id=q.w3c=q.src=null;for(var l in q){if(q[l]!==null){n+=''}}var o="";if(t){for(var m in t){if(t[m]!==null){o+=m+"="+(typeof t[m]=="object"?h(t[m]):t[m])+"&"}}o=o.substring(0,o.length-1);n+='"}n+="";return n}function d(m,p,l){var k=flashembed.getVersion();g(this,{getContainer:function(){return m},getConf:function(){return conf},getVersion:function(){return k},getFlashvars:function(){return l},getApi:function(){return m.firstChild},getHTML:function(){return a(p,l)}});var q=p.version;var r=p.expressInstall;var o=!q||flashembed.isSupported(q);if(o){p.onFail=p.version=p.expressInstall=null;m.innerHTML=a(p,l)}else{if(q&&r&&flashembed.isSupported([6,65])){g(p,{src:r});l={MMredirectURL:location.href,MMplayerType:"PlugIn",MMdoctitle:document.title};m.innerHTML=a(p,l)}else{if(m.innerHTML.replace(/\s/g,"")!==""){}else{m.innerHTML="

    Flash version "+q+" or greater is required

    "+(k[0]>0?"Your version is "+k:"You have no flash plugin installed")+"

    "+(m.tagName=="A"?"

    Click here to download latest version

    ":"

    Download latest version from here

    ");if(m.tagName=="A"){m.href="http://www.adobe.com/go/getflashplayer"}}}}if(!o&&p.onFail){var n=p.onFail.call(this);if(typeof n=="string"){m.innerHTML=n}}}window.flashembed=function(l,m,k){if(typeof l=="string"){var n=document.getElementById(l);if(n){l=n}else{c(function(){flashembed(l,m,k)});return}}if(!l){return}var o={width:"100%",height:"100%",allowFullScreen:true,allowscriptaccess:"always",quality:"high",version:null,onFail:null,expressInstall:null,w3c:false};if(typeof m=="string"){m={src:m}}g(o,m);return new d(l,o,k)};g(window.flashembed,{getVersion:function(){var m=[0,0];if(navigator.plugins&&typeof navigator.plugins["Shockwave Flash"]=="object"){var l=navigator.plugins["Shockwave Flash"].description;if(typeof l!="undefined"){l=l.replace(/^.*\s+(\S+\s+\S+$)/,"$1");var n=parseInt(l.replace(/^(.*)\..*$/,"$1"),10);var r=/r/.test(l)?parseInt(l.replace(/^.*r(.*)$/,"$1"),10):0;m=[n,r]}}else{if(window.ActiveXObject){try{var p=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(q){try{p=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");m=[6,0];p.AllowScriptAccess="always"}catch(k){if(m[0]==6){return}}try{p=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(o){}}if(typeof p=="object"){l=p.GetVariable("$version");if(typeof l!="undefined"){l=l.replace(/^\S+\s+(.*)$/,"$1").split(",");m=[parseInt(l[0],10),parseInt(l[2],10)]}}}}return m},isSupported:function(k){var m=flashembed.getVersion();var l=(m[0]>k[0])||(m[0]==k[0]&&m[1]>=k[1]);return l},domReady:c,asString:h,getHTML:a});if(f){jQuery.prototype.flashembed=function(l,k){return this.each(function(){flashembed(this,l,k)})}}})();(function(b,a){if(document.all){window.onbeforeunload=function(){a("*").each(function(){if(this.isLoaded()){this.unload()}});window.onbeforeunload=null}}a.addPlugin("resize",function(){var s=null;var j=null;var q=false;var h=null;var d=0,m=0;var p=false;var r=[];var c=this._fireEvent;var k=function(){var u=j.get(0);if(d!=u.clientWidth||m!=u.clientHeight){d=u.clientWidth;m=u.clientHeight;if(!p){p=true}}else{if(p){p=false;s.reset(["content","errors","screen"])}}while(r.length){var t=r.shift();if(!t){break}c(t)}};this._fireEvent=function(t){var u=(typeof t=="string")?t:t[0];var v={onError:true,onFinish:true,onLastSecond:true,onStop:true,onUnload:true};if(v[u]){if(u=="onUnload"){j.empty()}r.push(t);return true}if(u=="onMouseOver"){j.trigger("flashmouseover")}else{if(u=="onMouseOut"){j.trigger("flashmouseout")}}return c(t)};var o=function(){d=m=-1};var n=null;var l=function(){n();for(var t in this){if(typeof this[t]=="function"){try{this[t]=new Function()}catch(u){console.error("Error while cleaning up player",u);alert("Error while cleaning up"+u)}}}this.outerHTML="";n=null};var g=function(){s=this;try{n=s._api().fp_close;s._api().fp_close=l}catch(t){n=null}j=b(s.getParent());j.bind("resize",o);h=window.setInterval(k,100)};var f=function(){if(h){window.clearInterval(h)}h=null;j.unbind("resize",o);j=null;s=null};var i=function(){return !q};this.setPreventUnload=function(t){q=t};this.onLoad(g);this.onUnload(f);this.onBeforeUnload(i);return this});a.addPlugin("babelgum",function(p){var g={videoPrefix:"http://flash.velocix.com/c123/",navigationPathProvider:function(){return""},channelKeyProvider:function(){return'{type:"SEARCH", key: {queryString: \'id:"'+d.id+'"\', order:"MOST_POPULAR"}}'}};p=b.extend(g,p);for(var j in b.ui.timer_manager){this[j]=b.ui.timer_manager[j]}var o=null;var k=null;var l=-1;var d=null;var c=0;var f=function(r,i,q){if(r.isInStream||r.position==0||r.height==0){return}if(i=="finish"&&r.duration-5>=o.getTime()){return}if(!q){q=o.getTime()}babelgum.trigger(k,"video_player",i,[d,q])};var h={};this.onLoad(function(){babelgum.trigger(this.element,"video_player","started",[]);o=this;k=b(o.getParent());h={time:getStamp(),volume:o.getVolume()}});this.onBeforeVolume(function(i){if(o._lastVolume.time+2000=this._count){return null}var d=this._currentChannel.getClip(c);return this._list.showClip(f,c,d)},getItemsPerLine:function(){return 1}});b.widget("ui.current_channel",{_init:function(){var c=this.options;this._channel=null;this.element.addContext("current_channel");this.element.addListener("channel");this.element.bind("channel_update.current_channel",hitch(this,this._channelUpdate));this._backend=b.getContext(this.element,"backend");this._clipCount=-1;this._currentClip=-1;this.setChannel(c.channel)},destroy:function(){this._backend=null;this.element.unbind(".current_channel");this.element.removeListener("channel");this.element.removeContext("current_channel");b.widget.prototype.destroy.call(this)},_channelUpdate:function(d,c){if(this._channel&&this._backend.getChannelKey(this._channel)==this._backend.getChannelKey(c)){this._clipCount=this._backend.getClipCount(this._channel);this.refresh()}},refresh:function(){babelgum.broadcast(this.element,"current_channel",this);if(this.options.onChannelUpdateCb){this.options.onChannelUpdateCb(this)}},makeClipList:function(c){return new a(c)},getSortOrder:function(){if(!this._channel){return null}return this._backend.getSortOrder(this._channel)},setSortOrder:function(c){if(this._channel){this._backend.setSortOrder(this._channel,c)}this.refresh()},getAllowedSorts:function(){if(!this._channel){return null}return this._backend.getAllowedSorts(this._channel)},setChannel:function(c){if(!this._channel&&!c){return}if(this._channel&&c&&this._backend.getChannelKey(this._channel)==this._backend.getChannelKey(c)){return}this._channel=c;this._currentClip=-1;this._clipCount=0;if(c){this._backend.loadClips(this._channel,0,1);this._clipCount=this._backend.getClipCount(this._channel)}this.refresh()},getChannel:function(){if(!this._channel){return null}return b.extend(true,{},this._channel)},setCurrentClip:function(c){this._currentClip=c;if(this._clipCount>=0){this.refresh()}},getCurrentClip:function(){return this._currentClip},getClipCount:function(){return this._clipCount},getClip:function(c){if(!this._channel){return null}return this._backend.getClip(this._channel,c)},loadClips:function(d,c){if(!this._channel){return}return this._backend.loadClips(this._channel,d,c)}});b.extend(b.ui.current_channel,{getter:"makeClipList getOrderBy getAllowedSorts getChannel getClipCount getClip",defaults:{channel:null,onChannelUpdateCb:null}})})(jQuery);(function(a){a.affiliate={};a.affiliate.base_component={_checkDomain:function(c){var b=document.location.href;if(b.indexOf("://")!=-1){b=b.substr(b.indexOf("://")+3)}b=b.substr(0,b.indexOf("/"));if(b=="localhost"){return true}console.log("checking domain ",b,c);console.log("checking length ",b.indexOf(c),c.length,b.length);return b.indexOf(c)+c.length==b.length},_loadAffiliateController:function(){var d=a.getContext(this.element,"affiliate_controller");var b=hitch(this,function(){console.log("got conf",a.getContext(this.element,"affiliate_controller").getComponentConfiguration({}));if(this._checkDomain(a.getContext(this.element,"affiliate_controller").getComponentConfiguration({}).domain)){this._onAffiliateControllerReady()}else{this._showDomainWarning()}});if(!d||(d&&!d.isLoaded())){if(!d){var c={user:this.options.user,clientId:this.options.clientId,clientAppId:this.options.clientAppId,googleTracker:this.options.googleTracker,onLoad:this.options.onLoad};a("body").affiliate_controller(c)}this.element.addListener("affiliate_controller");this.element.bind("affiliate_ready.player_controller",hitch(this,function(){this.element.unbind("affiliate_ready.player_controller");this.element.removeListener("affiliate_controller");b()}))}else{b()}},_onAffiliateControllerReady:function(){alert("You forgot to override _onAffiliateControllerReady")},_showDomainWarning:function(){this.element.empty();if(this.options.width){this.element.css("width",this.options.width+"px")}if(this.options.height){this.element.css("height",this.options.height+"px")}this.element.append(a("
    We're sorry, but this domain is not allowed to host the Babelgum affiliate player."))},getParam:function(g,c){if(!g.attr(c)){return null}if(g.attr(c).substr(0,4)=="url:"){c=g.attr(c).substr(4);c=c.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var b="[\\?&]"+c+"=([^&#]*)";var f=new RegExp(b);var d=f.exec(window.location.href);if(d==null){return null}else{return d[1]}}else{return g.attr(c)}}}})(jQuery);(function(a){a.widget("affiliate.affiliate_controller",{_init:function(){this.options.affiliateId=__BBG_AFFILIATE_ID;this.options.env=__BBG_ENV;var c=this.options;if(c.affiliateId==null){alert("Unable to fetch affiliateId, please contact Babelgum")}this.element.addContext("affiliate_controller");this._isLoaded=false;this._affiliateConfiguration={};this._addEnvConfiguration();this._loadServices(this.options);if(this.options.__b00t==null){var b=new JSON(c.jsonUrl);b.method("Client","getAffiliateConfig",c.affiliateId).call(hitch(this,this._onBootstrapLoaded),hitch(this,this._onBootstrapError))}else{this._onBootstrapLoaded(this.options.__b00t)}},_addEnvConfiguration:function(){if(this.options.env=="STAGE"){this.options.playerPath="http://stage-www.babelgum.com/affiliates/"+this.options.affiliateId+"/";this.options.jsonUrl="http://stage-services.babelgum.com/babelgum/babelgum_api/";this.options.thumbnailsPrefix="http://stage-www.babelgum.com/thumbnails/"}else{if(this.options.env=="INT"){this.options.playerPath="http://int-www.babelgum.com/affiliates/"+this.options.affiliateId+"/";this.options.jsonUrl="http://int-services.babelgum.com/babelgum/babelgum_api/";this.options.thumbnailsPrefix="http://int-www.babelgum.com/thumbnails/"}else{if(this.options.env=="D3V"){this.options.playerPath="http://dev-services.babelgum.com/website.svn/affiliates/latest/";this.options.jsonUrl="http://dev-services.babelgum.com/babelgum/babelgum_api/";this.options.thumbnailsPrefix="http://int-www.babelgum.com/thumbnails/"}else{if(this.options.env=="L0C4L"){this.options.playerPath="http://localhost/website/affiliate/dist/latest/";this.options.jsonUrl="http://dev-services.babelgum.com/babelgum/babelgum_api/";this.options.thumbnailsPrefix="http://int-www.babelgum.com/thumbnails/"}else{this.options.playerPath="http://www.babelgum.com/affiliates/"+this.options.affiliateId+"/";this.options.jsonUrl="http://services.babelgum.com/babelgum/babelgum_api/";this.options.thumbnailsPrefix="http://www.babelgum.com/thumbnails/"}}}}if(!this.options.adManager){this.options.adManager={}}console.log("_addEnvConfiguration",this.options.env,this.options.playerPath)},_onBootstrapLoaded:function(b){this._affiliateConfiguration=this._buildAffiliateConfiguration(b);if(this._affiliateConfiguration){this._affiliateConfiguration=this.getComponentConfiguration(this.options);delete this._affiliateConfiguration.onLoad;this._loadModules(this._affiliateConfiguration);this._isLoaded=true;babelgum.broadcast(this.element,"affiliate_controller","affiliate_ready",[]);if(this.options.onLoad){this.options.onLoad()}}},_onBootstrapError:function(b){console.log(b);alert("Error details : "+b.message)},_buildAffiliateConfiguration:function(d){var b={domain:null,player:{playerKey:null},comScoreReporter:{baseUrl:null,adValue:null,clipValue:null,enabled:false},gaReporter:{gaTrackingCode:null,enabled:true},adManager:{enabled:true}};affiliateConfiguration=a.extend(true,b,d);var c=[];if(affiliateConfiguration.player.playerKey==null||affiliateConfiguration.player.playerKey==""){c.push("player.playerKey")}if(affiliateConfiguration.comScoreReporter.enabled){if(affiliateConfiguration.comScoreReporter.baseUrl==null||affiliateConfiguration.comScoreReporter.baseUrl==""){c.push("comScoreReporter.baseUrl")}if(affiliateConfiguration.comScoreReporter.adValue==null||affiliateConfiguration.comScoreReporter.adValue==""){c.push("comScoreReporter.adValue")}if(affiliateConfiguration.comScoreReporter.clipValue==null||affiliateConfiguration.comScoreReporter.clipValue==""){c.push("comScoreReporter.clipValue")}}if(affiliateConfiguration.gaReporter.enabled&&(affiliateConfiguration.gaReporter.gaTrackingCode==null||affiliateConfiguration.gaReporter.gaTrackingCode=="")){c.push("gaReporter.gaTrackingCode")}if(!affiliateConfiguration.domain){c.push("domain")}if(c.length){alert("Bootstrap error.\r\nPlease contact Babelgum. \r\nMissing fields : \r\n"+c.join(", "));return false}return affiliateConfiguration},_loadServices:function(b){if(!a("body").data("user_settings")){a("body").user_settings({})}if(!a("body").data("backend")){a("body").backend(babelgum.mergeConfiguration(b,"backend",["jsonUrl","affiliateId","clientAppId","clientId","user","thumbnailsPrefix"]))}this._backend=a("body").data("backend")},_loadModules:function(b){console.log(b);if(b.adManager.enabled){console.log("Creating adManager");this.element.oas_manager(babelgum.mergeConfiguration(b,"adManager",["jsonUrl","adProxy"]))}if(b.gaReporter.enabled){console.log("Creating gareporter");this.element.ga_reporter(babelgum.mergeConfiguration(b,"gaReporter",[]))}},isLoaded:function(){return this._isLoaded},getComponentConfiguration:function(b){return a.extend(true,{},b,this._affiliateConfiguration)},destroy:function(){this.element.removeContext("affiliate_controller");if(this.element.data("ad_manager")){this.element.ad_manager("destroy")}if(this.element.data("reporter")){this.element.reporter("destroy")}if(this.element.data("ga_reporter")){this.element.ga_reporter("destroy")}a.widget.prototype.destroy.call(this)}});a.extend(a.affiliate.affiliate_controller,{fetchConfigurationFromTag:function(c){var b={};return b}});a.extend(a.affiliate.affiliate_controller,{getter:"",defaults:{user:null,clientId:null,clientAppId:"AFFILIATE_PLAYER_1_1",googleTracker:null,__b00t:null,onLoad:null}})})(jQuery);(function(a){a.widget("affiliate.player_controller",a.extend({},a.affiliate.base_component,{_init:function(){var b=this.options;this.element.addContext("player_controller");this._autoPlay=false;this._currentClipId=null;this._buildPlaceholder();this._loadAffiliateController()},_onAffiliateControllerReady:function(){this.element.current_channel({});this._currentChannel=this.element.data("current_channel");this.element.addListener("current_channel");this.element.bind("channel_update.player_controller",hitch(this,this._onChannelUpdate));var c=a.getContext(this.element,"affiliate_controller").getComponentConfiguration(this.options);var b=c.onLoad;if(c.clipId){if(b){c.onLoad=hitch(this,function(){b();this.setClipById(c.clipId,c.autoPlay)})}else{c.onLoad=hitch(this,function(){this.setClipById(c.clipId,c.autoPlay)})}}else{if(c.clip){if(b){c.onLoad=hitch(this,function(){b();this.setClip(c.clip,c.autoPlay)})}else{c.onLoad=hitch(this,function(){this.setClip(c.clip,c.autoPlay)})}}}this._loadPlayer(c)},_getPlayerId:function(){var b=1;for(b=1;b<99;b++){if(a("div[playerId='player"+b+"']").length==0){break}}return"player"+b},_loadPlayer:function(g){var f=a('
    ');var b=g.playerId;if(!g.playerId){var b=this._getPlayerId();this.options.playerId=b;g.playerId=b}this.element.attr("playerId",b);this.element.append(f);a(".video_player").each(function(){var h=a(this).data("video_player");if(h){h.setPreventUnload(true)}});var d=babelgum.mergeConfiguration(g,"player",["jsonUrl","videoPrefix","playerPath","onLoad","playerId"]);d.adsConfiguration=g.adManager;d.comScoreConfiguration=g.comScoreReporter;var c=d.onLoad;d.onLoad=hitch(this,function(){console.log("loaded player",c);a(".video_player").each(function(){var h=a(this).data("video_player");if(h){h.setPreventUnload(false)}});if(c){c()}});f.video_player(d);this._videoPlayer=f.data("video_player")},_buildPlaceholder:function(){this.element.empty();if(this.options.width){this.element.css("width",this.options.width+"px")}if(this.options.height){this.element.css("height",this.options.height+"px")}return;if(clipId){this.element.append('')}},destroy:function(){this.element.removeContext("player_controller");this.element.removeListener("current_channel");if(this._videoPlayer){this._videoPlayer.destroy()}this._videoPlayer=null;if(this._currentChannel){this._currentChannel.destroy()}this._currentChannel=null;this.element.unbind(".player_controller");this.element.empty();a.widget.prototype.destroy.call(this)},_onChannelUpdate:function(){if(!this._currentChannel){return}if(this._currentChannel.getClipCount()==0){alert("We're sorry, but this clip does not belong to Babelgum anymore");return}else{var b=this._currentChannel.getClip(0);if(b){this.setClip(b,this._autoPlay)}}},setClip:function(c,b,f,d){a.getContext(this.element,"backend").fixMedia([c]);this._currentClipId=c.id;this._videoPlayer.setClip(0,c,b,f,d)},setClipById:function(d,b){this._autoPlay=b;var c={type:"SEARCH",key:{order:"MOST_POPULAR",queryString:'id:"'+d+'"'}};this._currentChannel.setChannel(c);this._currentChannel.loadClips(0,1);if(d==this._currentClipId){this._onChannelUpdate()}},stop:function(){this._videoPlayer.stop()},pause:function(){this._videoPlayer.pause()},play:function(){this._videoPlayer.play()},seek:function(b){return this._videoPlayer.seek(b)},getTime:function(){return this._videoPlayer.getTime()},getPlayerId:function(){return this.options.playerId}}));a.extend(a.affiliate.player_controller,{fetchConfigurationFromTag:function(d){var c={};c.playerId=d.attr("playerId");c.width=a.affiliate.base_component.getParam(d,"width");c.height=a.affiliate.base_component.getParam(d,"height");var b=a.affiliate.base_component.getParam(d,"autoPlay");c.autoPlay=(!(!b||b=="false"||b=="0"));c.clipId=a.affiliate.base_component.getParam(d,"clipId");return c}});a.extend(a.affiliate.player_controller,{getter:"",defaults:{onLoad:null,playerId:null,width:null,height:null,clipId:null,clip:null,autoPlay:false}})})(jQuery);(function($){$.widget("affiliate.list_controller",$.extend({},$.affiliate.base_component,$.ui.clip_template,$.ui.clipstrip,$.ui.timer_manager,{_init:function(){var o=this.options;this.element.addContext("list_controller");this._channel=null;this._currentClipId=null;this._buildPlaceholder();this._initTimers();this._loadAffiliateController()},_onAffiliateControllerReady:function(){if(!$.getContext(this.element,"current_channel")){this.element.current_channel({})}this._currentChannel=$.getContext(this.element,"current_channel");var conf=$.getContext(this.element,"affiliate_controller").getComponentConfiguration({});this.options.playerPath=conf.playerPath;if(this.options.channel){if(this.options.channel.match(/^[0-9]+$/)){this.loadChannelById(this.options.channel)}else{if(typeof this.options.channel=="string"){try{var channel=eval("("+unescape(decodeURI(this.options.channel))+");");this.loadChannel(channel)}catch(e){console.log(e);alert("Unable to parse channel.")}}else{this.loadChannel(this.options.channel)}}}this._initClipTemplate()},_initClipTemplate:function(page){this._clipTemplate=null;this.element.empty();var clipTemplateStr=" __clip_template__";if(typeof this.options.clipTemplate=="string"){clipTemplateStr+=this.options.clipTemplate}else{if(typeof this.options.clipTemplate.html=="function"){clipTemplateStr+=this.options.clipTemplate.html()}else{alert("Error : clipTemplate is not a valid bbg jQuery element nor string.");return}}clipTemplateStr+="__clip_template__ ";clipTemplateStr=clipTemplateStr.replace(/\{base_url\}/ig,this.options.playerPath);this._onClipTemplateLoaded(clipTemplateStr,"ok")},_onPageLoaded:function(){this.element.removeListener("clip");this.element.unbind("play.list_controller");this.element.addListener("clip");this.element.bind("play.list_controller",hitch(this,this._playClicked));var myClipList=$.getContext(this.element,"current_channel").makeClipList(this._getClipList());var classes="bbg_list ";var style="";if(this.options.width){style+="width: "+this.options.width+"px; "}if(this.options.height){style+="height: "+(this.options.view=="clipstrip"?160:this.options.height)+"px; "}style+="font-size: 10px; ";var scrollListConf={};var id=null;var prepend=null;var append=null;switch(this.options.view){case"grid":scrollListConf={list:myClipList,layout:"grid",refreshInterval:babelgum.refreshInterval,preferredIndex:this.options.scrollTo};classes+="icon grid ";break;case"list":scrollListConf={list:myClipList,layout:"list",refreshInterval:babelgum.refreshInterval,preferredIndex:this.options.scrollTo};classes+="list ";break;case"clipstrip":id="clipstrip_list";prepend='
    ';append='
    ';scrollListConf=null;classes="";if(navigator.appVersion.indexOf("MSIE 6.0")!=-1){style=style.replace("width: "+this.options.width+"px; ","width: "+(this.options.width-26*2)+"px; ")}else{style=""}break;default:alert("View "+this.options.view+" is not supported");return}this._list=$(prepend+'
    '+append);this.element.append(this._list);if(scrollListConf){this._list.scrolllist(scrollListConf)}else{this._initClipStrip()}this._currentChannel.setCurrentClip(this.options.scrollTo);if(this.options.onLoad){this.options.onLoad()}},_playClicked:function(evnt,index,clipId){this._currentChannel.setCurrentClip(index);if(this.getView()=="clipstrip"){this.select(index)}if(typeof this.options.onPlay=="function"){this.options.onPlay(this._currentChannel.getChannel(),index,this._currentChannel.getClip(index))}else{if(this.options.onPlay.toLowerCase().substr(0,9)=="navigate:"){var url=this.options.onPlay.substr(9);var c=this._currentChannel.getChannel();var serializedChannel="";if(c.key.channelID){serializedChannel=c.key.channelID}else{serializedChannel=escape(encodeURI(babelgum.json.stringify(c)))}url=url.replace(/\{channel\}/i,serializedChannel);url=url.replace(/\{clipId\}/i,clipId);url=url.replace(/\{index\}/i,index);window.location.href=url}else{if(this.options.onPlay=="replace"){var self=this;var playerConf={clip:self._currentChannel.getClip(index),width:self.options.width,height:self.options.height,autoPlay:true};this.options.scrollTo=this.getFirstDisplayedIndex();this.element.empty();var videoPlayer=$('
    ');this.element.append(videoPlayer);videoPlayer.player_controller(playerConf);var backButton=$('
    Back
    ');backButton.click(hitch(this,this._initClipTemplate));videoPlayer.append(backButton)}else{if(this.options.onPlay.toLowerCase().substr(0,10)=="useplayer:"){var playerId=this.options.onPlay.substr(10);var player=$bbg.getPlayer(playerId);if(player){player.setClip(this._currentChannel.getClip(index),true);var self=this;$bbg(".list_controller").each(function(){var clipstrip=$(this).data("list_controller");if(clipstrip.getView()!="clipstrip"){return}if(!(typeof clipstrip.onPlay()=="string"&&clipstrip.onPlay().toLowerCase()=="useplayer:"+playerId.toLowerCase())){return}var current_channel=clipstrip.getCurrentChannel();current_channel.setChannel(self._currentChannel.getChannel());current_channel.setCurrentClip(self._currentChannel.getCurrentClip());clipstrip.resetClipStrip()})}else{if(playerId=="*"){alert("There is no player on the page")}else{alert("Unable to find player "+playerId)}}}else{alert("Unknown onPlay action "+this.options.onPlay)}}}}},_buildPlaceholder:function(width,height,channelId){if(width){this.element.css("width",width+"px")}if(height){this.element.css("height",height+"px")}return;if(clipId){this.element.append('')}},destroy:function(){this.element.removeContext("list_controller");this.element.removeListener("clip");if(this.element.data("current_channel")){this._currentChannel.destroy()}this._destroyTimers();this._currentChannel=null;this.element.unbind(".list_controller");this.element.empty();$.widget.prototype.destroy.call(this)},loadChannel:function(channel){this._currentChannel.setChannel(channel);this._currentChannel.loadClips(0,64)},loadChannelById:function(channelId){var channel={type:"SEARCH",key:{order:"MOST_POPULAR",channelID:channelId}};this.loadChannel(channel)},onPlay:function(onPlay){if(!onPlay){return this.options.onPlay}this.options.onPlay=onPlay},getCurrentChannel:function(){return $.getContext(this.element,"current_channel")},getView:function(){return this.options.view}}));$.extend($.affiliate.list_controller,{fetchConfigurationFromTag:function(div){var configuration={};configuration.onPlay=div.attr("onPlay");configuration.width=$.affiliate.base_component.getParam(div,"width");configuration.height=$.affiliate.base_component.getParam(div,"height");configuration.scrollTo=$.affiliate.base_component.getParam(div,"scrollTo");configuration.view=div.attr("view");configuration.channel=$.affiliate.base_component.getParam(div,"channel");return configuration}});$.extend($.affiliate.list_controller,{getter:"",defaults:{onLoad:null,width:null,height:null,view:"grid",channel:null,onPlay:"usePlayer:*",scrollTo:0,clipTemplate:'
    This video is not available
    in your country
    {title}
    {description}
    {duration}
    '}})})(jQuery);(function($){$.widget("affiliate.components_loader",{_init:function(){var o=this.options;this.loadComponents()},loadComponents:function(){console.log("Loading components...");var self=this;$("div[bbgtype='affiliate']").each(function(){self._loadComponent($(this))});$("div[bbgtype!='affiliate']").each(function(){self._loadComponent($(this))})},_loadComponent:function(div){var type=div.attr("bbgtype");if(!type){return}console.log("Loading component ",type);var controllerName=type+"_controller";try{var conf=eval("($.affiliate."+controllerName+".fetchConfigurationFromTag(div))");eval("div."+controllerName+"(conf);")}catch(e){console.log(e);alert("Unable to load "+type+" component"+e.message)}},destroy:function(){$.widget.prototype.destroy.call(this)}});$.extend($.affiliate.components_loader,{getter:"",defaults:{}})})(jQuery);var $bbg=jQuery.noConflict(true);if(_bbgoldjq){$=_bbgoldjq}$bbg.getPlayer=function(a){var b=null;$bbg(".player_controller").each(function(){var c=$bbg(this);if((c.attr("playerId")==a||a=="*")&&c.data("player_controller")){b=c}});return b?b.data("player_controller"):b};$bbg.getThumbnailUrl=function(c,b){var a=$bbg(".backend");if(!a||!a.data("backend")){alert("Unable to find affiliate_controller component or component not yet loaded.");return}return a.data("backend").getThumbnailUrl(c,b)};$bbg(document).ready(function(){try{$bbg("body").components_loader({})}catch(a){console.log(a)}}); var __BBG_ENV = "PROD"; var __BBG_AFFILIATE_ID = "08-08-15-0773";