(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.makeArray(E))},selector:"",jquery:"1.3.1",size:function(){return this.length},get:function(E){return E===g?o.makeArray(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,find:function(E){if(this.length===1&&!/,/.test(E)){var G=this.pushStack([],"find",E);G.length=0;o.find(E,this[0],G);return G}else{var F=o.map(this,function(H){return o.find(E,H)});return this.pushStack(/[^+>] [^+>]/.test(E)?o.unique(F):F,"find",E)}},clone:function(F){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.cloneNode(true),H=document.createElement("div");H.appendChild(I);return o.clean([H.innerHTML])[0]}else{return this.cloneNode(true)}});var G=E.find("*").andSelf().each(function(){if(this[h]!==g){this[h]=null}});if(F===true){this.find("*").andSelf().each(function(I){if(this.nodeType==3){return}var H=o.data(this,"events");for(var K in H){for(var J in H[K]){o.event.add(G[I],K,H[K][J],H[K][J].data)}}})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var F=o.expr.match.POS.test(E)?o(E):null;return this.map(function(){var G=this;while(G&&G.ownerDocument){if(F?F.index(G)>-1:o(G).is(E)){return G}G=G.parentNode}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML:null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(K,N,M){if(this[0]){var J=(this[0].ownerDocument||this[0]).createDocumentFragment(),G=o.clean(K,(this[0].ownerDocument||this[0]),J),I=J.firstChild,E=this.length>1?J.cloneNode(true):J;if(I){for(var H=0,F=this.length;H<F;H++){M.call(L(this[H],I),H>0?E.cloneNode(true):J)}}if(G){o.each(G,z)}}return this;function L(O,P){return N&&o.nodeName(O,"table")&&o.nodeName(P,"tr")?(O.getElementsByTagName("tbody")[0]||O.appendChild(O.ownerDocument.createElement("tbody"))):O}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){G=o.trim(G);if(G){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(G,E,I){if(E=="width"||E=="height"){var K,F={position:"absolute",visibility:"hidden",display:"block"},J=E=="width"?["Left","Right"]:["Top","Bottom"];function H(){K=E=="width"?G.offsetWidth:G.offsetHeight;var M=0,L=0;o.each(J,function(){M+=parseFloat(o.curCSS(G,"padding"+this,true))||0;L+=parseFloat(o.curCSS(G,"border"+this+"Width",true))||0});K-=Math.round(M+L)}if(o(G).is(":visible")){H()}else{o.swap(G,F,H)}return Math.max(0,K)}return o.curCSS(G,E,I)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,R){if(typeof R==="number"){R+=""}if(!R){return}if(typeof R==="string"){R=R.replace(/(<(\w+)[^>]*?)\/>/g,function(T,U,S){return S.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?T:U+"></"+S+">"});var O=o.trim(R).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+R+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var N=!O.indexOf("<table")&&O.indexOf("<tbody")<0?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&O.indexOf("<tbody")<0?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(R)){L.insertBefore(K.createTextNode(R.match(/^\s*/)[0]),L.firstChild)}R=o.makeArray(L.childNodes)}if(R.nodeType){G.push(R)}else{G=o.merge(G,R)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(){var G=arguments;return this.each(function(){for(var H=0,I=G.length;H<I;H++){o(G[H])[F](this)}})}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(">*",this).remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
(function(){var Q=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]+['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,K=0,G=Object.prototype.toString;var F=function(X,T,aa,ab){aa=aa||[];T=T||document;if(T.nodeType!==1&&T.nodeType!==9){return[]}if(!X||typeof X!=="string"){return aa}var Y=[],V,ae,ah,S,ac,U,W=true;Q.lastIndex=0;while((V=Q.exec(X))!==null){Y.push(V[1]);if(V[2]){U=RegExp.rightContext;break}}if(Y.length>1&&L.exec(X)){if(Y.length===2&&H.relative[Y[0]]){ae=I(Y[0]+Y[1],T)}else{ae=H.relative[Y[0]]?[T]:F(Y.shift(),T);while(Y.length){X=Y.shift();if(H.relative[X]){X+=Y.shift()}ae=I(X,ae)}}}else{var ad=ab?{expr:Y.pop(),set:E(ab)}:F.find(Y.pop(),Y.length===1&&T.parentNode?T.parentNode:T,P(T));ae=F.filter(ad.expr,ad.set);if(Y.length>0){ah=E(ae)}else{W=false}while(Y.length){var ag=Y.pop(),af=ag;if(!H.relative[ag]){ag=""}else{af=Y.pop()}if(af==null){af=T}H.relative[ag](ah,af,P(T))}}if(!ah){ah=ae}if(!ah){throw"Syntax error, unrecognized expression: "+(ag||X)}if(G.call(ah)==="[object Array]"){if(!W){aa.push.apply(aa,ah)}else{if(T.nodeType===1){for(var Z=0;ah[Z]!=null;Z++){if(ah[Z]&&(ah[Z]===true||ah[Z].nodeType===1&&J(T,ah[Z]))){aa.push(ae[Z])}}}else{for(var Z=0;ah[Z]!=null;Z++){if(ah[Z]&&ah[Z].nodeType===1){aa.push(ae[Z])}}}}}else{E(ah,aa)}if(U){F(U,T,aa,ab)}return aa};F.matches=function(S,T){return F(S,null,null,T)};F.find=function(Z,S,aa){var Y,W;if(!Z){return[]}for(var V=0,U=H.order.length;V<U;V++){var X=H.order[V],W;if((W=H.match[X].exec(Z))){var T=RegExp.leftContext;if(T.substr(T.length-1)!=="\\"){W[1]=(W[1]||"").replace(/\\/g,"");Y=H.find[X](W,S,aa);if(Y!=null){Z=Z.replace(H.match[X],"");break}}}}if(!Y){Y=S.getElementsByTagName("*")}return{set:Y,expr:Z}};F.filter=function(ab,aa,ae,V){var U=ab,ag=[],Y=aa,X,S;while(ab&&aa.length){for(var Z in H.filter){if((X=H.match[Z].exec(ab))!=null){var T=H.filter[Z],af,ad;S=false;if(Y==ag){ag=[]}if(H.preFilter[Z]){X=H.preFilter[Z](X,Y,ae,ag,V);if(!X){S=af=true}else{if(X===true){continue}}}if(X){for(var W=0;(ad=Y[W])!=null;W++){if(ad){af=T(ad,X,W,Y);var ac=V^!!af;if(ae&&af!=null){if(ac){S=true}else{Y[W]=false}}else{if(ac){ag.push(ad);S=true}}}}}if(af!==g){if(!ae){Y=ag}ab=ab.replace(H.match[Z],"");if(!S){return[]}break}}}ab=ab.replace(/\s*,\s*/,"");if(ab==U){if(S==null){throw"Syntax error, unrecognized expression: "+ab}else{break}}U=ab}return Y};var H=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(S){return S.getAttribute("href")}},relative:{"+":function(W,T){for(var U=0,S=W.length;U<S;U++){var V=W[U];if(V){var X=V.previousSibling;while(X&&X.nodeType!==1){X=X.previousSibling}W[U]=typeof T==="string"?X||false:X===T}}if(typeof T==="string"){F.filter(T,W,true)}},">":function(X,T,Y){if(typeof T==="string"&&!/\W/.test(T)){T=Y?T:T.toUpperCase();for(var U=0,S=X.length;U<S;U++){var W=X[U];if(W){var V=W.parentNode;X[U]=V.nodeName===T?V:false}}}else{for(var U=0,S=X.length;U<S;U++){var W=X[U];if(W){X[U]=typeof T==="string"?W.parentNode:W.parentNode===T}}if(typeof T==="string"){F.filter(T,X,true)}}},"":function(V,T,X){var U="done"+(K++),S=R;if(!T.match(/\W/)){var W=T=X?T:T.toUpperCase();S=O}S("parentNode",T,U,V,W,X)},"~":function(V,T,X){var U="done"+(K++),S=R;if(typeof T==="string"&&!T.match(/\W/)){var W=T=X?T:T.toUpperCase();S=O}S("previousSibling",T,U,V,W,X)}},find:{ID:function(T,U,V){if(typeof U.getElementById!=="undefined"&&!V){var S=U.getElementById(T[1]);return S?[S]:[]}},NAME:function(S,T,U){if(typeof T.getElementsByName!=="undefined"&&!U){return T.getElementsByName(S[1])}},TAG:function(S,T){return T.getElementsByTagName(S[1])}},preFilter:{CLASS:function(V,T,U,S,Y){V=" "+V[1].replace(/\\/g,"")+" ";var X;for(var W=0;(X=T[W])!=null;W++){if(X){if(Y^(" "+X.className+" ").indexOf(V)>=0){if(!U){S.push(X)}}else{if(U){T[W]=false}}}}return false},ID:function(S){return S[1].replace(/\\/g,"")},TAG:function(T,S){for(var U=0;S[U]===false;U++){}return S[U]&&P(S[U])?T[1]:T[1].toUpperCase()},CHILD:function(S){if(S[1]=="nth"){var T=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(S[2]=="even"&&"2n"||S[2]=="odd"&&"2n+1"||!/\D/.test(S[2])&&"0n+"+S[2]||S[2]);S[2]=(T[1]+(T[2]||1))-0;S[3]=T[3]-0}S[0]="done"+(K++);return S},ATTR:function(T){var S=T[1].replace(/\\/g,"");if(H.attrMap[S]){T[1]=H.attrMap[S]}if(T[2]==="~="){T[4]=" "+T[4]+" "}return T},PSEUDO:function(W,T,U,S,X){if(W[1]==="not"){if(W[3].match(Q).length>1){W[3]=F(W[3],null,null,T)}else{var V=F.filter(W[3],T,U,true^X);if(!U){S.push.apply(S,V)}return false}}else{if(H.match.POS.test(W[0])){return true}}return W},POS:function(S){S.unshift(true);return S}},filters:{enabled:function(S){return S.disabled===false&&S.type!=="hidden"},disabled:function(S){return S.disabled===true},checked:function(S){return S.checked===true},selected:function(S){S.parentNode.selectedIndex;return S.selected===true},parent:function(S){return !!S.firstChild},empty:function(S){return !S.firstChild},has:function(U,T,S){return !!F(S[3],U).length},header:function(S){return/h\d/i.test(S.nodeName)},text:function(S){return"text"===S.type},radio:function(S){return"radio"===S.type},checkbox:function(S){return"checkbox"===S.type},file:function(S){return"file"===S.type},password:function(S){return"password"===S.type},submit:function(S){return"submit"===S.type},image:function(S){return"image"===S.type},reset:function(S){return"reset"===S.type},button:function(S){return"button"===S.type||S.nodeName.toUpperCase()==="BUTTON"},input:function(S){return/input|select|textarea|button/i.test(S.nodeName)}},setFilters:{first:function(T,S){return S===0},last:function(U,T,S,V){return T===V.length-1},even:function(T,S){return S%2===0},odd:function(T,S){return S%2===1},lt:function(U,T,S){return T<S[3]-0},gt:function(U,T,S){return T>S[3]-0},nth:function(U,T,S){return S[3]-0==T},eq:function(U,T,S){return S[3]-0==T}},filter:{CHILD:function(S,V){var Y=V[1],Z=S.parentNode;var X=V[0];if(Z&&(!Z[X]||!S.nodeIndex)){var W=1;for(var T=Z.firstChild;T;T=T.nextSibling){if(T.nodeType==1){T.nodeIndex=W++}}Z[X]=W-1}if(Y=="first"){return S.nodeIndex==1}else{if(Y=="last"){return S.nodeIndex==Z[X]}else{if(Y=="only"){return Z[X]==1}else{if(Y=="nth"){var ab=false,U=V[2],aa=V[3];if(U==1&&aa==0){return true}if(U==0){if(S.nodeIndex==aa){ab=true}}else{if((S.nodeIndex-aa)%U==0&&(S.nodeIndex-aa)/U>=0){ab=true}}return ab}}}}},PSEUDO:function(Y,U,V,Z){var T=U[1],W=H.filters[T];if(W){return W(Y,V,U,Z)}else{if(T==="contains"){return(Y.textContent||Y.innerText||"").indexOf(U[3])>=0}else{if(T==="not"){var X=U[3];for(var V=0,S=X.length;V<S;V++){if(X[V]===Y){return false}}return true}}}},ID:function(T,S){return T.nodeType===1&&T.getAttribute("id")===S},TAG:function(T,S){return(S==="*"&&T.nodeType===1)||T.nodeName===S},CLASS:function(T,S){return S.test(T.className)},ATTR:function(W,U){var S=H.attrHandle[U[1]]?H.attrHandle[U[1]](W):W[U[1]]||W.getAttribute(U[1]),X=S+"",V=U[2],T=U[4];return S==null?V==="!=":V==="="?X===T:V==="*="?X.indexOf(T)>=0:V==="~="?(" "+X+" ").indexOf(T)>=0:!U[4]?S:V==="!="?X!=T:V==="^="?X.indexOf(T)===0:V==="$="?X.substr(X.length-T.length)===T:V==="|="?X===T||X.substr(0,T.length+1)===T+"-":false},POS:function(W,T,U,X){var S=T[2],V=H.setFilters[S];if(V){return V(W,U,T,X)}}}};var L=H.match.POS;for(var N in H.match){H.match[N]=RegExp(H.match[N].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(T,S){T=Array.prototype.slice.call(T);if(S){S.push.apply(S,T);return S}return T};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(M){E=function(W,V){var T=V||[];if(G.call(W)==="[object Array]"){Array.prototype.push.apply(T,W)}else{if(typeof W.length==="number"){for(var U=0,S=W.length;U<S;U++){T.push(W[U])}}else{for(var U=0;W[U];U++){T.push(W[U])}}}return T}}(function(){var T=document.createElement("form"),U="script"+(new Date).getTime();T.innerHTML="<input name='"+U+"'/>";var S=document.documentElement;S.insertBefore(T,S.firstChild);if(!!document.getElementById(U)){H.find.ID=function(W,X,Y){if(typeof X.getElementById!=="undefined"&&!Y){var V=X.getElementById(W[1]);return V?V.id===W[1]||typeof V.getAttributeNode!=="undefined"&&V.getAttributeNode("id").nodeValue===W[1]?[V]:g:[]}};H.filter.ID=function(X,V){var W=typeof X.getAttributeNode!=="undefined"&&X.getAttributeNode("id");return X.nodeType===1&&W&&W.nodeValue===V}}S.removeChild(T)})();(function(){var S=document.createElement("div");S.appendChild(document.createComment(""));if(S.getElementsByTagName("*").length>0){H.find.TAG=function(T,X){var W=X.getElementsByTagName(T[1]);if(T[1]==="*"){var V=[];for(var U=0;W[U];U++){if(W[U].nodeType===1){V.push(W[U])}}W=V}return W}}S.innerHTML="<a href='#'></a>";if(S.firstChild&&S.firstChild.getAttribute("href")!=="#"){H.attrHandle.href=function(T){return T.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var S=F,T=document.createElement("div");T.innerHTML="<p class='TEST'></p>";if(T.querySelectorAll&&T.querySelectorAll(".TEST").length===0){return}F=function(X,W,U,V){W=W||document;if(!V&&W.nodeType===9&&!P(W)){try{return E(W.querySelectorAll(X),U)}catch(Y){}}return S(X,W,U,V)};F.find=S.find;F.filter=S.filter;F.selectors=S.selectors;F.matches=S.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){H.order.splice(1,0,"CLASS");H.find.CLASS=function(S,T){return T.getElementsByClassName(S[1])}}function O(T,Z,Y,ac,aa,ab){for(var W=0,U=ac.length;W<U;W++){var S=ac[W];if(S){S=S[T];var X=false;while(S&&S.nodeType){var V=S[Y];if(V){X=ac[V];break}if(S.nodeType===1&&!ab){S[Y]=W}if(S.nodeName===Z){X=S;break}S=S[T]}ac[W]=X}}}function R(T,Y,X,ab,Z,aa){for(var V=0,U=ab.length;V<U;V++){var S=ab[V];if(S){S=S[T];var W=false;while(S&&S.nodeType){if(S[X]){W=ab[S[X]];break}if(S.nodeType===1){if(!aa){S[X]=V}if(typeof Y!=="string"){if(S===Y){W=true;break}}else{if(F.filter(Y,[S]).length>0){W=S;break}}}S=S[T]}ab[V]=W}}}var J=document.compareDocumentPosition?function(T,S){return T.compareDocumentPosition(S)&16}:function(T,S){return T!==S&&(T.contains?T.contains(S):true)};var P=function(S){return S.nodeType===9&&S.documentElement.nodeName!=="HTML"||!!S.ownerDocument&&P(S.ownerDocument)};var I=function(S,Z){var V=[],W="",X,U=Z.nodeType?[Z]:Z;while((X=H.match.PSEUDO.exec(S))){W+=X[0];S=S.replace(H.match.PSEUDO,"")}S=H.relative[S]?S+"*":S;for(var Y=0,T=U.length;Y<T;Y++){F(S,U[Y],V)}return F.filter(W,V)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(S){return"hidden"===S.type||o.css(S,"display")==="none"||o.css(S,"visibility")==="hidden"};F.selectors.filters.visible=function(S){return"hidden"!==S.type&&o.css(S,"display")!=="none"&&o.css(S,"visibility")!=="hidden"};F.selectors.filters.animated=function(S){return o.grep(o.timers,function(T){return S===T.elem}).length};o.multiFilter=function(U,S,T){if(T){U=":not("+U+")"}return F.matches(U,S)};o.dir=function(U,T){var S=[],V=U[T];while(V&&V!=document){if(V.nodeType==1){S.push(V)}V=V[T]}return S};o.nth=function(W,S,U,V){S=S||1;var T=0;for(;W;W=W[U]){if(W.nodeType==1&&++T==S){break}}return W};o.sibling=function(U,T){var S=[];for(;U;U=U.nextSibling){if(U.nodeType==1&&U!=T){S.push(U)}}return S};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){G=false}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&typeof l.frameElement==="undefined"){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width="1px";L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L)})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){if($.browser.msie && $.browser.version > 7){return new XMLHttpRequest()}else{return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}this[H].style.display=o.data(this[H],"olddisplay",K)}}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)==1){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n)}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(H,F){var E=H?"Left":"Top",G=H?"Right":"Bottom";o.fn["inner"+F]=function(){return this[F.toLowerCase()]()+j(this,"padding"+E)+j(this,"padding"+G)};o.fn["outer"+F]=function(J){return this["inner"+F]()+j(this,"border"+E+"Width")+j(this,"border"+G+"Width")+(J?j(this,"margin"+E)+j(this,"margin"+G):0)};var I=F.toLowerCase();o.fn[I]=function(J){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+F]||document.body["client"+F]:this[0]==document?Math.max(document.documentElement["client"+F],document.body["scroll"+F],document.documentElement["scroll"+F],document.body["offset"+F],document.documentElement["offset"+F]):J===g?(this.length?o.css(this[0],I):null):this.css(I,typeof J==="string"?J:J+"px")}})})();

(function($){var scrollbarWidth=0;$.getScrollbarWidth=function(){if(!scrollbarWidth){if($.browser.msie){var $textarea1=$('<textarea cols="10" rows="2"></textarea>').css({position:'absolute',top:-1000,left:-1000}).appendTo('body'),$textarea2=$('<textarea cols="10" rows="2" style="overflow: hidden;"></textarea>').css({position:'absolute',top:-1000,left:-1000}).appendTo('body');scrollbarWidth=$textarea1.width()-$textarea2.width();$textarea1.add($textarea2).remove();}else{var $div=$('<div />').css({width:100,height:100,overflow:'auto',position:'absolute',top:-1000,left:-1000}).prependTo('body').append('<div />').find('div').css({width:'100%',height:200});scrollbarWidth=100-$div.width();$div.parent().remove();}}return scrollbarWidth;};})(jQuery);
jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}expires='; expires='+date.toUTCString();}var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}return cookieValue;}};
jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.2",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m<n.length;m++){if(j.options[n[m][0]]){n[m][1].apply(j.element,k)}}}},contains:function(k,j){return document.compareDocumentPosition?k.compareDocumentPosition(j)&16:k!==j&&k.contains(j)},hasScroll:function(m,k){if(c(m).css("overflow")=="hidden"){return false}var j=(k&&k=="left")?"scrollLeft":"scrollTop",l=false;if(m[j]>0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return !this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);;
(function(a){a.widget("ui.draggable",a.extend({},a.ui.mouse,{_init:function(){if(this.options.helper=="original"&&!(/^(?:r|a|f)/).test(this.element.css("position"))){this.element[0].style.position="relative"}(this.options.addClasses&&this.element.addClass("ui-draggable"));(this.options.disabled&&this.element.addClass("ui-draggable-disabled"));this._mouseInit()},destroy:function(){if(!this.element.data("draggable")){return}this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy()},_mouseCapture:function(b){var c=this.options;if(this.helper||c.disabled||a(b.target).is(".ui-resizable-handle")){return false}this.handle=this._getHandle(b);if(!this.handle){return false}return true},_mouseStart:function(b){var c=this.options;this.helper=this._createHelper(b);this._cacheHelperProportions();if(a.ui.ddmanager){a.ui.ddmanager.current=this}this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(b);this.originalPageX=b.pageX;this.originalPageY=b.pageY;if(c.cursorAt){this._adjustOffsetFromHelper(c.cursorAt)}if(c.containment){this._setContainment()}this._trigger("start",b);this._cacheHelperProportions();if(a.ui.ddmanager&&!c.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,b)}this.helper.addClass("ui-draggable-dragging");this._mouseDrag(b,true);return true},_mouseDrag:function(b,d){this.position=this._generatePosition(b);this.positionAbs=this._convertPositionTo("absolute");if(!d){var c=this._uiHash();this._trigger("drag",b,c);this.position=c.position}if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}if(a.ui.ddmanager){a.ui.ddmanager.drag(this,b)}return false},_mouseStop:function(c){var d=false;if(a.ui.ddmanager&&!this.options.dropBehaviour){d=a.ui.ddmanager.drop(this,c)}if(this.dropped){d=this.dropped;this.dropped=false}if((this.options.revert=="invalid"&&!d)||(this.options.revert=="valid"&&d)||this.options.revert===true||(a.isFunction(this.options.revert)&&this.options.revert.call(this.element,d))){var b=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){b._trigger("stop",c);b._clear()})}else{this._trigger("stop",c);this._clear()}return false},_getHandle:function(b){var c=!this.options.handle||!a(this.options.handle,this.element).length?true:false;a(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==b.target){c=true}});return c},_createHelper:function(c){var d=this.options;var b=a.isFunction(d.helper)?a(d.helper.apply(this.element[0],[c])):(d.helper=="clone"?this.element.clone():this.element);if(!b.parents("body").length){b.appendTo((d.appendTo=="parent"?this.element[0].parentNode:d.appendTo))}if(b[0]!=this.element[0]&&!(/(fixed|absolute)/).test(b.css("position"))){b.css("position","absolute")}return b},_adjustOffsetFromHelper:function(b){if(b.left!=undefined){this.offset.click.left=b.left+this.margins.left}if(b.right!=undefined){this.offset.click.left=this.helperProportions.width-b.right+this.margins.left}if(b.top!=undefined){this.offset.click.top=b.top+this.margins.top}if(b.bottom!=undefined){this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])){b.left+=this.scrollParent.scrollLeft();b.top+=this.scrollParent.scrollTop()}if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)){b={top:0,left:0}}return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var b=this.element.position();return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e=this.options;if(e.containment=="parent"){e.containment=this.helper[0].parentNode}if(e.containment=="document"||e.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(e.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(e.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(e.containment)&&e.containment.constructor!=Array){var c=a(e.containment)[0];if(!c){return}var d=a(e.containment).offset();var b=(a(c).css("overflow")!="hidden");this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(b?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}else{if(e.containment.constructor==Array){this.containment=e.containment}}},_convertPositionTo:function(f,h){if(!h){h=this.position}var c=f=="absolute"?1:-1;var e=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(b[0].tagName);return{top:(h.top+this.offset.relative.top*c+this.offset.parent.top*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(g?0:b.scrollTop()))*c)),left:(h.left+this.offset.relative.left*c+this.offset.parent.left*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:b.scrollLeft())*c))}},_generatePosition:function(e){var h=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,i=(/(html|body)/i).test(b[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}var d=e.pageX;var c=e.pageY;if(this.originalPosition){if(this.containment){if(e.pageX-this.offset.click.left<this.containment[0]){d=this.containment[0]+this.offset.click.left}if(e.pageY-this.offset.click.top<this.containment[1]){c=this.containment[1]+this.offset.click.top}if(e.pageX-this.offset.click.left>this.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:(!(g-this.offset.click.top<this.containment[1])?g-h.grid[1]:g+h.grid[1])):g;var f=this.originalPageX+Math.round((d-this.originalPageX)/h.grid[0])*h.grid[0];d=this.containment?(!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:(!(f-this.offset.click.left<this.containment[0])?f-h.grid[0]:f+h.grid[0])):f}}return{top:(c-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(i?0:b.scrollTop())))),left:(d-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():i?0:b.scrollLeft())))}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval){this.helper.remove()}this.helper=null;this.cancelHelperRemoval=false},_trigger:function(b,c,d){d=d||this._uiHash();a.ui.plugin.call(this,b,[c,d]);if(b=="drag"){this.positionAbs=this._convertPositionTo("absolute")}return a.widget.prototype._trigger.call(this,b,c,d)},plugins:{},_uiHash:function(b){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,offset:this.positionAbs}}}));a.extend(a.ui.draggable,{version:"1.7.2",eventPrefix:"drag",defaults:{addClasses:true,appendTo:"parent",axis:false,cancel:":input,option",connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,delay:0,distance:1,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false}});a.ui.plugin.add("draggable","connectToSortable",{start:function(c,e){var d=a(this).data("draggable"),f=d.options,b=a.extend({},e,{item:d.element});d.sortables=[];a(f.connectToSortable).each(function(){var g=a.data(this,"sortable");if(g&&!g.options.disabled){d.sortables.push({instance:g,shouldRevert:g.options.revert});g._refreshItems();g._trigger("activate",c,b)}})},stop:function(c,e){var d=a(this).data("draggable"),b=a.extend({},e,{item:d.element});a.each(d.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;d.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert){this.instance.options.revert=true}this.instance._mouseStop(c);this.instance.options.helper=this.instance.options._helper;if(d.options.helper=="original"){this.instance.currentItem.css({top:"auto",left:"auto"})}}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",c,b)}})},drag:function(c,f){var e=a(this).data("draggable"),b=this;var d=function(i){var n=this.offset.click.top,m=this.offset.click.left;var g=this.positionAbs.top,k=this.positionAbs.left;var j=i.height,l=i.width;var p=i.top,h=i.left;return a.ui.isOver(g+n,k+m,p,h,j,l)};a.each(e.sortables,function(g){this.instance.positionAbs=e.positionAbs;this.instance.helperProportions=e.helperProportions;this.instance.offset.click=e.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=a(b).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return f.helper[0]};c.target=this.instance.currentItem[0];this.instance._mouseCapture(c,true);this.instance._mouseStart(c,true,true);this.instance.offset.click.top=e.offset.click.top;this.instance.offset.click.left=e.offset.click.left;this.instance.offset.parent.left-=e.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=e.offset.parent.top-this.instance.offset.parent.top;e._trigger("toSortable",c);e.dropped=this.instance.element;e.currentItem=e.element;this.instance.fromOutside=e}if(this.instance.currentItem){this.instance._mouseDrag(c)}}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",c,this.instance._uiHash(this.instance));this.instance._mouseStop(c,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder){this.instance.placeholder.remove()}e._trigger("fromSortable",c);e.dropped=false}}})}});a.ui.plugin.add("draggable","cursor",{start:function(c,d){var b=a("body"),e=a(this).data("draggable").options;if(b.css("cursor")){e._cursor=b.css("cursor")}b.css("cursor",e.cursor)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._cursor){a("body").css("cursor",d._cursor)}}});a.ui.plugin.add("draggable","iframeFix",{start:function(b,c){var d=a(this).data("draggable").options;a(d.iframeFix===true?"iframe":d.iframeFix).each(function(){a('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(a(this).offset()).appendTo("body")})},stop:function(b,c){a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});a.ui.plugin.add("draggable","opacity",{start:function(c,d){var b=a(d.helper),e=a(this).data("draggable").options;if(b.css("opacity")){e._opacity=b.css("opacity")}b.css("opacity",e.opacity)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._opacity){a(c.helper).css("opacity",d._opacity)}}});a.ui.plugin.add("draggable","scroll",{start:function(c,d){var b=a(this).data("draggable");if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){b.overflowOffset=b.scrollParent.offset()}},drag:function(d,e){var c=a(this).data("draggable"),f=c.options,b=false;if(c.scrollParent[0]!=document&&c.scrollParent[0].tagName!="HTML"){if(!f.axis||f.axis!="x"){if((c.overflowOffset.top+c.scrollParent[0].offsetHeight)-d.pageY<f.scrollSensitivity){c.scrollParent[0].scrollTop=b=c.scrollParent[0].scrollTop+f.scrollSpeed}else{if(d.pageY-c.overflowOffset.top<f.scrollSensitivity){c.scrollParent[0].scrollTop=b=c.scrollParent[0].scrollTop-f.scrollSpeed}}}if(!f.axis||f.axis!="y"){if((c.overflowOffset.left+c.scrollParent[0].offsetWidth)-d.pageX<f.scrollSensitivity){c.scrollParent[0].scrollLeft=b=c.scrollParent[0].scrollLeft+f.scrollSpeed}else{if(d.pageX-c.overflowOffset.left<f.scrollSensitivity){c.scrollParent[0].scrollLeft=b=c.scrollParent[0].scrollLeft-f.scrollSpeed}}}}else{if(!f.axis||f.axis!="x"){if(d.pageY-a(document).scrollTop()<f.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()-f.scrollSpeed)}else{if(a(window).height()-(d.pageY-a(document).scrollTop())<f.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()+f.scrollSpeed)}}}if(!f.axis||f.axis!="y"){if(d.pageX-a(document).scrollLeft()<f.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()-f.scrollSpeed)}else{if(a(window).width()-(d.pageX-a(document).scrollLeft())<f.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()+f.scrollSpeed)}}}}if(b!==false&&a.ui.ddmanager&&!f.dropBehaviour){a.ui.ddmanager.prepareOffsets(c,d)}}});a.ui.plugin.add("draggable","snap",{start:function(c,d){var b=a(this).data("draggable"),e=b.options;b.snapElements=[];a(e.snap.constructor!=String?(e.snap.items||":data(draggable)"):e.snap).each(function(){var g=a(this);var f=g.offset();if(this!=b.element[0]){b.snapElements.push({item:this,width:g.outerWidth(),height:g.outerHeight(),top:f.top,left:f.left})}})},drag:function(u,p){var g=a(this).data("draggable"),q=g.options;var y=q.snapTolerance;var x=p.offset.left,w=x+g.helperProportions.width,f=p.offset.top,e=f+g.helperProportions.height;for(var v=g.snapElements.length-1;v>=0;v--){var s=g.snapElements[v].left,n=s+g.snapElements[v].width,m=g.snapElements[v].top,A=m+g.snapElements[v].height;if(!((s-y<x&&x<n+y&&m-y<f&&f<A+y)||(s-y<x&&x<n+y&&m-y<e&&e<A+y)||(s-y<w&&w<n+y&&m-y<f&&f<A+y)||(s-y<w&&w<n+y&&m-y<e&&e<A+y))){if(g.snapElements[v].snapping){(g.options.snap.release&&g.options.snap.release.call(g.element,u,a.extend(g._uiHash(),{snapItem:g.snapElements[v].item})))}g.snapElements[v].snapping=false;continue}if(q.snapMode!="inner"){var c=Math.abs(m-e)<=y;var z=Math.abs(A-f)<=y;var j=Math.abs(s-w)<=y;var k=Math.abs(n-x)<=y;if(c){p.position.top=g._convertPositionTo("relative",{top:m-g.helperProportions.height,left:0}).top-g.margins.top}if(z){p.position.top=g._convertPositionTo("relative",{top:A,left:0}).top-g.margins.top}if(j){p.position.left=g._convertPositionTo("relative",{top:0,left:s-g.helperProportions.width}).left-g.margins.left}if(k){p.position.left=g._convertPositionTo("relative",{top:0,left:n}).left-g.margins.left}}var h=(c||z||j||k);if(q.snapMode!="outer"){var c=Math.abs(m-f)<=y;var z=Math.abs(A-e)<=y;var j=Math.abs(s-x)<=y;var k=Math.abs(n-w)<=y;if(c){p.position.top=g._convertPositionTo("relative",{top:m,left:0}).top-g.margins.top}if(z){p.position.top=g._convertPositionTo("relative",{top:A-g.helperProportions.height,left:0}).top-g.margins.top}if(j){p.position.left=g._convertPositionTo("relative",{top:0,left:s}).left-g.margins.left}if(k){p.position.left=g._convertPositionTo("relative",{top:0,left:n-g.helperProportions.width}).left-g.margins.left}}if(!g.snapElements[v].snapping&&(c||z||j||k||h)){(g.options.snap.snap&&g.options.snap.snap.call(g.element,u,a.extend(g._uiHash(),{snapItem:g.snapElements[v].item})))}g.snapElements[v].snapping=(c||z||j||k||h)}}});a.ui.plugin.add("draggable","stack",{start:function(b,c){var e=a(this).data("draggable").options;var d=a.makeArray(a(e.stack.group)).sort(function(g,f){return(parseInt(a(g).css("zIndex"),10)||e.stack.min)-(parseInt(a(f).css("zIndex"),10)||e.stack.min)});a(d).each(function(f){this.style.zIndex=e.stack.min+f});this[0].style.zIndex=e.stack.min+d.length}});a.ui.plugin.add("draggable","zIndex",{start:function(c,d){var b=a(d.helper),e=a(this).data("draggable").options;if(b.css("zIndex")){e._zIndex=b.css("zIndex")}b.css("zIndex",e.zIndex)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._zIndex){a(c.helper).css("zIndex",d._zIndex)}}})})(jQuery);;
(function(a){a.widget("ui.droppable",{_init:function(){var c=this.options,b=c.accept;this.isover=0;this.isout=1;this.options.accept=this.options.accept&&a.isFunction(this.options.accept)?this.options.accept:function(e){return e.is(b)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};a.ui.ddmanager.droppables[this.options.scope]=a.ui.ddmanager.droppables[this.options.scope]||[];a.ui.ddmanager.droppables[this.options.scope].push(this);(this.options.addClasses&&this.element.addClass("ui-droppable"))},destroy:function(){var b=a.ui.ddmanager.droppables[this.options.scope];for(var c=0;c<b.length;c++){if(b[c]==this){b.splice(c,1)}}this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable")},_setData:function(b,c){if(b=="accept"){this.options.accept=c&&a.isFunction(c)?c:function(e){return e.is(c)}}else{a.widget.prototype._setData.apply(this,arguments)}},_activate:function(c){var b=a.ui.ddmanager.current;if(this.options.activeClass){this.element.addClass(this.options.activeClass)}(b&&this._trigger("activate",c,this.ui(b)))},_deactivate:function(c){var b=a.ui.ddmanager.current;if(this.options.activeClass){this.element.removeClass(this.options.activeClass)}(b&&this._trigger("deactivate",c,this.ui(b)))},_over:function(c){var b=a.ui.ddmanager.current;if(!b||(b.currentItem||b.element)[0]==this.element[0]){return}if(this.options.accept.call(this.element[0],(b.currentItem||b.element))){if(this.options.hoverClass){this.element.addClass(this.options.hoverClass)}this._trigger("over",c,this.ui(b))}},_out:function(c){var b=a.ui.ddmanager.current;if(!b||(b.currentItem||b.element)[0]==this.element[0]){return}if(this.options.accept.call(this.element[0],(b.currentItem||b.element))){if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)}this._trigger("out",c,this.ui(b))}},_drop:function(c,d){var b=d||a.ui.ddmanager.current;if(!b||(b.currentItem||b.element)[0]==this.element[0]){return false}var e=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var f=a.data(this,"droppable");if(f.options.greedy&&a.ui.intersect(b,a.extend(f,{offset:f.element.offset()}),f.options.tolerance)){e=true;return false}});if(e){return false}if(this.options.accept.call(this.element[0],(b.currentItem||b.element))){if(this.options.activeClass){this.element.removeClass(this.options.activeClass)}if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)}this._trigger("drop",c,this.ui(b));return this.element}return false},ui:function(b){return{draggable:(b.currentItem||b.element),helper:b.helper,position:b.position,absolutePosition:b.positionAbs,offset:b.positionAbs}}});a.extend(a.ui.droppable,{version:"1.7.2",eventPrefix:"drop",defaults:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"}});a.ui.intersect=function(q,j,o){if(!j.offset){return false}var e=(q.positionAbs||q.position.absolute).left,d=e+q.helperProportions.width,n=(q.positionAbs||q.position.absolute).top,m=n+q.helperProportions.height;var g=j.offset.left,c=g+j.proportions.width,p=j.offset.top,k=p+j.proportions.height;switch(o){case"fit":return(g<e&&d<c&&p<n&&m<k);break;case"intersect":return(g<e+(q.helperProportions.width/2)&&d-(q.helperProportions.width/2)<c&&p<n+(q.helperProportions.height/2)&&m-(q.helperProportions.height/2)<k);break;case"pointer":var h=((q.positionAbs||q.position.absolute).left+(q.clickOffset||q.offset.click).left),i=((q.positionAbs||q.position.absolute).top+(q.clickOffset||q.offset.click).top),f=a.ui.isOver(i,h,p,g,j.proportions.height,j.proportions.width);return f;break;case"touch":return((n>=p&&n<=k)||(m>=p&&m<=k)||(n<p&&m>k))&&((e>=g&&e<=c)||(d>=g&&d<=c)||(e<g&&d>c));break;default:return false;break}};a.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,g){var b=a.ui.ddmanager.droppables[e.options.scope];var f=g?g.type:null;var h=(e.currentItem||e.element).find(":data(droppable)").andSelf();droppablesLoop:for(var d=0;d<b.length;d++){if(b[d].options.disabled||(e&&!b[d].options.accept.call(b[d].element[0],(e.currentItem||e.element)))){continue}for(var c=0;c<h.length;c++){if(h[c]==b[d].element[0]){b[d].proportions.height=0;continue droppablesLoop}}b[d].visible=b[d].element.css("display")!="none";if(!b[d].visible){continue}b[d].offset=b[d].element.offset();b[d].proportions={width:b[d].element[0].offsetWidth,height:b[d].element[0].offsetHeight};if(f=="mousedown"){b[d]._activate.call(b[d],g)}}},drop:function(b,c){var d=false;a.each(a.ui.ddmanager.droppables[b.options.scope],function(){if(!this.options){return}if(!this.options.disabled&&this.visible&&a.ui.intersect(b,this,this.options.tolerance)){d=this._drop.call(this,c)}if(!this.options.disabled&&this.visible&&this.options.accept.call(this.element[0],(b.currentItem||b.element))){this.isout=1;this.isover=0;this._deactivate.call(this,c)}});return d},drag:function(b,c){if(b.options.refreshPositions){a.ui.ddmanager.prepareOffsets(b,c)}a.each(a.ui.ddmanager.droppables[b.options.scope],function(){if(this.options.disabled||this.greedyChild||!this.visible){return}var e=a.ui.intersect(b,this,this.options.tolerance);var g=!e&&this.isover==1?"isout":(e&&this.isover==0?"isover":null);if(!g){return}var f;if(this.options.greedy){var d=this.element.parents(":data(droppable):eq(0)");if(d.length){f=a.data(d[0],"droppable");f.greedyChild=(g=="isover"?1:0)}}if(f&&g=="isover"){f.isover=0;f.isout=1;f._out.call(f,c)}this[g]=1;this[g=="isout"?"isover":"isout"]=0;this[g=="isover"?"_over":"_out"].call(this,c);if(f&&g=="isout"){f.isout=0;f.isover=1;f._over.call(f,c)}})}}})(jQuery);;
(function(c){c.widget("ui.resizable",c.extend({},c.ui.mouse,{_init:function(){var e=this,j=this.options;this.element.addClass("ui-resizable");c.extend(this,{_aspectRatio:!!(j.aspectRatio),aspectRatio:j.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:j.helper||j.ghost||j.animate?j.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){if(/relative/.test(this.element.css("position"))&&c.browser.opera){this.element.css({position:"relative",top:"auto",left:"auto"})}this.element.wrap(c('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=j.handles||(!c(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw"}var k=this.handles.split(",");this.handles={};for(var f=0;f<k.length;f++){var h=c.trim(k[f]),d="ui-resizable-"+h;var g=c('<div class="ui-resizable-handle '+d+'"></div>');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]=c(this.handles[m],this.element).show()}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var n=c(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("");p.css(l,o);this._proportionallyResize()}if(!c(this.handles[m]).length){continue}}};this._renderAxis(this.element);this._handles=c(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!e.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}e.axis=i&&i[1]?i[1]:"se"}});if(j.autoHide){this._handles.hide();c(this.element).addClass("ui-resizable-autohide").hover(function(){c(this).removeClass("ui-resizable-autohide");e._handles.show()},function(){if(!e.resizing){c(this).addClass("ui-resizable-autohide");e._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var d=function(f){c(f).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){d(this.element);var e=this.element;e.parent().append(this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")})).end().remove()}this.originalElement.css("resize",this.originalResizeStyle);d(this.originalElement)},_mouseCapture:function(e){var f=false;for(var d in this.handles){if(c(this.handles[d])[0]==e.target){f=true}}return this.options.disabled||!!f},_mouseStart:function(f){var i=this.options,e=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:c(document).scrollTop(),left:c(document).scrollLeft()};if(d.is(".ui-draggable")||(/absolute/).test(d.css("position"))){d.css({position:"absolute",top:e.top,left:e.left})}if(c.browser.opera&&(/relative/).test(d.css("position"))){d.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var j=b(this.helper.css("left")),g=b(this.helper.css("top"));if(i.containment){j+=c(i.containment).scrollLeft()||0;g+=c(i.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:j,top:g};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:j,top:g};this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:f.pageX,top:f.pageY};this.aspectRatio=(typeof i.aspectRatio=="number")?i.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var h=c(".ui-resizable-"+this.axis).css("cursor");c("body").css("cursor",h=="auto"?this.axis+"-resize":h);d.addClass("ui-resizable-resizing");this._propagate("start",f);return true},_mouseDrag:function(d){var g=this.helper,f=this.options,l={},p=this,i=this.originalMousePosition,m=this.axis;var q=(d.pageX-i.left)||0,n=(d.pageY-i.top)||0;var h=this._change[m];if(!h){return false}var k=h.apply(this,[d,q,n]),j=c.browser.msie&&c.browser.version<7,e=this.sizeDiff;if(this._aspectRatio||d.shiftKey){k=this._updateRatio(k,d)}k=this._respectSize(k,d);this._propagate("resize",d);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._proportionallyResizeElements.length){this._proportionallyResize()}this._updateCache(k);this._trigger("resize",d,this.ui());return false},_mouseStop:function(g){this.resizing=false;var h=this.options,l=this;if(this._helper){var f=this._proportionallyResizeElements,d=f.length&&(/textarea/i).test(f[0].nodeName),e=d&&c.ui.hasScroll(f[0],"left")?0:l.sizeDiff.height,j=d?0:l.sizeDiff.width;var m={width:(l.size.width-j),height:(l.size.height-e)},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(c.extend(m,{top:k,left:i}))}l.helper.height(l.size.height);l.helper.width(l.size.width);if(this._helper&&!h.animate){this._proportionallyResize()}}c("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",g);if(this._helper){this.helper.remove()}return false},_updateCache:function(d){var e=this.options;this.offset=this.helper.offset();if(a(d.left)){this.position.left=d.left}if(a(d.top)){this.position.top=d.top}if(a(d.height)){this.size.height=d.height}if(a(d.width)){this.size.width=d.width}},_updateRatio:function(g,f){var h=this.options,i=this.position,e=this.size,d=this.axis;if(g.height){g.width=(e.height*this.aspectRatio)}else{if(g.width){g.height=(e.width/this.aspectRatio)}}if(d=="sw"){g.left=i.left+(e.width-g.width);g.top=null}if(d=="nw"){g.top=i.top+(e.height-g.height);g.left=i.left+(e.width-g.width)}return g},_respectSize:function(k,f){var i=this.helper,h=this.options,q=this._aspectRatio||f.shiftKey,p=this.axis,s=a(k.width)&&h.maxWidth&&(h.maxWidth<k.width),l=a(k.height)&&h.maxHeight&&(h.maxHeight<k.height),g=a(k.width)&&h.minWidth&&(h.minWidth>k.width),r=a(k.height)&&h.minHeight&&(h.minHeight>k.height);if(g){k.width=h.minWidth}if(r){k.height=h.minHeight}if(s){k.width=h.maxWidth}if(l){k.height=h.maxHeight}var e=this.originalPosition.left+this.originalSize.width,n=this.position.top+this.size.height;var j=/sw|nw|w/.test(p),d=/nw|ne|n/.test(p);if(g&&j){k.left=e-h.minWidth}if(s&&j){k.left=e-h.maxWidth}if(r&&d){k.top=n-h.minHeight}if(l&&d){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._proportionallyResizeElements.length){return}var f=this.helper||this.element;for(var e=0;e<this._proportionallyResizeElements.length;e++){var g=this._proportionallyResizeElements[e];if(!this.borderDif){var d=[g.css("borderTopWidth"),g.css("borderRightWidth"),g.css("borderBottomWidth"),g.css("borderLeftWidth")],h=[g.css("paddingTop"),g.css("paddingRight"),g.css("paddingBottom"),g.css("paddingLeft")];this.borderDif=c.map(d,function(k,m){var l=parseInt(k,10)||0,n=parseInt(h[m],10)||0;return l+n})}if(c.browser.msie&&!(!(c(f).is(":hidden")||c(f).parents(":hidden").length))){continue}g.css({height:(f.height()-this.borderDif[0]-this.borderDif[2])||0,width:(f.width()-this.borderDif[1]-this.borderDif[3])||0})}},_renderProxy:function(){var e=this.element,h=this.options;this.elementOffset=e.offset();if(this._helper){this.helper=this.helper||c('<div style="overflow:hidden;"></div>');var d=c.browser.msie&&c.browser.version<7,f=(d?1:0),g=(d?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").disableSelection()}else{this.helper=this.element}},_change:{e:function(f,e,d){return{width:this.originalSize.width+e}},w:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{left:h.left+e,width:f.width-e}},n:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{top:h.top+d,height:f.height-d}},s:function(f,e,d){return{height:this.originalSize.height+d}},se:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},sw:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[f,e,d]))},ne:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},nw:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[f,e,d]))}},_propagate:function(e,d){c.ui.plugin.call(this,e,[d,this.ui()]);(e!="resize"&&this._trigger(e,d,this.ui()))},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}));c.extend(c.ui.resizable,{version:"1.7.2",eventPrefix:"resize",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input,option",containment:false,delay:0,distance:1,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000}});c.ui.plugin.add("resizable","alsoResize",{start:function(e,f){var d=c(this).data("resizable"),g=d.options;_store=function(h){c(h).each(function(){c(this).data("resizable-alsoresize",{width:parseInt(c(this).width(),10),height:parseInt(c(this).height(),10),left:parseInt(c(this).css("left"),10),top:parseInt(c(this).css("top"),10)})})};if(typeof(g.alsoResize)=="object"&&!g.alsoResize.parentNode){if(g.alsoResize.length){g.alsoResize=g.alsoResize[0];_store(g.alsoResize)}else{c.each(g.alsoResize,function(h,i){_store(h)})}}else{_store(g.alsoResize)}},resize:function(f,h){var e=c(this).data("resizable"),i=e.options,g=e.originalSize,k=e.originalPosition;var j={height:(e.size.height-g.height)||0,width:(e.size.width-g.width)||0,top:(e.position.top-k.top)||0,left:(e.position.left-k.left)||0},d=function(l,m){c(l).each(function(){var p=c(this),q=c(this).data("resizable-alsoresize"),o={},n=m&&m.length?m:["width","height","top","left"];c.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"))&&c.browser.opera){e._revertToRelativePosition=true;p.css({position:"absolute",top:"auto",left:"auto"})}p.css(o)})};if(typeof(i.alsoResize)=="object"&&!i.alsoResize.nodeType){c.each(i.alsoResize,function(l,m){d(l,m)})}else{d(i.alsoResize)}},stop:function(e,f){var d=c(this).data("resizable");if(d._revertToRelativePosition&&c.browser.opera){d._revertToRelativePosition=false;el.css({position:"relative"})}c(this).removeData("resizable-alsoresize-start")}});c.ui.plugin.add("resizable","animate",{stop:function(h,m){var n=c(this).data("resizable"),i=n.options;var g=n._proportionallyResizeElements,d=g.length&&(/textarea/i).test(g[0].nodeName),e=d&&c.ui.hasScroll(g[0],"left")?0:n.sizeDiff.height,k=d?0:n.sizeDiff.width;var f={width:(n.size.width-k),height:(n.size.height-e)},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(c.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.length){c(g[0]).css({width:o.width,height:o.height})}n._updateCache(o);n._propagate("resize",h)}})}});c.ui.plugin.add("resizable","containment",{start:function(e,q){var s=c(this).data("resizable"),i=s.options,k=s.element;var f=i.containment,j=(f instanceof c)?f.get(0):(/parent/.test(f))?k.parent().get(0):f;if(!j){return}s.containerElement=c(j);if(/document/.test(f)||f==document){s.containerOffset={left:0,top:0};s.containerPosition={left:0,top:0};s.parentData={element:c(document),left:0,top:0,width:c(document).width(),height:c(document).height()||document.body.parentNode.scrollHeight}}else{var m=c(j),h=[];c(["Top","Right","Left","Bottom"]).each(function(p,o){h[p]=b(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,d=s.containerSize.height,l=s.containerSize.width,g=(c.ui.hasScroll(j,"left")?j.scrollWidth:l),r=(c.ui.hasScroll(j)?j.scrollHeight:d);s.parentData={element:j,left:n.left,top:n.top,width:g,height:r}}},resize:function(f,p){var s=c(this).data("resizable"),h=s.options,e=s.containerSize,n=s.containerOffset,l=s.size,m=s.position,q=s._aspectRatio||f.shiftKey,d={top:0,left:0},g=s.containerElement;if(g[0]!=document&&(/static/).test(g.css("position"))){d=n}if(m.left<(s._helper?n.left:0)){s.size.width=s.size.width+(s._helper?(s.position.left-n.left):(s.position.left-d.left));if(q){s.size.height=s.size.width/h.aspectRatio}s.position.left=h.helper?n.left:0}if(m.top<(s._helper?n.top:0)){s.size.height=s.size.height+(s._helper?(s.position.top-n.top):s.position.top);if(q){s.size.width=s.size.height*h.aspectRatio}s.position.top=s._helper?n.top:0}s.offset.left=s.parentData.left+s.position.left;s.offset.top=s.parentData.top+s.position.top;var k=Math.abs((s._helper?s.offset.left-d.left:(s.offset.left-d.left))+s.sizeDiff.width),r=Math.abs((s._helper?s.offset.top-d.top:(s.offset.top-n.top))+s.sizeDiff.height);var j=s.containerElement.get(0)==s.element.parent().get(0),i=/relative|absolute/.test(s.containerElement.css("position"));if(j&&i){k-=s.parentData.left}if(k+s.size.width>=s.parentData.width){s.size.width=s.parentData.width-k;if(q){s.size.height=s.size.width/s.aspectRatio}}if(r+s.size.height>=s.parentData.height){s.size.height=s.parentData.height-r;if(q){s.size.width=s.size.height*s.aspectRatio}}},stop:function(e,m){var p=c(this).data("resizable"),f=p.options,k=p.position,l=p.containerOffset,d=p.containerPosition,g=p.containerElement;var i=c(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"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}if(p._helper&&!f.animate&&(/static/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}}});c.ui.plugin.add("resizable","ghost",{start:function(f,g){var d=c(this).data("resizable"),h=d.options,e=d.size;d.ghost=d.originalElement.clone();d.ghost.css({opacity:0.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof h.ghost=="string"?h.ghost:"");d.ghost.appendTo(d.helper)},resize:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost){d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})}},stop:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost&&d.helper){d.helper.get(0).removeChild(d.ghost.get(0))}}});c.ui.plugin.add("resizable","grid",{resize:function(d,l){var n=c(this).data("resizable"),g=n.options,j=n.size,h=n.originalSize,i=n.originalPosition,m=n.axis,k=g._aspectRatio||d.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),e=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+e}else{if(/^(ne)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e}else{if(/^(sw)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.left=i.left-f}else{n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e;n.position.left=i.left-f}}}}});var b=function(d){return parseInt(d,10)||0};var a=function(d){return !isNaN(parseInt(d,10))}})(jQuery);;
(function(a){a.widget("ui.slider",a.extend({},a.ui.mouse,{_init:function(){var b=this,c=this.options;this._keySliding=false;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget ui-widget-content ui-corner-all");this.range=a([]);if(c.range){if(c.range===true){this.range=a("<div></div>");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("<div></div>")}this.range.appendTo(this.element).addClass("ui-slider-range");if(c.range=="min"||c.range=="max"){this.range.addClass("ui-slider-range-"+c.range)}this.range.addClass("ui-widget-header")}if(a(".ui-slider-handle",this.element).length==0){a('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle")}if(c.values&&c.values.length){while(a(".ui-slider-handle",this.element).length<c.values.length){a('<a href="#"></a>').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(){if(!c.disabled){a(this).addClass("ui-state-hover")}},function(){a(this).removeClass("ui-state-hover")}).focus(function(){if(!c.disabled){a(".ui-slider .ui-state-focus").removeClass("ui-state-focus");a(this).addClass("ui-state-focus")}else{a(this).blur()}}).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=true;var e=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:f=false;if(!b._keySliding){b._keySliding=true;a(this).addClass("ui-state-active");b._start(i,e)}break}var g,d,h=b._step();if(b.options.values&&b.options.values.length){g=d=b.values(e)}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,e,d);return f}).keyup(function(e){var d=a(this).data("index.ui-slider-handle");if(b._keySliding){b._stop(e,d);b._change(e,d);b._keySliding=false;a(this).removeClass("ui-state-active")}});this._refreshValue()},destroy:function(){this.handles.remove();this.range.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 e=this.options;if(e.disabled){return false}this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();var h={x:d.pageX,y:d.pageY};var j=this._normValueFromMouse(h);var c=this._valueMax()-this._valueMin()+1,f;var k=this,i;this.handles.each(function(l){var m=Math.abs(j-k.values(l));if(c>m){c=m;f=a(this);i=l}});if(e.range==true&&this.values(1)==e.min){f=a(this.handles[++i])}this._start(d,i);k._handleIndex=i;f.addClass("ui-state-active").focus();var g=f.offset();var b=!a(d.target).parents().andSelf().is(".ui-slider-handle");this._clickOffset=b?{left:0,top:0}:{left:d.pageX-g.left-(f.width()/2),top:d.pageY-g.top-(f.height()/2)-(parseInt(f.css("borderTopWidth"),10)||0)-(parseInt(f.css("borderBottomWidth"),10)||0)+(parseInt(f.css("marginTop"),10)||0)};j=this._normValueFromMouse(h);this._slide(d,i,j);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._handleIndex);this._change(b,this._handleIndex);this._handleIndex=null;this._clickOffset=null;return false},_detectOrientation:function(){this.orientation=this.options.orientation=="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(d){var c,h;if("horizontal"==this.orientation){c=this.elementSize.width;h=d.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{c=this.elementSize.height;h=d.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}var f=(h/c);if(f>1){f=1}if(f<0){f=0}if("vertical"==this.orientation){f=1-f}var e=this._valueMax()-this._valueMin(),i=f*e,b=i%this.options.step,g=this._valueMin()+i-b;if(b>(this.options.step/2)){g+=this.options.step}return parseFloat(g.toFixed(5))},_start:function(d,c){var b={handle:this.handles[c],value:this.value()};if(this.options.values&&this.options.values.length){b.value=this.values(c);b.values=this.values()}this._trigger("start",d,b)},_slide:function(f,e,d){var g=this.handles[e];if(this.options.values&&this.options.values.length){var b=this.values(e?0:1);if((this.options.values.length==2&&this.options.range===true)&&((e==0&&d>b)||(e==1&&d<b))){d=b}if(d!=this.values(e)){var c=this.values();c[e]=d;var h=this._trigger("slide",f,{handle:this.handles[e],value:d,values:c});var b=this.values(e?0:1);if(h!==false){this.values(e,d,(f.type=="mousedown"&&this.options.animate),true)}}}else{if(d!=this.value()){var h=this._trigger("slide",f,{handle:this.handles[e],value:d});if(h!==false){this._setData("value",d,(f.type=="mousedown"&&this.options.animate))}}}},_stop:function(d,c){var b={handle:this.handles[c],value:this.value()};if(this.options.values&&this.options.values.length){b.value=this.values(c);b.values=this.values()}this._trigger("stop",d,b)},_change:function(d,c){var b={handle:this.handles[c],value:this.value()};if(this.options.values&&this.options.values.length){b.value=this.values(c);b.values=this.values()}this._trigger("change",d,b)},value:function(b){if(arguments.length){this._setData("value",b);this._change(null,0)}return this._value()},values:function(b,e,c,d){if(arguments.length>1){this.options.values[b]=e;this._refreshValue(c);if(!d){this._change(null,b)}}if(arguments.length){if(this.options.values&&this.options.values.length){return this._values(b)}else{return this.value()}}else{return this._values()}},_setData:function(b,d,c){a.widget.prototype._setData.apply(this,arguments);switch(b){case"disabled":if(d){this.handles.filter(".ui-state-focus").blur();this.handles.removeClass("ui-state-hover");this.handles.attr("disabled","disabled")}else{this.handles.removeAttr("disabled")}case"orientation":this._detectOrientation();this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue(c);break;case"value":this._refreshValue(c);break}},_step:function(){var b=this.options.step;return b},_value:function(){var b=this.options.value;if(b<this._valueMin()){b=this._valueMin()}if(b>this._valueMax()){b=this._valueMax()}return b},_values:function(b){if(arguments.length){var c=this.options.values[b];if(c<this._valueMin()){c=this._valueMin()}if(c>this._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(c){var f=this.options.range,d=this.options,l=this;if(this.options.values&&this.options.values.length){var i,h;this.handles.each(function(p,n){var o=(l.values(p)-l._valueMin())/(l._valueMax()-l._valueMin())*100;var m={};m[l.orientation=="horizontal"?"left":"bottom"]=o+"%";a(this).stop(1,1)[c?"animate":"css"](m,d.animate);if(l.options.range===true){if(l.orientation=="horizontal"){(p==0)&&l.range.stop(1,1)[c?"animate":"css"]({left:o+"%"},d.animate);(p==1)&&l.range[c?"animate":"css"]({width:(o-lastValPercent)+"%"},{queue:false,duration:d.animate})}else{(p==0)&&l.range.stop(1,1)[c?"animate":"css"]({bottom:(o)+"%"},d.animate);(p==1)&&l.range[c?"animate":"css"]({height:(o-lastValPercent)+"%"},{queue:false,duration:d.animate})}}lastValPercent=o})}else{var j=this.value(),g=this._valueMin(),k=this._valueMax(),e=k!=g?(j-g)/(k-g)*100:0;var b={};b[l.orientation=="horizontal"?"left":"bottom"]=e+"%";this.handle.stop(1,1)[c?"animate":"css"](b,d.animate);(f=="min")&&(this.orientation=="horizontal")&&this.range.stop(1,1)[c?"animate":"css"]({width:e+"%"},d.animate);(f=="max")&&(this.orientation=="horizontal")&&this.range[c?"animate":"css"]({width:(100-e)+"%"},{queue:false,duration:d.animate});(f=="min")&&(this.orientation=="vertical")&&this.range.stop(1,1)[c?"animate":"css"]({height:e+"%"},d.animate);(f=="max")&&(this.orientation=="vertical")&&this.range[c?"animate":"css"]({height:(100-e)+"%"},{queue:false,duration:d.animate})}}}));a.extend(a.ui.slider,{getter:"value values",version:"1.7.2",eventPrefix:"slide",defaults:{animate:false,delay:0,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null}})})(jQuery);;
(function(a){a.widget("ui.tabs",{_init:function(){if(this.options.deselectable!==undefined){this.options.collapsible=this.options.deselectable}this._tabify(true)},_setData:function(b,c){if(b=="selected"){if(this.options.collapsible&&c==this.options.selected){return}this.select(c)}else{this.options[b]=c;if(b=="deselectable"){this.options.collapsible=c}this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^A-Za-z0-9\-_:\.]/g,"")||this.options.idPrefix+a.data(b)},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+a.data(this.list[0]));return a.cookie.apply(null,[b].concat(a.makeArray(arguments)))},_ui:function(c,b){return{tab:c,panel:b,index:this.anchors.index(c)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=a(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(n){this.list=this.element.children("ul:first");this.lis=a("li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return a("a",this)[0]});this.panels=a([]);var p=this,d=this.options;var c=/^#.+/;this.anchors.each(function(r,o){var q=a(o).attr("href");var s=q.split("#")[0],u;if(s&&(s===location.toString().split("#")[0]||(u=a("base")[0])&&s===u.href)){q=o.hash;o.href=q}if(c.test(q)){p.panels=p.panels.add(p._sanitizeSelector(q))}else{if(q!="#"){a.data(o,"href.tabs",q);a.data(o,"load.tabs",q.replace(/#.*$/,""));var w=p._tabId(o);o.href="#"+w;var v=a("#"+w);if(!v.length){v=a(d.panelTemplate).attr("id",w).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(p.panels[r-1]||p.list);v.data("destroy.tabs",true)}p.panels=p.panels.add(v)}else{d.disabled.push(r)}}});if(n){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(d.selected===undefined){if(location.hash){this.anchors.each(function(q,o){if(o.hash==location.hash){d.selected=q;return false}})}if(typeof d.selected!="number"&&d.cookie){d.selected=parseInt(p._cookie(),10)}if(typeof d.selected!="number"&&this.lis.filter(".ui-tabs-selected").length){d.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}d.selected=d.selected||0}else{if(d.selected===null){d.selected=-1}}d.selected=((d.selected>=0&&this.anchors[d.selected])||d.selected<0)?d.selected:0;d.disabled=a.unique(d.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(q,o){return p.lis.index(q)}))).sort();if(a.inArray(d.selected,d.disabled)!=-1){d.disabled.splice(a.inArray(d.selected,d.disabled),1)}this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");if(d.selected>=0&&this.anchors.length){this.panels.eq(d.selected).removeClass("ui-tabs-hide");this.lis.eq(d.selected).addClass("ui-tabs-selected ui-state-active");p.element.queue("tabs",function(){p._trigger("show",null,p._ui(p.anchors[d.selected],p.panels[d.selected]))});this.load(d.selected)}a(window).bind("unload",function(){p.lis.add(p.anchors).unbind(".tabs");p.lis=p.anchors=p.panels=null})}else{d.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}this.element[d.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");if(d.cookie){this._cookie(d.selected,d.cookie)}for(var g=0,m;(m=this.lis[g]);g++){a(m)[a.inArray(g,d.disabled)!=-1&&!a(m).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled")}if(d.cache===false){this.anchors.removeData("cache.tabs")}this.lis.add(this.anchors).unbind(".tabs");if(d.event!="mouseover"){var f=function(o,i){if(i.is(":not(.ui-state-disabled)")){i.addClass("ui-state-"+o)}};var j=function(o,i){i.removeClass("ui-state-"+o)};this.lis.bind("mouseover.tabs",function(){f("hover",a(this))});this.lis.bind("mouseout.tabs",function(){j("hover",a(this))});this.anchors.bind("focus.tabs",function(){f("focus",a(this).closest("li"))});this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"))})}var b,h;if(d.fx){if(a.isArray(d.fx)){b=d.fx[0];h=d.fx[1]}else{b=h=d.fx}}function e(i,o){i.css({display:""});if(a.browser.msie&&o.opacity){i[0].style.removeAttribute("filter")}}var k=h?function(i,o){a(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");o.hide().removeClass("ui-tabs-hide").animate(h,h.duration||"normal",function(){e(o,h);p._trigger("show",null,p._ui(i,o[0]))})}:function(i,o){a(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");o.removeClass("ui-tabs-hide");p._trigger("show",null,p._ui(i,o[0]))};var l=b?function(o,i){i.animate(b,b.duration||"normal",function(){p.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");i.addClass("ui-tabs-hide");e(i,b);p.element.dequeue("tabs")})}:function(o,i,q){p.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");i.addClass("ui-tabs-hide");p.element.dequeue("tabs")};this.anchors.bind(d.event+".tabs",function(){var o=this,r=a(this).closest("li"),i=p.panels.filter(":not(.ui-tabs-hide)"),q=a(p._sanitizeSelector(this.hash));if((r.hasClass("ui-tabs-selected")&&!d.collapsible)||r.hasClass("ui-state-disabled")||r.hasClass("ui-state-processing")||p._trigger("select",null,p._ui(this,q[0]))===false){this.blur();return false}d.selected=p.anchors.index(this);p.abort();if(d.collapsible){if(r.hasClass("ui-tabs-selected")){d.selected=-1;if(d.cookie){p._cookie(d.selected,d.cookie)}p.element.queue("tabs",function(){l(o,i)}).dequeue("tabs");this.blur();return false}else{if(!i.length){if(d.cookie){p._cookie(d.selected,d.cookie)}p.element.queue("tabs",function(){k(o,q)});p.load(p.anchors.index(this));this.blur();return false}}}if(d.cookie){p._cookie(d.selected,d.cookie)}if(q.length){if(i.length){p.element.queue("tabs",function(){l(o,i)})}p.element.queue("tabs",function(){k(o,q)});p.load(p.anchors.index(this))}else{throw"jQuery UI Tabs: Mismatching fragment identifier."}if(a.browser.msie){this.blur()}});this.anchors.bind("click.tabs",function(){return false})},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var c=a.data(this,"href.tabs");if(c){this.href=c}var d=a(this).unbind(".tabs");a.each(["href","load","cache"],function(e,f){d.removeData(f+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){if(a.data(this,"destroy.tabs")){a(this).remove()}else{a(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}});if(b.cookie){this._cookie(null,b.cookie)}},add:function(e,d,c){if(c===undefined){c=this.anchors.length}var b=this,g=this.options,i=a(g.tabTemplate.replace(/#\{href\}/g,e).replace(/#\{label\}/g,d)),h=!e.indexOf("#")?e.replace("#",""):this._tabId(a("a",i)[0]);i.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var f=a("#"+h);if(!f.length){f=a(g.panelTemplate).attr("id",h).data("destroy.tabs",true)}f.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(c>=this.lis.length){i.appendTo(this.list);f.appendTo(this.list[0].parentNode)}else{i.insertBefore(this.lis[c]);f.insertBefore(this.panels[c])}g.disabled=a.map(g.disabled,function(k,j){return k>=c?++k:k});this._tabify();if(this.anchors.length==1){i.addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){b._trigger("show",null,b._ui(b.anchors[0],b.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[c],this.panels[c]))},remove:function(b){var d=this.options,e=this.lis.eq(b).remove(),c=this.panels.eq(b).remove();if(e.hasClass("ui-tabs-selected")&&this.anchors.length>1){this.select(b+(b+1<this.anchors.length?1:-1))}d.disabled=a.map(a.grep(d.disabled,function(g,f){return g!=b}),function(g,f){return g>=b?--g:g});this._tabify();this._trigger("remove",null,this._ui(e.find("a")[0],c[0]))},enable:function(b){var c=this.options;if(a.inArray(b,c.disabled)==-1){return}this.lis.eq(b).removeClass("ui-state-disabled");c.disabled=a.grep(c.disabled,function(e,d){return e!=b});this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b]))},disable:function(c){var b=this,d=this.options;if(c!=d.selected){this.lis.eq(c).addClass("ui-state-disabled");d.disabled.push(c);d.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[c],this.panels[c]))}},select:function(b){if(typeof b=="string"){b=this.anchors.index(this.anchors.filter("[href$="+b+"]"))}else{if(b===null){b=-1}}if(b==-1&&this.options.collapsible){b=this.options.selected}this.anchors.eq(b).trigger(this.options.event+".tabs")},load:function(e){var c=this,g=this.options,b=this.anchors.eq(e)[0],d=a.data(b,"load.tabs");this.abort();if(!d||this.element.queue("tabs").length!==0&&a.data(b,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(e).addClass("ui-state-processing");if(g.spinner){var f=a("span",b);f.data("label.tabs",f.html()).html(g.spinner)}this.xhr=a.ajax(a.extend({},g.ajaxOptions,{url:d,success:function(i,h){a(c._sanitizeSelector(b.hash)).html(i);c._cleanup();if(g.cache){a.data(b,"cache.tabs",true)}c._trigger("load",null,c._ui(c.anchors[e],c.panels[e]));try{g.ajaxOptions.success(i,h)}catch(j){}c.element.dequeue("tabs")}}))},abort:function(){this.element.queue([]);this.panels.stop(false,true);if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup()},url:function(c,b){this.anchors.eq(c).removeData("cache.tabs").data("load.tabs",b)},length:function(){return this.anchors.length}});a.extend(a.ui.tabs,{version:"1.7.2",getter:"length",defaults:{ajaxOptions:null,cache:false,cookie:null,collapsible:false,disabled:[],event:"click",fx:null,idPrefix:"ui-tabs-",panelTemplate:"<div></div>",spinner:"<em>Loading&#8230;</em>",tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>'}});a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(d,f){var b=this,g=this.options;var c=b._rotate||(b._rotate=function(h){clearTimeout(b.rotation);b.rotation=setTimeout(function(){var i=g.selected;b.select(++i<b.anchors.length?i:0)},d);if(h){h.stopPropagation()}});var e=b._unrotate||(b._unrotate=!f?function(h){if(h.clientX){b.rotate(null)}}:function(h){t=g.selected;c()});if(d){this.element.bind("tabsshow",c);this.anchors.bind(g.event+".tabs",e);c()}else{clearTimeout(b.rotation);this.element.unbind("tabsshow",c);this.anchors.unbind(g.event+".tabs",e);delete this._rotate;delete this._unrotate}}})})(jQuery);;
jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(var f=0;f<h.length;f++){if(h[f]!==null){g.data("ec.storage."+h[f],g[0].style[h[f]])}}},restore:function(g,h){for(var f=0;f<h.length;f++){if(h[f]!==null){g.css(h[f],g.data("ec.storage."+h[f]))}}},setMode:function(f,g){if(g=="toggle"){g=f.is(":hidden")?"show":"hide"}return g},getBaseline:function(g,h){var i,f;switch(g[0]){case"top":i=0;break;case"middle":i=0.5;break;case"bottom":i=1;break;default:i=g[0]/h.height}switch(g[1]){case"left":f=0;break;case"center":f=0.5;break;case"right":f=1;break;default:f=g[1]/h.width}return{x:f,y:i}},createWrapper:function(f){if(f.parent().is(".ui-effects-wrapper")){return f.parent()}var g={width:f.outerWidth(true),height:f.outerHeight(true),"float":f.css("float")};f.wrap('<div class="ui-effects-wrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');var j=f.parent();if(f.css("position")=="static"){j.css({position:"relative"});f.css({position:"relative"})}else{var i=f.css("top");if(isNaN(parseInt(i,10))){i="auto"}var h=f.css("left");if(isNaN(parseInt(h,10))){h="auto"}j.css({position:f.css("position"),top:i,left:h,zIndex:f.css("z-index")}).show();f.css({position:"relative",top:0,left:0})}j.css(g);return j},removeWrapper:function(f){if(f.parent().is(".ui-effects-wrapper")){return f.parent().replaceWith(f)}return f},setTransition:function(g,i,f,h){h=h||{};d.each(i,function(k,j){unit=g.cssUnit(j);if(unit[0]>0){h[j]=unit[0]*f+unit[1]}});return h},animateClass:function(h,i,k,j){var f=(typeof k=="function"?k:(j?j:null));var g=(typeof k=="string"?k:null);return this.each(function(){var q={};var o=d(this);var p=o.attr("style")||"";if(typeof p=="object"){p=p.cssText}if(h.toggle){o.hasClass(h.toggle)?h.remove=h.toggle:h.add=h.toggle}var l=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(h.add){o.addClass(h.add)}if(h.remove){o.removeClass(h.remove)}var m=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(h.add){o.removeClass(h.add)}if(h.remove){o.addClass(h.remove)}for(var r in m){if(typeof m[r]!="function"&&m[r]&&r.indexOf("Moz")==-1&&r.indexOf("length")==-1&&m[r]!=l[r]&&(r.match(/color/i)||(!r.match(/color/i)&&!isNaN(parseInt(m[r],10))))&&(l.position!="static"||(l.position=="static"&&!r.match(/left|top|bottom|right/)))){q[r]=m[r]}}o.animate(q,i,g,function(){if(typeof d(this).attr("style")=="object"){d(this).attr("style")["cssText"]="";d(this).attr("style")["cssText"]=p}else{d(this).attr("style",p)}if(h.add){d(this).addClass(h.add)}if(h.remove){d(this).removeClass(h.remove)}if(f){f.apply(this,arguments)}})})}};function c(g,f){var i=g[1]&&g[1].constructor==Object?g[1]:{};if(f){i.mode=f}var h=g[1]&&g[1].constructor!=Object?g[1]:(i.duration?i.duration:g[2]);h=d.fx.off?0:typeof h==="number"?h:d.fx.speeds[h]||d.fx.speeds._default;var j=i.callback||(d.isFunction(g[1])&&g[1])||(d.isFunction(g[2])&&g[2])||(d.isFunction(g[3])&&g[3]);return[g[0],i,h,j]}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(g,f,h,i){return d.effects[g]?d.effects[g].call(this,{method:g,options:f||{},duration:h,callback:i}):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]))||(d.isFunction(arguments[0])||typeof arguments[0]=="boolean")){return this.__toggle.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"toggle"))}},addClass:function(g,f,i,h){return f?d.effects.animateClass.apply(this,[{add:g},f,i,h]):this._addClass(g)},removeClass:function(g,f,i,h){return f?d.effects.animateClass.apply(this,[{remove:g},f,i,h]):this._removeClass(g)},toggleClass:function(g,f,i,h){return((typeof f!=="boolean")&&f)?d.effects.animateClass.apply(this,[{toggle:g},f,i,h]):this._toggleClass(g,f)},morph:function(f,h,g,j,i){return d.effects.animateClass.apply(this,[{add:h,remove:f},g,j,i])},switchClass:function(){return this.morph.apply(this,arguments)},cssUnit:function(f){var g=this.css(f),h=[];d.each(["em","px","%","pt"],function(j,k){if(g.indexOf(k)>0){h=[parseFloat(g),k]}});return h}});d.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(g,f){d.fx.step[f]=function(h){if(h.state==0){h.start=e(h.elem,f);h.end=b(h.end)}h.elem.style[f]="rgb("+[Math.max(Math.min(parseInt((h.pos*(h.end[0]-h.start[0]))+h.start[0],10),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[1]-h.start[1]))+h.start[1],10),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[2]-h.start[2]))+h.start[2],10),255),0)].join(",")+")"}});function b(g){var f;if(g&&g.constructor==Array&&g.length==3){return g}if(f=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(g)){return[parseInt(f[1],10),parseInt(f[2],10),parseInt(f[3],10)]}if(f=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(g)){return[parseFloat(f[1])*2.55,parseFloat(f[2])*2.55,parseFloat(f[3])*2.55]}if(f=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(g)){return[parseInt(f[1],16),parseInt(f[2],16),parseInt(f[3],16)]}if(f=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(g)){return[parseInt(f[1]+f[1],16),parseInt(f[2]+f[2],16),parseInt(f[3]+f[3],16)]}if(f=/rgba\(0, 0, 0, 0\)/.exec(g)){return a.transparent}return a[d.trim(g).toLowerCase()]}function e(h,f){var g;do{g=d.curCSS(h,f);if(g!=""&&g!="transparent"||d.nodeName(h,"body")){break}f="backgroundColor"}while(h=h.parentNode);return b(g)}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(g,h,f,j,i){return d.easing[d.easing.def](g,h,f,j,i)},easeInQuad:function(g,h,f,j,i){return j*(h/=i)*h+f},easeOutQuad:function(g,h,f,j,i){return -j*(h/=i)*(h-2)+f},easeInOutQuad:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h+f}return -j/2*((--h)*(h-2)-1)+f},easeInCubic:function(g,h,f,j,i){return j*(h/=i)*h*h+f},easeOutCubic:function(g,h,f,j,i){return j*((h=h/i-1)*h*h+1)+f},easeInOutCubic:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h+f}return j/2*((h-=2)*h*h+2)+f},easeInQuart:function(g,h,f,j,i){return j*(h/=i)*h*h*h+f},easeOutQuart:function(g,h,f,j,i){return -j*((h=h/i-1)*h*h*h-1)+f},easeInOutQuart:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h*h+f}return -j/2*((h-=2)*h*h*h-2)+f},easeInQuint:function(g,h,f,j,i){return j*(h/=i)*h*h*h*h+f},easeOutQuint:function(g,h,f,j,i){return j*((h=h/i-1)*h*h*h*h+1)+f},easeInOutQuint:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h*h*h+f}return j/2*((h-=2)*h*h*h*h+2)+f},easeInSine:function(g,h,f,j,i){return -j*Math.cos(h/i*(Math.PI/2))+j+f},easeOutSine:function(g,h,f,j,i){return j*Math.sin(h/i*(Math.PI/2))+f},easeInOutSine:function(g,h,f,j,i){return -j/2*(Math.cos(Math.PI*h/i)-1)+f},easeInExpo:function(g,h,f,j,i){return(h==0)?f:j*Math.pow(2,10*(h/i-1))+f},easeOutExpo:function(g,h,f,j,i){return(h==i)?f+j:j*(-Math.pow(2,-10*h/i)+1)+f},easeInOutExpo:function(g,h,f,j,i){if(h==0){return f}if(h==i){return f+j}if((h/=i/2)<1){return j/2*Math.pow(2,10*(h-1))+f}return j/2*(-Math.pow(2,-10*--h)+2)+f},easeInCirc:function(g,h,f,j,i){return -j*(Math.sqrt(1-(h/=i)*h)-1)+f},easeOutCirc:function(g,h,f,j,i){return j*Math.sqrt(1-(h=h/i-1)*h)+f},easeInOutCirc:function(g,h,f,j,i){if((h/=i/2)<1){return -j/2*(Math.sqrt(1-h*h)-1)+f}return j/2*(Math.sqrt(1-(h-=2)*h)+1)+f},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<Math.abs(m)){h=m;var j=k/4}else{var j=k/(2*Math.PI)*Math.asin(m/h)}return -(h*Math.pow(2,10*(i-=1))*Math.sin((i*l-j)*(2*Math.PI)/k))+f},easeOutElastic: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<Math.abs(m)){h=m;var j=k/4}else{var j=k/(2*Math.PI)*Math.asin(m/h)}return h*Math.pow(2,-10*i)*Math.sin((i*l-j)*(2*Math.PI)/k)+m+f},easeInOutElastic:function(g,i,f,m,l){var j=1.70158;var k=0;var h=m;if(i==0){return f}if((i/=l/2)==2){return f+m}if(!k){k=l*(0.3*1.5)}if(h<Math.abs(m)){h=m;var j=k/4}else{var j=k/(2*Math.PI)*Math.asin(m/h)}if(i<1){return -0.5*(h*Math.pow(2,10*(i-=1))*Math.sin((i*l-j)*(2*Math.PI)/k))+f}return h*Math.pow(2,-10*(i-=1))*Math.sin((i*l-j)*(2*Math.PI)/k)*0.5+m+f},easeInBack:function(g,h,f,k,j,i){if(i==undefined){i=1.70158}return k*(h/=j)*h*((i+1)*h-i)+f},easeOutBack:function(g,h,f,k,j,i){if(i==undefined){i=1.70158}return k*((h=h/j-1)*h*((i+1)*h+i)+1)+f},easeInOutBack:function(g,h,f,k,j,i){if(i==undefined){i=1.70158}if((h/=j/2)<1){return k/2*(h*h*(((i*=(1.525))+1)*h-i))+f}return k/2*((h-=2)*h*(((i*=(1.525))+1)*h+i)+2)+f},easeInBounce:function(g,h,f,j,i){return j-d.easing.easeOutBounce(g,i-h,0,j,i)+f},easeOutBounce:function(g,h,f,j,i){if((h/=i)<(1/2.75)){return j*(7.5625*h*h)+f}else{if(h<(2/2.75)){return j*(7.5625*(h-=(1.5/2.75))*h+0.75)+f}else{if(h<(2.5/2.75)){return j*(7.5625*(h-=(2.25/2.75))*h+0.9375)+f}else{return j*(7.5625*(h-=(2.625/2.75))*h+0.984375)+f}}}},easeInOutBounce:function(g,h,f,j,i){if(h<i/2){return d.easing.easeInBounce(g,h*2,0,j,i)*0.5+f}return d.easing.easeOutBounce(g,h*2-i,0,j,i)*0.5+j*0.5+f}})})(jQuery);;
(function(a){a.effects.highlight=function(b){return this.queue(function(){var e=a(this),d=["backgroundImage","backgroundColor","opacity"];var h=a.effects.setMode(e,b.options.mode||"show");var c=b.options.color||"#ffff99";var g=e.css("backgroundColor");a.effects.save(e,d);e.show();e.css({backgroundImage:"none",backgroundColor:c});var f={backgroundColor:g};if(h=="hide"){f.opacity=0}e.animate(f,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(h=="hide"){e.hide()}a.effects.restore(e,d);if(h=="show"&&a.browser.msie){this.style.removeAttribute("filter")}if(b.callback){b.callback.apply(this,arguments)}e.dequeue()}})})}})(jQuery);;
function ucfirst(str){str+='';var f=str.charAt(0).toUpperCase();return f+str.substr(1);}
(function($){var ver="2.72";if($.support==undefined){$.support={opacity:!($.browser.msie)};}function debug(s){if($.fn.cycle.debug){log(s);}}function log(){if(window.console&&window.console.log){window.console.log("[cycle] "+Array.prototype.join.call(arguments," "));}}$.fn.cycle=function(options,arg2){var o={s:this.selector,c:this.context};if(this.length===0&&options!="stop"){if(!$.isReady&&o.s){log("DOM not ready, queuing slideshow");$(function(){$(o.s,o.c).cycle(options,arg2);});return this;}log("terminating; zero elements found by selector"+($.isReady?"":" (DOM not ready)"));return this;}return this.each(function(){var opts=handleArguments(this,options,arg2);if(opts===false){return;}if(this.cycleTimeout){clearTimeout(this.cycleTimeout);}this.cycleTimeout=this.cyclePause=0;var $cont=$(this);var $slides=opts.slideExpr?$(opts.slideExpr,this):$cont.children();var els=$slides.get();if(els.length<2){log("terminating; too few slides: "+els.length);return;}var opts2=buildOptions($cont,$slides,els,opts,o);if(opts2===false){return;}var startTime=opts2.continuous?10:getTimeout(opts2.currSlide,opts2.nextSlide,opts2,!opts2.rev);if(startTime){startTime+=(opts2.delay||0);if(startTime<10){startTime=10;}debug("first timeout: "+startTime);this.cycleTimeout=setTimeout(function(){go(els,opts2,0,!opts2.rev);},startTime);}});};function handleArguments(cont,options,arg2){if(cont.cycleStop==undefined){cont.cycleStop=0;}if(options===undefined||options===null){options={};}if(options.constructor==String){switch(options){case"stop":cont.cycleStop++;if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);}cont.cycleTimeout=0;$(cont).removeData("cycle.opts");return false;case"pause":cont.cyclePause=1;return false;case"resume":cont.cyclePause=0;if(arg2===true){options=$(cont).data("cycle.opts");if(!options){log("options not found, can not resume");return false;}if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);cont.cycleTimeout=0;}go(options.elements,options,1,1);}return false;case"prev":case"next":var opts=$(cont).data("cycle.opts");if(!opts){log('options not found, "prev/next" ignored');return false;}$.fn.cycle[options](opts);return false;default:options={fx:options};}return options;}else{if(options.constructor==Number){var num=options;options=$(cont).data("cycle.opts");if(!options){log("options not found, can not advance slide");return false;}if(num<0||num>=options.elements.length){log("invalid slide index: "+num);return false;}options.nextSlide=num;if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);cont.cycleTimeout=0;}if(typeof arg2=="string"){options.oneTimeFx=arg2;}go(options.elements,options,1,num>=options.currSlide);return false;}}return options;}function removeFilter(el,opts){if(!$.support.opacity&&opts.cleartype&&el.style.filter){try{el.style.removeAttribute("filter");}catch(smother){}}}function buildOptions($cont,$slides,els,options,o){var opts=$.extend({},$.fn.cycle.defaults,options||{},$.metadata?$cont.metadata():$.meta?$cont.data():{});if(opts.autostop){opts.countdown=opts.autostopCount||els.length;}var cont=$cont[0];$cont.data("cycle.opts",opts);opts.$cont=$cont;opts.stopCount=cont.cycleStop;opts.elements=els;opts.before=opts.before?[opts.before]:[];opts.after=opts.after?[opts.after]:[];opts.after.unshift(function(){opts.busy=0;});if(!$.support.opacity&&opts.cleartype){opts.after.push(function(){removeFilter(this,opts);});}if(opts.continuous){opts.after.push(function(){go(els,opts,0,!opts.rev);});}saveOriginalOpts(opts);if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg){clearTypeFix($slides);}if($cont.css("position")=="static"){$cont.css("position","relative");}if(opts.width){$cont.width(opts.width);}if(opts.height&&opts.height!="auto"){$cont.height(opts.height);}if(opts.startingSlide){opts.startingSlide=parseInt(opts.startingSlide);}if(opts.random){opts.randomMap=[];for(var i=0;i<els.length;i++){opts.randomMap.push(i);}opts.randomMap.sort(function(a,b){return Math.random()-0.5;});opts.randomIndex=0;opts.startingSlide=opts.randomMap[0];}else{if(opts.startingSlide>=els.length){opts.startingSlide=0;}}opts.currSlide=opts.startingSlide=opts.startingSlide||0;var first=opts.startingSlide;$slides.css({position:"absolute",top:6,left:6}).hide().each(function(i){var z=first?i>=first?els.length-(i-first):first-i:els.length-i;$(this).css("z-index",z);});$(els[first]).css("opacity",1).show();removeFilter(els[first],opts);if(opts.fit&&opts.width){$slides.width(opts.width);}if(opts.fit&&opts.height&&opts.height!="auto"){$slides.height(opts.height);}var reshape=opts.containerResize&&!$cont.innerHeight();if(reshape){var maxw=0,maxh=0;for(var j=0;j<els.length;j++){var $e=$(els[j]),e=$e[0],w=$e.outerWidth(),h=$e.outerHeight();if(!w){w=e.offsetWidth;}if(!h){h=e.offsetHeight;}maxw=w>maxw?w:maxw;maxh=h>maxh?h:maxh;}if(maxw>0&&maxh>0){$cont.css({width:maxw+"px",height:maxh+"px"});}}if(opts.pause){$cont.hover(function(){this.cyclePause++;},function(){this.cyclePause--;});}if(supportMultiTransitions(opts)===false){return false;}var requeue=false;options.requeueAttempts=options.requeueAttempts||0;$slides.each(function(){var $el=$(this);this.cycleH=(opts.fit&&opts.height)?opts.height:$el.height();this.cycleW=(opts.fit&&opts.width)?opts.width:$el.width();if($el.is("img")){var loadingIE=($.browser.msie&&this.cycleW==28&&this.cycleH==30&&!this.complete);var loadingFF=($.browser.mozilla&&this.cycleW==34&&this.cycleH==19&&!this.complete);var loadingOp=($.browser.opera&&((this.cycleW==42&&this.cycleH==19)||(this.cycleW==37&&this.cycleH==17))&&!this.complete);var loadingOther=(this.cycleH==0&&this.cycleW==0&&!this.complete);if(loadingIE||loadingFF||loadingOp||loadingOther){if(o.s&&opts.requeueOnImageNotLoaded&&++options.requeueAttempts<100){log(options.requeueAttempts," - img slide not loaded, requeuing slideshow: ",this.src,this.cycleW,this.cycleH);setTimeout(function(){$(o.s,o.c).cycle(options);},opts.requeueTimeout);requeue=true;return false;}else{log("could not determine size of image: "+this.src,this.cycleW,this.cycleH);}}}return true;});if(requeue){return false;}opts.cssBefore=opts.cssBefore||{};opts.animIn=opts.animIn||{};opts.animOut=opts.animOut||{};$slides.not(":eq("+first+")").css(opts.cssBefore);if(opts.cssFirst){$($slides[first]).css(opts.cssFirst);}if(opts.timeout){opts.timeout=parseInt(opts.timeout);if(opts.speed.constructor==String){opts.speed=$.fx.speeds[opts.speed]||parseInt(opts.speed);}if(!opts.sync){opts.speed=opts.speed/2;}while((opts.timeout-opts.speed)<250){opts.timeout+=opts.speed;}}if(opts.easing){opts.easeIn=opts.easeOut=opts.easing;}if(!opts.speedIn){opts.speedIn=opts.speed;}if(!opts.speedOut){opts.speedOut=opts.speed;}opts.slideCount=els.length;opts.currSlide=opts.lastSlide=first;if(opts.random){opts.nextSlide=opts.currSlide;if(++opts.randomIndex==els.length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{opts.nextSlide=opts.startingSlide>=(els.length-1)?0:opts.startingSlide+1;}if(!opts.multiFx){var init=$.fn.cycle.transitions[opts.fx];if($.isFunction(init)){init($cont,$slides,opts);}else{if(opts.fx!="custom"&&!opts.multiFx){log("unknown transition: "+opts.fx,"; slideshow terminating");return false;}}}var e0=$slides[first];if(opts.before.length){opts.before[0].apply(e0,[e0,e0,opts,true]);}if(opts.after.length>1){opts.after[1].apply(e0,[e0,e0,opts,true]);}if(opts.next){$(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,opts.rev?-1:1);});}if(opts.prev){$(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,opts.rev?1:-1);});}if(opts.pager){buildPager(els,opts);}exposeAddSlide(opts,els);return opts;}function saveOriginalOpts(opts){opts.original={before:[],after:[]};opts.original.cssBefore=$.extend({},opts.cssBefore);opts.original.cssAfter=$.extend({},opts.cssAfter);opts.original.animIn=$.extend({},opts.animIn);opts.original.animOut=$.extend({},opts.animOut);$.each(opts.before,function(){opts.original.before.push(this);});$.each(opts.after,function(){opts.original.after.push(this);});}function supportMultiTransitions(opts){var i,tx,txs=$.fn.cycle.transitions;if(opts.fx.indexOf(",")>0){opts.multiFx=true;opts.fxs=opts.fx.replace(/\s*/g,"").split(",");for(i=0;i<opts.fxs.length;i++){var fx=opts.fxs[i];tx=txs[fx];if(!tx||!txs.hasOwnProperty(fx)||!$.isFunction(tx)){log("discarding unknown transition: ",fx);opts.fxs.splice(i,1);i--;}}if(!opts.fxs.length){log("No valid transitions named; slideshow terminating.");return false;}}else{if(opts.fx=="all"){opts.multiFx=true;opts.fxs=[];for(p in txs){tx=txs[p];if(txs.hasOwnProperty(p)&&$.isFunction(tx)){opts.fxs.push(p);}}}}if(opts.multiFx&&opts.randomizeEffects){var r1=Math.floor(Math.random()*20)+30;for(i=0;i<r1;i++){var r2=Math.floor(Math.random()*opts.fxs.length);opts.fxs.push(opts.fxs.splice(r2,1)[0]);}debug("randomized fx sequence: ",opts.fxs);}return true;}function exposeAddSlide(opts,els){opts.addSlide=function(newSlide,prepend){var $s=$(newSlide),s=$s[0];if(!opts.autostopCount){opts.countdown++;}els[prepend?"unshift":"push"](s);if(opts.els){opts.els[prepend?"unshift":"push"](s);}opts.slideCount=els.length;$s.css("position","absolute");$s[prepend?"prependTo":"appendTo"](opts.$cont);if(prepend){opts.currSlide++;opts.nextSlide++;}if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg){clearTypeFix($s);}if(opts.fit&&opts.width){$s.width(opts.width);}if(opts.fit&&opts.height&&opts.height!="auto"){$slides.height(opts.height);}s.cycleH=(opts.fit&&opts.height)?opts.height:$s.height();s.cycleW=(opts.fit&&opts.width)?opts.width:$s.width();$s.css(opts.cssBefore);if(opts.pager){$.fn.cycle.createPagerAnchor(els.length-1,s,$(opts.pager),els,opts);}if($.isFunction(opts.onAddSlide)){opts.onAddSlide($s);}else{$s.hide();}};}$.fn.cycle.resetState=function(opts,fx){fx=fx||opts.fx;opts.before=[];opts.after=[];opts.cssBefore=$.extend({},opts.original.cssBefore);opts.cssAfter=$.extend({},opts.original.cssAfter);opts.animIn=$.extend({},opts.original.animIn);opts.animOut=$.extend({},opts.original.animOut);opts.fxFn=null;$.each(opts.original.before,function(){opts.before.push(this);});$.each(opts.original.after,function(){opts.after.push(this);});var init=$.fn.cycle.transitions[fx];if($.isFunction(init)){init(opts.$cont,$(opts.elements),opts);}};function go(els,opts,manual,fwd){if(manual&&opts.busy&&opts.manualTrump){$(els).stop(true,true);opts.busy=false;}if(opts.busy){return;}var p=opts.$cont[0],curr=els[opts.currSlide],next=els[opts.nextSlide];if(p.cycleStop!=opts.stopCount||p.cycleTimeout===0&&!manual){return;}if(!manual&&!p.cyclePause&&((opts.autostop&&(--opts.countdown<=0))||(opts.nowrap&&!opts.random&&opts.nextSlide<opts.currSlide))){if(opts.end){opts.end(opts);}return;}if(manual||!p.cyclePause){var fx=opts.fx;curr.cycleH=curr.cycleH||$(curr).height();curr.cycleW=curr.cycleW||$(curr).width();next.cycleH=next.cycleH||$(next).height();next.cycleW=next.cycleW||$(next).width();if(opts.multiFx){if(opts.lastFx==undefined||++opts.lastFx>=opts.fxs.length){opts.lastFx=0;}fx=opts.fxs[opts.lastFx];opts.currFx=fx;}if(opts.oneTimeFx){fx=opts.oneTimeFx;opts.oneTimeFx=null;}$.fn.cycle.resetState(opts,fx);if(opts.before.length){$.each(opts.before,function(i,o){if(p.cycleStop!=opts.stopCount){return;}o.apply(next,[curr,next,opts,fwd]);});}var after=function(){$.each(opts.after,function(i,o){if(p.cycleStop!=opts.stopCount){return;}o.apply(next,[curr,next,opts,fwd]);});};if(opts.nextSlide!=opts.currSlide){opts.busy=1;if(opts.fxFn){opts.fxFn(curr,next,opts,after,fwd);}else{if($.isFunction($.fn.cycle[opts.fx])){$.fn.cycle[opts.fx](curr,next,opts,after);}else{$.fn.cycle.custom(curr,next,opts,after,manual&&opts.fastOnEvent);}}}opts.lastSlide=opts.currSlide;if(opts.random){opts.currSlide=opts.nextSlide;if(++opts.randomIndex==els.length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{var roll=(opts.nextSlide+1)==els.length;opts.nextSlide=roll?0:opts.nextSlide+1;opts.currSlide=roll?els.length-1:opts.nextSlide-1;}if(opts.pager){$.fn.cycle.updateActivePagerLink(opts.pager,opts.currSlide);}}var ms=0;if(opts.timeout&&!opts.continuous){ms=getTimeout(curr,next,opts,fwd);}else{if(opts.continuous&&p.cyclePause){ms=10;}}if(ms>0){p.cycleTimeout=setTimeout(function(){go(els,opts,0,!opts.rev);},ms);}}$.fn.cycle.updateActivePagerLink=function(pager,currSlide){$(pager).find("a").removeClass("activeSlide").filter("a:eq("+currSlide+")").addClass("activeSlide");};function getTimeout(curr,next,opts,fwd){if(opts.timeoutFn){var t=opts.timeoutFn(curr,next,opts,fwd);while((t-opts.speed)<250){t+=opts.speed;}debug("calculated timeout: "+t+"; speed: "+opts.speed);if(t!==false){return t;}}return opts.timeout;}$.fn.cycle.next=function(opts){advance(opts,opts.rev?-1:1);};$.fn.cycle.prev=function(opts){advance(opts,opts.rev?1:-1);};function advance(opts,val){var els=opts.elements;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}if(opts.random&&val<0){opts.randomIndex--;if(--opts.randomIndex==-2){opts.randomIndex=els.length-2;}else{if(opts.randomIndex==-1){opts.randomIndex=els.length-1;}}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{if(opts.random){if(++opts.randomIndex==els.length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{opts.nextSlide=opts.currSlide+val;if(opts.nextSlide<0){if(opts.nowrap){return false;}opts.nextSlide=els.length-1;}else{if(opts.nextSlide>=els.length){if(opts.nowrap){return false;}opts.nextSlide=0;}}}}if($.isFunction(opts.prevNextClick)){opts.prevNextClick(val>0,opts.nextSlide,els[opts.nextSlide]);}go(els,opts,1,val>=0);return false;}function buildPager(els,opts){var $p=$(opts.pager);$.each(els,function(i,o){$.fn.cycle.createPagerAnchor(i,o,$p,els,opts);});$.fn.cycle.updateActivePagerLink(opts.pager,opts.startingSlide);}$.fn.cycle.createPagerAnchor=function(i,el,$p,els,opts){var a;if($.isFunction(opts.pagerAnchorBuilder)){a=opts.pagerAnchorBuilder(i,el);}else{a='<a href="#">'+(i+1)+"</a>";}if(!a){return;}var $a=$(a);if($a.parents("body").length===0){var arr=[];if($p.length>1){$p.each(function(){var $clone=$a.clone(true);$(this).append($clone);arr.push($clone);});$a=$(arr);}else{$a.appendTo($p);}}$a.bind(opts.pagerEvent,function(e){e.preventDefault();opts.nextSlide=i;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}if($.isFunction(opts.pagerClick)){opts.pagerClick(opts.nextSlide,els[opts.nextSlide]);}go(els,opts,1,opts.currSlide<i);return false;});if(opts.pagerEvent!="click"){$a.click(function(){return false;});}if(opts.pauseOnPagerHover){$a.hover(function(){opts.$cont[0].cyclePause++;},function(){opts.$cont[0].cyclePause--;});}};$.fn.cycle.hopsFromLast=function(opts,fwd){var hops,l=opts.lastSlide,c=opts.currSlide;if(fwd){hops=c>l?c-l:opts.slideCount-l;}else{hops=c<l?l-c:l+opts.slideCount-c;}return hops;};function clearTypeFix($slides){function hex(s){s=parseInt(s).toString(16);return s.length<2?"0"+s:s;}function getBg(e){for(;e&&e.nodeName.toLowerCase()!="html";e=e.parentNode){var v=$.css(e,"background-color");if(v.indexOf("rgb")>=0){var rgb=v.match(/\d+/g);return"#"+hex(rgb[0])+hex(rgb[1])+hex(rgb[2]);}if(v&&v!="transparent"){return v;}}return"#ffffff";}$slides.each(function(){$(this).css("background-color",getBg(this));});}$.fn.cycle.commonReset=function(curr,next,opts,w,h,rev){$(opts.elements).not(curr).hide();opts.cssBefore.opacity=1;opts.cssBefore.display="block";if(w!==false&&next.cycleW>0){opts.cssBefore.width=next.cycleW;}if(h!==false&&next.cycleH>0){opts.cssBefore.height=next.cycleH;}opts.cssAfter=opts.cssAfter||{};opts.cssAfter.display="none";$(curr).css("zIndex",opts.slideCount+(rev===true?1:0));$(next).css("zIndex",opts.slideCount+(rev===true?0:1));};$.fn.cycle.custom=function(curr,next,opts,cb,speedOverride){var $l=$(curr),$n=$(next);var speedIn=opts.speedIn,speedOut=opts.speedOut,easeIn=opts.easeIn,easeOut=opts.easeOut;$n.css(opts.cssBefore);if(speedOverride){if(typeof speedOverride=="number"){speedIn=speedOut=speedOverride;}else{speedIn=speedOut=1;}easeIn=easeOut=null;}var fn=function(){$n.animate(opts.animIn,speedIn,easeIn,cb);};$l.animate(opts.animOut,speedOut,easeOut,function(){if(opts.cssAfter){$l.css(opts.cssAfter);}if(!opts.sync){fn();}});if(opts.sync){fn();}};$.fn.cycle.transitions={fade:function($cont,$slides,opts){$slides.not(":eq("+opts.currSlide+")").css("opacity",0);opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.opacity=0;});opts.animIn={opacity:1};opts.animOut={opacity:0};opts.cssBefore={top:6,left:6};}};$.fn.cycle.ver=function(){return ver;};$.fn.cycle.defaults={fx:"fade",timeout:4000,timeoutFn:null,continuous:0,speed:1000,speedIn:null,speedOut:null,next:null,prev:null,prevNextClick:null,prevNextEvent:"click",pager:null,pagerClick:null,pagerEvent:"click",pagerAnchorBuilder:null,before:null,after:null,end:null,easing:null,easeIn:null,easeOut:null,shuffle:null,animIn:null,animOut:null,cssBefore:null,cssAfter:null,fxFn:null,height:"auto",startingSlide:0,sync:1,random:0,fit:0,containerResize:1,pause:0,pauseOnPagerHover:0,autostop:0,autostopCount:0,delay:0,slideExpr:null,cleartype:!$.support.opacity,cleartypeNoBg:false,nowrap:0,fastOnEvent:0,randomizeEffects:1,rev:0,manualTrump:true,requeueOnImageNotLoaded:true,requeueTimeout:250};})(jQuery);
(function(){var special=jQuery.event.special,uid1='D'+(+new Date()),uid2='D'+(+new Date()+1);jQuery.event.special.focus={setup:function(){var _self=this,handler=function(e){e=jQuery.event.fix(e);e.type='focus';if(_self===document){jQuery.event.handle.call(_self,e);}};jQuery(this).data(uid1,handler);if(_self===document){if(_self.addEventListener){_self.addEventListener('focus',handler,true);}else{_self.attachEvent('onfocusin',handler);}}else{return false;}},teardown:function(){var handler=jQuery(this).data(uid1);if(this===document){if(this.removeEventListener){this.removeEventListener('focus',handler,true);}else{this.detachEvent('onfocusin',handler);}}}};jQuery.event.special.blur={setup:function(){var _self=this,handler=function(e){e=jQuery.event.fix(e);e.type='blur';if(_self===document){jQuery.event.handle.call(_self,e);}};jQuery(this).data(uid2,handler);if(_self===document){if(_self.addEventListener){_self.addEventListener('blur',handler,true);}else{_self.attachEvent('onfocusout',handler);}}else{return false;}},teardown:function(){var handler=jQuery(this).data(uid2);if(this===document){if(this.removeEventListener){this.removeEventListener('blur',handler,true);}else{this.detachEvent('onfocusout',handler);}}}};})();
(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&/6.0/.test(navigator.userAgent)){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild);});}return this;};})(jQuery);
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();

// FUNCTIONS
var player =  null;
var playlist =  null;

function gid(name)
{
	return document.getElementById(name);
}

function displayPlaylist()
{
	playlist = player.getPlaylist();
	if(playlist.length > 0)
	{
		for(i=0; i < playlist.length; i++)
		{
			$('.playlist-items').append('<div class="playlist-item-box" onclick="loadFile('+i+')"><p class="bold" style="margin-bottom: 5px;">' + playlist[i].title.substr(0,60) + '</p><p class="right">' + playlist[i].description + '</p><p class="hidden filename-playlist">' + playlist[i].file + '</p><div class="clear"></div></div>');
		}
    }
	else
    {
		setTimeout("displayPlaylist()", 50);
    }
}

function playerReady(obj)
{
	player = gid(obj.id);
	displayPlaylist();
}

function loadFile(index)
{
	 player.sendEvent("LOAD", playlist[index]);
	 player.sendEvent("PLAY", "true");
}

$(document).ready(function(){

	if($.browser.msie && $.browser.version < 7){

	}
	else
	{
		$('.submit-hover').live('mouseover', function(){
			$(this).css('background-color', '#ddd');
			$(this).css('cursor', 'pointer');
		});

		$('.submit-hover').live('mouseout', function(){
			$(this).css('background-color', '#eee');
		});

		$('.ticket-next-btn').live('mouseover', function(){
			$(this).css('background-image', 'url('+ url_base +'resources/img/buttons/btn-top-hover.gif');
		});

		$('.ticket-next-btn').live('mouseout', function(){
			$(this).css('background-image', 'url('+ url_base +'resources/img/buttons/btn-top-normal.gif');
		});

		$('.ticket-done-btn').live('mouseover', function(){
			$(this).css('background-image', 'url('+ url_base +'resources/img/buttons/btn-top-hover.gif');
		});

		$('.ticket-done-btn').live('mouseout', function(){
			$(this).css('background-image', 'url('+ url_base +'resources/img/buttons/btn-top-normal.gif');
		});

		$('.ticket-checksms-btn').live('mouseover', function(){
			$(this).css('background-image', 'url('+ url_base +'resources/img/buttons/btn-top-hover.gif');
		});

		$('.ticket-checksms-btn').live('mouseout', function(){
			$(this).css('background-image', 'url('+ url_base +'resources/img/buttons/btn-top-normal.gif');
		});

		$('.ticket-back2choice-btn').live('mouseover', function(){
			$(this).css('background-image', 'url('+ url_base +'resources/img/buttons/btn-top-hover.gif');
		});

		$('.ticket-back2choice-btn').live('mouseout', function(){
			$(this).css('background-image', 'url('+ url_base +'resources/img/buttons/btn-top-normal.gif');
		});

		$('.ticket-back-btn').live('mouseover', function(){
			$(this).css('background-image', 'url('+ url_base +'resources/img/buttons/btn-top-hover.gif');
		});

		$('.ticket-back-btn').live('mouseout', function(){
			$(this).css('background-image', 'url('+ url_base +'resources/img/buttons/btn-top-normal.gif');
		});

		$('.ticket-print-btn').live('mouseover', function(){
			$(this).attr('src', url_base +'resources/img/buttons/print-button-hover.png');
		});

		$('.ticket-print-btn').live('mouseout', function(){
			$(this).attr('src', url_base +'resources/img/buttons/print-button.png');
		});
	}

	$('.ticket-back-btn').live('click', function(event){
		if(event.button === 0) {
			window.location = url_base;
		}
	});

	$('.res-close-btn').live('click', function(event){
		if(event.button === 0) {
			window.location = url_base;
		}
	});

	$('.ui-tabs-nav').children('li').each(function(i, element){
		url = $(element).children('a').attr('href');
		url = url.replace(url_base, '');
		$(element).children('a').attr('class', url);
	});

	$("#left-tabs").tabs({
		cache: true,
		spinner: '',
		ajaxOptions: {
			error: function (httprequest, errortxt, errorobj) {
				$('#left-tab-spinner').empty();
				$('#left-tab-spinner').append('<p class="ajax-error">fout</p>&nbsp;<img src="'+ url_base +'resources/img/icons/cross.png" width="16" height="16">');
			}
		},
		select: function(event, ui) {
			$('#left-tab-spinner').empty();
			$('#left-tab-spinner').append('<p class="ajax-loading">laden</p>&nbsp;<img src="'+ url_base +'resources/img/other/ajax-loader.gif" width="16" height="16">');

			uri = $(ui.tab).attr('class');
			pageTracker._trackPageview(uri);

		},
		show: function(event, ui) {
			$('#left-tab-spinner').empty();
			if($('#googlemap').size() > 0)
			{
				$('#googlemap').jmap('init', {
					'mapType': G_NORMAL_MAP,
					'mapShowjMapsIcon': false,
					'mapEnableType': true,
					'language': 'nl',
					'mapZoom': 13
				});

				$('#googlemap').jmap('AddMarker',{
					'pointLatLng': [longtitude, latitude],
					'pointHTML': cinema_name + '<br />'+ cinema_address + '<br />' + cinema_postalcode + ' ' + cinema_city,
					'centerMap': true
				});
			}
		}
	});

	$("#right-tabs").tabs({
		cache: true,
		spinner: '',
		ajaxOptions: {
			error: function (httprequest, errortxt, errorobj) {
				$('#right-tab-spinner').empty();
				$('#right-tab-spinner').append('<img src="'+ url_base +'resources/img/icons/cross.png" width="16" height="16">');
			}
		},
		select: function(event, ui) {
			$('#right-tab-spinner').empty();
			$('#right-tab-spinner').append('<img src="'+ url_base +'resources/img/other/ajax-loader.gif" width="16" height="16">');
		},
		show: function(event, ui) {
			$('#right-tab-spinner').empty();
		}
	});

	$('#right-tabs').tabs('add', url_base +'reviews/right', 'Reviews');
	$('#right-tabs').tabs('add', url_base +'castcrew/verjaardagen', 'Vandaag jarig');



	$('#left-header').cycle({
	    fx:			'fade',
	    speed:		2000,
	    timeout:	7000,
	    next:		'.header-next',
	    top:		6,
	    left:		6
	});

	$('.header-overlay').hover(function(){
		$('#left-header').cycle('pause');
	}, function(){
		$('#left-header').cycle('resume');
	});

	$('.left-header-image').click(function(event){
		var name = $(this).attr('id');

		if($.browser.msie){
			if(event.srcElement.className == 'left-header-image')
			{
				window.location = url_base +'bioscoopfilms/index/'+ name;
			}
		}
		else
		{
			if(event.originalEvent.target.className == 'left-header-image')
			{
				window.location = url_base +'bioscoopfilms/index/'+ name;
			}
		}
	});

	$('.uitleg-lijst').css('display', 'none');
	$('.uitleg-para').children('h2').css('cursor', 'pointer');

	$('.uitleg-para').children('h2').click(function(){
			$(this).parent().children('.uitleg-lijst').slideToggle('slow');
	});
	$('.uitleg-stap').css('cursor', 'pointer');
	$('.uitleg-stap').css('font-weight', 'bold');
	$('.uitleg-stap').click(function(){
		var element = $(this);
		$(this).parent().children('.hidden').slideToggle('slow', function(){
			if(element.children('.slider').attr('src') == 'http://www.belbios.nl/resources/img/icons/slided_up.png')
			{
				element.children('.slider').attr('src', 'http://www.belbios.nl/resources/img/icons/slided_down.png');
			}
			else
			{
				element.children('.slider').attr('src', 'http://www.belbios.nl/resources/img/icons/slided_up.png');
			}
		});
	});

	$('#res-uitleg-1').click(function(){
		var scrollbar = ($.getScrollbarWidth() - 1) / 2;
		$('body').css('overflow', 'hidden');
		$('body').css('margin-left', '-'+ scrollbar +'px');
		$('.overlay').show();
		$('.res-uitleg-1').show();
	});
	$('#res-uitleg-2').click(function(){
		var scrollbar = ($.getScrollbarWidth() - 1) / 2;
		$('body').css('overflow', 'hidden');
		$('body').css('margin-left', '-'+ scrollbar +'px');
		$('.overlay').show();
		$('.res-uitleg-2').show();
	});
	$('#res-uitleg-3').click(function(){
		var scrollbar = ($.getScrollbarWidth() - 1) / 2;
		$('body').css('overflow', 'hidden');
		$('body').css('margin-left', '-'+ scrollbar +'px');
		$('.overlay').show();
		$('.res-uitleg-3').show();
	});


	$(document).keypress(function(e){
		if(e.keyCode == 27){
			$('body').css('overflow', 'auto');
			$('body').css('margin-left', '0px');
			$('.trailer-player').hide();
			$('.modal-box').hide();
			$('.modal-box-uitleg').hide();
			$('.overlay').hide();
			$('.playlist-items').empty();
			swfobject.removeSWF('player_object');
			$('#playercontainer').append('<a href="#" class="player" id="player"></a>');
		}
	});

	$('.modal-close').click(function(){
		$('body').css('overflow', 'auto');
		$('body').css('margin-left', '0px');
		$('.trailer-player').hide();
		$('.modal-box').hide();
		$('.modal-box-uitleg').hide();
		$('.overlay').hide();
		$('.playlist-items').empty();
		swfobject.removeSWF('player_object');
		$('#playercontainer').append('<a href="#" class="player" id="player"></a>');
	});

	$('.person-search').live('keyup', function() {
		var sid = $(this).attr('id');

		$('#left-tab-spinner').empty();
		$('#left-tab-spinner').append('<p class="ajax-loading">laden</p>&nbsp;<img src="'+ url_base +'resources/img/other/ajax-loader.gif" width="16" height="16">');

		$.ajax({
			type: 'GET',
			url: url_base +'cast-en-crew/zoeken/'+ $(this).attr('id') +'/'+ $(this).val(),
			success: function(data) {
				$('.'+ sid).empty();
				$('.'+ sid).append(data);
				$('#left-tab-spinner').empty();
			}
		});
	});

	$('.person-search-button').hide();
	$('.person-search').attr('size', 20);
	$('.person-search-label').text('Snel zoeken:');

	$('.person-search-letter').live('click', function(event) {
		if(event.button === 0) {
			$('.person-search').val('');
			$(this).blur();
			var role = $(this).attr('id');
			$('.person-search-letter').css('font-weight', 'normal');
			$(this).css('font-weight', 'bold');

			$('#left-tab-spinner').empty();
			$('#left-tab-spinner').append('<p class="ajax-loading">laden</p>&nbsp;<img src="'+ url_base +'resources/img/other/ajax-loader.gif" width="16" height="16">');

			event.preventDefault();
			$.ajax({
				type: 'GET',
				url: $(this).attr('href'),
				success: function(data) {
					$('.' + role + '-field').empty();
					$('.' + role + '-field').append(data);
					$('#left-tab-spinner').empty();
				}
			});
		}
	});

	$('.movie-search').live('keyup', function(event) {
		event.preventDefault();
		var sid = $(this).attr('id');

		$('#left-tab-spinner').empty();
		$('#left-tab-spinner').append('<p class="ajax-loading">laden</p>&nbsp;<img src="'+ url_base +'resources/img/other/ajax-loader.gif" width="16" height="16">');

		$.ajax({
			type: 'GET',
			url: url_base +'bioscoopfilms/zoeken/'+ $(this).parent().children('.search-status').val() +'/'+ $(this).parent().children('.genre-search').val() +'/1/'+ $(this).val(),
			success: function(data) {
				$('.'+ sid).empty();
				$('.'+ sid).append(data);
				$('#left-tab-spinner').empty();
			}
		});
	});

	$('.movie-search-button').hide();
	$('.movie-search-label').text('Snel zoeken:');
	$('.genre-search').css('width', '198px');

	$('.trailer-search').live('keyup', function(event) {
		event.preventDefault();
		var sid = $(this).attr('id');

		$('#left-tab-spinner').empty();
		$('#left-tab-spinner').append('<p class="ajax-loading">laden</p>&nbsp;<img src="'+ url_base +'resources/img/other/ajax-loader.gif" width="16" height="16">');

		$.ajax({
			type: 'GET',
			url: url_base +'trailers/zoeken/'+ $(this).parent().children('.search-status').val() +'/'+ $(this).parent().children('.trailer-genre-search').val() +'/1/'+ $(this).val(),
			success: function(data) {
				$('.'+ sid).empty();
				$('.'+ sid).append(data);
				$('#left-tab-spinner').empty();
			}
		});
	});

	$('.trailer-search-button').hide();
	$('.trailer-search-label').text('Snel zoeken:');
	$('.trailer-genre-search').css('width', '198px');

	$('input[name="mobile"]').css('color', '#888');

	$('input[name="mobile"]').live('focus', function(){
		if($(this).val() == 'bijv. 0619283746'){
			$('input[name="mobile"]').css('color', '#000');
			$(this).val('');
		}
		else {
			$('input[name="mobile"]').css('color', '#000');
		}
	});

	$('input[name="mobile"]').live('blur', function(){
		if($(this).val() == ''){
			$('input[name="mobile"]').css('color', '#aaa');
			$(this).val('bijv. 0619283746');
		}
	});

	$('input[name="tel_mob"]').css('color', '#888');

	$('input[name="tel_mob"]').live('focus', function(){
		if($(this).val() == 'bijv. 0612345678'){
			$('input[name="tel_mob"]').css('color', '#000');
			$(this).val('');
		}
	});

	$('input[name="tel_mob"]').live('blur', function(){
		if($(this).val() == ''){
			$('input[name="tel_mob"]').css('color', '#aaa');
			$(this).val('bijv. 0612345678');
		}
	});

	$('.modal-box').bgiframe();
	$('.picture-overlay').bgiframe();
	$('.overlay').bgiframe();

	if(!$.browser.msie && $.browser.version != 7){
		$('.open-trailer').live('mouseover', function() {
			$(this).children('.movie-thumb-poster').children('.movie-thumb-play').show();
			$(this).children('.movie-thumb-poster').children('.movie-thumb-dark').show();
		});

		$('.open-trailer').live('mouseout', function() {
			$(this).children('.movie-thumb-poster').children('.movie-thumb-play').hide();
			$(this).children('.movie-thumb-poster').children('.movie-thumb-dark').hide();
		});
	}

	$('.open-trailer').live('click', function(event) {
		if(event.button === 0) {
			event.preventDefault();

			var movie_id = $(this).attr('id');
				movie_id = movie_id.split('_');
				movie_id = movie_id[1];

			$.ajax({
				type: 'get',
				url: url_base +'ajax/kijkwijzers/'+ movie_id,
				success: function(data) {
					$('.kijkwijzer-trailer').html(data);
				}
			});

			var movie_title = $(this).attr('title');
			$('.trailer-title').html(movie_title);

			var movie_url = $(this).attr('href') || $(this).children('.movie-thumb-poster').children('.trailer-page-link').attr('href');
			movie_url = movie_url.split('/');
			movie_url = movie_url[5];

			$('.more-info-trailer').attr('href', url_base + 'bioscoopfilms/index/' + movie_url);

			var scrollbar = ($.getScrollbarWidth() - 1) / 2;

			$('body').css('overflow', 'hidden');
			$('body').css('margin-left', '-'+ scrollbar +'px');

			$('.overlay').show();
			$('.modal-box').show();
			$('.trailer-player').show();

			var flashvars =
			{
				'file':url_base +'trailers/index/'+ movie_id,
				'volume':50,
	    		'skin':url_base +'resources/swf/stylish.swf',
				'displayclick':'none',
				'icons':'false',
				'repeat':'list',
				'stretching':'uniform',
				'lightcolor':'777777',
				'frontcolor':'ffffff',
				'backcolor':'333333',
				'screencolor':'000000',
				'id':'player_object',
				'autostart':'true',
				'plugins':'adtvideo',
				'adtvideo.config':'splash_config.xml'
			};

			var params =
			{
				'allowfullscreen':		'true',
				'allowscriptaccess':	'always',
				'bgcolor':				'#FFFFFF'
			};

			var attributes =
			{
				'id':		'player_object',
				'name':		'player_object'
			};

			swfobject.embedSWF(url_base +'resources/swf/player.swf', 'player', '610', '476', '9.0.124', false, flashvars, params, attributes);
		}
	});

	$('.bios-foto').live('click', function(event) {
		if(event.button === 0) {
			event.preventDefault();

			var pic = $(this).attr('href');
				img = pic.split('_');
				size = img[1].split('x');
				height = size[1].split('.');

			if(size[0] > 153 && height[0] > 153)
			{
				$('.bios-groot').children('.bios-foto-groot').attr('src', pic);

				var scrollbar = ($.getScrollbarWidth() - 1) / 2;
				var imgwidth = (size[0] / 2) + 30 ;
				var imgheight = (height[0] / 2) + 30 ;
				$('body').css('overflow', 'hidden');
				$('body').css('margin-left', '-'+ scrollbar +'px');
				$('.bios-groot').css('margin-left', '-'+ imgwidth +'px');
				$('.bios-groot').css('margin-top', '-'+ imgheight +'px');
				$('.overlay').show();
				$('.bios-groot').show();
			}
		}
	});

	$(document).keypress(function(e){
		if(e.keyCode == 27){
			$('body').css('overflow', 'auto');
			$('body').css('margin-left', '0px');
			$('.overlay').hide();
			$('.bios-groot').hide();
			$('.bios-groot').children('.bios-foto-groot').attr('src', '');
		}
	});

	$('.modal-close').click(function(){
		$('body').css('overflow', 'auto');
		$('body').css('margin-left', '0px');
		$('.overlay').hide();
		$('.bios-groot').hide();
		$('.bios-groot').children('.bios-foto-groot').attr('src', '');
	});

	$('.bios-foto-groot').css('cursor', 'pointer');
	$('.bios-foto-groot').click(function(){
		$('body').css('overflow', 'auto');
		$('body').css('margin-left', '0px');
		$('.overlay').hide();
		$('.bios-groot').hide();
		$('.bios-groot').children('.bios-foto-groot').attr('src', '');
	});

	$('#keuze-info-1').live('click', function(event) {
		if(event.button === 0) {
			event.preventDefault();

			var scrollbar = ($.getScrollbarWidth() - 1) / 2;

			$('body').css('overflow', 'hidden');
			$('body').css('margin-left', '-'+ scrollbar +'px');

			$('.overlay').show();
			$('.more-payment-info').show();
			$('#choice-1').show();
			$('#choice-2').hide();
			$('#choice-3').hide();
		}
	});

	$('#keuze-info-2').live('click', function(event) {
		if(event.button === 0) {
			event.preventDefault();

			var scrollbar = ($.getScrollbarWidth() - 1) / 2;

			$('body').css('overflow', 'hidden');
			$('body').css('margin-left', '-'+ scrollbar +'px');

			$('.overlay').show();
			$('.more-payment-info').show();
			$('#choice-1').hide();
			$('#choice-2').show();
			$('#choice-3').hide();
		}
	});

	$('#keuze-info-3').live('click', function(event) {
		if(event.button === 0) {
			event.preventDefault();

			var scrollbar = ($.getScrollbarWidth() - 1) / 2;

			$('body').css('overflow', 'hidden');
			$('body').css('margin-left', '-'+ scrollbar +'px');

			$('.overlay').show();
			$('.more-payment-info').show();
			$('#choice-1').hide();
			$('#choice-2').hide();
			$('#choice-3').show();
		}
	});

	$(document).keypress(function(e){
		if(e.keyCode == 27){
			$('body').css('overflow', 'auto');
			$('body').css('margin-left', '0px');
			$('.more-payment-info').hide();
			$('.overlay').hide();
			$('#choice-1').hide();
			$('#choice-2').hide();
			$('#choice-3').hide();
		}
	});

	$('.modal-close').click(function(){
		$('body').css('overflow', 'auto');
		$('body').css('margin-left', '0px');
		$('.more-payment-info').hide();
		$('.overlay').hide();
		$('#choice-1').hide();
		$('#choice-2').hide();
		$('#choice-3').hide();
	});

	$('.movie-poster').live('mouseover', function() {
		$(this).children('.movie-thumb-plus').show();
	});

	$('.movie-poster').live('mouseout', function() {
		$(this).children('.movie-thumb-plus').hide();
	});

	$('.movie-poster').live('click', function(event) {
		if(event.button === 0) {
			event.preventDefault();

			var scrollbar = ($.getScrollbarWidth() - 1) / 2;

			$('body').css('overflow', 'hidden');
			$('body').css('margin-left', '-'+ scrollbar +'px');

			$('.overlay').fadeIn();
			$('.picture-overlay').fadeIn();
		}
	});

	$(document).keypress(function(e){
		if(e.keyCode == 27){
			$('body').css('overflow', 'auto');
			$('body').css('margin-left', '0px');
			$('.picture-overlay').hide();
			$('.overlay').hide();
		}
	});

	$('.modal-close').click(function(){
		$('body').css('overflow', 'auto');
		$('body').css('margin-left', '0px');
		$('.picture-overlay').hide();
		$('.overlay').hide();
	});

	$('.poster-org').css('cursor', 'pointer');
	$('.poster-org').click(function(){
		$('body').css('overflow', 'auto');
		$('body').css('margin-left', '0px');
		$('.picture-overlay').hide();
		$('.overlay').hide();
	});

	$('#res-nu').live('click', function(event) {
		if(event.button === 0) {
			event.preventDefault();
			var scrollbar = ($.getScrollbarWidth() - 1) / 2;

			$('#resbox-buy-btn').show();
			$('#resbox-reservation-btn').show();
			$('.reservation-type-information').hide();
			$('.reservation-type-information-belbios').hide();
			$('.reservation-box-part:eq(4)').show();
			$('.reservation-box-part:last').css('margin-top', '0px');
			$('.reservation-select[name="date"]').empty();
			$('.reservation-select[name="date"]').append('<option value="0">Selecteer een datum...</option>');
			$('.reservation-select[name="date"]').attr('disabled', 'disabled');
			$('.reservation-select[name="date"]').css('opacity', '0.5');
			$('.reservation-select[name="total_tickets"]').empty();
			$('.reservation-select[name="total_tickets"]').append('<option value="1">1</option>');
			$('.reservation-select[name="total_tickets"]').attr('disabled', 'disabled');
			$('.reservation-select[name="total_tickets"]').css('opacity', '0.5');
			$('.reservation-select[name="cinema"]').empty();
			$('.reservation-select[name="cinema"]').append('<option value="0">Selecteer een bioscoop...</option>');
			$('.reservation-select[name="cinema"]').attr('disabled', 'disabled');
			$('.reservation-select[name="cinema"]').css('opacity', '0.5');
			$('#cinema-all').addClass('hidden');
			$('#city-all').addClass('hidden');
			$('#cinema-info').addClass('hidden');
			$('#movie-info').addClass('hidden');

			$('body').css('overflow', 'hidden');
			$('body').css('margin-left', '-'+ scrollbar +'px');
			$('.overlay').show();
			$('.register-bg').show();
			$('#right-reservation').css('z-index', '1500');
			$('#right-reservation').css('position', 'fixed');
			$('#right-reservation').css('left', '50%');
			$('#right-reservation').css('top', '50%');
			$('#right-reservation').css('margin-left', '-177px');
			$('#right-reservation').css('margin-top', '-112.5px');

			var bbid = $(this).attr('rel');
			$('.reservation-select[name="movie"]').children('option[value="'+ bbid +'"]').attr('selected', 'selected');

			$.ajax({
				type: 'get',
				url: url_base +'ajax/cities/'+ bbid,
				dataType: 'json',
				success: function(json){
					var str = '';
					for(i=0;i<json.length;i++)
					{
						str += '<option value="'+ json[i].belbios_id +'">'+ json[i].name +'</option>';
					}

					$('.reservation-select[name="city"]').empty();
					$('.reservation-select[name="city"]').append('<option value="0">Selecteer een stad...</option>');
					$('.reservation-select[name="city"]').append(str);
					$('.reservation-select[name="city"]').children('option[value="'+ selected_city +'"]').attr('selected', 'selected');
				}
			});
		}
	});

	$('.res-nu').live('click', function(event) {
		if(event.button === 0) {
			$('.res-overlay').hide();
			event.preventDefault();
			var scrollbar = ($.getScrollbarWidth() - 1) / 2;

			$('#resbox-buy-btn').show();
			$('#resbox-reservation-btn').show();
			$('.reservation-type-information').hide();
			$('.reservation-type-information-belbios').hide();
			$('.reservation-box-part:eq(4)').show();
			$('.reservation-box-part:last').css('margin-top', '0px');
			$('.reservation-select[name="date"]').empty();
			$('.reservation-select[name="date"]').append('<option value="0">Selecteer een datum...</option>');
			$('.reservation-select[name="date"]').attr('disabled', 'disabled');
			$('.reservation-select[name="date"]').css('opacity', '0.5');
			$('.reservation-select[name="total_tickets"]').empty();
			$('.reservation-select[name="total_tickets"]').append('<option value="1">1</option>');
			$('.reservation-select[name="total_tickets"]').attr('disabled', 'disabled');
			$('.reservation-select[name="total_tickets"]').css('opacity', '0.5');
			$('.reservation-select[name="cinema"]').empty();
			$('.reservation-select[name="cinema"]').append('<option value="0">Selecteer een bioscoop...</option>');
			$('.reservation-select[name="cinema"]').attr('disabled', 'disabled');
			$('.reservation-select[name="cinema"]').css('opacity', '0.5');
			$('#cinema-all').addClass('hidden');
			$('#city-all').addClass('hidden');
			$('#cinema-info').addClass('hidden');
			$('#movie-info').addClass('hidden');

			$('body').css('overflow', 'hidden');
			$('body').css('margin-left', '-'+ scrollbar +'px');
			$('.overlay').show();
			$('.register-bg').show();
			$('#right-reservation').css('z-index', '1500');
			$('#right-reservation').css('position', 'fixed');
			$('#right-reservation').css('left', '50%');
			$('#right-reservation').css('top', '50%');
			$('#right-reservation').css('margin-left', '-177px');
			$('#right-reservation').css('margin-top', '-112.5px');

			var bbid = $(this).attr('rel');
			$('.reservation-select[name="movie"]').children('option[value="'+ bbid +'"]').attr('selected', 'selected');

			$.ajax({
				type: 'get',
				url: url_base +'ajax/cities/'+ bbid,
				dataType: 'json',
				success: function(json){
					var str = '';
					for(i=0;i<json.length;i++)
					{
						str += '<option value="'+ json[i].belbios_id +'">'+ json[i].name +'</option>';
					}

					$('.reservation-select[name="city"]').empty();
					$('.reservation-select[name="city"]').append('<option value="0">Selecteer een stad...</option>');
					$('.reservation-select[name="city"]').append(str);
					$('.reservation-select[name="city"]').children('option[value="'+ selected_city +'"]').attr('selected', 'selected');
				}
			});
		}
	});

	$(document).keypress(function(e){
		if(e.keyCode == 27){
			$('body').css('overflow', 'auto');
			$('body').css('margin-left', '0px');
			$('.register-bg').hide();
			$('#right-reservation').css('z-index', '100');
			$('#right-reservation').css('position', 'relative');
			$('#right-reservation').css('left', 0);
			$('#right-reservation').css('top', 0);
			$('#right-reservation').css('margin-left', 0);
			$('#right-reservation').css('margin-top', 0);
			$('.overlay').hide();
			$('.newsletter-more-info').hide();
			url = ''+window.location;
			url = url.split('/');
			if(url[6] == 'reserveren' || url[6] == 'kopen')
			{
				$('.res-overlay').show();
			}
		}
	});

	$('.modal-close').click(function(){
		$('body').css('overflow', 'auto');
		$('body').css('margin-left', '0px');
		$('.register-bg').hide();
		$('#right-reservation').css('z-index', '100');
		$('#right-reservation').css('position', 'relative');
		$('#right-reservation').css('left', 0);
		$('#right-reservation').css('top', 0);
		$('#right-reservation').css('margin-left', 0);
		$('#right-reservation').css('margin-top', 0);
		$('.overlay').hide();
		$('.newsletter-more-info').hide();
		$('.pathe-more-info').hide();
		url = ''+window.location;
		url = url.split('/');
		if(url[6] == 'reserveren' || url[6] == 'kopen')
		{
			$('.res-overlay').show();
		}
	});

	$('#newsletter-info').live('click', function(event){
		if(event.button === 0) {
			event.preventDefault();
			var scrollbar = ($.getScrollbarWidth() - 1) / 2;

			$('body').css('overflow', 'hidden');
			$('body').css('margin-left', '-'+ scrollbar +'px');
			$('.overlay').show();
			$('.newsletter-more-info').show();
		}
	});

	var text;

	$('.movie-wide-voted > img').live('mouseover', function(){
		text = $(this).parent().children('.vote-value').text();
		$(this).parent().children('.vote-value').text('U heeft al gestemd');
	});

	$('.movie-wide-voted > img').live('mouseout', function(){
		$(this).parent().children('.vote-value').text(text);
	});

	$('.movie-wide-vote > img').live('mouseover', function(){
		$(this).nextAll('img').attr('src', url_base +'resources/img/buttons/vote.png');
		$(this).prevAll('img').andSelf().attr('src', url_base +'resources/img/buttons/vote-hover.png');

		var values = ['Vreselijk!', 'Slecht', 'Matig', 'Goed', 'Fantastisch!'];
		var count = $(this).prevAll('img').andSelf().size();
		text = $(this).parent().children('.vote-value').text();
		$(this).parent().children('.vote-value').text(values[(count - 1)]);
	});

	$('.movie-wide-vote > img').live('mouseout', function(){
		if(!$(this).hasClass('voted')){
			$(this).parent().children('img:not(.voted)').attr('src', url_base +'resources/img/buttons/vote.png');
		}
		$(this).parent().children('.voted').attr('src', url_base +'resources/img/buttons/vote-hover.png');
		$(this).parent().children('.vote-value').text(text);
	});

	$('.movie-wide-vote > img').live('click', function(event){
		if(event.button === 0) {
			$(this).parent().children('.vote-value').text('');

			var id = $(this).parent().attr('id');
				id = id.split('_');
				id = id[1];

			$(this).nextAll('img').removeClass('voted');
			$(this).prevAll('img').andSelf().addClass('voted');

			var count = $(this).prevAll('img').andSelf().size();
			var element = $(this);

			$.ajax({
				type: 'post',
				url: url_base +'ajax/vote',
				data: 'rating='+ count +'&movie='+ id,
				success: function(msg){
					text = msg;
					$(element).parent().children('.vote-value').text(msg);

					var cookie_val = $.cookie('belbios_votes');
						cookie_val = cookie_val ? cookie_val + ',' : '';
					$.cookie('belbios_votes', cookie_val+id, { expires: 7, path: '/' });  //TODO add domain

					$(element).parent().removeClass('movie-wide-vote');
					$(element).parent().addClass('movie-wide-voted');
				}
			});
		}
	});

	$('#search-box').css('color', '#aaa');

	$('#search-box').focus(function(){
		if($(this).val() == 'Zoeken...'){
			$('#search-box').css('color', '#000');
			$(this).val('');
		}
	});

	$('#search-box').blur(function(){
		if($(this).val() == ''){
			$('#search-box').css('color', '#aaa');
			$(this).val('Zoeken...');
		}
	});

	$('#news-letter-name').css('color', '#888');

	$('#news-letter-name').focus(function(){
		if($(this).val() == 'Voornaam...'){
			$('#news-letter-name').css('color', '#000');
			$(this).val('');
		}
	});

	$('#news-letter-name').blur(function(){
		if($(this).val() == ''){
			$('#news-letter-name').css('color', '#aaa');
			$(this).val('Voornaam...');
		}
	});

	$('#news-letter-email').css('color', '#888');

	$('#news-letter-email').focus(function(){
		if($(this).val() == 'E-mailadres...'){
			$('#news-letter-email').css('color', '#000');
			$(this).val('');
		}
	});

	$('#news-letter-email').blur(function(){
		if($(this).val() == ''){
			$('#news-letter-email').css('color', '#aaa');
			$(this).val('E-mailadres...');
		}
	});

	var title;
	$('.movie-wide-kijkwijzer > a > img').live('mouseover', function(){
		title = $(this).attr('title');
		$(this).removeAttr('title');
		$(this).attr('title', '');

		var offset = $(this).offset();
		var image = $(this).attr('src').replace('small/', '');
		var content = '<img src="'+ image +'" width="25" height="25" /><p>'+ title +'</p>';

		$('body').append('<div class="tooltip" style="left: '+ (offset.left + 10) +'px; top: '+ (offset.top + 25) +'px; ">'+ content +'</div>');
	});

	$('.movie-wide-kijkwijzer > a > img').live('mouseout', function(){
		$('.tooltip').remove();
		$(this).attr('title', title);
	});

	$('.gallery-thumbs-left').live('click', function(event){
		if(event.button === 0) {
			var current_offset = parseInt($('.gallery-thumbs-slider').css('margin-left'));
			if(current_offset < 20)
			{
				$('.gallery-thumbs-slider').css('margin-left', ''+ (current_offset + 74) +'px');
			}
		}
	});

	$('.gallery-thumbs-right').live('click', function(event){
		if(event.button === 0) {
			var current_offset = parseInt($('.gallery-thumbs-slider').css('margin-left'));
			var width = ($('.gallery-thumbs-slider').children().size() * 74) - 168;

			if(Math.abs(current_offset) <= width && $('.gallery-thumbs-slider').children().size() >= 8)
			{
				$('.gallery-thumbs-slider').css('margin-left', ''+ (current_offset - 74) +'px');
			}
		}
	});

	$('.gallery-thumbs-slider > img').live('click', function(event){
		if(event.button === 0) {
			var img = $(this).attr('src');
				img = img.split('_');
				img = img[0];

			$('.gallery-big-image > img').fadeOut('normal', function(){
				$('.gallery-big-image > img').attr('src', img +'_resized.jpg');
				$('.gallery-big-image > img').fadeIn();
			});
		}
	});

	if($('input[name="extra-acties"]').is(':checked'))
	{
		$('#extra-info').show();
		var checked = true;
	}
	else
	{
		var checked = false;
	}
	$('#extra-acties').click(function(){
		$('#extra-info2').slideToggle();
		if(!checked) {
			$('#extra-info').slideDown();
			checked = true;
		}
		else
		{
			$('#extra-info').slideUp();
			checked = false;
		}
	});
	$('p.res-ann').hide();
	$('.res-ann-txt').click(function(){
		$(this).parent().children('.res-ann').slideToggle('slow');
	});

	$('.review-options > .add-review-button').live('click', function(event){
		if(event.button === 0) {
			event.preventDefault();

			if(loggedin == 1)
			{
				$(this).slideToggle('slow');
				$('.add-review').slideToggle('slow');

				$('.add-review-slider').slider({
					orientation: 'vertical',
					range: 'min',
					min: 10,
					max: 100,
					value: 55,
					step: 5,
					animate: true,
					slide: function(event, ui) {
						var value = ''+ ui.value;
						var left = value.slice(0, 1);
						var right = value.slice(1, 2);

						if(ui.value == 100) {
							$('.add-review-value').text(10);
							$('.add-review-rating-field').val(10);
						}
						else {
							$('.add-review-value').text(left +'.'+ right);
							$('.add-review-rating-field').val(left +'.'+ right);
						}
					}
				});
			}
			else
			{
				window.location = url_base +'inloggen/'+ $(this).attr('id');
			}
		}
	});
	$('.add-review-content-field').css('color', '#ccc');

	$('.add-review-content-field').live('keyup', function() {
		if($('.add-review-content-field').val().length > 1000)
		{
			$('.add-review-content-field').val($('.add-review-content-field').val().substring(0,1000));
		}
		$('.char-count').text((1000-$('.add-review-content-field').val().length) + ' tekens');
	});

	$('.add-review-submit-button').live('click', function(event){
		if(event.button === 0) {
			event.preventDefault();

			if($('.add-review-content-field').val().length < 150)
			{
				alert('Je review moet minimaal 150 tekens bevatten.');
			}
			else if($('.add-review-content-field').val().length > 1000)
			{
				alert('Je review mag maximaal 1000 tekens bevatten.');
			}
			else
			{
				if($('.add-review-content-field').val() == $('.add-review-hidden-text').val())
				{
					alert('Je review mag niet bestaan uit de standaard tekst.');
				}
				else
				{
					if($('.add-review-value').text() == 5.5)
					{
						if(confirm('Je waardering is nu 5.5 voor deze film.\nWeet je dit zeker?'))
						{
							$('.add-review-form').submit();
						}
					}
					else
					{
						$('.add-review-form').submit();
					}
				}
			}
		}
	});

	$('.add-review-rating-info').live('mouseover', function(){
		var offset = $(this).offset();
		$('body').append('<div class="tooltip" style="left: '+ (offset.left + 10) +'px; top: '+ (offset.top + 25) +'px; ">Om de film positief te waarderen<br /> verschuif je het oranje blokje naar boven.<br />Bij een mindere film naar beneden. <br /><br />Waardering: 1 [zeer slecht] tot 10 [uitmuntend]</div>');
	});

	$('.add-review-rating-info').live('mouseout', function(){
		$('.tooltip').remove();
	});

	$('.review-user-info').live('mouseover', function(){
		var offset = $(this).offset();
		$('body').append('<div class="tooltip" style="left: '+ (offset.left + 10) +'px; top: '+ (offset.top - 45) +'px; ">'+ $('.review-user-data').html() +'</div>');
	});

	$('.review-user-info').live('mouseout', function(){
		$('.tooltip').remove();
	});

	$('.add-review-content-field').live('focus', function(){
		$('.add-review-content-field').css('color', '#000');
		if($(this).val() == $('.add-review-hidden-text').val())
		{
			$(this).val('');
		}
	});

	$('.add-review-content-field').live('blur', function(){
		if($(this).val() == $('.add-review-hidden-text').val() || $(this).val() == '')
		{
			$(this).val($('.add-review-hidden-text').val());
			$('.add-review-content-field').css('color', '#ccc');
		}
	});

	$('.add-review-options > .cancel-review').live('click', function(event){
		if(event.button === 0) {
			event.preventDefault();

			$('.review-options > .add-review-button').slideToggle('slow');
			$('.add-review').slideToggle('slow');
		}
	});

	$('.cinema-search').live('keyup', function(){
		var query = $('.cinema-search').val();
		$('.cinema-search > option:eq(0)').attr('selected', 'selected');

		$.ajax({
			type: 'GET',
			url: url_base +'bioscopen/zoeken/text/'+ query,
			success: function(data) {
			    $('.bioscopen-lijst').empty();
			    $('.bioscopen-lijst').html(data);
			}
		});
	})

	$(".draggable").draggable({containment: 'parent'});
	$("#action-detail").droppable({
		drop: function(event, ui) {
			$(".draggable").draggable({containment: 'parent'});
			console.log(ui.draggable[0].id + ' X: ' + ui.position.left + ' Y: ' + ui.position.top);
		}
	});

	var return_status = $('.ticket-confirm-text').text();
	var result = return_status.split('|');
	if(result[1] == 'HOLD')
	{
		$('.ticket-confirm-text').html('<img src="'+ url_base +'resources/img/other/res-loader.gif" width="32" height="32" class="left" /><p style="padding: 7px 0px 0px 50px;">Even geduld, je reservering wordt nu naar de bioscoop verstuurd...</p><div class="clear"></div>');
		$('.ticket-confirm-text').show();
		verify_ticket(result[2]);
	}
	if(result[1] == 'ERROR')
	{
		$('.ticket-confirm-text').html('<img src="'+ url_base +'resources/img/other/cross.png" width="32" height="32" class="left" /><p style="padding: 7px 0px 0px 50px;">Er is iets misgegaan, probeer het nog eens...</p><div class="clear"></div>');
		$('.ticket-confirm-text').show();
		$('.ticket-back-btn').show();
	}
	if(return_status == 'ACCOUNT')
	{
		$('.ticket-confirm-text').html('<img src="'+ url_base +'resources/img/other/cross.png" width="32" height="32" class="left" /><p style="padding: 7px 0px 0px 50px;">Je bent niet bekend bij Belbios met deze gegevens, probeer het nog eens...</p><div class="clear"></div>');
		$('.ticket-confirm-text').show();
		$('.ticket-back-btn').show();
		$('.ticket-done-btn').remove();
	}
	if(return_status == 'CHECK_SMS')
	{
		$('.ticket-confirm-text').html('<img src="'+ url_base +'resources/img/other/info-icon.png" width="32" height="32" class="left" /><p style="padding: 7px 0px 0px 50px;">SMS eenmalig <b>RES AAN &lt;gebruikersnaam&gt; &lt;wachtwoord&gt;</b> naar <b>5454</b> (eenmalig 25 eurocent).<br />SMS ontvangen? Klik dan op ok om verder te gaan.</p><div class="clear"></div>');
		$('.ticket-confirm-text').show();
		$('.ticket-back2choice-btn').show();
		$('.ticket-checksms-btn').show();
	}
	if(result[1] != 'ERROR' && result[1] != 'HOLD' && return_status != 'CHECK_SMS')
	{
		$('.ticket-done-btn').show();
		$('.ticket-confirm-text').show();
	}

	$('.ticket-checksms-btn').live('click', function(event){
		if(event.button === 0) {
			param_array = new Object();

			$('input[type="hidden"]').each(function(i, element){
					param_array[$(element).attr('name')] = $(element).val();
			});

			$.ajax({
				type: 'post',
				url: url_base +'ticket/bevestiging/checksms',
				data: param_array,
				dataType: 'text',
				success: function(text)
				{
					if(text == 'ACCOUNT')
					{
						$('.ticket-confirm-text').html('<img src="'+ url_base +'resources/img/other/cross.png" width="32" height="32" class="left" /><p style="padding: 7px 0px 0px 50px;">Je bent niet bekend bij Belbios met deze gegevens, probeer het nog eens...</p><div class="clear"></div>');
						$('.ticket-confirm-text').show();
						$('.ticket-back-btn').show();
						$('.ticket-done-btn').remove();
						$('.ticket-back2choice-btn').remove();
						$('.ticket-checksms-btn').remove();
					}
					else
					{
						$('.ticket-confirm-text').html(text);
						$('.ticket-done-btn').show();
						$('.ticket-back2choice-btn').hide();
						$('.ticket-checksms-btn').hide();
					}
				}
			});
		}
	});

	$('.ticket-back2choice-btn').click(function(event){
		event.preventDefault();

		username = $('input[name="username"]').val();
		city = $('input[name="city"]').val();
		movie = $('input[name="movie"]').val();
		ticket_type = $('input[name="ticket_type"]').val();
		cinema = $('input[name="cinema"]').val();
		date = $('input[name="datetime"]').val();
		total_tickets = $('input[name="tickets"]').val();

		var html = '<div id="ticket-stepsbar">\
			<div class="bar-inner">\
				<ul>\
					<li style="opacity: 0.5"><img src="'+ url_base +'resources/img/other/ticket-1.png" />&nbsp;&nbsp;&nbsp;&nbsp;Controleren</li>\
					<li class="active"><img src="'+ url_base +'resources/img/other/ticket-2-active.png" />&nbsp;&nbsp;&nbsp;&nbsp;Keuze</li>\
					<li style="opacity: 0.5"><img src="'+ url_base +'resources/img/other/ticket-3.png" />&nbsp;&nbsp;&nbsp;&nbsp;Bevestigen</li>\
				</ul>\
				<div class="clear"></div>\
			</div>\
		</div>\
		<h2 class="small-title">Maak een keuze uit de verschillende reserverings mogelijkheden.</h2>\
		<br />\
		<form action="'+ url_base +'reserveren/bevestiging" method="post" class="choice-form">\
			<div class="ticket-choices-select">\
				<div class="ticket-choice" id="account">\
					<div class="left">\
						<div class="ticket-choice-title left">\
							<b>Keuze 1</b>\
						</div>\
						<div class="ticket-choice-subtitle left">\
							<b>Belbios account</b>&nbsp;&nbsp;<a href="#" id="keuze-info-1"><img style="margin-bottom: -3px" src="'+ url_base +'resources/img/icons/information.png" width="16" height="16" /></a>\
						</div>\
						<div class="clear"></div>\
						<div class="ticket-choice-explain">\
							Log in met je Belbios account en <br />\
							reserveer makkelijk en snel!<br /><br />\
							<span style="font-size: 10px">Kosten 55 eurocent per reservering.</span>\
						</div>\
					</div>\
					<div class="right">\
						<table>\
							<tr>\
								<td width="125">Gebruikersnaam: *</td>\
								<td><input autocomplete="off" type="text" name="username" class="account" value="'+ username +'" /></td>\
							</tr>\
							<tr>\
								<td>Wachtwoord: *</td>\
								<td><input autocomplete="off" type="password" name="password" class="account" /></td>\
							</tr>\
						</table>\
						<input type="submit" value="Verder  &raquo;" name="submit" class="ticket-next-btn" style="position: absolute; bottom: 10px; right: 10px;"/>\
					</div>\
					<div class="clear"></div>\
				</div>\
				<div class="ticket-choice" id="sms">\
					<div class="left">\
						<div class="ticket-choice-title left">\
							<b>Keuze 2</b>\
						</div>\
						<div class="ticket-choice-subtitle left">\
							<b>SMS bevestiging</b>&nbsp;&nbsp;<a href="#" id="keuze-info-2"><img style="margin-bottom: -3px" src="'+ url_base +'resources/img/icons/information.png" width="16" height="16" /></a>\
						</div>\
						<div class="clear"></div>\
						<div class="ticket-choice-explain">\
							Verzend en ontvang 1 SMS bericht <br />\
							per reservering.<br /><br />\
							<span style="font-size: 10px">Kosten 55 eurocent per reservering.</span>\
						</div>\
					</div>\
					<div class="right">\
						<table>\
							<tr>\
								<td width="125">Mobiele nummer: *</td>\
								<td><input autocomplete="off" type="text" name="mobile" class="sms" style="color: #ccc;" value="bijv. 0619283746" /></td>\
							</tr>\
						</table>\
						<input type="submit" value="Verder  &raquo;" name="submit" class="ticket-next-btn ticket-check-sms" style="position: absolute; bottom: 10px; right: 10px;"/>\
					</div>\
					<div class="clear"></div>\
				</div>\
				<div class="ticket-choice" id="telephone">\
					<div class="left">\
						<div class="ticket-choice-title left">\
							<b>Keuze 3</b>\
						</div>\
						<div class="ticket-choice-subtitle left">\
							<b>Telefonische bevestiging</b>&nbsp;&nbsp;<a href="#" id="keuze-info-3"><img style="margin-bottom: -3px" src="'+ url_base +'resources/img/icons/information.png" width="16" height="16" /></a>\
						</div>\
						<div class="clear"></div>\
						<div class="ticket-choice-explain">\
							Ontvang je reserveringsnummer per <br />\
							telefoon en per email.<br /><br />\
							<span style="font-size: 10px">Kosten 55 eurocent per reservering.</span>\
						</div>\
					</div>\
					<div class="right">\
						<table>\
							<tr>\
								<td width="125">Telefoonnummer: *</td>\
								<td><input autocomplete="off" type="text" name="telephone" class="telephone" /></td>\
							</tr>\
							<tr>\
								<td>Emailadres: *</td>\
								<td><input autocomplete="off" type="text" name="email" class="telephone" /></td>\
							</tr>\
						</table>\
						<input type="submit" value="Verder  &raquo;" name="submit" class="ticket-next-btn ticket-check-phone" style="position: absolute; bottom: 10px; right: 10px;"/>\
					</div>\
					<div class="clear"></div>\
				</div>\
				<input type="hidden" name="movie" value="'+ movie +'" />\
				<input type="hidden" name="city" value="'+ city +'" />\
				<input type="hidden" name="cinema" value="'+ cinema +'" />\
				<input type="hidden" name="date" value="'+ date +'" />\
				<input type="hidden" name="ticket_type" value="'+ ticket_type +'" />\
				<input type="hidden" name="total_tickets" value="'+ total_tickets +'" />\
				<div class="clear"></div>\
			</div>\
		</form>';

		$('#reserveren').empty();
		$('#reserveren').append(html);
	});

	$('.ticket-done-btn').click(function(){
		$('li.active').css('opacity', '0.5');
		$('li.active').css('background-color', 'transparent');
		$('li.active').css('color', '#666');
		$('li.active > img').attr('src', url_base +'resources/img/other/ticket-3.png');

		var tickets = $('input[name="tickets"]').val();
		var movie = $('input[name="movie_name"]').val();
		var cinema = $('input[name="cinema_name"]').val();
		var pickup = $('input[name="pickupmins"]').val();

		$('#reserveren > h2.small-title').text('Bedankt voor je reservering!');
		if(tickets == '1')
		{
			$('.ticket-confirm-text').html('Als de reservering is bevestigd dan ligt er 1 kaart voor "'+ movie +'" voor je klaar bij de kassa van '+ cinema +'.<br /><br />Je kunt de kaart tot uiterlijk '+ pickup +' minuten voor aanvang ophalen.<br /><br />Veel kijkplezier!<br />Belbios.nl');
		}
		else
		{
			$('.ticket-confirm-text').html('Als de reservering is bevestigd dan liggen er '+ tickets +' kaarten voor "'+ movie +'" voor je klaar bij de kassa van '+ cinema +'.<br /><br />Je kunt de kaarten tot uiterlijk '+ pickup +' minuten voor aanvang ophalen.<br /><br />Veel kijkplezier!<br />Belbios.nl');
		}
		$('.ticket-done-btn').hide();
		$('.ticket-back-btn').show();
	});

	$('.reservation-select:disabled').css('opacity', '0.5');

	$('.ticket-reset-btn').click(function(){
		$('.ticket-choice').css('opacity', 1);
	});

	$('#resbox-buy-btn').click(function(event){
		event.preventDefault();
		if($('.reservation-select[name="movie"]').val() != 0 && $('.reservation-select[name="city"]').val() != 0 && $('.reservation-select[name="cinema"]').val() != 0 && $('.reservation-select[name="date"]').val() != 0)
		{
			$('.resbox-ticket-type').val('kopen');
			$('#resbox-form').attr('action', url_base +'kopen');
			$('#resbox-form').submit();
		}
		else
		{
			$('.tooltip').remove();
			var offset = $(this).offset();
			$('body').append('<div class="tooltip" style="width: 230px; left: '+ (offset.left + 10) +'px; top: '+ (offset.top - 45) +'px; ">Gebruik de bovenstaande velden<br /> om een aankoop te doen<div style="cursor: pointer; position: absolute; top: 5px; right: 5px;"><img class="remove-tooltip" src="'+url_base+'resources/img/buttons/close.jpg" /></div></div>');
		}
	});

	$('#resbox-reservation-btn').click(function(event){
		event.preventDefault();
		var pathe_cinemas = [192, 194, 230, 13, 201, 204, 197, 191, 193, 212, 142, 205];

		if(in_array($('.reservation-select[name="cinema"]').val(), pathe_cinemas))
		{
			$('.pathe-more-info').show();
			$('.overlay').show();
		}
		else
		{
			if($('.reservation-select[name="movie"]').val() != 0 && $('.reservation-select[name="city"]').val() != 0 && $('.reservation-select[name="cinema"]').val() != 0 && $('.reservation-select[name="date"]').val() != 0)
			{
				$('.resbox-ticket-type').val('reserveren');
				$('#resbox-form').attr('action', url_base +'reserveren');
				$('#resbox-form').submit();
			}
			else
			{
				$('.tooltip').remove();
				var offset = $(this).offset();
				$('body').append('<div class="tooltip" style="width: 230px; left: '+ (offset.left + 10) +'px; top: '+ (offset.top - 45) +'px; ">Gebruik de bovenstaande velden<br /> om een reservering te maken<div style="cursor: pointer; position: absolute; top: 5px; right: 5px;"><img class="remove-tooltip" src="'+url_base+'resources/img/buttons/close.jpg" /></div></div>');
			}
		}
	});

	$('.remove-tooltip').live('click', function(event){
		if(event.button === 0) {
			$('.tooltip').remove();
		}
	})
	$('.cinema_agenda').children(':header').css('cursor', 'pointer');

	$('.cinema_agenda').children('table').hide();
	$('#cinema').show();
	$('.cinema_agenda').children(':header').click(function(event){
		$('.cinema_agenda').children('table').hide();
		$(this).next().toggle();
	});

	$('.reservation-select[name="movie"]').focus(function(){
		$('.tooltip').remove();
	});
	$('.reservation-select[name="city"]').focus(function(){
		$('.tooltip').remove();
	});

	if($('.reservation-select[name="movie"]').val() != 0)
	{
		var selected_movie = $('.reservation-select[name="movie"]').val();

		$.ajax({
			type: 'get',
			url: url_base +'ajax/cities/'+ $('.reservation-select[name="movie"]').val(),
			dataType: 'json',
			success: function(json){
				var str = '';
				for(i=0;i<json.length;i++)
				{
					str += '<option value="'+ json[i].belbios_id +'">'+ json[i].name +'</option>';
				}

				$('.reservation-select[name="city"]').empty();
				$('.reservation-select[name="city"]').append('<option value="0">Selecteer een stad...</option>');
				$('.reservation-select[name="city"]').append(str);
			}
		});
	}

	if($('.reservation-select[name="city"]').val() != 0)
	{
		var selected_city = $('.reservation-select[name="city"]').val();

		$.ajax({
			type: 'get',
			url: url_base +'ajax/cinemas/'+ selected_city +'/0',
			dataType: 'json',
			success: function(json){
				var str = '';
				for(i=0;i<json.length;i++)
				{
					str += '<option value="'+ json[i].belbios_id +'">'+ json[i].name +'</option>';
				}

				$('.reservation-select[name="cinema"]').empty();
				$('.reservation-select[name="cinema"]').append('<option value="0">Selecteer een bioscoop...</option>');
				$('.reservation-select[name="cinema"]').append(str);
				$('.reservation-select[name="cinema"]').attr('disabled', '');
				$('.reservation-select[name="cinema"]').css('opacity', 1);
			}
		});
		$('#city-all').removeClass('hidden');
		$('#city-all').css('cursor', 'pointer');
	}

	$('.ticket-choice .right table input').keyup(function(){
		var active = $(this).attr('class');
		$('.ticket-choice .right table input:not(.'+ active +')').val('');
		$('.ticket-choice').css('opacity', 1);
		$('.ticket-choice:not(#'+ active +')').css('opacity', '0.5');
		$('.ticket-choice .left .ticket-choice-title').css('color', '#fff');
		$('.ticket-choice .left .ticket-choice-title').css('background-color', '#9169AF');
		$('.ticket-choice:not(#'+ active +') .left .ticket-choice-title').css('color', '#666');
		$('.ticket-choice:not(#'+ active +') .left .ticket-choice-title').css('background-color', '#bbb');
		if($(this).val() == '')
		{
			if($(this).parents('table').children('tbody > tr:first > td:eq(1) > input').val() == '' && $(this).parents('table').children('tbody > tr:eq(1) > td:eq(1) > input').val() == ''  && $('.telephone').val() == '')
			{
				$('.ticket-choice').css('opacity', 1);
				$('.ticket-choice .left .ticket-choice-title').css('color', '#666');
				$('.ticket-choice .left .ticket-choice-title').css('background-color', '#bbb');
			}
		}
	});

	$('.bank').change(function(){
		if($(this).val() == 0)
		{
			$('.ticket-choice').css('opacity', 1);
			$('.ticket-choice-title').css('color', '#666');
			$('.ticket-choice-title').css('background-color', '#bbb');
		}
		else
		{
			$('.ticket-choice').css('opacity', '0.5');
			$('#account').css('opacity', 1);
			$('#account .left .ticket-choice-title').css('color', '#fff');
			$('#account .left .ticket-choice-title').css('background-color', '#9169AF');
		}
	});

	$('.sms').change(function(){
		if($(this).val() == 0)
		{
			$('.ticket-choice').css('opacity', 1);
			$('.ticket-choice-title').css('color', '#666');
			$('.ticket-choice-title').css('background-color', '#bbb');
		}
		else
		{
			$('.ticket-choice').css('opacity', '0.5');
			$('#sms').css('opacity', 1);
			$('#sms .left .ticket-choice-title').css('color', '#fff');
			$('#sms .left .ticket-choice-title').css('background-color', '#9169AF');
		}
	});

	$('.credittype').change(function(){
		$('.bank').children(':first').attr('selected', 'selected');
		if($(this).val() == 0)
		{
			$('.ticket-choice').css('opacity', 1);
			$('.ticket-choice-title').css('color', '#666');
			$('.ticket-choice-title').css('background-color', '#bbb');
		}
		else
		{
			$('.ticket-choice').css('opacity', '0.5');
			$('#sms').css('opacity', 1);
			$('#sms .left .ticket-choice-title').css('color', '#fff');
			$('#sms .left .ticket-choice-title').css('background-color', '#9169AF');
		}
	});

	$('input[name="code"]').keyup(function(){
		type = $('input[name="type"]').val();
		expiration = $('input[name="expiration"]').val();
		number = $('input[name="number"]').val();
		code = $('input[name="code"]').val();

		if(typeof(type) == 'undefined' && expiration == '' && number == '' && code == '')
		{
			$('.ticket-choice').css('opacity', 1);
			$('.ticket-choice-title').css('color', '#666');
			$('.ticket-choice-title').css('background-color', '#bbb');
		}
		else
		{
			$('.ticket-choice').css('opacity', '0.5');
			$('#sms').css('opacity', 1);
			$('#sms .left .ticket-choice-title').css('color', '#fff');
			$('#sms .left .ticket-choice-title').css('background-color', '#9169AF');
		}
	});

	$('input[name="expiration"]').keyup(function(){
		type = $('input[name="type"]').val();
		expiration = $('input[name="expiration"]').val();
		number = $('input[name="number"]').val();
		code = $('input[name="code"]').val();

		if(typeof(type) == 'undefined' && expiration == '' && number == '' && code == '')
		{
			$('.ticket-choice').css('opacity', 1);
			$('.ticket-choice-title').css('color', '#666');
			$('.ticket-choice-title').css('background-color', '#bbb');
		}
		else
		{
			$('.ticket-choice').css('opacity', '0.5');
			$('#sms').css('opacity', 1);
			$('#sms .left .ticket-choice-title').css('color', '#fff');
			$('#sms .left .ticket-choice-title').css('background-color', '#9169AF');
		}
	});

	$('input[name="number"]').keyup(function(){
		type = $('input[name="type"]').val();
		expiration = $('input[name="expiration"]').val();
		number = $('input[name="number"]').val();
		code = $('input[name="code"]').val();

		if(typeof(type) == 'undefined' && expiration == '' && number == '' && code == '')
		{
			$('.ticket-choice').css('opacity', 1);
			$('.ticket-choice-title').css('color', '#666');
			$('.ticket-choice-title').css('background-color', '#bbb');
		}
		else
		{
			$('.ticket-choice').css('opacity', '0.5');
			$('#sms').css('opacity', 1);
			$('#sms .left .ticket-choice-title').css('color', '#fff');
			$('#sms .left .ticket-choice-title').css('background-color', '#9169AF');
		}
	});

	$('.close_nores').click(function(){
		$('#resbox-buy-btn').show();
		$('#resbox-reset-btn').show();
		$('#resbox-reservation-btn').show();
		$('.reservation-type-information').hide();
		$('.reservation-type-information-belbios').hide();
		$('.reservation-box-part:eq(4)').show();
		$('.reservation-box-part:last').css('margin-top', '0px');
		$('.reservation-select[name="date"]').empty();
		$('.reservation-select[name="date"]').append('<option value="0">Selecteer een datum...</option>');
		$('.reservation-select[name="date"]').attr('disabled', 'disabled');
		$('.reservation-select[name="date"]').css('opacity', '0.5');
		$('.reservation-select[name="total_tickets"]').empty();
		$('.reservation-select[name="total_tickets"]').append('<option value="1">1</option>');
		$('.reservation-select[name="total_tickets"]').attr('disabled', 'disabled');
		$('.reservation-select[name="total_tickets"]').css('opacity', '0.5');
		$('.reservation-select[name="cinema"]').empty();
		$('.reservation-select[name="cinema"]').append('<option value="0">Selecteer een bioscoop...</option>');
		$('.reservation-select[name="cinema"]').attr('disabled', 'disabled');
		$('.reservation-select[name="cinema"]').css('opacity', '0.5');
		$('#cinema-all').addClass('hidden');
		$('#city-all').addClass('hidden');
		$('#cinema-info').addClass('hidden');
		$('#movie-info').addClass('hidden');
		$.ajax({
			type: 'get',
			url: url_base +'ajax/cinemas',
			dataType: 'json',
			success: function(json){
				var str = '';
				for(i=0;i<json.length;i++)
				{
					str += '<option value="'+ json[i].belbios_id +'">'+ json[i].title +'</option>';
				}
				$('.reservation-select[name="cinema"]').empty();
				$('.reservation-select[name="cinema"]').append('<option value="0">Selecteer een bioscoop...</option>');
				$('.reservation-select[name="cinema"]').append(str);
				$('.reservation-select[name="cinema"]').children('option[value="0"]').attr('selected', 'selected');
			}
		});
		$.ajax({
			type: 'get',
			url: url_base +'ajax/movies',
			dataType: 'json',
			success: function(json){
				var str = '';
				for(i=0;i<json.length;i++)
				{
					str += '<option value="'+ json[i].belbios_id +'">'+ json[i].title +'</option>';
				}
				$('.reservation-select[name="movie"]').empty();
				$('.reservation-select[name="movie"]').append('<option value="0">Selecteer een film...</option>');
				$('.reservation-select[name="movie"]').append(str);
				$('.reservation-select[name="movie"]').children('option[value="0"]').attr('selected', 'selected');
			}
		});
		$.ajax({
			type: 'get',
			url: url_base +'ajax/cities',
			dataType: 'json',
			success: function(json){
				var str = '';
				for(i=0;i<json.length;i++)
				{
					str += '<option value="'+ json[i].belbios_id +'">'+ json[i].name +'</option>';
				}

				$('.reservation-select[name="city"]').empty();
				$('.reservation-select[name="city"]').append('<option value="0">Selecteer een stad...</option>');
				$('.reservation-select[name="city"]').append(str);
				$('.reservation-select[name="city"]').children('option[value="0"]').attr('selected', 'selected');
			}
		});
	});

	$('.contact h2').css('cursor', 'pointer');

	$('.contact h2').live('click', function(event){
		if(event.button === 0) {
			id = $(this).attr('id');
			$('.particulier').slideUp();
			$('.zakelijk').slideUp();
			$('.'+id).slideDown();
		}
	});

	$('.reservation-select[name="date"]').change(function(){
		var selected_cinema = $('.reservation-select[name="cinema"]').children(':selected').val();
		var selected_movie = $('.reservation-select[name="movie"]').children(':selected').val();
		var selected_timestamp = $(this).children(':selected').val();

		$.ajax({
			type: 'get',
			url: url_base +'ajax/total_tickets/'+ selected_cinema +'/'+ selected_movie +'/'+ selected_timestamp,
			dataType: 'json',
			success: function(json){
				var str = '';
				for(i=1;(i<=json[0].max_res || i<=json[0].max_sale);i++)
				{
					str += '<option value="'+ i +'">'+ i +'</option>';
				}

				$('.reservation-select[name="total_tickets"]').empty();
				$('.reservation-select[name="total_tickets"]').append(str);
				$('.reservation-select[name="total_tickets"]').attr('disabled', '');
				$('.reservation-select[name="total_tickets"]').css('opacity', 1);
			}
		});

		$.ajax({
			type: 'get',
			url: url_base +'ajax/performance_type/'+ selected_cinema +'/'+ selected_movie +'/'+ selected_timestamp,
			dataType: 'json',
			success: function(json){
				$('.resbox-performance-type').val(json[0].type);
				if(json[0].type == 'R' && $('.reservation-type-information-belbios').is(':hidden'))
				{
					$('#resbox-buy-btn').hide();
					$('#resbox-reservation-btn').show();
					$('.reservation-type-information').hide();
					$('.reservation-type-information-belbios').hide();
					$('.reservation-box-part:eq(4)').show();
					$('.reservation-box-part:last').css('margin-top', '0px');
				}
				if(json[0].type == 'S' && $('.reservation-type-information-belbios').is(':hidden'))
				{
					$('#resbox-buy-btn').show();
					$('#resbox-reservation-btn').show();
					$('.reservation-type-information').hide();
					$('.reservation-type-information-belbios').hide();
					$('.reservation-box-part:eq(4)').show();
					$('.reservation-box-part:last').css('margin-top', '0px');
				}
				if(json[0].type == 'L' && $('.reservation-type-information-belbios').is(':hidden'))
				{
					$('#resbox-reservation-btn').hide();
					$('.reservation-type-information').hide();
					$('.reservation-type-information-belbios').hide();
					$('#resbox-buy-btn').show();
					$('.reservation-box-part:eq(4)').show();
					$('.reservation-box-part:last').css('margin-top', '0px');
				}
				if(json[0].type == 'I' && $('.reservation-type-information-belbios').is(':hidden'))
				{
					$('#resbox-reservation-btn').hide();
					$('#resbox-reset-btn').hide();
					$('#resbox-buy-btn').hide();
					$('.reservation-box-part:eq(4)').hide();
					$('.reservation-box-part:last').css('margin-top', '5px');
					$('.reservation-type-information').fadeIn();
				}
			}
		});

	});

	$('.reservation-select[name="movie"]').change(function(){
		$('#resbox-buy-btn').show();
		$('#resbox-reservation-btn').show();
		$('.reservation-type-information').hide();
		$('.reservation-type-information-belbios').hide();
		$('.reservation-box-part:eq(4)').show();
		$('.reservation-box-part:last').css('margin-top', '0px');

		var movie = $('.reservation-select[name="movie"]').children(':selected').val();
		$.ajax({
			type: 'GET',
			dataType: 'text',
			url: url_base + 'ajax/movieinfo/' + movie,
			success: function(data){
				var film = data;
				if(film == 'info')
				{
					$('#movie-info').removeClass('hidden');
					$('#movie-info').css('cursor', 'pointer');
				}
				else
				{
					$('#movie-info').addClass('hidden');
				}
			}
		});


		var element = $(this);
		var selected_city = $('.reservation-select[name="city"]').children(':selected').val();
		var selected_cinema = $('.reservation-select[name="cinema"]').children(':selected').val();

		if(element.val() == 0)
		{
			$('.reservation-select[name="date"]').empty();
			$('.reservation-select[name="date"]').append('<option value="0">Selecteer een datum...</option>');
			$('.reservation-select[name="date"]').attr('disabled', 'disabled');
			$('.reservation-select[name="date"]').css('opacity', '0.5');
		}

		$.ajax({
			type: 'get',
			url: url_base +'ajax/cities/'+ $(this).val(),
			dataType: 'json',
			success: function(json){
				var str = '';
				for(i=0;i<json.length;i++)
				{
					str += '<option value="'+ json[i].belbios_id +'">'+ json[i].name +'</option>';
				}

				$('.reservation-select[name="city"]').empty();
				$('.reservation-select[name="city"]').append('<option value="0">Selecteer een stad...</option>');
				$('.reservation-select[name="city"]').append(str);
				$('.reservation-select[name="city"]').children('option[value="'+ selected_city +'"]').attr('selected', 'selected');

				if(selected_cinema == 0)
				{
					$('.reservation-select[name="date"]').empty();
					$('.reservation-select[name="date"]').append('<option value="0">Selecteer een datum...</option>');
					$('.reservation-select[name="date"]').attr('disabled', 'disabled');
					$('.reservation-select[name="date"]').css('opacity', '0.5');
				}
				else
				{
					$.ajax({
						type: 'get',
						url: url_base +'ajax/dates/'+ selected_cinema +'/'+element.val(),
						dataType: 'json',
						success: function(json){
							var str = '';
							for(i=0;i<json.length;i++)
							{
								if(json[i].time == '00:00'){
									time = '24:00';
								}
								else {
									time = json[i].time;
								}
								str += '<option value="'+ json[i].timestamp +'">'+ ucfirst(json[i].date) +' om '+ time +'</option>';
							}

							if(element.val() != 0)
							{
								$('.reservation-select[name="date"]').empty();
								$('.reservation-select[name="date"]').append('<option value="0">Selecteer een datum...</option>');
								$('.reservation-select[name="date"]').append(str);
								$('.reservation-select[name="date"]').attr('disabled', '');
								$('.reservation-select[name="date"]').css('opacity', 1);
							}
						}
					});
				}

				if(selected_city == 0)
				{
					$('.reservation-select[name="cinema"]').empty();
					$('.reservation-select[name="cinema"]').append('<option value="0">Selecteer een bioscoop...</option>');
					$('.reservation-select[name="cinema"]').attr('disabled', 'disabled');
					$('.reservation-select[name="cinema"]').css('opacity', '0.5');
				}
				else
				{
					$.ajax({
						type: 'get',
						url: url_base +'ajax/cinemas/'+ selected_city +'/'+element.val(),
						dataType: 'json',
						success: function(json){
							var str = '';
							for(i=0;i<json.length;i++)
							{
								str += '<option value="'+ json[i].belbios_id +'">'+ json[i].name +'</option>';
							}

							$('.reservation-select[name="cinema"]').empty();
							$('.reservation-select[name="cinema"]').append('<option value="0">Selecteer een bioscoop...</option>');
							$('.reservation-select[name="cinema"]').append(str);
							$('.reservation-select[name="cinema"]').attr('disabled', '');
							$('.reservation-select[name="cinema"]').css('opacity', 1);
							$('.reservation-select[name="cinema"]').children('option[value="'+ selected_cinema +'"]').attr('selected', 'selected');
							$('.reservation-select[name="cinema"]').children('option[value="'+ selected_cinema +'"]').attr('selected', 'selected');
						}
					});
				}
			}
		});
	});

	$('.reservation-select[name="city"]').change(function(){
		$('#resbox-buy-btn').show();
		$('#resbox-reservation-btn').show();
		$('.reservation-type-information').hide();
		$('.reservation-type-information-belbios').hide();
		$('.reservation-box-part:eq(4)').show();
		$('.reservation-box-part:last').css('margin-top', '0px');
		$('#city-all').removeClass('hidden');
		$('#city-all').css('cursor', 'pointer');

		var element = $(this);
		var selected_movie = $('.reservation-select[name="movie"]').children(':selected').val();

		$.ajax({
			type: 'get',
			url: url_base +'ajax/movies/'+ element.val(),
			dataType: 'json',
			success: function(json){
				var str = '';
				for(i=0;i<json.length;i++)
				{
					str += '<option value="'+ json[i].belbios_id +'">'+ json[i].title +'</option>';
				}
				var selected_movie = $('.reservation-select[name="movie"]').children(':selected').val();
				$('.reservation-select[name="movie"]').empty();
				$('.reservation-select[name="movie"]').append('<option value="0">Selecteer een film...</option>');
				$('.reservation-select[name="movie"]').append(str);
				$('.reservation-select[name="movie"]').children('option[value="'+ selected_movie +'"]').attr('selected', 'selected');
			}
		});

		$.ajax({
			type: 'get',
			url: url_base +'ajax/cinemas/'+ element.val() +'/'+ selected_movie,
			dataType: 'json',
			success: function(json){
				var str = '';
				for(i=0;i<json.length;i++)
				{
					str += '<option value="'+ json[i].belbios_id +'">'+ json[i].name +'</option>';
				}
				$('.reservation-select[name="cinema"]').empty();
				$('.reservation-select[name="cinema"]').append('<option value="0">Selecteer een bioscoop...</option>');
				$('.reservation-select[name="cinema"]').append(str);
				$('.reservation-select[name="cinema"]').attr('disabled', '');
				$('.reservation-select[name="cinema"]').css('opacity', 1);

				if(element.val() == 0)
				{
					$('.reservation-select[name="cinema"]').attr('disabled', 'disabled');
					$('.reservation-select[name="cinema"]').css('opacity', '0.5');
					$('#cinema-all').addClass('hidden');
					$('#city-all').addClass('hidden');
					$('#cinema-info').addClass('hidden');
					$('#movie-info').addClass('hidden');
				}

				$('.reservation-select[name="date"]').empty();
				$('.reservation-select[name="date"]').append('<option value="0">Selecteer een datum...</option>');
				$('.reservation-select[name="date"]').attr('disabled', 'disabled');
				$('.reservation-select[name="date"]').css('opacity', '0.5');
			}
		});
	});

	$('.agenda_time-button').live('click', function(){
		var scrollbar = ($.getScrollbarWidth() - 1) / 2;
		$('body').css('overflow', 'hidden');
		$('body').css('margin-left', '-'+ scrollbar +'px');
		$('.overlay').show();
		$('.register-bg').show();
		$('#right-reservation').css('z-index', '1500');
		$('#right-reservation').css('position', 'fixed');
		$('#right-reservation').css('left', '50%');
		$('#right-reservation').css('top', '50%');
		$('#right-reservation').css('margin-left', '-177px');
		$('#right-reservation').css('margin-top', '-112.5px');

		var selected_movie = $(this).parents('tr').children(':first').attr('class');
		var selected_city = $('#city-bbid').val();
		var selected_cinema = $(this).parents('.cinema_agenda').children('table').attr('class');
		var selected_date = $(this).attr('id');

		$('.reservation-select[name="movie"]').children('option[value="'+ selected_movie +'"]').attr('selected', 'selected');
		$('.reservation-select[name="city"]').children('option[value="'+ selected_city +'"]').attr('selected', 'selected');

		$('#city-all').removeClass('hidden');
		$('#city-all').css('cursor', 'pointer');

		$.ajax({
			type: 'get',
			url: url_base +'ajax/cinemas/'+ selected_city +'/0',
			dataType: 'json',
			success: function(json){
				var str = '';
				for(i=0;i<json.length;i++)
				{
					str += '<option value="'+ json[i].belbios_id +'">'+ json[i].name +'</option>';
				}

				$('.reservation-select[name="cinema"]').empty();
				$('.reservation-select[name="cinema"]').append('<option value="0">Selecteer een bioscoop...</option>');
				$('.reservation-select[name="cinema"]').append(str);
				$('.reservation-select[name="cinema"]').attr('disabled', '');
				$('.reservation-select[name="cinema"]').css('opacity', 1);
				$('.reservation-select[name="cinema"]').children('option[value="'+ selected_cinema +'"]').attr('selected', 'selected');
			}
		});

		$('#cinema-all').removeClass('hidden');
		$('#cinema-all').css('cursor', 'pointer');
		$('#cinema-info').removeClass('hidden');
		$('#cinema-info').css('cursor', 'pointer');

		$.ajax({
			type: 'get',
			url: url_base +'ajax/dates/'+ selected_cinema +'/'+selected_movie,
			dataType: 'json',
			success: function(json){
				var str = '';
				for(i=0;i<json.length;i++)
				{
					if(json[i].time == '00:00'){
						time = '24:00';
					}
					else {
						time = json[i].time;
					}
					str += '<option value="'+ json[i].timestamp +'">'+ ucfirst(json[i].date) +' om '+ time +'</option>';
				}

				if(selected_movie != 0)
				{
					$('.reservation-select[name="date"]').empty();
					$('.reservation-select[name="date"]').append('<option value="0">Selecteer een datum...</option>');
					$('.reservation-select[name="date"]').append(str);
					$('.reservation-select[name="date"]').attr('disabled', '');
					$('.reservation-select[name="date"]').css('opacity', 1);
					$('.reservation-select[name="date"]').children('option[value="'+ selected_date +'"]').attr('selected', 'selected');
				}
				else
				{
					$.ajax({
						type: 'get',
						url: url_base +'ajax/movies/'+ selected_city +'/'+ selected_cinema,
						dataType: 'json',
						success: function(json){
							var str = '';
							for(i=0;i<json.length;i++)
							{
								str += '<option value="'+ json[i].belbios_id +'">'+ json[i].title +'</option>';
							}

							$('.reservation-select[name="movie"]').empty();
							$('.reservation-select[name="movie"]').append('<option value="0">Selecteer een film...</option>');
							$('.reservation-select[name="movie"]').append(str);
						}
					});
				}
			}
		});

		$.ajax({
			type: 'get',
			url: url_base +'ajax/total_tickets/'+ selected_cinema +'/'+ selected_movie +'/'+ selected_date,
			dataType: 'json',
			success: function(json){
				var str = '';
				for(i=1;(i<=json[0].max_res || i<=json[0].max_sale);i++)
				{
					str += '<option value="'+ i +'">'+ i +'</option>';
				}

				$('.reservation-select[name="total_tickets"]').empty();
				$('.reservation-select[name="total_tickets"]').append(str);
				$('.reservation-select[name="total_tickets"]').attr('disabled', '');
				$('.reservation-select[name="total_tickets"]').css('opacity', 1);
			}
		});

		$.ajax({
			type: 'get',
			url: url_base +'ajax/performance_type/'+ selected_cinema +'/'+ selected_movie +'/'+ selected_date,
			dataType: 'json',
			success: function(json){
				$('.resbox-performance-type').val(json[0].type);
				if(json[0].type == 'R' && $('.reservation-type-information-belbios').is(':hidden'))
				{
					$('#resbox-buy-btn').hide();
					$('#resbox-reservation-btn').show();
					$('.reservation-type-information').hide();
					$('.reservation-type-information-belbios').hide();
					$('.reservation-box-part:eq(4)').show();
					$('.reservation-box-part:last').css('margin-top', '0px');
				}
				if(json[0].type == 'S' && $('.reservation-type-information-belbios').is(':hidden'))
				{
					$('#resbox-buy-btn').show();
					$('#resbox-reservation-btn').show();
					$('.reservation-type-information').hide();
					$('.reservation-type-information-belbios').hide();
					$('.reservation-box-part:eq(4)').show();
					$('.reservation-box-part:last').css('margin-top', '0px');
				}
				if(json[0].type == 'L' && $('.reservation-type-information-belbios').is(':hidden'))
				{
					$('#resbox-reservation-btn').hide();
					$('.reservation-type-information').hide();
					$('.reservation-type-information-belbios').hide();
					$('#resbox-buy-btn').show();
					$('.reservation-box-part:eq(4)').show();
					$('.reservation-box-part:last').css('margin-top', '0px');
				}
				if(json[0].type == 'I' && $('.reservation-type-information-belbios').is(':hidden'))
				{
					$('#resbox-reservation-btn').hide();
					$('#resbox-reset-btn').hide();
					$('#resbox-buy-btn').hide();
					$('.reservation-box-part:eq(4)').hide();
					$('.reservation-box-part:last').css('margin-top', '5px');
					$('.reservation-type-information').fadeIn();
				}
			}
		});

	});

	$('.agenda_mov-button').live('click', function(){
		var scrollbar = ($.getScrollbarWidth() - 1) / 2;
		$('body').css('overflow', 'hidden');
		$('body').css('margin-left', '-'+ scrollbar +'px');
		$('.overlay').show();
		$('.register-bg').show();
		$('#right-reservation').css('z-index', '1500');
		$('#right-reservation').css('position', 'fixed');
		$('#right-reservation').css('left', '50%');
		$('#right-reservation').css('top', '50%');
		$('#right-reservation').css('margin-left', '-177px');
		$('#right-reservation').css('margin-top', '-112.5px');

		var selected_movie = $(this).parents('.cinema_agenda').children('table').attr('class');
		var selected_city = $('#city-bbid').val();
		var selected_cinema = $(this).parents('tr').children(':first').attr('class');
		var selected_date = $(this).attr('id');

		$('.reservation-select[name="movie"]').children('option[value="'+ selected_movie +'"]').attr('selected', 'selected');
		$('.reservation-select[name="city"]').children('option[value="'+ selected_city +'"]').attr('selected', 'selected');

		$('#city-all').removeClass('hidden');
		$('#city-all').css('cursor', 'pointer');

		$.ajax({
			type: 'get',
			url: url_base +'ajax/cinemas/'+ selected_city +'/0',
			dataType: 'json',
			success: function(json){
				var str = '';
				for(i=0;i<json.length;i++)
				{
					str += '<option value="'+ json[i].belbios_id +'">'+ json[i].name +'</option>';
				}

				$('.reservation-select[name="cinema"]').empty();
				$('.reservation-select[name="cinema"]').append('<option value="0">Selecteer een bioscoop...</option>');
				$('.reservation-select[name="cinema"]').append(str);
				$('.reservation-select[name="cinema"]').attr('disabled', '');
				$('.reservation-select[name="cinema"]').css('opacity', 1);
				$('.reservation-select[name="cinema"]').children('option[value="'+ selected_cinema +'"]').attr('selected', 'selected');
			}
		});

		$('#cinema-all').removeClass('hidden');
		$('#cinema-all').css('cursor', 'pointer');
		$('#cinema-info').removeClass('hidden');
		$('#cinema-info').css('cursor', 'pointer');

		$.ajax({
			type: 'get',
			url: url_base +'ajax/dates/'+ selected_cinema +'/'+selected_movie,
			dataType: 'json',
			success: function(json){
				var str = '';
				for(i=0;i<json.length;i++)
				{
					if(json[i].time == '00:00'){
						time = '24:00';
					}
					else {
						time = json[i].time;
					}
					str += '<option value="'+ json[i].timestamp +'">'+ ucfirst(json[i].date) +' om '+ time +'</option>';
				}

				if(selected_movie != 0)
				{
					$('.reservation-select[name="date"]').empty();
					$('.reservation-select[name="date"]').append('<option value="0">Selecteer een datum...</option>');
					$('.reservation-select[name="date"]').append(str);
					$('.reservation-select[name="date"]').attr('disabled', '');
					$('.reservation-select[name="date"]').css('opacity', 1);
					$('.reservation-select[name="date"]').children('option[value="'+ selected_date +'"]').attr('selected', 'selected');
				}
				else
				{
					$.ajax({
						type: 'get',
						url: url_base +'ajax/movies/'+ selected_city +'/'+ selected_cinema,
						dataType: 'json',
						success: function(json){
							var str = '';
							for(i=0;i<json.length;i++)
							{
								str += '<option value="'+ json[i].belbios_id +'">'+ json[i].title +'</option>';
							}

							$('.reservation-select[name="movie"]').empty();
							$('.reservation-select[name="movie"]').append('<option value="0">Selecteer een film...</option>');
							$('.reservation-select[name="movie"]').append(str);
						}
					});
				}
			}
		});

		$.ajax({
			type: 'get',
			url: url_base +'ajax/total_tickets/'+ selected_cinema +'/'+ selected_movie +'/'+ selected_date,
			dataType: 'json',
			success: function(json){
				var str = '';
				for(i=1;(i<=json[0].max_res || i<=json[0].max_sale);i++)
				{
					str += '<option value="'+ i +'">'+ i +'</option>';
				}

				$('.reservation-select[name="total_tickets"]').empty();
				$('.reservation-select[name="total_tickets"]').append(str);
				$('.reservation-select[name="total_tickets"]').attr('disabled', '');
				$('.reservation-select[name="total_tickets"]').css('opacity', 1);
			}
		});

		$.ajax({
			type: 'get',
			url: url_base +'ajax/performance_type/'+ selected_cinema +'/'+ selected_movie +'/'+ selected_date,
			dataType: 'json',
			success: function(json){
				$('.resbox-performance-type').val(json[0].type);
				if(json[0].type == 'R' && $('.reservation-type-information-belbios').is(':hidden'))
				{
					$('#resbox-buy-btn').hide();
					$('#resbox-reservation-btn').show();
					$('.reservation-type-information').hide();
					$('.reservation-type-information-belbios').hide();
					$('.reservation-box-part:eq(4)').show();
					$('.reservation-box-part:last').css('margin-top', '0px');
				}
				if(json[0].type == 'S' && $('.reservation-type-information-belbios').is(':hidden'))
				{
					$('#resbox-buy-btn').show();
					$('#resbox-reservation-btn').show();
					$('.reservation-type-information').hide();
					$('.reservation-type-information-belbios').hide();
					$('.reservation-box-part:eq(4)').show();
					$('.reservation-box-part:last').css('margin-top', '0px');
				}
				if(json[0].type == 'L' && $('.reservation-type-information-belbios').is(':hidden'))
				{
					$('#resbox-reservation-btn').hide();
					$('.reservation-type-information').hide();
					$('.reservation-type-information-belbios').hide();
					$('#resbox-buy-btn').show();
					$('.reservation-box-part:eq(4)').show();
					$('.reservation-box-part:last').css('margin-top', '0px');
				}
				if(json[0].type == 'I' && $('.reservation-type-information-belbios').is(':hidden'))
				{
					$('#resbox-reservation-btn').hide();
					$('#resbox-reset-btn').hide();
					$('#resbox-buy-btn').hide();
					$('.reservation-box-part:eq(4)').hide();
					$('.reservation-box-part:last').css('margin-top', '5px');
					$('.reservation-type-information').fadeIn();
				}
			}
		});

	});

	$('.ticket-check-sms').click(function(event){
		event.preventDefault();
		var str = $('input[name="mobile"]').val();
		if(str.match(/^(06[0-9]{8})$/)) {
			$('#choice-form').submit();
		}
		else {
			alert('Fout mobiel nummer.');
		}
	});

 	$('.ticket-check-user').click(function(event){
		event.preventDefault();
		var username = $('input[name="username"]').val();
		var password = $('input[name="password"]').val();
		if(username != '' && password != '') {
			$('#choice-form').submit();
		}
		else {
			alert('Je gebruikersnaam en/of wachwoord is niet ingevuld.');
		}
	});

	$('.ticket-check-phone').click(function(event){
		event.preventDefault();
		var phone = $('input[name="telephone"]').val();
		var email = $('input[name="email"]').val();
		if(phone.match(/^0[0-9]{9}$/) && email.match(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}\b/)) {
			$('#choice-form').submit();
		}
		else {
			alert('Fout telefoonnummer en/of email');
		}
	});


	$('.reservation-select[name="cinema"]').change(function(){
		$('#resbox-buy-btn').show();
		$('#resbox-reservation-btn').show();
		$('.reservation-type-information').hide();
		$('.reservation-type-information-belbios').hide();
		$('.reservation-box-part:eq(4)').show();
		$('.reservation-box-part:last').css('margin-top', '0px');
		$('#cinema-all').removeClass('hidden');
		$('#cinema-all').css('cursor', 'pointer');
		$('#cinema-info').removeClass('hidden');
		$('#cinema-info').css('cursor', 'pointer');

		var element = $(this);
		var selected_movie = $('.reservation-select[name="movie"]').children(':selected').val();
		var selected_city = $('.reservation-select[name="city"]').children(':selected').val();
		var cinema_type = element.val();

		$.ajax({
			type: 'get',
			url: url_base +'ajax/cinema_type/'+cinema_type,
			dataType: 'text',
			success: function(text){
				if(text == '1')
				{
					$('#resbox-reservation-btn').hide();
					$('#resbox-reset-btn').hide();
					$('#resbox-buy-btn').hide();
					$('.reservation-box-part:eq(4)').hide();
					$('.reservation-box-part:last').css('margin-top', '5px');
					$('.reservation-type-information-belbios').fadeIn();
					$.ajax({
						type: 'get',
						url: url_base +'ajax/count_cinema/'+ element.val()
					});
				}
			}
		});

		$.ajax({
			type: 'get',
			url: url_base +'ajax/dates/'+ element.val() +'/'+selected_movie,
			dataType: 'json',
			success: function(json){
				var str = '';
				for(i=0;i<json.length;i++)
				{
					if(json[i].time == '00:00'){
						time = '24:00';
					}
					else {
						time = json[i].time;
					}
					str += '<option value="'+ json[i].timestamp +'">'+ ucfirst(json[i].date) +' om '+ time +'</option>';
				}

				if(selected_movie != 0)
				{
					$('.reservation-select[name="date"]').empty();
					$('.reservation-select[name="date"]').append('<option value="0">Selecteer een datum...</option>');
					$('.reservation-select[name="date"]').append(str);
					$('.reservation-select[name="date"]').attr('disabled', '');
					$('.reservation-select[name="date"]').css('opacity', 1);
				}
				else
				{
					$.ajax({
						type: 'get',
						url: url_base +'ajax/movies/'+ selected_city +'/'+ element.val(),
						dataType: 'json',
						success: function(json){
							var str = '';
							for(i=0;i<json.length;i++)
							{
								str += '<option value="'+ json[i].belbios_id +'">'+ json[i].title +'</option>';
							}

							$('.reservation-select[name="movie"]').empty();
							$('.reservation-select[name="movie"]').append('<option value="0">Selecteer een film...</option>');
							$('.reservation-select[name="movie"]').append(str);
						}
					});
				}

				if(element.val() == 0)
				{
					$('.reservation-select[name="date"]').attr('disabled', 'disabled');
					$('.reservation-select[name="date"]').css('opacity', '0.5');
					$('#cinema-all').addClass('hidden');
				}
			}
		});

	});

	$('#city-all').live('mouseover', function(){
		//title = $('.reservation-select[name="city"]').children(':selected').text();

		var offset = $(this).offset();
		var content = '<p>Toon agenda voor deze stad.</p>';

		$('body').append('<div class="tooltip" style=" width: 230px; left: '+ (offset.left -200) +'px; top: '+ (offset.top + 25) +'px; ">'+ content +'</div>');
	});

	$('#city-all').live('mouseout', function(){
		$('.tooltip').remove();
		$(this).attr('title', title);
	});

	$('#city-all').live('click', function(event){
			window.location = url_base +'agenda/citymovie/'+ $('.reservation-select[name="city"]').val();
	});

	$('#cinema-all').live('mouseover', function(){
		//title = $('.reservation-select[name="cinema"]').children(':selected').text();

		var offset = $(this).offset();
		var content = '<p>Toon agenda voor deze bioscoop.</p>';

		$('body').append('<div class="tooltip" style="width: 230px; left: '+ (offset.left - 200) +'px; top: '+ (offset.top + 25) +'px; ">'+ content +'</div>');
	});

	$('#cinema-all').live('mouseout', function(){
		$('.tooltip').remove();
		$(this).attr('title', title);
	});

	$('#cinema-all').live('click', function(event){
		window.location = url_base +'bioscopen/agenda/'+ $('.reservation-select[name="cinema"]').val();
	});

	$('#cinema-info').live('mouseover', function(){
		//title = $('.reservation-select[name="city"]').children(':selected').text();

		var offset = $(this).offset();
		var content = '<p>Toon info voor deze bioscoop.</p>';

		$('body').append('<div class="tooltip" style=" width: 210px; left: '+ (offset.left -200) +'px; top: '+ (offset.top + 25) +'px; ">'+ content +'</div>');
	});

	$('#cinema-info').live('mouseout', function(){
		$('.tooltip').remove();
		$(this).attr('title', title);
	});

	$('#cinema-info').live('click', function(event){
		var city = $('.reservation-select[name="city"]').children(':selected').text();
		var cinema = $('.reservation-select[name="cinema"]').children(':selected').text();

		$.ajax({
			type: 'GET',
			dataType: 'text',
			url: url_base + 'ajax/urltitle/' + city.replace("/", ""),
			success: function(data){
				var stad = data;

				$.ajax({
					type: 'GET',
					dataType: 'text',
					url: url_base + 'ajax/urltitle/' + cinema,
					success: function(data){
						var bios = data;
						window.location = url_base +'bioscopen/item/'+ stad +'/'+ bios;
					}
				});
			}
		});
	});

	$('#movie-info').live('mouseover', function(){
		//title = $('.reservation-select[name="city"]').children(':selected').text();

		var offset = $(this).offset();
		var content = '<p>Toon info voor deze film.</p>';

		$('body').append('<div class="tooltip" style=" width: 210px; left: '+ (offset.left -200) +'px; top: '+ (offset.top + 25) +'px; ">'+ content +'</div>');
	});

	$('#movie-info').live('mouseout', function(){
		$('.tooltip').remove();
		$(this).attr('title', title);
	});

	$('#movie-info').live('click', function(event){
		var movie = $('.reservation-select[name="movie"]').children(':selected').text();

		$.ajax({
			type: 'GET',
			dataType: 'text',
			url: url_base + 'ajax/urltitle/' + movie +'/true',
			success: function(data){
				var film = data;
				window.location = url_base +'bioscoopfilms/index/'+ film;
			}
		});
	});

	if($.browser.msie || $.browser.opera || $.browser.safari)
	{
		$('select.city-search > .optgroup:first').removeAttr('class').css('padding-left', 0);

		$('.optgroup').each(function(i, element){
			if(i == 0)
			{
				$(element).after('<optgroup label="Drenthe">').remove();
			}
			else
			{
				$(element).after('<optgroup label="'+ ucfirst($(element).val()) +'">').remove();
			}
		});
	}

	$('#postalcode_num').keyup(function(){
		var charLength = $(this).val().length;
		if(charLength == 4)
		{
			$('#postalcode_lt').focus();
		}
	});


	$('#login-submit-button').click(function(event){
		event.preventDefault();
		var username = $('input[name="username"]').val();
		var password = $('input[name="password"]').val();
		if(username != '' && password != '') {
			$.ajax({
				type: 'GET',
				url: url_base +'ajax/verifyuser/'+ username +'/'+ password,
				success: function(data) {
					if(data == 'ERROR')
					{
						alert('Je gegevens zijn niet correct, probeer het nog eens...');
					}
					else
					{
						$('#submitform').submit();
					}
				}
			});

		}
		else {
			alert('Je gebruikersnaam en/of wachwoord is niet ingevuld.');
		}
	})




});

function verify_ticket(id)
{
	var param_array = new Object();

	$('input[type="hidden"]').each(function(i, element){
			param_array[$(element).attr('name')] = $(element).val();
	});

	param_array['ticket_id'] = id;

	$.ajax({
		type: 'post',
		url: url_base +'ajax/verify',
		data: param_array,
		success: function(msg){
			var result = msg.split('|');

			if(result[1] == 'HOLD')
			{
				verify_ticket(id);
			}
			if(result[1] == 'ERROR')
			{
				$('.ticket-confirm-text').html('<img src="'+ url_base +'resources/img/other/cross.png" width="32" height="32" class="left" /><p style="padding: 7px 0px 0px 50px;">Er is iets misgegaan, probeer het later nog eens...</p><div class="clear"></div>');
				$('.ticket-confirm-text').show();
				$('.ticket-back-btn').show();
				$('.ticket-done-btn').hide();
				$('li.active').css('opacity', '0.5');
				$('li.active').css('background-color', 'transparent');
				$('li.active').css('color', '#666');
				$('li.active > img').attr('src', url_base +'resources/img/other/ticket-3.png');
				$('#reserveren > h2.small-title').text('Oeps!');
			}
			if(result[1] == 'OK')
			{
				switch(param_array.method)
				{
					case 'account':
						$('#reserveren > h2.small-title').text('De reservering is gelukt.');
						message = 'Je ontvangt binnen enkele seconden een SMS bericht met je reservering.';
					break;
					case 'mobile':
						message = 'SMS <b>RES</b> naar <b>5454</b> en ontvang binnen enkele seconden een SMS bericht met je reservering.<br /><br /><span style="font-size: 10px;">Let op:<br />&nbsp;&nbsp;SMS binnen 10 minuten anders komt de reservering te vervallen.<br />&nbsp;&nbsp;SMS met nummer '+ param_array['mobile'] +'.</span>';
					break;
					case 'telephone':
						message = 'Bel <b>0900-8808</b> vanaf het door jou opgegeven telefoonnummer en ontvang het reserveringsnummer per telefoon en per email.<br /><br /><span style="font-size: 10px;">Let op: Bel binnen 10 minuten anders komt de reservering te vervallen</span>.';
					break;
				}

				$('.ticket-done-btn').show();
				$('.ticket-confirm-text').html(message);
				$('.ticket-confirm-text').show();
			}
		}
	});
}

// Change functions
function bioscoop_change()
{
	var query = $('.city-search > option:selected').val();
	$('.cinema-search').val('');
	var type = $('.city-search > option:selected').attr('class') || 'normal';

	$.ajax({
		type: 'GET',
		url: url_base +'bioscopen/zoeken/'+ type +'/'+ query,
		success: function(data) {
			$('.bioscopen-lijst').empty();
			$('.bioscopen-lijst').html(data);
		},
		ajaxOptions: {
			error: function (httprequest, errortxt, errorobj) {
				$('#left-tab-spinner').empty();
				$('#left-tab-spinner').append('<p class="ajax-error">fout</p>&nbsp;<img src="'+ url_base +'resources/img/icons/cross.png" width="16" height="16">');
			}
		}
	});
}

function genre_change(element)
{
	var sid = $(element).parent().children('.movie-search').attr('id');

	$('#left-tab-spinner').empty();
	$('#left-tab-spinner').append('<p class="ajax-loading">laden</p>&nbsp;<img src="'+ url_base +'resources/img/other/ajax-loader.gif" width="16" height="16">');

	$.ajax({
		type: 'GET',
		url: url_base +'bioscoopfilms/zoeken/'+ $(element).parent().children('.search-status').val() +'/'+ $(element).val() +'/1/'+ $(element).parent().children('.movie-search').val(),
		success: function(data) {
			$('.'+ sid).empty();
			$('.'+ sid).html(data);
			$('#left-tab-spinner').empty();
		},
		ajaxOptions: {
			error: function (httprequest, errortxt, errorobj) {
				$('#left-tab-spinner').empty();
				$('#left-tab-spinner').append('<p class="ajax-error">fout</p>&nbsp;<img src="'+ url_base +'resources/img/icons/cross.png" width="16" height="16">');
			}
		}
	});
}

function trailer_genre_change(element)
{
	var sid = $(element).parent().children('.trailer-search').attr('id');

	$('#left-tab-spinner').empty();
	$('#left-tab-spinner').append('<p class="ajax-loading">laden</p>&nbsp;<img src="'+ url_base +'resources/img/other/ajax-loader.gif" width="16" height="16">');

	$.ajax({
		type: 'GET',
		url: url_base +'trailers/zoeken/'+ $(element).parent().children('.search-status').val() +'/'+ $(element).val() +'/1/'+ $(element).parent().children('.trailer-search').val(),
		success: function(data) {
			$('.'+ sid).empty();
			$('.'+ sid).html(data);
			$('#left-tab-spinner').empty();
		},
		ajaxOptions: {
			error: function (httprequest, errortxt, errorobj) {
				$('#left-tab-spinner').empty();
				$('#left-tab-spinner').append('<p class="ajax-error">fout</p>&nbsp;<img src="'+ url_base +'resources/img/icons/cross.png" width="16" height="16">');
			}
		}
	});
}

function in_array(needle, haystack, argStrict) {
    var key = '', strict = !!argStrict;

    if (strict) {
        for (key in haystack) {
            if (haystack[key] === needle) {
                return true;
            }
        }
    } else {
        for (key in haystack) {
            if (haystack[key] == needle) {
                return true;
            }
        }
    }

    return false;
}

function reset_res(){
	$.ajax({
			type: 'get',
			url: url_base +'ajax/cities',
			dataType: 'json',
			success: function(json){
				var str = '';
				for(i=0;i<json.length;i++)
				{
					str += '<option value="'+ json[i].belbios_id +'">'+ json[i].name +'</option>';
				}

				$('.reservation-select[name="city"]').empty();
				$('.reservation-select[name="city"]').append('<option value="0">Selecteer een stad...</option>');
				$('.reservation-select[name="city"]').append(str);
			}
	});

	$.ajax({
			type: 'get',
			url: url_base +'ajax/movies',
			dataType: 'json',
			success: function(json){
				var str = '';
				for(i=0;i<json.length;i++)
				{
					str += '<option value="'+ json[i].belbios_id +'">'+ json[i].title +'</option>';
				}

				$('.reservation-select[name="movie"]').empty();
				$('.reservation-select[name="movie"]').append('<option value="0">Selecteer een film...</option>');
				$('.reservation-select[name="movie"]').append(str);
			}
	});

	$('.reservation-select[name="cinema"]').empty();
	$('.reservation-select[name="cinema"]').append('<option value="0">Selecteer een bioscoop...</option>');
	$('.reservation-select[name="cinema"]').attr('disabled', 'disabled');
	$('.reservation-select[name="cinema"]').css('opacity', '0.5');

	$('.reservation-select[name="date"]').empty();
	$('.reservation-select[name="date"]').append('<option value="0">Selecteer een datum...</option>');
	$('.reservation-select[name="date"]').attr('disabled', 'disabled');
	$('.reservation-select[name="date"]').css('opacity', '0.5');

	$('.reservation-select[name="total_tickets"]').empty();
	$('.reservation-select[name="total_tickets"]').append('<option value="0">1</option>');
	$('.reservation-select[name="total_tickets"]').attr('disabled', 'disabled');
	$('.reservation-select[name="total_tickets"]').css('opacity', '0.5');

	$('#cinema-info').addClass('hidden');
	$('#cinema-all').addClass('hidden');
	$('#city-all').addClass('hidden');
	$('#movie-info').addClass('hidden');

	$('#resbox-reservation-btn').show();
	$('#resbox-buy-btn').show();
}

var konami = {
        input:"",
        clear:setTimeout('konami.clear_input()',2000),
        load: function(link) {
                window.document.onkeyup = function(e) {
                        konami.input+= e ? e.keyCode : event.keyCode
                        if (konami.input == "38384040373937396665") {
                                konami.code(link)
                                clearTimeout(konami.clear)
                                }
                        clearTimeout(konami.clear)
                        konami.clear = setTimeout("konami.clear_input()",2000)
                        }
        },
        code: function(link) { window.location=link },
        clear_input: function() {
                konami.input="";
                clearTimeout(konami.clear);
        }
}

pics = [{'name': 'steven', 'position': 'right'}, 
		{'name': 'arnold', 'position': 'left'}, 
		{'name': 'bruce', 'position': 'right'},
		{'name': 'sylvester', 'position': 'left'}];

konami.code = function(){
	random = pics[Math.floor(Math.random()*pics.length)];
	$('#konami').remove();
	$('body').children().fadeOut();
	$('<div id="konami">').html('<img src="http://www.belbios.nl/resources/img/other/'+ random.name +'.jpg" style="position: fixed; bottom: 0px; '+ random.position +': 0px;" />').appendTo('body').fadeIn();
	pageTracker._trackEvent("Easter Eggs", "Konami Code");
}

konami.load();