﻿/*
 * jQuery JavaScript Library v1.3.1
 * http://jquery.com/
 *
 * Copyright (c) 2009 John Resig
 * Dual licensed under the MIT and GPL licenses.
 * http://docs.jquery.com/License
 *
 * Date: 2009-01-21 20:42:16 -0500 (Wed, 21 Jan 2009)
 * Revision: 6158
 */
(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)})}});
/*
 * Sizzle CSS Selector Engine - v0.9.3
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
(function(){var 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(){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 MibAjaxCache()
{
}
MibAjaxCache.prototype.items = this.items = Array();
MibAjaxCache.prototype.Add = function(item)
{
this.items.push(item);
}
MibAjaxCache.prototype.Get = function(url)
{
for (var i = 0; i < this.items.length; i++)
{
if (this.items[i].cacheKey == url)
{
return this.items[i];
}
}
return null;
}
function MibAjaxManager()
{
}
MibAjaxManager.prototype.CreateLoading = function() { };
MibAjaxManager.prototype.DestroyLoading = function() { };
MibAjaxManager.prototype.DefaultRequestError = function(xhr, desc, ex) { };
MibAjaxManager.prototype.Cache = new MibAjaxCache();
MibAjaxManager.prototype.Get = function(url, useCache, beginRequest, parseRequest, endRequest, requestError, contentType) {
var urlPath = url.toString().split(/\?/)[0];
var data = url.toString().split(/\?/)[1];
if (!contentType) contentType = 'html';
if (!data) data = {}; // FDB: jQuery breaks if you use POST with undefined data
var item =
{
beforeSend: beginRequest,
type: "POST",
cacheKey: url,
url: urlPath,
data: data,
error: requestError,
complete: endRequest,
cache: useCache,
success: parseRequest,
dataType: contentType
}
if (useCache) {
var ajaxItem = this.Cache.Get(url);
if (ajaxItem) {
if (ajaxItem.beforeSend) ajaxItem.beforeSend();
ajaxItem.success(ajaxItem.content);
if (ajaxItem.complete) ajaxItem.complete();
}
else {
this.Cache.Add(item);
$.ajax(item);
}
}
else {
$.ajax(item);
}
}
MibAjaxManager.prototype.GetContent = function(url, target, useCache, beginRequest, endRequest, requestError)
{
this.Get(
url,
useCache,
beginRequest ? function() { beginRequest(); mibAjaxManager.CreateLoading(); } : this.CreateLoading,
function(content)
{
$(target).html(content);
this.content = content;
},
endRequest ? function() { endRequest(); mibAjaxManager.DestroyLoading(); } : this.DestroyLoading,
requestError == null ? mibAjaxManager.DefaultRequestError : requestError,
'html'
);
}
MibAjaxManager.prototype.GetContentAfter = function(url, target, useCache, beginRequest, endRequest, requestError) {
this.Get(
url,
useCache,
beginRequest ? function() { beginRequest(); mibAjaxManager.CreateLoading(); } : this.CreateLoading,
function(content) {
$(target).after(content);
this.content = content;
},
endRequest ? function() { endRequest(); mibAjaxManager.DestroyLoading(); } : this.DestroyLoading,
requestError == null ? mibAjaxManager.DefaultRequestError : requestError,
'html'
);
}
MibAjaxManager.prototype.GetContentBefore = function(url, target, useCache, beginRequest, endRequest, requestError) {
this.Get(
url,
useCache,
beginRequest ? function() { beginRequest(); mibAjaxManager.CreateLoading(); } : this.CreateLoading,
function(content) {
$(target).before(content);
this.content = content;
},
endRequest ? function() { endRequest(); mibAjaxManager.DestroyLoading(); } : this.DestroyLoading,
requestError == null ? mibAjaxManager.DefaultRequestError : requestError,
'html'
);
}
MibAjaxManager.prototype.GetJson = function(url, callback, useCache, beginRequest, endRequest, requestError)
{
this.Get(
url,
useCache,
beginRequest ? function() { beginRequest(); mibAjaxManager.CreateLoading(); } : this.CreateLoading,
callback,
endRequest ? function() { endRequest(); mibAjaxManager.DestroyLoading(); } : this.DestroyLoading,
requestError == null ? mibAjaxManager.DefaultRequestError : requestError,
'json'
);
}
MibAjaxManager.prototype.GetScript = function(url, callback, useCache, beginRequest, endRequest, requestError)
{
this.Get(
url,
useCache,
beginRequest ? function() { beginRequest(); mibAjaxManager.CreateLoading(); } : this.CreateLoading,
callback,
endRequest ? function() { endRequest(); mibAjaxManager.DestroyLoading(); } : this.DestroyLoading,
requestError == null ? mibAjaxManager.DefaultRequestError : requestError,
'script'
);
}
var mibAjaxManager = new MibAjaxManager();
function Url() { }
Url.Build = function(selector, url) {
url = url ? url : "";
var list = jQuery(selector);
if (url.indexOf("?", 0) < 0) {
url += "?";
}
else {
url += "&";
}
for (var i = 0; i < list.length; i++) {
url += list[i].id + "=" + list[i].value;
if (i < list.length - 1) {
url += "&";
}
}
return url;
}
function MibTranslationManager() {
MibTranslationManager.prototype.Length = this.Length = 0;
MibTranslationManager.prototype.Items = new Array();
for (var i = 0; i < arguments.Length; i += 2) {
if (typeof (arguments[i + 1]) != 'undefined') {
this.Items[arguments[i]] = arguments[i + 1];
this.Length++;
}
}
MibTranslationManager.prototype.RemoveItem = function(section, key) {
var tmpValue;
var itemId = '';
if (section != null && section != '')
itemId += section + '/';
itemId += key;
if (typeof (this.Items[itemId.toLowerCase()]) != 'undefined') {
this.Length--;
tmpValue = this.Items[itemId.toLowerCase()];
delete this.Items[itemId.toLowerCase()];
}
return tmpValue;
}
MibTranslationManager.prototype.GetItem = function(section, key) {
var itemId = '';
if (section != null && section != '')
itemId += section + '/';
itemId += key;
return this.Items[itemId.toLowerCase()];
}
MibTranslationManager.prototype.SetItem = function(section, key, value) {
if (typeof (value) != 'undefined') {
var itemId = '';
if (section != null && section != '')
itemId += section + '/';
itemId += key;
if (typeof (this.Items[itemId.toLowerCase()]) == 'undefined') {
this.Length++;
}
this.Items[itemId.toLowerCase()] = value;
}
return value;
}
MibTranslationManager.prototype.HasItem = function(section, key) {
var itemId = '';
if (section != null && section != '')
itemId += section + '/';
itemId += key;
return typeof (this.Items[itemId.toLowerCase()]) != 'undefined';
}
}
var mibTranslation = new MibTranslationManager();
(function($) {
var _remove = $.fn.remove; $.fn.remove = function() { $("*", this).add(this).triggerHandler("remove"); return _remove.apply(this, arguments); }; function isVisible(element) {
function checkStyles(element) { var style = element.style; return (style.display != 'none' && style.visibility != 'hidden'); }
var visible = checkStyles(element); (visible && $.each($.dir(element, 'parentNode'), function() { return (visible = checkStyles(this)); })); return visible;
}
$.extend($.expr[':'], { data: function(a, i, m) { return $.data(a, m[3]); }, tabbable: function(a, i, m) { var nodeName = a.nodeName.toLowerCase(); return (a.tabIndex >= 0 && (('a' == nodeName && a.href) || (/input|select|textarea|button/.test(nodeName) && 'hidden' != a.type && !a.disabled)) && isVisible(a)); } }); $.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 }; function getter(namespace, plugin, method, args) {
function getMethods(type) { var methods = $[namespace][plugin][type] || []; return (typeof methods == 'string' ? methods.split(/,?\s+/) : methods); }
var methods = getMethods('getter'); if (args.length == 1 && typeof args[0] == 'string') { methods = methods.concat(getMethods('getterSetter')); }
return ($.inArray(method, methods) != -1);
}
$.widget = function(name, prototype) {
var namespace = name.split(".")[0]; name = name.split(".")[1]; $.fn[name] = function(options) {
var isMethodCall = (typeof options == 'string'), args = Array.prototype.slice.call(arguments, 1); if (isMethodCall && options.substring(0, 1) == '_') { return this; }
if (isMethodCall && getter(namespace, name, options, args)) { var instance = $.data(this[0], name); return (instance ? instance[options].apply(instance, args) : undefined); }
return this.each(function() { var instance = $.data(this, name); (!instance && !isMethodCall && $.data(this, name, new $[namespace][name](this, options))); (instance && isMethodCall && $.isFunction(instance[options]) && instance[options].apply(instance, args)); });
}; $[namespace][name] = function(element, options) { var self = this; this.widgetName = name; this.widgetEventPrefix = $[namespace][name].eventPrefix || name; this.widgetBaseClass = namespace + '-' + name; this.options = $.extend({}, $.widget.defaults, $[namespace][name].defaults, $.metadata && $.metadata.get(element)[name], options); this.element = $(element).bind('setData.' + name, function(e, key, value) { return self._setData(key, value); }).bind('getData.' + name, function(e, key) { return self._getData(key); }).bind('remove', function() { return self.destroy(); }); this._init(); }; $[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype); $[namespace][name].getterSetter = 'option';
}; $.widget.prototype = { _init: function() { }, destroy: function() { this.element.removeData(this.widgetName); }, option: function(key, value) {
var options = key, self = this; if (typeof key == "string") {
if (value === undefined) { return this._getData(key); }
options = {}; options[key] = value;
}
$.each(options, function(key, value) { self._setData(key, value); });
}, _getData: function(key) { return this.options[key]; }, _setData: function(key, value) { this.options[key] = value; if (key == 'disabled') { this.element[value ? 'addClass' : 'removeClass'](this.widgetBaseClass + '-disabled'); } }, enable: function() { this._setData('disabled', false); }, disable: function() { this._setData('disabled', true); }, _trigger: function(type, e, data) { var eventName = (type == this.widgetEventPrefix ? type : this.widgetEventPrefix + type); e = e || $.event.fix({ type: eventName, target: this.element[0] }); return this.element.triggerHandler(eventName, [e, data], this.options[type]); }
}; $.widget.defaults = { disabled: false }; $.ui = { plugin: { add: function(module, option, set) { var proto = $.ui[module].prototype; for (var i in set) { proto.plugins[i] = proto.plugins[i] || []; proto.plugins[i].push([option, set[i]]); } }, call: function(instance, name, args) {
var set = instance.plugins[name]; if (!set) { return; }
for (var i = 0; i < set.length; i++) { if (instance.options[set[i][0]]) { set[i][1].apply(instance.element, args); } }
}
}, cssCache: {}, css: function(name) {
if ($.ui.cssCache[name]) { return $.ui.cssCache[name]; }
var tmp = $('<div class="ui-gen">').addClass(name).css({ position: 'absolute', top: '-5000px', left: '-5000px', display: 'block' }).appendTo('body'); $.ui.cssCache[name] = !!((!(/auto|default/).test(tmp.css('cursor')) || (/^[1-9]/).test(tmp.css('height')) || (/^[1-9]/).test(tmp.css('width')) || !(/none/).test(tmp.css('backgroundImage')) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor')))); try { $('body').get(0).removeChild(tmp.get(0)); } catch (e) { }
return $.ui.cssCache[name];
}, disableSelection: function(el) { return $(el).attr('unselectable', 'on').css('MozUserSelect', 'none').bind('selectstart.ui', function() { return false; }); }, enableSelection: function(el) { return $(el).attr('unselectable', 'off').css('MozUserSelect', '').unbind('selectstart.ui'); }, hasScroll: function(e, a) {
if ($(e).css('overflow') == 'hidden') { return false; }
var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop', has = false; if (e[scroll] > 0) { return true; }
e[scroll] = 1; has = (e[scroll] > 0); e[scroll] = 0; return has;
}
}; $.ui.mouse = { _mouseInit: function() {
var self = this; this.element.bind('mousedown.' + this.widgetName, function(e) { return self._mouseDown(e); }); if ($.browser.msie) { this._mouseUnselectable = this.element.attr('unselectable'); this.element.attr('unselectable', 'on'); }
this.started = false;
}, _mouseDestroy: function() { this.element.unbind('.' + this.widgetName); ($.browser.msie && this.element.attr('unselectable', this._mouseUnselectable)); }, _mouseDown: function(e) {
(this._mouseStarted && this._mouseUp(e)); this._mouseDownEvent = e; var self = this, btnIsLeft = (e.which == 1), elIsCancel = (typeof this.options.cancel == "string" ? $(e.target).parents().add(e.target).filter(this.options.cancel).length : false); if (!btnIsLeft || elIsCancel || !this._mouseCapture(e)) { return true; }
this.mouseDelayMet = !this.options.delay; if (!this.mouseDelayMet) { this._mouseDelayTimer = setTimeout(function() { self.mouseDelayMet = true; }, this.options.delay); }
if (this._mouseDistanceMet(e) && this._mouseDelayMet(e)) { this._mouseStarted = (this._mouseStart(e) !== false); if (!this._mouseStarted) { e.preventDefault(); return true; } }
this._mouseMoveDelegate = function(e) { return self._mouseMove(e); }; this._mouseUpDelegate = function(e) { return self._mouseUp(e); }; $(document).bind('mousemove.' + this.widgetName, this._mouseMoveDelegate).bind('mouseup.' + this.widgetName, this._mouseUpDelegate); return false;
}, _mouseMove: function(e) {
if ($.browser.msie && !e.button) { return this._mouseUp(e); }
if (this._mouseStarted) { this._mouseDrag(e); return false; }
if (this._mouseDistanceMet(e) && this._mouseDelayMet(e)) { this._mouseStarted = (this._mouseStart(this._mouseDownEvent, e) !== false); (this._mouseStarted ? this._mouseDrag(e) : this._mouseUp(e)); }
return !this._mouseStarted;
}, _mouseUp: function(e) {
$(document).unbind('mousemove.' + this.widgetName, this._mouseMoveDelegate).unbind('mouseup.' + this.widgetName, this._mouseUpDelegate); if (this._mouseStarted) { this._mouseStarted = false; this._mouseStop(e); }
return false;
}, _mouseDistanceMet: function(e) { return (Math.max(Math.abs(this._mouseDownEvent.pageX - e.pageX), Math.abs(this._mouseDownEvent.pageY - e.pageY)) >= this.options.distance); }, _mouseDelayMet: function(e) { return this.mouseDelayMet; }, _mouseStart: function(e) { }, _mouseDrag: function(e) { }, _mouseStop: function(e) { }, _mouseCapture: function(e) { return true; }
}; $.ui.mouse.defaults = { cancel: null, distance: 1, delay: 0 };
})(jQuery);
(function($) {
$.widget("ui.tabs", {
_init: function() {
this._tabify(true);
},
destroy: function() {
var o = this.options;
this.list.unbind('.tabs')
.removeClass(o.navClass).removeData('tabs');
this.$tabs.each(function() {
var href = $.data(this, 'href.tabs');
if (href)
this.href = href;
var $this = $(this).unbind('.tabs');
$.each(['href', 'load', 'cache'], function(i, prefix) {
$this.removeData(prefix + '.tabs');
});
});
this.$lis.unbind('.tabs').add(this.$panels).each(function() {
if ($.data(this, 'destroy.tabs'))
$(this).remove();
else
$(this).removeClass([o.tabClass, o.selectedClass, o.deselectableClass,
o.disabledClass, o.panelClass, o.hideClass].join(' '));
});
if (o.cookie)
this._cookie(null, o.cookie);
},
_setData: function(key, value) {
if ((/^selected/).test(key))
this.select(value);
else {
this.options[key] = value;
this._tabify();
}
},
length: function() {
return this.$tabs.length;
},
_tabId: function(a) {
return a.title && a.title.replace(/\s/g, '_').replace(/[^A-Za-z0-9\-_:\.]/g, '')
|| this.options.idPrefix + $.data(a);
},
_sanitizeSelector: function(hash) {
return hash.replace(/:/g, '\\:'); // we need this because an id may contain a ":"
},
_cookie: function() {
var cookie = this.cookie || (this.cookie = 'ui-tabs-' + $.data(this.list[0]));
return $.cookie.apply(null, [cookie].concat($.makeArray(arguments)));
},
_tabify: function(init) {
this.list = this.element.is('div') ? this.element.children('ul:first, ol:first').eq(0) : this.element;
this.$lis = $('li:has(a[href])', this.list);
this.$tabs = this.$lis.map(function() { return $('a', this)[0]; });
this.$panels = $([]);
var self = this, o = this.options;
this.$tabs.each(function(i, a) {
if (a.hash && a.hash.replace('#', '')) // Safari 2 reports '#' for an empty hash
self.$panels = self.$panels.add(self._sanitizeSelector(a.hash));
else if ($(a).attr('href') != '#') { // prevent loading the page itself if href is just "#"
$.data(a, 'href.tabs', a.href); // required for restore on destroy
$.data(a, 'load.tabs', a.href); // mutable
var id = self._tabId(a);
a.href = '#' + id;
var $panel = $('#' + id);
if (!$panel.length) {
$panel = $(o.panelTemplate).attr('id', id).addClass(o.panelClass)
.insertAfter(self.$panels[i - 1] || self.list);
$panel.data('destroy.tabs', true);
}
self.$panels = self.$panels.add($panel);
}
else
o.disabled.push(i + 1);
});
if (init) {
if (this.element.is('div')) {
this.element.addClass('ui-tabs ui-widget ui-widget-content ui-corner-all');
}
this.list.addClass(o.navClass);
this.$lis.addClass(o.tabClass);
this.$panels.addClass(o.panelClass);
if (o.selected === undefined) {
if (location.hash) {
this.$tabs.each(function(i, a) {
if (a.hash == location.hash) {
o.selected = i;
return false; // break
}
});
}
else if (o.cookie) {
var index = parseInt(self._cookie(), 10);
if (index && self.$tabs[index]) o.selected = index;
}
else if (self.$lis.filter('.' + o.selectedClass).length)
o.selected = self.$lis.index( self.$lis.filter('.' + o.selectedClass)[0] );
}
o.selected = o.selected === null || o.selected !== undefined ? o.selected : 0; // first tab selected by default
o.disabled = $.unique(o.disabled.concat(
$.map(this.$lis.filter('.' + o.disabledClass),
function(n, i) { return self.$lis.index(n); } )
)).sort();
if ($.inArray(o.selected, o.disabled) != -1)
o.disabled.splice($.inArray(o.selected, o.disabled), 1);
this.$panels.addClass(o.hideClass);
this.$lis.removeClass(o.selectedClass);
if (o.selected !== null && this.$tabs.length) { // check for length avoids error when initializing empty list
this.$panels.eq(o.selected).removeClass(o.hideClass);
var classes = [o.selectedClass];
if (o.deselectable) classes.push(o.deselectableClass);
this.$lis.eq(o.selected).addClass(classes.join(' '));
var onShow = function() {
self._trigger('show', null,
self.ui(self.$tabs[o.selected], self.$panels[o.selected]));
};
if ($.data(this.$tabs[o.selected], 'load.tabs'))
this.load(o.selected, onShow);
else onShow();
}
var handleState = function(state, el) {
if (el.is(':not(.' + o.disabledClass + ')')) el.toggleClass('ui-state-' + state);
};
this.$lis.bind('mouseover.tabs mouseout.tabs', function() {
handleState('hover', $(this));
});
this.$tabs.bind('focus.tabs blur.tabs', function() {
handleState('focus', $(this).parents('li:first'));
});
$(window).bind('unload', function() {
self.$lis.add(self.$tabs).unbind('.tabs');
self.$lis = self.$tabs = self.$panels = null;
});
}
else
o.selected = this.$lis.index( this.$lis.filter('.' + o.selectedClass)[0] );
if (o.cookie) this._cookie(o.selected, o.cookie);
for (var i = 0, li; li = this.$lis[i]; i++)
$(li)[$.inArray(i, o.disabled) != -1 && !$(li).hasClass(o.selectedClass) ? 'addClass' : 'removeClass'](o.disabledClass);
if (o.cache === false) this.$tabs.removeData('cache.tabs');
var hideFx, showFx;
if (o.fx) {
if (o.fx.constructor == Array) {
hideFx = o.fx[0];
showFx = o.fx[1];
}
else hideFx = showFx = o.fx;
}
function resetStyle($el, fx) {
$el.css({ display: '' });
if ($.browser.msie && fx.opacity) $el[0].style.removeAttribute('filter');
}
var showTab = showFx ?
function(clicked, $show) {
$show.animate(showFx, showFx.duration || 'normal', function() {
$show.removeClass(o.hideClass);
resetStyle($show, showFx);
self._trigger('show', null, self.ui(clicked, $show[0]));
});
} :
function(clicked, $show) {
$show.removeClass(o.hideClass);
self._trigger('show', null, self.ui(clicked, $show[0]));
};
var hideTab = hideFx ?
function(clicked, $hide, $show) {
$hide.animate(hideFx, hideFx.duration || 'normal', function() {
$hide.addClass(o.hideClass);
resetStyle($hide, hideFx);
if ($show) showTab(clicked, $show, $hide);
});
} :
function(clicked, $hide, $show) {
$hide.addClass(o.hideClass);
if ($show) showTab(clicked, $show);
};
function switchTab(clicked, $li, $hide, $show) {
var classes = [o.selectedClass];
if (o.deselectable) classes.push(o.deselectableClass);
$li.removeClass('ui-state-default').addClass(classes.join(' '))
.siblings().removeClass(classes.join(' ')).addClass('ui-state-default');
hideTab(clicked, $hide, $show);
}
this.$tabs.unbind('.tabs').bind(o.event + '.tabs', function() {
var $li = $(this).parents('li:eq(0)'),
$hide = self.$panels.filter(':visible'),
$show = $(self._sanitizeSelector(this.hash));
if (($li.hasClass('ui-state-active') && !o.deselectable)
|| $li.hasClass(o.disabledClass)
|| $(this).hasClass(o.loadingClass)
|| self._trigger('select', null, self.ui(this, $show[0])) === false
) {
this.blur();
return false;
}
o.selected = self.$tabs.index(this);
if (o.deselectable) {
if ($li.hasClass('ui-state-active')) {
self.options.selected = null;
$li.removeClass([o.selectedClass, o.deselectableClass].join(' ')).
addClass('ui-state-default');
self.$panels.stop();
hideTab(this, $hide);
this.blur();
return false;
} else if (!$hide.length) {
self.$panels.stop();
var a = this;
self.load(self.$tabs.index(this), function() {
$li.addClass([o.selectedClass, o.deselectableClass].join(' '))
.removeClass('ui-state-default');
showTab(a, $show);
});
this.blur();
return false;
}
}
if (o.cookie) self._cookie(o.selected, o.cookie);
self.$panels.stop();
if ($show.length) {
var a = this;
self.load(self.$tabs.index(this), $hide.length ?
function() {
switchTab(a, $li, $hide, $show);
} :
function() {
$li.addClass(o.selectedClass).removeClass('ui-state-default');
showTab(a, $show);
}
);
} else
throw 'jQuery UI Tabs: Mismatching fragment identifier.';
if ($.browser.msie) this.blur();
return false;
});
if (o.event != 'click') this.$tabs.bind('click.tabs', function(){return false;});
},
add: function(url, label, index) {
if (index == undefined)
index = this.$tabs.length; // append by default
var o = this.options;
var $li = $(o.tabTemplate.replace(/#\{href\}/g, url).replace(/#\{label\}/g, label));
$li.addClass(o.tabClass).data('destroy.tabs', true);
var id = url.indexOf('#') == 0 ? url.replace('#', '') : this._tabId( $('a:first-child', $li)[0] );
var $panel = $('#' + id);
if (!$panel.length) {
$panel = $(o.panelTemplate).attr('id', id)
.addClass(o.hideClass)
.data('destroy.tabs', true);
}
$panel.addClass(o.panelClass);
if (index >= this.$lis.length) {
$li.appendTo(this.list);
$panel.appendTo(this.list[0].parentNode);
}
else {
$li.insertBefore(this.$lis[index]);
$panel.insertBefore(this.$panels[index]);
}
o.disabled = $.map(o.disabled,
function(n, i) { return n >= index ? ++n : n });
this._tabify();
if (this.$tabs.length == 1) {
$li.addClass(o.selectedClass);
$panel.removeClass(o.hideClass);
var href = $.data(this.$tabs[0], 'load.tabs');
if (href) this.load(index, href);
}
this._trigger('add', null, this.ui(this.$tabs[index], this.$panels[index]));
},
remove: function(index) {
var o = this.options, $li = this.$lis.eq(index).remove(),
$panel = this.$panels.eq(index).remove();
if ($li.hasClass(o.selectedClass) && this.$tabs.length > 1)
this.select(index + (index + 1 < this.$tabs.length ? 1 : -1));
o.disabled = $.map($.grep(o.disabled, function(n, i) { return n != index; }),
function(n, i) { return n >= index ? --n : n });
this._tabify();
this._trigger('remove', null, this.ui($li.find('a')[0], $panel[0]));
},
enable: function(index) {
var o = this.options;
if ($.inArray(index, o.disabled) == -1)
return;
var $li = this.$lis.eq(index).removeClass(o.disabledClass);
if ($.browser.safari) { // fix disappearing tab (that used opacity indicating disabling) after enabling in Safari 2...
$li.css('display', 'inline-block');
setTimeout(function() {
$li.css('display', 'block');
}, 0);
}
o.disabled = $.grep(o.disabled, function(n, i) { return n != index; });
this._trigger('enable', null, this.ui(this.$tabs[index], this.$panels[index]));
},
disable: function(index) {
var self = this, o = this.options;
if (index != o.selected) { // cannot disable already selected tab
this.$lis.eq(index).addClass(o.disabledClass);
o.disabled.push(index);
o.disabled.sort();
this._trigger('disable', null, this.ui(this.$tabs[index], this.$panels[index]));
}
},
select: function(index) {
if (typeof index == 'string')
index = this.$tabs.index( this.$tabs.filter('[href$=' + index + ']')[0] );
this.$tabs.eq(index).trigger(this.options.event + '.tabs');
},
load: function(index, callback) { // callback is for internal usage only
var self = this, o = this.options, $a = this.$tabs.eq(index), a = $a[0],
bypassCache = callback == undefined || callback === false, url = $a.data('load.tabs');
callback = callback || function() {};
if (!url || !bypassCache && $.data(a, 'cache.tabs')) {
callback();
return;
}
var inner = function(parent) {
var $parent = $(parent), $inner = $parent.find('*:last');
return $inner.length && $inner.is(':not(img)') && $inner || $parent;
};
var cleanup = function() {
self.$tabs.filter('.' + o.loadingClass).removeClass(o.loadingClass)
.each(function() {
if (o.spinner)
inner(this).parent().html(inner(this).data('label.tabs'));
});
self.xhr = null;
};
if (o.spinner) {
var label = inner(a).html();
inner(a).wrapInner('<em></em>')
.find('em').data('label.tabs', label).html(o.spinner);
}
var ajaxOptions = $.extend({}, o.ajaxOptions, {
url: url,
success: function(r, s) {
$(self._sanitizeSelector(a.hash)).html(r);
cleanup();
if (o.cache)
$.data(a, 'cache.tabs', true); // if loaded once do not load them again
self._trigger('load', null, self.ui(self.$tabs[index], self.$panels[index]));
try {
o.ajaxOptions.success(r, s);
}
catch (er) {}
callback();
}
});
if (this.xhr) {
this.xhr.abort();
cleanup();
}
$a.addClass(o.loadingClass);
self.xhr = $.ajax(ajaxOptions);
},
url: function(index, url) {
this.$tabs.eq(index).removeData('cache.tabs').data('load.tabs', url);
},
ui: function(tab, panel) {
return {
options: this.options,
tab: tab,
panel: panel,
index: this.$tabs.index(tab)
};
}
});
$.extend($.ui.tabs, {
version: '1.6rc5',
getter: 'length',
defaults: {
ajaxOptions: null,
cache: false,
cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
deselectable: false,
deselectableClass: 'ui-tabs-deselectable',
disabled: [],
disabledClass: 'ui-state-disabled',
event: 'click',
fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }
hideClass: 'ui-tabs-hide',
idPrefix: 'ui-tabs-',
loadingClass: 'ui-tabs-loading',
navClass: 'ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all',
tabClass: 'ui-state-default ui-corner-top',
panelClass: 'ui-tabs-panel ui-widget-content ui-corner-bottom',
panelTemplate: '<div></div>',
selectedClass: 'selected ui-state-active',
spinner: 'Loading&#8230;',
tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>'
}
});
$.extend($.ui.tabs.prototype, {
rotation: null,
rotate: function(ms, continuing) {
continuing = continuing || false;
var self = this, t = this.options.selected;
function start() {
self.rotation = setInterval(function() {
t = ++t < self.$tabs.length ? t : 0;
self.select(t);
}, ms);
}
function stop(event) {
if (!event || event.clientX) { // only in case of a true click
clearInterval(self.rotation);
}
}
if (ms) {
start();
if (!continuing)
this.$tabs.bind(this.options.event + '.tabs', stop);
else
this.$tabs.bind(this.options.event + '.tabs', function() {
stop();
t = self.options.selected;
start();
});
}
else {
stop();
this.$tabs.unbind(this.options.event + '.tabs', stop);
}
}
});
})(jQuery);
function getMonthArray() {
var month = new Array(12);
month[0] = "Janeiro";
month[1] = "Fevereiro";
month[2] = "Marco";
month[3] = "Abril";
month[4] = "Maio";
month[5] = "Junho";
month[6] = "Julho";
month[7] = "Agosto";
month[8] = "Setembro";
month[9] = "Outubro";
month[10] = "Novembro";
month[11] = "Dezembro";
return month;
}
function loadHomeDatePickerProgrameSe() {
var dateInicial = currentDate;
var dateFinal = new Date(dateInicial.getFullYear(), (dateInicial.getMonth() + 2), dateInicial.getDate());
$("#linkedDates").datepicker({
minDate: dateInicial,
maxDate: dateFinal,
beforeShow: readLinked,
onSelect: updateLinked,
showOn: "both",
buttonImage: "Content/img/images/calendar.gif",
buttonImageOnly: true
});
var month = getMonthArray();
var dateRunning = dateInicial;
$('#selectMonth').html("");
while( dateRunning <= dateFinal ){
$('#selectMonth').append("<option value=\"" + (dateRunning.getMonth() + 1) + "\">" + month[dateRunning.getMonth()] + "</option>");
dateRunning = new Date(dateRunning.getFullYear(), (dateRunning.getMonth() + 1), dateRunning.getDate());
}
$("#selectMonth").change(checkLinkedDays);
$("#selectDay").change(selectDateRadio);
var selectCurrentDate = function() {
$("#selectMonth").val((currentDate.getMonth() + 1));
$("#selectDay").val(currentDate.getDate());
$("#selectYear").val(currentDate.getFullYear());
};
$.browser.msie ? setTimeout(selectCurrentDate, 1) : selectCurrentDate();
}
function loadAdvancedSearchDate() {
var dateInicial = currentDate;
var dateFinal = new Date(dateInicial.getFullYear(), (dateInicial.getMonth() + 2), dateInicial.getDate());
var month = new Array(12);
month[0] = "Jan";
month[1] = "Fev";
month[2] = "Mar";
month[3] = "Abr";
month[4] = "Maio";
month[5] = "Jun";
month[6] = "Jul";
month[7] = "Ago";
month[8] = "Set";
month[9] = "Out";
month[10] = "Nov";
month[11] = "Dez";
var dateRunning = dateInicial;
while (dateRunning <= dateFinal) {
$('#advSelectMonth').append("<option value=\"" + (dateRunning.getMonth() + 1) + "\">" + month[dateRunning.getMonth()] + "</option>");
dateRunning = new Date(dateRunning.getFullYear(), (dateRunning.getMonth() + 1), dateRunning.getDate());
}
$("#advSelectMonth").change(checkLinkedDays);
$("#advSelectDay").change(selectDateRadio);
$("#advSelectMonth").val((currentDate.getMonth() + 1));
$("#advSelectDay").val(currentDate.getDate());
$("#advSelectYear").val(currentDate.getFullYear());
}
function loadGradeDataPicker() {
var dateInicial = new Date(currentDate.getFullYear(), currentDate.getMonth(), (currentDate.getDate() - 7));
var dateFinal = new Date(dateInicial.getFullYear(), dateInicial.getMonth(), (dateInicial.getDate() + 40));
$("#gradeSelectDate").datepicker({
minDate: dateInicial,
maxDate: dateFinal,
showOn: "both",
buttonImage: "/Content/img/images/calendar.gif",
buttonImageOnly: true,
buttonText: "Calendario",
dateFormat: 'yy-mm-dd',
onSelect: function() {
trocaData($(this).val());
}
});
}
function selectDateRadio() {
$("#ProgrameseData").attr("checked", true);
}
function readLinked() {
$('#linkedDates').val($('#selectMonth').val() + '/' +
$('#selectDay').val() + '/' + $('#selectYear').val());
return {};
}
function updateLinked(date) {
$('#selectMonth').val(parseInt(date.substring(0, 2)));
$('#selectDay').val(date.substring(3, 5));
$('#selectYear').val(date.substring(6, 10));
selectDateRadio();
}
function checkLinkedDays() {
selectDateRadio();
var daysInMonth = 32 - new Date(currentDate.getFullYear(), ($('#selectMonth').val() - 1), 32).getDate();
$('#selectDay option').attr('disabled', '');
$('#selectDay option:gt(' + (daysInMonth - 1) + ')').attr('disabled', 'disabled');
if ($('#selectDay').val() > daysInMonth) {
$('#selectDay').val(daysInMonth);
}
}
(function($) { // hide the namespace
$.extend($.ui, { datepicker: { version: "@VERSION"} });
var PROP_NAME = 'datepicker';
function Datepicker() {
this.debug = false; // Change this to true to start debugging
this._curInst = null; // The current instance in use
this._keyEvent = false; // If the last event was a key event
this._disabledInputs = []; // List of date picker inputs that have been disabled
this._datepickerShowing = false; // True if the popup picker is showing , false if not
this._inDialog = false; // True if showing within a "dialog", false if not
this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division
this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class
this._appendClass = 'ui-datepicker-append'; // The name of the append marker class
this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class
this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class
this._promptClass = 'ui-datepicker-prompt'; // The name of the dialog prompt marker class
this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class
this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class
this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class
this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class
this._weekOverClass = 'ui-datepicker-week-over'; // The name of the week hover marker class
this.regional = []; // Available regional settings, indexed by language code
this.regional[''] = { // Default regional settings
clearText: 'Limpar', // Display text for clear link
clearStatus: 'Limpar data atual', // Status text for clear link
closeText: 'Fechar', // Display text for close link
closeStatus: 'Fechar sem Alterar', // Status text for close link
prevText: '&#x3c; &#x3c;', // Display text for previous month link
prevStatus: 'Mês anterior', // Status text for previous month link
prevBigText: '&#x3c;&#x3c;', // Display text for previous year link
prevBigStatus: 'Ano anterior', // Status text for previous year link
nextText: '&#x3e; &#x3e;', // Display text for next month link
nextStatus: 'Próximo mês', // Status text for next month link
nextBigText: '&#x3e; &#x3e;', // Display text for next year link
nextBigStatus: 'Próximo ano', // Status text for next year link
currentText: 'Hoje', // Display text for current month link
currentStatus: 'Exibir mês atual', // Status text for current month link
monthNames: ['Janeiro', 'Fevereiro', 'Marco', 'Abril', 'Maio', 'Junho',
'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'], // Names of months for drop-down and formatting
monthNamesShort: ['Jan', 'Fev', 'Mar', 'Abr', 'Maio', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'], // For formatting
monthStatus: 'Ver outro mês', // Status text for selecting a month
yearStatus: 'Ver outro ano', // Status text for selecting a year
weekHeader: 'Sem.', // Header for the week of the year column
weekStatus: 'Semana do mês', // Status text for the week of the year column
dayNames: ['Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado'], // For formatting
dayNamesShort: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sab'], // For formatting
dayNamesMin: ['D', 'S', 'T', 'Q', 'Q', 'S', 'S'], // Column headings for days starting at Sunday
dayStatus: 'Definir DD como primeiro dia da semana', // Status text for the day of the week selection
dateStatus: 'Select DD, M d', // Status text for the date selection
dateFormat: 'mm/dd/yy', // See format options on parseDate
firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
initStatus: 'Seleciona uma data', // Initial Status text on opening
isRTL: false // True if right-to-left language, false if left-to-right
};
this._defaults = { // Global defaults for all the date picker instances
showOn: 'focus', // 'focus' for popup on focus,
showAnim: 'show', // Name of jQuery animation for popup
showOptions: {}, // Options for enhanced animations
defaultDate: null, // Used when field is blank: actual date,
appendText: '', // Display text following the input box, e.g. showing the format
buttonText: '...', // Text for trigger button
buttonImage: '', // URL for trigger button image
buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
closeAtTop: true, // True to have the clear/close at the top,
mandatory: false, // True to hide the Clear link, false to include it
hideIfNoPrevNext: false, // True to hide next/previous month links
navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
showBigPrevNext: false, // True to show big prev/next links
gotoCurrent: false, // True if today link goes back to current selection instead
changeMonth: true, // True if month can be selected directly, false if only prev/next
changeYear: true, // True if year can be selected directly, false if only prev/next
showMonthAfterYear: false, // True if the year select precedes month, false for month then year
yearRange: '-10:+10', // Range of years to display in drop-down,
changeFirstDay: true, // True to click on day name to change, false to remain as set
highlightWeek: false, // True to highlight the selected week
showOtherMonths: false, // True to show dates in other months, false to leave blank
showWeeks: false, // True to show week of the year, false to omit
calculateWeek: this.iso8601Week, // How to calculate the week of the year,
shortYearCutoff: '+10', // Short year values < this are in the current century,
showStatus: false, // True to show status bar at bottom, false to not show it
statusForDate: this.dateStatus, // Function to provide status text for a date -
minDate: null, // The earliest selectable date, or null for no limit
maxDate: null, // The latest selectable date, or null for no limit
duration: 'normal', // Duration of display/closure
beforeShowDay: null, // Function that takes a date and returns an array with
beforeShow: null, // Function that takes an input field and
onSelect: null, // Define a callback function when a date is selected
onChangeMonthYear: null, // Define a callback function when the month or year is changed
onClose: null, // Define a callback function when the datepicker is closed
numberOfMonths: 1, // Number of months to show at a time
showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
stepMonths: 1, // Number of months to step back/forward
stepBigMonths: 12, // Number of months to step back/forward for the big links
rangeSelect: false, // Allows for selecting a date range on one date picker
rangeSeparator: ' - ', // Text between two dates in a range
altField: '', // Selector for an alternate field to store selected dates into
altFormat: '', // The date format to use for the alternate field
constrainInput: true // The input is constrained by the current date format
};
$.extend(this._defaults, this.regional['']);
this.dpDiv = $('<div id="' + this._mainDivId + '" style="display: none;"></div>');
}
$.extend(Datepicker.prototype, {
markerClassName: 'hasDatepicker',
log: function() {
if (this.debug)
console.log.apply('', arguments);
},
setDefaults: function(settings) {
extendRemove(this._defaults, settings || {});
return this;
},
_attachDatepicker: function(target, settings) {
var inlineSettings = null;
for (var attrName in this._defaults) {
var attrValue = target.getAttribute('date:' + attrName);
if (attrValue) {
inlineSettings = inlineSettings || {};
try {
inlineSettings[attrName] = eval(attrValue);
} catch (err) {
inlineSettings[attrName] = attrValue;
}
}
}
var nodeName = target.nodeName.toLowerCase();
var inline = (nodeName == 'div' || nodeName == 'span');
if (!target.id)
target.id = 'dp' + (++this.uuid);
var inst = this._newInst($(target), inline);
inst.settings = $.extend({}, settings || {}, inlineSettings || {});
if (nodeName == 'input') {
this._connectDatepicker(target, inst);
} else if (inline) {
this._inlineDatepicker(target, inst);
}
},
_newInst: function(target, inline) {
var id = target[0].id.replace(/([:\[\]\.])/g, '\\\\$1'); // escape jQuery meta chars
return { id: id, input: target, // associated target
selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
drawMonth: 0, drawYear: 0, // month being drawn
inline: inline, // is datepicker inline or not
dpDiv: (!inline ? this.dpDiv : // presentation div
$('<div class="' + this._inlineClass + '"></div>'))
};
},
_connectDatepicker: function(target, inst) {
var input = $(target);
if (input.hasClass(this.markerClassName))
return;
var appendText = this._get(inst, 'appendText');
var isRTL = this._get(inst, 'isRTL');
if (appendText)
input[isRTL ? 'before' : 'after']('<span class="' + this._appendClass + '">' + appendText + '</span>');
var showOn = this._get(inst, 'showOn');
if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field
input.focus(this._showDatepicker);
if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked
var buttonText = this._get(inst, 'buttonText');
var buttonImage = this._get(inst, 'buttonImage');
var trigger = $(this._get(inst, 'buttonImageOnly') ?
$('<img/>').addClass(this._triggerClass).
attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
$('<button type="button"></button>').addClass(this._triggerClass).
html(buttonImage == '' ? buttonText : $('<img/>').attr(
{ src: buttonImage, alt: buttonText, title: buttonText })));
input[isRTL ? 'before' : 'after'](trigger);
trigger.click(function() {
if ($.datepicker._datepickerShowing && $.datepicker._lastInput == target)
$.datepicker._hideDatepicker();
else
$.datepicker._showDatepicker(target);
return false;
});
}
input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).
bind("setData.datepicker", function(event, key, value) {
inst.settings[key] = value;
}).bind("getData.datepicker", function(event, key) {
return this._get(inst, key);
});
$.data(target, PROP_NAME, inst);
},
_inlineDatepicker: function(target, inst) {
var divSpan = $(target);
if (divSpan.hasClass(this.markerClassName))
return;
divSpan.addClass(this.markerClassName).append(inst.dpDiv).
bind("setData.datepicker", function(event, key, value) {
inst.settings[key] = value;
}).bind("getData.datepicker", function(event, key) {
return this._get(inst, key);
});
$.data(target, PROP_NAME, inst);
this._setDate(inst, this._getDefaultDate(inst));
this._updateDatepicker(inst);
this._updateAlternate(inst);
},
_dialogDatepicker: function(input, dateText, onSelect, settings, pos) {
var inst = this._dialogInst; // internal instance
if (!inst) {
var id = 'dp' + (++this.uuid);
this._dialogInput = $('<input type="text" id="' + id +
'" size="1" style="position: absolute; top: -100px;"/>');
this._dialogInput.keydown(this._doKeyDown);
$('body').append(this._dialogInput);
inst = this._dialogInst = this._newInst(this._dialogInput, false);
inst.settings = {};
$.data(this._dialogInput[0], PROP_NAME, inst);
}
extendRemove(inst.settings, settings || {});
this._dialogInput.val(dateText);
this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
if (!this._pos) {
var browserWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
var browserHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
this._pos = // should use actual width/height below
[(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
}
this._dialogInput.css('left', this._pos[0] + 'px').css('top', this._pos[1] + 'px');
inst.settings.onSelect = onSelect;
this._inDialog = true;
this.dpDiv.addClass(this._dialogClass);
this._showDatepicker(this._dialogInput[0]);
if ($.blockUI)
$.blockUI(this.dpDiv);
$.data(this._dialogInput[0], PROP_NAME, inst);
return this;
},
_destroyDatepicker: function(target) {
var $target = $(target);
if (!$target.hasClass(this.markerClassName)) {
return;
}
var nodeName = target.nodeName.toLowerCase();
$.removeData(target, PROP_NAME);
if (nodeName == 'input') {
$target.siblings('.' + this._appendClass).remove().end().
siblings('.' + this._triggerClass).remove().end().
removeClass(this.markerClassName).
unbind('focus', this._showDatepicker).
unbind('keydown', this._doKeyDown).
unbind('keypress', this._doKeyPress);
} else if (nodeName == 'div' || nodeName == 'span')
$target.removeClass(this.markerClassName).empty();
},
_enableDatepicker: function(target) {
var $target = $(target);
if (!$target.hasClass(this.markerClassName)) {
return;
}
var nodeName = target.nodeName.toLowerCase();
if (nodeName == 'input') {
target.disabled = false;
$target.siblings('button.' + this._triggerClass).
each(function() { this.disabled = false; }).end().
siblings('img.' + this._triggerClass).
css({ opacity: '1.0', cursor: '' });
}
else if (nodeName == 'div' || nodeName == 'span') {
$target.children('.' + this._disableClass).remove();
}
this._disabledInputs = $.map(this._disabledInputs,
function(value) { return (value == target ? null : value); }); // delete entry
},
_disableDatepicker: function(target) {
var $target = $(target);
if (!$target.hasClass(this.markerClassName)) {
return;
}
var nodeName = target.nodeName.toLowerCase();
if (nodeName == 'input') {
target.disabled = true;
$target.siblings('button.' + this._triggerClass).
each(function() { this.disabled = true; }).end().
siblings('img.' + this._triggerClass).
css({ opacity: '0.5', cursor: 'default' });
}
else if (nodeName == 'div' || nodeName == 'span') {
var inline = $target.children('.' + this._inlineClass);
var offset = inline.offset();
var relOffset = { left: 0, top: 0 };
inline.parents().each(function() {
if ($(this).css('position') == 'relative') {
relOffset = $(this).offset();
return false;
}
});
$target.prepend('<div class="' + this._disableClass + '" style="' +
($.browser.msie ? 'background-color: transparent; ' : '') +
'width: ' + inline.width() + 'px; height: ' + inline.height() +
'px; left: ' + (offset.left - relOffset.left) +
'px; top: ' + (offset.top - relOffset.top) + 'px;"></div>');
}
this._disabledInputs = $.map(this._disabledInputs,
function(value) { return (value == target ? null : value); }); // delete entry
this._disabledInputs[this._disabledInputs.length] = target;
},
_isDisabledDatepicker: function(target) {
if (!target)
return false;
for (var i = 0; i < this._disabledInputs.length; i++) {
if (this._disabledInputs[i] == target)
return true;
}
return false;
},
_getInst: function(target) {
try {
return $.data(target, PROP_NAME);
}
catch (err) {
throw 'Missing instance data for this datepicker';
}
},
_optionDatepicker: function(target, name, value) {
var settings = name || {};
if (typeof name == 'string') {
settings = {};
settings[name] = value;
}
var inst = this._getInst(target);
if (inst) {
if (this._curInst == inst) {
this._hideDatepicker(null);
}
extendRemove(inst.settings, settings);
var date = new Date();
extendRemove(inst, { rangeStart: null, // start of range
endDay: null, endMonth: null, endYear: null, // end of range
selectedDay: date.getDate(), selectedMonth: date.getMonth(),
selectedYear: date.getFullYear(), // starting point
currentDay: date.getDate(), currentMonth: date.getMonth(),
currentYear: date.getFullYear(), // current selection
drawMonth: date.getMonth(), drawYear: date.getFullYear()
}); // month being drawn
this._updateDatepicker(inst);
}
},
_changeDatepicker: function(target, name, value) {
this._optionDatepicker(target, name, value);
},
_refreshDatepicker: function(target) {
var inst = this._getInst(target);
if (inst) {
this._updateDatepicker(inst);
}
},
_setDateDatepicker: function(target, date, endDate) {
var inst = this._getInst(target);
if (inst) {
this._setDate(inst, date, endDate);
this._updateDatepicker(inst);
this._updateAlternate(inst);
}
},
_getDateDatepicker: function(target) {
var inst = this._getInst(target);
if (inst && !inst.inline)
this._setDateFromField(inst);
return (inst ? this._getDate(inst) : null);
},
_doKeyDown: function(event) {
var inst = $.datepicker._getInst(event.target);
var handled = true;
inst._keyEvent = true;
if ($.datepicker._datepickerShowing)
switch (event.keyCode) {
case 9: $.datepicker._hideDatepicker(null, '');
break; // hide on tab out
case 13: var sel = $('td.' + $.datepicker._dayOverClass +
', td.' + $.datepicker._currentClass, inst.dpDiv);
if (sel[0])
$.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
else
$.datepicker._hideDatepicker(null, $.datepicker._get(inst, 'duration'));
return false; // don't submit the form
break; // select the value on enter
case 27: $.datepicker._hideDatepicker(null, $.datepicker._get(inst, 'duration'));
break; // hide on escape
case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
-$.datepicker._get(inst, 'stepBigMonths') :
-$.datepicker._get(inst, 'stepMonths')), 'M');
break; // previous month/year on page up/+ ctrl
case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+$.datepicker._get(inst, 'stepBigMonths') :
+$.datepicker._get(inst, 'stepMonths')), 'M');
break; // next month/year on page down/+ ctrl
case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target);
handled = event.ctrlKey || event.metaKey;
break; // clear on ctrl or command +end
case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target);
handled = event.ctrlKey || event.metaKey;
break; // current on ctrl or command +home
case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -1, 'D');
handled = event.ctrlKey || event.metaKey;
if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
-$.datepicker._get(inst, 'stepBigMonths') :
-$.datepicker._get(inst, 'stepMonths')), 'M');
break;
case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D');
handled = event.ctrlKey || event.metaKey;
break; // -1 week on ctrl or command +up
case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +1, 'D');
handled = event.ctrlKey || event.metaKey;
if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+$.datepicker._get(inst, 'stepBigMonths') :
+$.datepicker._get(inst, 'stepMonths')), 'M');
break;
case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D');
handled = event.ctrlKey || event.metaKey;
break; // +1 week on ctrl or command +down
default: handled = false;
}
else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home
$.datepicker._showDatepicker(this);
else {
handled = false;
}
if (handled) {
event.preventDefault();
event.stopPropagation();
}
},
_doKeyPress: function(event) {
var inst = $.datepicker._getInst(event.target);
if ($.datepicker._get(inst, 'constrainInput')) {
var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode);
return event.ctrlKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
}
},
_showDatepicker: function(input) {
input = input.target || input;
if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger
input = $('input', input.parentNode)[0];
if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here
return;
var inst = $.datepicker._getInst(input);
var beforeShow = $.datepicker._get(inst, 'beforeShow');
extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {}));
$.datepicker._hideDatepicker(null, '');
$.datepicker._lastInput = input;
$.datepicker._setDateFromField(inst);
if ($.datepicker._inDialog) // hide cursor
input.value = '';
if (!$.datepicker._pos) { // position below input
$.datepicker._pos = $.datepicker._findPos(input);
$.datepicker._pos[1] += input.offsetHeight; // add the height
}
var isFixed = false;
$(input).parents().each(function() {
isFixed |= $(this).css('position') == 'fixed';
return !isFixed;
});
if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled
$.datepicker._pos[0] -= document.documentElement.scrollLeft;
$.datepicker._pos[1] -= document.documentElement.scrollTop;
}
var offset = { left: $.datepicker._pos[0], top: $.datepicker._pos[1] };
$.datepicker._pos = null;
inst.rangeStart = null;
inst.dpDiv.css({ position: 'absolute', display: 'block', top: '-1000px' });
$.datepicker._updateDatepicker(inst);
inst.dpDiv.width($.datepicker._getNumberOfMonths(inst)[1] *
$('.ui-datepicker', inst.dpDiv[0])[0].offsetWidth);
offset = $.datepicker._checkOffset(inst, offset, isFixed);
inst.dpDiv.css({ position: ($.datepicker._inDialog && $.blockUI ?
'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',
left: offset.left + 'px', top: offset.top + 'px'
});
if (!inst.inline) {
var showAnim = $.datepicker._get(inst, 'showAnim') || 'show';
var duration = $.datepicker._get(inst, 'duration');
var postProcess = function() {
$.datepicker._datepickerShowing = true;
if ($.browser.msie && parseInt($.browser.version, 10) < 7) // fix IE < 7 select problems
$('iframe.ui-datepicker-cover').css({ width: inst.dpDiv.width() + 4,
height: inst.dpDiv.height() + 4
});
};
if ($.effects && $.effects[showAnim])
inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
else
inst.dpDiv[showAnim](duration, postProcess);
if (duration == '')
postProcess();
if (inst.input[0].type != 'hidden')
inst.input[0].focus();
$.datepicker._curInst = inst;
}
},
_updateDatepicker: function(inst) {
var dims = { width: inst.dpDiv.width() + 4,
height: inst.dpDiv.height() + 4
};
inst.dpDiv.empty().append(this._generateHTML(inst)).
find('iframe.ui-datepicker-cover').
css({ width: dims.width, height: dims.height });
var numMonths = this._getNumberOfMonths(inst);
inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
'Class']('ui-datepicker-multi');
inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
'Class']('ui-datepicker-rtl');
if (inst.input && inst.input[0].type != 'hidden' && inst == $.datepicker._curInst)
$(inst.input[0]).focus();
},
_checkOffset: function(inst, offset, isFixed) {
var pos = inst.input ? this._findPos(inst.input[0]) : null;
var browserWidth = window.innerWidth || (document.documentElement ?
document.documentElement.clientWidth : document.body.clientWidth);
var browserHeight = window.innerHeight || (document.documentElement ?
document.documentElement.clientHeight : document.body.clientHeight);
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
if (this._get(inst, 'isRTL') || (offset.left + inst.dpDiv.width() - scrollX) > browserWidth)
offset.left = Math.max((isFixed ? 0 : scrollX),
pos[0] + (inst.input ? inst.input.width() : 0) - (isFixed ? scrollX : 0) - inst.dpDiv.width() -
(isFixed && $.browser.opera ? document.documentElement.scrollLeft : 0));
else
offset.left -= (isFixed ? scrollX : 0);
if ((offset.top + inst.dpDiv.height() - scrollY) > browserHeight)
offset.top = Math.max((isFixed ? 0 : scrollY),
pos[1] - (isFixed ? scrollY : 0) - (this._inDialog ? 0 : inst.dpDiv.height()) -
(isFixed && $.browser.opera ? document.documentElement.scrollTop : 0));
else
offset.top -= (isFixed ? scrollY : 0);
return offset;
},
_findPos: function(obj) {
while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {
obj = obj.nextSibling;
}
var position = $(obj).offset();
return [position.left, position.top];
},
_hideDatepicker: function(input, duration) {
var inst = this._curInst;
if (!inst || (input && inst != $.data(input, PROP_NAME)))
return;
var rangeSelect = this._get(inst, 'rangeSelect');
if (rangeSelect && inst.stayOpen)
this._selectDate('#' + inst.id, this._formatDate(inst,
inst.currentDay, inst.currentMonth, inst.currentYear));
inst.stayOpen = false;
if (this._datepickerShowing) {
duration = (duration != null ? duration : this._get(inst, 'duration'));
var showAnim = this._get(inst, 'showAnim');
var postProcess = function() {
$.datepicker._tidyDialog(inst);
};
if (duration != '' && $.effects && $.effects[showAnim])
inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'),
duration, postProcess);
else
inst.dpDiv[(duration == '' ? 'hide' : (showAnim == 'slideDown' ? 'slideUp' :
(showAnim == 'fadeIn' ? 'fadeOut' : 'hide')))](duration, postProcess);
if (duration == '')
this._tidyDialog(inst);
var onClose = this._get(inst, 'onClose');
if (onClose)
onClose.apply((inst.input ? inst.input[0] : null),
[(inst.input ? inst.input.val() : ''), inst]); // trigger custom callback
this._datepickerShowing = false;
this._lastInput = null;
inst.settings.prompt = null;
if (this._inDialog) {
this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });
if ($.blockUI) {
$.unblockUI();
$('body').append(this.dpDiv);
}
}
this._inDialog = false;
}
this._curInst = null;
},
_tidyDialog: function(inst) {
inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker');
$('.' + this._promptClass, inst.dpDiv).remove();
},
_checkExternalClick: function(event) {
if (!$.datepicker._curInst)
return;
var $target = $(event.target);
if (($target.parents('#' + $.datepicker._mainDivId).length == 0) &&
!$target.hasClass($.datepicker.markerClassName) &&
!$target.hasClass($.datepicker._triggerClass) &&
$.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))
$.datepicker._hideDatepicker(null, '');
},
_adjustDate: function(id, offset, period) {
var target = $(id);
var inst = this._getInst(target[0]);
this._adjustInstDate(inst, offset, period);
this._updateDatepicker(inst);
},
_gotoToday: function(id) {
var target = $(id);
var inst = this._getInst(target[0]);
if (this._get(inst, 'gotoCurrent') && inst.currentDay) {
inst.selectedDay = inst.currentDay;
inst.drawMonth = inst.selectedMonth = inst.currentMonth;
inst.drawYear = inst.selectedYear = inst.currentYear;
}
else {
var date = new Date();
inst.selectedDay = date.getDate();
inst.drawMonth = inst.selectedMonth = date.getMonth();
inst.drawYear = inst.selectedYear = date.getFullYear();
}
this._notifyChange(inst);
this._adjustDate(target);
},
_selectMonthYear: function(id, select, period) {
var target = $(id);
var inst = this._getInst(target[0]);
inst._selectingMonthYear = false;
inst['selected' + (period == 'M' ? 'Month' : 'Year')] =
inst['draw' + (period == 'M' ? 'Month' : 'Year')] =
parseInt(select.options[select.selectedIndex].value, 10);
this._notifyChange(inst);
this._adjustDate(target);
},
_clickMonthYear: function(id) {
var target = $(id);
var inst = this._getInst(target[0]);
if (inst.input && inst._selectingMonthYear && !$.browser.msie)
inst.input[0].focus();
inst._selectingMonthYear = !inst._selectingMonthYear;
},
_changeFirstDay: function(id, day) {
var target = $(id);
var inst = this._getInst(target[0]);
inst.settings.firstDay = day;
this._updateDatepicker(inst);
},
_selectDay: function(id, month, year, td) {
if ($(td).hasClass(this._unselectableClass))
return;
var target = $(id);
var inst = this._getInst(target[0]);
var rangeSelect = this._get(inst, 'rangeSelect');
if (rangeSelect) {
inst.stayOpen = !inst.stayOpen;
if (inst.stayOpen) {
$('.ui-datepicker td', inst.dpDiv).removeClass(this._currentClass);
$(td).addClass(this._currentClass);
}
}
inst.selectedDay = inst.currentDay = $('a', td).html();
inst.selectedMonth = inst.currentMonth = month;
inst.selectedYear = inst.currentYear = year;
if (inst.stayOpen) {
inst.endDay = inst.endMonth = inst.endYear = null;
}
else if (rangeSelect) {
inst.endDay = inst.currentDay;
inst.endMonth = inst.currentMonth;
inst.endYear = inst.currentYear;
}
this._selectDate(id, this._formatDate(inst,
inst.currentDay, inst.currentMonth, inst.currentYear));
if (inst.stayOpen) {
inst.rangeStart = this._daylightSavingAdjust(
new Date(inst.currentYear, inst.currentMonth, inst.currentDay));
this._updateDatepicker(inst);
}
else if (rangeSelect) {
inst.selectedDay = inst.currentDay = inst.rangeStart.getDate();
inst.selectedMonth = inst.currentMonth = inst.rangeStart.getMonth();
inst.selectedYear = inst.currentYear = inst.rangeStart.getFullYear();
inst.rangeStart = null;
if (inst.inline)
this._updateDatepicker(inst);
}
},
_clearDate: function(id) {
var target = $(id);
var inst = this._getInst(target[0]);
if (this._get(inst, 'mandatory'))
return;
inst.stayOpen = false;
inst.endDay = inst.endMonth = inst.endYear = inst.rangeStart = null;
this._selectDate(target, '');
},
_selectDate: function(id, dateStr) {
var target = $(id);
var inst = this._getInst(target[0]);
dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
if (this._get(inst, 'rangeSelect') && dateStr)
dateStr = (inst.rangeStart ? this._formatDate(inst, inst.rangeStart) :
dateStr) + this._get(inst, 'rangeSeparator') + dateStr;
if (inst.input)
inst.input.val(dateStr);
this._updateAlternate(inst);
var onSelect = this._get(inst, 'onSelect');
if (onSelect)
onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback
else if (inst.input)
inst.input.trigger('change'); // fire the change event
if (inst.inline)
this._updateDatepicker(inst);
else if (!inst.stayOpen) {
this._hideDatepicker(null, this._get(inst, 'duration'));
this._lastInput = inst.input[0];
if (typeof (inst.input[0]) != 'object')
inst.input[0].focus(); // restore focus
this._lastInput = null;
}
},
_updateAlternate: function(inst) {
var altField = this._get(inst, 'altField');
if (altField) { // update alternate field too
var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat');
var date = this._getDate(inst);
dateStr = (isArray(date) ? (!date[0] && !date[1] ? '' :
this.formatDate(altFormat, date[0], this._getFormatConfig(inst)) +
this._get(inst, 'rangeSeparator') + this.formatDate(
altFormat, date[1] || date[0], this._getFormatConfig(inst))) :
this.formatDate(altFormat, date, this._getFormatConfig(inst)));
$(altField).each(function() { $(this).val(dateStr); });
}
},
noWeekends: function(date) {
var day = date.getDay();
return [(day > 0 && day < 6), ''];
},
iso8601Week: function(date) {
var checkDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
var firstMon = new Date(checkDate.getFullYear(), 1 - 1, 4); // First week always contains 4 Jan
var firstDay = firstMon.getDay() || 7; // Day of week: Mon = 1, ..., Sun = 7
firstMon.setDate(firstMon.getDate() + 1 - firstDay); // Preceding Monday
if (firstDay < 4 && checkDate < firstMon) { // Adjust first three days in year if necessary
checkDate.setDate(checkDate.getDate() - 3); // Generate for previous year
return $.datepicker.iso8601Week(checkDate);
} else if (checkDate > new Date(checkDate.getFullYear(), 12 - 1, 28)) { // Check last three days in year
firstDay = new Date(checkDate.getFullYear() + 1, 1 - 1, 4).getDay() || 7;
if (firstDay > 4 && (checkDate.getDay() || 7) < firstDay - 3) { // Adjust if necessary
return 1;
}
}
return Math.floor(((checkDate - firstMon) / 86400000) / 7) + 1; // Weeks to given date
},
dateStatus: function(date, inst) {
return $.datepicker.formatDate($.datepicker._get(inst, 'dateStatus'),
date, $.datepicker._getFormatConfig(inst));
},
parseDate: function(format, value, settings) {
if (format == null || value == null)
throw 'Invalid arguments';
value = (typeof value == 'object' ? value.toString() : value + '');
if (value == '')
return null;
var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;
var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
var year = -1;
var month = -1;
var day = -1;
var doy = -1;
var literal = false;
var lookAhead = function(match) {
var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
if (matches)
iFormat++;
return matches;
};
var getNumber = function(match) {
lookAhead(match);
var origSize = (match == '@' ? 14 : (match == 'y' ? 4 : (match == 'o' ? 3 : 2)));
var size = origSize;
var num = 0;
while (size > 0 && iValue < value.length &&
value.charAt(iValue) >= '0' && value.charAt(iValue) <= '9') {
num = num * 10 + parseInt(value.charAt(iValue++), 10);
size--;
}
if (size == origSize)
throw 'Missing number at position ' + iValue;
return num;
};
var getName = function(match, shortNames, longNames) {
var names = (lookAhead(match) ? longNames : shortNames);
var size = 0;
for (var j = 0; j < names.length; j++)
size = Math.max(size, names[j].length);
var name = '';
var iInit = iValue;
while (size > 0 && iValue < value.length) {
name += value.charAt(iValue++);
for (var i = 0; i < names.length; i++)
if (name == names[i])
return i + 1;
size--;
}
throw 'Unknown name at position ' + iInit;
};
var checkLiteral = function() {
if (value.charAt(iValue) != format.charAt(iFormat))
throw 'Unexpected literal at position ' + iValue;
iValue++;
};
var iValue = 0;
for (var iFormat = 0; iFormat < format.length; iFormat++) {
if (literal)
if (format.charAt(iFormat) == "'" && !lookAhead("'"))
literal = false;
else
checkLiteral();
else
switch (format.charAt(iFormat)) {
case 'd':
day = getNumber('d');
break;
case 'D':
getName('D', dayNamesShort, dayNames);
break;
case 'o':
doy = getNumber('o');
break;
case 'm':
month = getNumber('m');
break;
case 'M':
month = getName('M', monthNamesShort, monthNames);
break;
case 'y':
year = getNumber('y');
break;
case '@':
var date = new Date(getNumber('@'));
year = date.getFullYear();
month = date.getMonth() + 1;
day = date.getDate();
break;
case "'":
if (lookAhead("'"))
checkLiteral();
else
literal = true;
break;
default:
checkLiteral();
}
}
if (year == -1)
year = new Date().getFullYear();
else if (year < 100)
year += new Date().getFullYear() - new Date().getFullYear() % 100 +
(year <= shortYearCutoff ? 0 : -100);
if (doy > -1) {
month = 1;
day = doy;
do {
var dim = this._getDaysInMonth(year, month - 1);
if (day <= dim)
break;
month++;
day -= dim;
} while (true);
}
var date = this._daylightSavingAdjust(new Date(year, month - 1, day));
if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day)
throw 'Invalid date';
return date;
},
ATOM: 'yy-mm-dd',
COOKIE_F: 'D, dd M yy',
ISO_8601: 'yy-mm-dd',
RFC_822: 'D, d M y',
RFC_850: 'DD, dd-M-y',
RFC_1036: 'D, d M y',
RFC_1123: 'D, d M yy',
RFC_2822: 'D, d M yy',
RSS: 'D, d M y',
TIMESTAMP: '@',
W3C: 'yy-mm-dd',
formatDate: function(format, date, settings) {
if (!date)
return '';
var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
var lookAhead = function(match) {
var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
if (matches)
iFormat++;
return matches;
};
var formatNumber = function(match, value, len) {
var num = '' + value;
if (lookAhead(match))
while (num.length < len)
num = '0' + num;
return num;
};
var formatName = function(match, value, shortNames, longNames) {
return (lookAhead(match) ? longNames[value] : shortNames[value]);
};
var output = '';
var literal = false;
if (date)
for (var iFormat = 0; iFormat < format.length; iFormat++) {
if (literal)
if (format.charAt(iFormat) == "'" && !lookAhead("'"))
literal = false;
else
output += format.charAt(iFormat);
else
switch (format.charAt(iFormat)) {
case 'd':
output += formatNumber('d', date.getDate(), 2);
break;
case 'D':
output += formatName('D', date.getDay(), dayNamesShort, dayNames);
break;
case 'o':
var doy = date.getDate();
for (var m = date.getMonth() - 1; m >= 0; m--)
doy += this._getDaysInMonth(date.getFullYear(), m);
output += formatNumber('o', doy, 3);
break;
case 'm':
output += formatNumber('m', date.getMonth() + 1, 2);
break;
case 'M':
output += formatName('M', date.getMonth(), monthNamesShort, monthNames);
break;
case 'y':
output += (lookAhead('y') ? date.getFullYear() :
(date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);
break;
case '@':
output += date.getTime();
break;
case "'":
if (lookAhead("'"))
output += "'";
else
literal = true;
break;
default:
output += format.charAt(iFormat);
}
}
return output;
},
_possibleChars: function(format) {
var chars = '';
var literal = false;
for (var iFormat = 0; iFormat < format.length; iFormat++)
if (literal)
if (format.charAt(iFormat) == "'" && !lookAhead("'"))
literal = false;
else
chars += format.charAt(iFormat);
else
switch (format.charAt(iFormat)) {
case 'd': case 'm': case 'y': case '@':
chars += '0123456789';
break;
case 'D': case 'M':
return null; // Accept anything
case "'":
if (lookAhead("'"))
chars += "'";
else
literal = true;
break;
default:
chars += format.charAt(iFormat);
}
return chars;
},
_get: function(inst, name) {
return inst.settings[name] !== undefined ?
inst.settings[name] : this._defaults[name];
},
_setDateFromField: function(inst) {
var dateFormat = this._get(inst, 'dateFormat');
var dates = inst.input ? inst.input.val().split(this._get(inst, 'rangeSeparator')) : null;
inst.endDay = inst.endMonth = inst.endYear = null;
var date = defaultDate = this._getDefaultDate(inst);
if (dates.length > 0) {
var settings = this._getFormatConfig(inst);
if (dates.length > 1) {
date = this.parseDate(dateFormat, dates[1], settings) || defaultDate;
inst.endDay = date.getDate();
inst.endMonth = date.getMonth();
inst.endYear = date.getFullYear();
}
try {
date = this.parseDate(dateFormat, dates[0], settings) || defaultDate;
} catch (event) {
this.log(event);
date = defaultDate;
}
}
inst.selectedDay = date.getDate();
inst.drawMonth = inst.selectedMonth = date.getMonth();
inst.drawYear = inst.selectedYear = date.getFullYear();
inst.currentDay = (dates[0] ? date.getDate() : 0);
inst.currentMonth = (dates[0] ? date.getMonth() : 0);
inst.currentYear = (dates[0] ? date.getFullYear() : 0);
this._adjustInstDate(inst);
},
_getDefaultDate: function(inst) {
var date = this._determineDate(this._get(inst, 'defaultDate'), new Date());
var minDate = this._getMinMaxDate(inst, 'min', true);
var maxDate = this._getMinMaxDate(inst, 'max');
date = (minDate && date < minDate ? minDate : date);
date = (maxDate && date > maxDate ? maxDate : date);
return date;
},
_determineDate: function(date, defaultDate) {
var offsetNumeric = function(offset) {
var date = new Date();
date.setDate(date.getDate() + offset);
return date;
};
var offsetString = function(offset, getDaysInMonth) {
var date = new Date();
var year = date.getFullYear();
var month = date.getMonth();
var day = date.getDate();
var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;
var matches = pattern.exec(offset);
while (matches) {
switch (matches[2] || 'd') {
case 'd': case 'D':
day += parseInt(matches[1], 10); break;
case 'w': case 'W':
day += parseInt(matches[1], 10) * 7; break;
case 'm': case 'M':
month += parseInt(matches[1], 10);
day = Math.min(day, getDaysInMonth(year, month));
break;
case 'y': case 'Y':
year += parseInt(matches[1], 10);
day = Math.min(day, getDaysInMonth(year, month));
break;
}
matches = pattern.exec(offset);
}
return new Date(year, month, day);
};
date = (date == null ? defaultDate :
(typeof date == 'string' ? offsetString(date, this._getDaysInMonth) :
(typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : date)));
date = (date && date.toString() == 'Invalid Date' ? defaultDate : date);
if (date) {
date.setHours(0);
date.setMinutes(0);
date.setSeconds(0);
date.setMilliseconds(0);
}
return this._daylightSavingAdjust(date);
},
_daylightSavingAdjust: function(date) {
if (!date) return null;
date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
return date;
},
_setDate: function(inst, date, endDate) {
var clear = !(date);
var origMonth = inst.selectedMonth;
var origYear = inst.selectedYear;
date = this._determineDate(date, new Date());
inst.selectedDay = inst.currentDay = date.getDate();
inst.drawMonth = inst.selectedMonth = inst.currentMonth = date.getMonth();
inst.drawYear = inst.selectedYear = inst.currentYear = date.getFullYear();
if (this._get(inst, 'rangeSelect')) {
if (endDate) {
endDate = this._determineDate(endDate, null);
inst.endDay = endDate.getDate();
inst.endMonth = endDate.getMonth();
inst.endYear = endDate.getFullYear();
} else {
inst.endDay = inst.currentDay;
inst.endMonth = inst.currentMonth;
inst.endYear = inst.currentYear;
}
}
if (origMonth != inst.selectedMonth || origYear != inst.selectedYear)
this._notifyChange(inst);
this._adjustInstDate(inst);
if (inst.input)
inst.input.val(clear ? '' : this._formatDate(inst) +
(!this._get(inst, 'rangeSelect') ? '' : this._get(inst, 'rangeSeparator') +
this._formatDate(inst, inst.endDay, inst.endMonth, inst.endYear)));
},
_getDate: function(inst) {
var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null :
this._daylightSavingAdjust(new Date(
inst.currentYear, inst.currentMonth, inst.currentDay)));
if (this._get(inst, 'rangeSelect')) {
return [inst.rangeStart || startDate,
(!inst.endYear ? inst.rangeStart || startDate :
this._daylightSavingAdjust(new Date(inst.endYear, inst.endMonth, inst.endDay)))];
} else
return startDate;
},
_generateHTML: function(inst) {
var today = new Date();
today = this._daylightSavingAdjust(
new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time
var showStatus = this._get(inst, 'showStatus');
var initStatus = this._get(inst, 'initStatus') || '&#xa0;';
var isRTL = this._get(inst, 'isRTL');
var clear = '<div class="ui-datepicker-clear"></div>';
var controls = '<div class="ui-datepicker-control">' + (isRTL ? '' : clear) +
'<div class="ui-datepicker-close"><a onclick="jQuery.datepicker._hideDatepicker();"' +
this._addStatus(showStatus, inst.id, this._get(inst, 'closeStatus'), initStatus) + '>' +
this._get(inst, 'closeText') + '</a></div>' + (isRTL ? clear : '') + '</div>';
var prompt = this._get(inst, 'prompt');
var closeAtTop = this._get(inst, 'closeAtTop');
var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext');
var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat');
var showBigPrevNext = this._get(inst, 'showBigPrevNext');
var numMonths = this._getNumberOfMonths(inst);
var showCurrentAtPos = this._get(inst, 'showCurrentAtPos');
var stepMonths = this._get(inst, 'stepMonths');
var stepBigMonths = this._get(inst, 'stepBigMonths');
var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);
var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
var minDate = this._getMinMaxDate(inst, 'min', true);
var maxDate = this._getMinMaxDate(inst, 'max');
var drawMonth = inst.drawMonth - showCurrentAtPos;
var drawYear = inst.drawYear;
if (drawMonth < 0) {
drawMonth += 12;
drawYear--;
}
if (maxDate) {
var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
maxDate.getMonth() - numMonths[1] + 1, maxDate.getDate()));
maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
drawMonth--;
if (drawMonth < 0) {
drawMonth = 11;
drawYear--;
}
}
}
var prevText = this._get(inst, 'prevText');
prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
this._getFormatConfig(inst)));
var prevBigText = (showBigPrevNext ? this._get(inst, 'prevBigText') : '');
prevBigText = (!navigationAsDateFormat ? prevBigText : this.formatDate(prevBigText,
this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepBigMonths, 1)),
this._getFormatConfig(inst)));
var prev = '<div class="ui-datepicker-prev">' + (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
(showBigPrevNext ? '<a onclick="jQuery.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepBigMonths + ', \'M\');"' +
this._addStatus(showStatus, inst.id, this._get(inst, 'prevBigStatus'), initStatus) + '>' + prevBigText + '</a>' : '') +
'<a onclick="jQuery.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');"' +
this._addStatus(showStatus, inst.id, this._get(inst, 'prevStatus'), initStatus) + '>' + prevText + '</a>' :
(hideIfNoPrevNext ? '' : (showBigPrevNext ? '<label>' + prevBigText + '</label>' : '') +
'<label>' + prevText + '</label>')) + '</div>';
var nextText = this._get(inst, 'nextText');
nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
this._getFormatConfig(inst)));
var nextBigText = (showBigPrevNext ? this._get(inst, 'nextBigText') : '');
nextBigText = (!navigationAsDateFormat ? nextBigText : this.formatDate(nextBigText,
this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepBigMonths, 1)),
this._getFormatConfig(inst)));
var next = '<div class="ui-datepicker-next">' + (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
'<a onclick="jQuery.datepicker._adjustDate(\'#' + inst.id + '\', +' + stepMonths + ', \'M\');"' +
this._addStatus(showStatus, inst.id, this._get(inst, 'nextStatus'), initStatus) + '>' + nextText + '</a>' +
(showBigPrevNext ? '<a onclick="jQuery.datepicker._adjustDate(\'#' + inst.id + '\', +' + stepBigMonths + ', \'M\');"' +
this._addStatus(showStatus, inst.id, this._get(inst, 'nextBigStatus'), initStatus) + '>' + nextBigText + '</a>' : '') :
(hideIfNoPrevNext ? '' : '<label>' + nextText + '</label>' +
(showBigPrevNext ? '<label>' + nextBigText + '</label>' : ''))) + '</div>';
var currentText = this._get(inst, 'currentText');
var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today);
currentText = (!navigationAsDateFormat ? currentText :
this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
var html = (closeAtTop && !inst.inline ? controls : '') +
'<div class="ui-datepicker-links">' + (isRTL ? next : prev) +
(this._isInRange(inst, gotoDate) ? '<div class="ui-datepicker-current">' +
'<a onclick="jQuery.datepicker._gotoToday(\'#' + inst.id + '\');"' +
this._addStatus(showStatus, inst.id, this._get(inst, 'currentStatus'), initStatus) + '>' +
currentText + '</a></div>' : '') + (isRTL ? prev : next) + '</div>' +
(prompt ? '<div class="' + this._promptClass + '"><span>' + prompt + '</span></div>' : '');
var firstDay = this._get(inst, 'firstDay');
var changeFirstDay = this._get(inst, 'changeFirstDay');
var dayNames = this._get(inst, 'dayNames');
var dayNamesShort = this._get(inst, 'dayNamesShort');
var dayNamesMin = this._get(inst, 'dayNamesMin');
var monthNames = this._get(inst, 'monthNames');
var beforeShowDay = this._get(inst, 'beforeShowDay');
var highlightWeek = this._get(inst, 'highlightWeek');
var showOtherMonths = this._get(inst, 'showOtherMonths');
var showWeeks = this._get(inst, 'showWeeks');
var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week;
var weekStatus = this._get(inst, 'weekStatus');
var status = (showStatus ? this._get(inst, 'dayStatus') || initStatus : '');
var dateStatus = this._get(inst, 'statusForDate') || this.dateStatus;
var endDate = inst.endDay ? this._daylightSavingAdjust(
new Date(inst.endYear, inst.endMonth, inst.endDay)) : currentDate;
var defaultDate = this._getDefaultDate(inst);
for (var row = 0; row < numMonths[0]; row++)
for (var col = 0; col < numMonths[1]; col++) {
var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
html += '<div class="ui-datepicker-one-month' + (col == 0 ? ' ui-datepicker-new-row' : '') + '">' +
this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
selectedDate, row > 0 || col > 0, showStatus, initStatus, monthNames) + // draw month headers
'<table class="ui-datepicker" cellpadding="0" cellspacing="0"><thead>' +
'<tr class="ui-datepicker-title-row">' +
(showWeeks ? '<td' + this._addStatus(showStatus, inst.id, weekStatus, initStatus) + '>' +
this._get(inst, 'weekHeader') + '</td>' : '');
for (var dow = 0; dow < 7; dow++) { // days of the week
var day = (dow + firstDay) % 7;
var dayStatus = (status.indexOf('DD') > -1 ? status.replace(/DD/, dayNames[day]) :
status.replace(/D/, dayNamesShort[day]));
html += '<td' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end-cell"' : '') + '>' +
(!changeFirstDay ? '<span' :
'<a onclick="jQuery.datepicker._changeFirstDay(\'#' + inst.id + '\', ' + day + ');"') +
this._addStatus(showStatus, inst.id, dayStatus, initStatus) + ' title="' + dayNames[day] + '">' +
dayNamesMin[day] + (changeFirstDay ? '</a>' : '</span>') + '</td>';
}
html += '</tr></thead><tbody>';
var daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth)
inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7)); // calculate the number of rows to generate
var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows
html += '<tr class="ui-datepicker-days-row">' +
(showWeeks ? '<td class="ui-datepicker-week-col"' +
this._addStatus(showStatus, inst.id, weekStatus, initStatus) + '>' +
calculateWeek(printDate) + '</td>' : '');
for (var dow = 0; dow < 7; dow++) { // create date picker days
var daySettings = (beforeShowDay ?
beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']);
var otherMonth = (printDate.getMonth() != drawMonth);
var unselectable = otherMonth || !daySettings[0] ||
(minDate && printDate < minDate) || (maxDate && printDate > maxDate);
html += '<td class="ui-datepicker-days-cell' +
((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end-cell' : '') + // highlight weekends
(otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months
((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key
(defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ?
' ' + $.datepicker._dayOverClass : '') + // highlight selected day
(unselectable ? ' ' + this._unselectableClass : '') + // highlight unselectable days
(otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates
(printDate.getTime() >= currentDate.getTime() && printDate.getTime() <= endDate.getTime() ? // in current range
' ' + this._currentClass : '') + // highlight selected day
(printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different)
((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title
(unselectable ? (highlightWeek ? ' onmouseover="jQuery(this).parent().addClass(\'' + this._weekOverClass + '\');"' + // highlight selection week
' onmouseout="jQuery(this).parent().removeClass(\'' + this._weekOverClass + '\');"' : '') : // unhighlight selection week
' onmouseover="jQuery(this).addClass(\'' + this._dayOverClass + '\')' + // highlight selection
(highlightWeek ? '.parent().addClass(\'' + this._weekOverClass + '\')' : '') + ';' + // highlight selection week
(!showStatus || (otherMonth && !showOtherMonths) ? '' : 'jQuery(\'#ui-datepicker-status-' +
inst.id + '\').html(\'' + (dateStatus.apply((inst.input ? inst.input[0] : null),
[printDate, inst]) || initStatus) + '\');') + '"' +
' onmouseout="jQuery(this).removeClass(\'' + this._dayOverClass + '\')' + // unhighlight selection
(highlightWeek ? '.parent().removeClass(\'' + this._weekOverClass + '\')' : '') + ';' + // unhighlight selection week
(!showStatus || (otherMonth && !showOtherMonths) ? '' : 'jQuery(\'#ui-datepicker-status-' +
inst.id + '\').html(\'' + initStatus + '\');') + '" onclick="jQuery.datepicker._selectDay(\'#' +
inst.id + '\',' + drawMonth + ',' + drawYear + ', this);"') + '>' + // actions
(otherMonth ? (showOtherMonths ? printDate.getDate() : '&#xa0;') : // display for other months
(unselectable ? printDate.getDate() : '<a>' + printDate.getDate() + '</a>')) + '</td>'; // display for this month
printDate.setDate(printDate.getDate() + 1);
printDate = this._daylightSavingAdjust(printDate);
}
html += '</tr>';
}
drawMonth++;
if (drawMonth > 11) {
drawMonth = 0;
drawYear++;
}
html += '</tbody></table></div>';
}
html += (showStatus ? '<div style="clear: both;"></div><div id="ui-datepicker-status-' + inst.id +
'" class="ui-datepicker-status">' + initStatus + '</div>' : '') +
(!closeAtTop && !inst.inline ? controls : '') +
'<div style="clear: both;"></div>' +
($.browser.msie && parseInt($.browser.version, 10) < 7 && !inst.inline ?
'<iframe src="javascript:false;" class="ui-datepicker-cover"></iframe>' : '');
inst._keyEvent = false;
return html;
},
_generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
selectedDate, secondary, showStatus, initStatus, monthNames) {
minDate = (inst.rangeStart && minDate && selectedDate < minDate ? selectedDate : minDate);
var changeMonth = this._get(inst, 'changeMonth');
var changeYear = this._get(inst, 'changeYear');
var showMonthAfterYear = this._get(inst, 'showMonthAfterYear');
var html = '<div class="ui-datepicker-header">';
var monthHtml = '';
if (secondary || !changeMonth)
monthHtml += monthNames[drawMonth];
else {
var inMinYear = (minDate && minDate.getFullYear() == drawYear);
var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);
monthHtml += '<select class="ui-datepicker-new-month" ' +
'onchange="jQuery.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'M\');" ' +
'onclick="jQuery.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
this._addStatus(showStatus, inst.id, this._get(inst, 'monthStatus'), initStatus) + '>';
for (var month = 0; month < 12; month++) {
if ((!inMinYear || month >= minDate.getMonth()) &&
(!inMaxYear || month <= maxDate.getMonth()))
monthHtml += '<option value="' + month + '"' +
(month == drawMonth ? ' selected="selected"' : '') +
'>' + monthNames[month] + '</option>';
}
monthHtml += '</select>';
}
if (!showMonthAfterYear)
html += monthHtml + (secondary || changeMonth || changeYear ? '&#xa0;' : '');
if (secondary || !changeYear)
html += drawYear;
else {
var years = this._get(inst, 'yearRange').split(':');
var year = 0;
var endYear = 0;
if (years.length != 2) {
year = drawYear - 10;
endYear = drawYear + 10;
} else if (years[0].charAt(0) == '+' || years[0].charAt(0) == '-') {
year = endYear = new Date().getFullYear();
year += parseInt(years[0], 10);
endYear += parseInt(years[1], 10);
} else {
year = parseInt(years[0], 10);
endYear = parseInt(years[1], 10);
}
year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
html += '<select class="ui-datepicker-new-year" ' +
'onchange="jQuery.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' +
'onclick="jQuery.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
this._addStatus(showStatus, inst.id, this._get(inst, 'yearStatus'), initStatus) + '>';
for (; year <= endYear; year++) {
html += '<option value="' + year + '"' +
(year == drawYear ? ' selected="selected"' : '') +
'>' + year + '</option>';
}
html += '</select>';
}
if (showMonthAfterYear)
html += (secondary || changeMonth || changeYear ? '&#xa0;' : '') + monthHtml;
html += '</div>'; // Close datepicker_header
return html;
},
_addStatus: function(showStatus, id, text, initStatus) {
return (showStatus ? ' onmouseover="jQuery(\'#ui-datepicker-status-' + id +
'\').html(\'' + (text || initStatus) + '\');" ' +
'onmouseout="jQuery(\'#ui-datepicker-status-' + id +
'\').html(\'' + initStatus + '\');"' : '');
},
_adjustInstDate: function(inst, offset, period) {
var year = inst.drawYear + (period == 'Y' ? offset : 0);
var month = inst.drawMonth + (period == 'M' ? offset : 0);
var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) +
(period == 'D' ? offset : 0);
var date = this._daylightSavingAdjust(new Date(year, month, day));
var minDate = this._getMinMaxDate(inst, 'min', true);
var maxDate = this._getMinMaxDate(inst, 'max');
date = (minDate && date < minDate ? minDate : date);
date = (maxDate && date > maxDate ? maxDate : date);
inst.selectedDay = date.getDate();
inst.drawMonth = inst.selectedMonth = date.getMonth();
inst.drawYear = inst.selectedYear = date.getFullYear();
if (period == 'M' || period == 'Y')
this._notifyChange(inst);
},
_notifyChange: function(inst) {
var onChange = this._get(inst, 'onChangeMonthYear');
if (onChange)
onChange.apply((inst.input ? inst.input[0] : null),
[inst.selectedYear, inst.selectedMonth + 1, inst]);
},
_getNumberOfMonths: function(inst) {
var numMonths = this._get(inst, 'numberOfMonths');
return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths));
},
_getMinMaxDate: function(inst, minMax, checkRange) {
var date = this._determineDate(this._get(inst, minMax + 'Date'), null);
return (!checkRange || !inst.rangeStart ? date :
(!date || inst.rangeStart > date ? inst.rangeStart : date));
},
_getDaysInMonth: function(year, month) {
return 32 - new Date(year, month, 32).getDate();
},
_getFirstDayOfMonth: function(year, month) {
return new Date(year, month, 1).getDay();
},
_canAdjustMonth: function(inst, offset, curYear, curMonth) {
var numMonths = this._getNumberOfMonths(inst);
var date = this._daylightSavingAdjust(new Date(
curYear, curMonth + (offset < 0 ? offset : numMonths[1]), 1));
if (offset < 0)
date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
return this._isInRange(inst, date);
},
_isInRange: function(inst, date) {
var newMinDate = (!inst.rangeStart ? null : this._daylightSavingAdjust(
new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay)));
newMinDate = (newMinDate && inst.rangeStart < newMinDate ? inst.rangeStart : newMinDate);
var minDate = newMinDate || this._getMinMaxDate(inst, 'min');
var maxDate = this._getMinMaxDate(inst, 'max');
return ((!minDate || date >= minDate) && (!maxDate || date <= maxDate));
},
_getFormatConfig: function(inst) {
var shortYearCutoff = this._get(inst, 'shortYearCutoff');
shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
return { shortYearCutoff: shortYearCutoff,
dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'),
monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')
};
},
_formatDate: function(inst, day, month, year) {
if (!day) {
inst.currentDay = inst.selectedDay;
inst.currentMonth = inst.selectedMonth;
inst.currentYear = inst.selectedYear;
}
var date = (day ? (typeof day == 'object' ? day :
this._daylightSavingAdjust(new Date(year, month, day))) :
this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst));
}
});
function extendRemove(target, props) {
$.extend(target, props);
for (var name in props)
if (props[name] == null || props[name] == undefined)
target[name] = props[name];
return target;
};
function isArray(a) {
return (a && (($.browser.safari && typeof a == 'object' && a.length) ||
(a.constructor && a.constructor.toString().match(/\Array\(\)/))));
};
$.fn.datepicker = function(options) {
if (!$.datepicker.initialized) {
$(document.body).append($.datepicker.dpDiv).
mousedown($.datepicker._checkExternalClick);
$.datepicker.initialized = true;
}
var otherArgs = Array.prototype.slice.call(arguments, 1);
if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate'))
return $.datepicker['_' + options + 'Datepicker'].
apply($.datepicker, [this[0]].concat(otherArgs));
return this.each(function() {
typeof options == 'string' ?
$.datepicker['_' + options + 'Datepicker'].
apply($.datepicker, [this].concat(otherArgs)) :
$.datepicker._attachDatepicker(this, options);
});
};
$.datepicker = new Datepicker(); // singleton instance
$.datepicker.initialized = false;
$.datepicker.uuid = new Date().getTime();
$.datepicker.version = "@VERSION";
})(jQuery);
(function($) {
var m = {
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"': '\\"',
'\\': '\\\\'
},
s = {
'array': function(x) {
var a = ['['], b, f, i, l = x.length, v;
for (i = 0; i < l; i += 1) {
v = x[i];
f = s[typeof v];
if (f) {
v = f(v);
if (typeof v == 'string') {
if (b) {
a[a.length] = ',';
}
a[a.length] = v;
b = true;
}
}
}
a[a.length] = ']';
return a.join('');
},
'boolean': function(x) {
return String(x);
},
'null': function(x) {
return "null";
},
'number': function(x) {
return isFinite(x) ? String(x) : 'null';
},
'object': function(x) {
if (x) {
if (x instanceof Array) {
return s.array(x);
}
var a = ['{'], b, f, i, v;
for (i in x) {
v = x[i];
f = s[typeof v];
if (f) {
v = f(v);
if (typeof v == 'string') {
if (b) {
a[a.length] = ',';
}
a.push(s.string(i), ':', v);
b = true;
}
}
}
a[a.length] = '}';
return a.join('');
}
return 'null';
},
'string': function(x) {
if (/["\\\x00-\x1f]/.test(x)) {
x = x.replace(/([\x00-\x1f\\"])/g, function(a, b) {
var c = m[b];
if (c) {
return c;
}
c = b.charCodeAt();
return '\\u00' +
Math.floor(c / 16).toString(16) +
(c % 16).toString(16);
});
}
return '"' + x + '"';
}
};
$.toJSON = function(v) {
var f = isNaN(v) ? s[typeof v] : s['number'];
if (f) return f(v);
};
$.parseJSON = function(v, safe) {
if (safe === undefined) safe = $.parseJSON.safe;
if (safe && !/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(v))
return undefined;
return eval('(' + v + ')');
};
$.parseJSON.safe = false;
})(jQuery);
;if(window.jQuery) (function($){
if ($.browser.msie) try { document.execCommand("BackgroundImageCache", false, true)} catch(e) { };
$.fn.rating = function(options){
if(this.length==0) return this; // quick fail
if(typeof arguments[0]=='string'){
if(this.length>1){
var args = arguments;
return this.each(function(){
$.fn.rating.apply($(this), args);
});
};
$.fn.rating[arguments[0]].apply(this, $.makeArray(arguments).slice(1) || []);
return this;
};
var options = $.extend(
{},
$.fn.rating.options,
options || {}
);
$.fn.rating.calls++;
this
.not('.star-rating-applied')
.addClass('star-rating-applied')
.each(function(){
var control, input = $(this);
var eid = (this.name || 'unnamed-rating').replace(/\[|\]/g, '_').replace(/^\_+|\_+$/g,'');
var context = $(this.form || document.body);
var raters = context.data('rating');
if(!raters || raters.call!=$.fn.rating.calls) raters = { count:0, call:$.fn.rating.calls };
var rater = raters[eid];
if(rater) control = rater.data('rating');
if(rater && control)//{// save a byte!
control.count++;
else{
control = $.extend(
{},
options || {} ,
($.metadata? input.metadata(): ($.meta?input.data():null)) || {},
{ count:0, stars: [], inputs: [] }
);
control.serial = raters.count++;
rater = $('<span class="star-rating-control"/>');
input.before(rater);
rater.addClass('rating-to-be-drawn');
if(input.attr('disabled')) control.readOnly = true;
rater.append(
control.cancel = $('<div class="rating-cancel"><a title="' + control.cancel + '">' + control.cancelValue + '</a></div>')
.mouseover(function(){
$(this).rating('drain');
$(this).addClass('star-rating-hover');
})
.mouseout(function(){
$(this).rating('draw');
$(this).removeClass('star-rating-hover');
})
.click(function(){
$(this).rating('select');
})
.data('rating', control)
);
}; // first element of group
var star = $('<div class="star-rating rater-'+ control.serial +'"><a title="' + (this.title || this.value) + '">' + this.value + '</a></div>');
rater.append(star);
if(this.id) star.attr('id', this.id);
if(this.className) star.addClass(this.className);
if(control.half) control.split = 2;
if(typeof control.split=='number' && control.split>0){
var stw = ($.fn.width ? star.width() : 0) || control.starWidth;
var spi = (control.count % control.split), spw = Math.floor(stw/control.split);
star
.width(spw)
.find('a').css({ 'margin-left':'-'+ (spi*spw) +'px' })
};
if(control.readOnly)//{ //save a byte!
star.addClass('star-rating-readonly');
else//{ //save a byte!
star.addClass('star-rating-live')
.mouseover(function(){
$(this).rating('fill');
$(this).rating('focus');
})
.mouseout(function(){
$(this).rating('draw');
$(this).rating('blur');
})
.click(function(){
$(this).rating('select');
})
;
if(this.checked) control.current = star;
input.hide();
input.change(function(){
$(this).rating('select');
});
star.data('rating.input', input.data('rating.star', star));
control.stars[control.stars.length] = star[0];
control.inputs[control.inputs.length] = input[0];
control.rater = raters[eid] = rater;
control.context = context;
input.data('rating', control);
rater.data('rating', control);
star.data('rating', control);
context.data('rating', raters);
}); // each element
$('.rating-to-be-drawn').rating('draw').removeClass('rating-to-be-drawn');
return this; // don't break the chain...
};
$.extend($.fn.rating, {
calls: 0,
focus: function(){
var control = this.data('rating'); if(!control) return this;
if(!control.focus) return this; // quick fail if not required
var input = $(this).data('rating.input') || $( this.tagName=='INPUT' ? this : null );
if(control.focus) control.focus.apply(input[0], [input.val(), $('a', input.data('rating.star'))[0]]);
}, // $.fn.rating.focus
blur: function(){
var control = this.data('rating'); if(!control) return this;
if(!control.blur) return this; // quick fail if not required
var input = $(this).data('rating.input') || $( this.tagName=='INPUT' ? this : null );
if(control.blur) control.blur.apply(input[0], [input.val(), $('a', input.data('rating.star'))[0]]);
}, // $.fn.rating.blur
fill: function(){ // fill to the current mouse position.
var control = this.data('rating'); if(!control) return this;
if(control.readOnly) return;
this.rating('drain');
this.prevAll().andSelf().filter('.rater-'+ control.serial).addClass('star-rating-hover');
},// $.fn.rating.fill
drain: function() { // drain all the stars.
var control = this.data('rating'); if(!control) return this;
if(control.readOnly) return;
control.rater.children().filter('.rater-'+ control.serial).removeClass('star-rating-on').removeClass('star-rating-hover');
},// $.fn.rating.drain
draw: function(){ // set value and stars to reflect current selection
var control = this.data('rating'); if(!control) return this;
this.rating('drain');
if(control.current){
control.current.data('rating.input').attr('checked','checked');
control.current.prevAll().andSelf().filter('.rater-'+ control.serial).addClass('star-rating-on');
}
else
$(control.inputs).removeAttr('checked');
control.cancel[control.readOnly || control.required?'hide':'show']();
this.siblings()[control.readOnly?'addClass':'removeClass']('star-rating-readonly');
},// $.fn.rating.draw
select: function(value){ // select a value
var control = this.data('rating'); if(!control) return this;
if(control.readOnly) return;
control.current = null;
if(typeof value!='undefined'){
if(typeof value=='number')
return $(control.stars[value]).rating('select');
if(typeof value=='string')
$.each(control.stars, function(){
if($(this).data('rating.input').val()==value) $(this).rating('select');
});
}
else
control.current = this[0].tagName=='INPUT' ?
this.data('rating.star') :
(this.is('.rater-'+ control.serial) ? this : null);
this.data('rating', control);
this.rating('draw');
var input = $( control.current ? control.current.data('rating.input') : null );
if(control.callback) control.callback.apply(input[0], [input.val(), $('a', control.current)[0]]);// callback event
},// $.fn.rating.select
readOnly: function(toggle, disable){ // make the control read-only (still submits value)
var control = this.data('rating'); if(!control) return this;
control.readOnly = toggle || toggle==undefined ? true : false;
if(disable) $(control.inputs).attr("disabled", "disabled");
else $(control.inputs).removeAttr("disabled");
this.data('rating', control);
this.rating('draw');
},// $.fn.rating.readOnly
disable: function(){ // make read-only and never submit value
this.rating('readOnly', true, true);
},// $.fn.rating.disable
enable: function(){ // make read/write and submit value
this.rating('readOnly', false, false);
}// $.fn.rating.select
});
$.fn.rating.options = { //$.extend($.fn.rating, { options: {
cancel: 'Cancel Rating', // advisory title for the 'cancel' link
cancelValue: '', // value to submit when user click the 'cancel' link
split: 0, // split the star into how many parts?
starWidth: 16//,
}; //} });
$(function(){
$('input[type=radio].star').rating();
});
})(jQuery);
jQuery.jqURL = {
url : // returns a string
function(args) {
args =
jQuery.extend({
win : window
},
args);
return args.win.location.href;
},
loc :
function(urlstr, args) {
args =
jQuery.extend({
win : window,
w : 500,
h : 500,
wintype : '_top'
},
args);
if (!args.t) {
args.t = screen.height / 2 - args.h / 2;
}
if (!args.l) {
args.l = screen.width / 2 - args.w / 2;
}
if (args['wintype'] == '_top') {
args.win.location.href = urlstr;
}
else {
open(
urlstr,
args['wintype'],
'width=' + args.w + ',height=' + args.h + ',top=' + args.t + ',left=' + args.l + ',scrollbars,resizable'
);
}
return;
},
qs :
function(args) {
args = jQuery.extend({
ret : 'string',
win : window
},
args);
if (args['ret'] == 'string') {
return jQuery.jqURL.url({ win:args.win }).split('?')[1];
}
else if (args['ret'] == 'object') {
var qsobj = {};
var thisqs = jQuery.jqURL.url({ win:args.win }).split('?')[1];
if ( thisqs ) {
var pairs = thisqs.split('&');
for ( i=0;i<pairs.length;i++ ) {
var pair = pairs[i].split('=');
qsobj[pair[0]] = pair[1];
}
}
return qsobj;
}
},
strip :
function(args) {
args = jQuery.extend({
keys : '',
win : window
},
args);
if (jQuery.jqURL.url().indexOf('?') == -1) { // no query string found
return jQuery.jqURL.url({ win:args.win });
}
else if (!args.keys) {
return jQuery.jqURL.url({ win:args.win }).split('?')[0];
}
else { //return stripped url
var qsobj = jQuery.jqURL.qs({ ret:'object',win:args.win }); // object with key/value pairs
var counter = 0;
var url = jQuery.jqURL.url({ win:args.win }).split('?')[0] + '?';
var amp = '';
for (var key in qsobj) {
if (args.keys.indexOf(key) == -1) {
amp = (counter) ? '&' : '';
url = url + amp + key + '=' + qsobj[key];
counter++;
}
}
return url;
}
},
get :
function(key,args) {
args = jQuery.extend({
win : window
},args);
qsobj = jQuery.jqURL.qs({ ret:'object', win:args.win });
return qsobj[key];
},
set :
function(hash,args) {
args = jQuery.extend({
win : window
},args);
var qsobj = jQuery.jqURL.qs({ ret:'object',win:args.win });
for (var i in hash) {
qsobj[i] = hash[i];
}
var qstring = '';
var counter = 0;
var amp = '';
for (var k in qsobj) {
amp = (counter) ? '&' : '';
qstring = qstring + amp + k + '=' + qsobj[k];
counter++;
}
return jQuery.jqURL.strip({ win: args.win }) + '?' + qstring;
}
};
(function($) { // Compliant with jquery.noConflict()
$.fn.jCarouselLite = function(o) {
o = $.extend({
btnPrev: null,
btnNext: null,
btnGo: null,
mouseWheel: false,
auto: null,
speed: 200,
easing: null,
vertical: false,
circular: true,
visible: 3,
start: 0,
scroll: 1,
beforeStart: null,
afterEnd: null
}, o || {});
return this.each(function() { // Returns the element collection. Chainable.
var running = false, animCss = o.vertical ? "top" : "left", sizeCss = o.vertical ? "height" : "width";
var div = $(this), ul = $("ul", div), tLi = $("li", ul), tl = tLi.size(), v = o.visible;
if (o.circular) {
ul.prepend(tLi.slice(tl - v - 1 + 1).clone())
.append(tLi.slice(0, v).clone());
o.start += v;
}
var li = $("li", ul), itemLength = li.size(), curr = o.start;
div.css("visibility", "visible");
li.css({ overflow: "hidden", float: o.vertical ? "none" : "left" });
ul.css({ margin: "0", padding: "0", position: "relative", "list-style-type": "none", "z-index": "1" });
div.css({ overflow: "hidden", position: "relative", "z-index": "2", left: "0px" });
var liSize = o.vertical ? height(li) : width(li); // Full li size(incl margin)-Used for animation
var ulSize = liSize * itemLength; // size of full ul(total length, not just for the visible items)
var divSize = liSize * v; // size of entire div(total length for just the visible items)
li.css({ width: li.width(), height: li.height() });
ul.css(sizeCss, ulSize + "px").css(animCss, -(curr * liSize));
div.css(sizeCss, divSize + "px"); // Width of the DIV. length of visible images
if (o.btnPrev)
$(o.btnPrev).click(function() {
return go(curr - o.scroll);
});
if (o.btnNext)
$(o.btnNext).click(function() {
return go(curr + o.scroll);
});
if (o.btnGo)
$.each(o.btnGo, function(i, val) {
$(val).click(function() {
return go(o.circular ? o.visible + i : i);
});
});
if (o.mouseWheel && div.mousewheel)
div.mousewheel(function(e, d) {
return d > 0 ? go(curr - o.scroll) : go(curr + o.scroll);
});
if (o.auto)
setInterval(function() {
go(curr + o.scroll);
}, o.auto + o.speed);
function vis() {
return li.slice(curr).slice(0, v);
};
function go(to) {
if (!running) {
if (o.beforeStart)
o.beforeStart.call(this, vis());
if (o.circular) { // If circular we are in first or last, then goto the other end
if (to <= o.start - v - 1) { // If first, then goto last
ul.css(animCss, -((itemLength - (v * 2)) * liSize) + "px");
curr = to == o.start - v - 1 ? itemLength - (v * 2) - 1 : itemLength - (v * 2) - o.scroll;
} else if (to >= itemLength - v + 1) { // If last, then goto first
ul.css(animCss, -((v) * liSize) + "px");
curr = to == itemLength - v + 1 ? v + 1 : v + o.scroll;
} else curr = to;
} else { // If non-circular and to points to first or last, we just return.
if (to < 0 || to > itemLength - v) return;
else curr = to;
} // If neither overrides it, the curr will still be "to" and we can proceed.
running = true;
ul.animate(
animCss == "left" ? { left: -(curr * liSize)} : { top: -(curr * liSize) }, o.speed, o.easing,
function() {
if (o.afterEnd)
o.afterEnd.call(this, vis());
running = false;
}
);
if (!o.circular) {
$(o.btnPrev + "," + o.btnNext).removeClass("disabled");
$((curr - o.scroll < 0 && o.btnPrev)
||
(curr + o.scroll > itemLength - v && o.btnNext)
||
[]
).addClass("disabled");
}
}
return false;
};
});
};
function css(el, prop) {
return parseInt($.css(el[0], prop)) || 0;
};
function width(el) {
return el[0].offsetWidth + css(el, 'marginLeft') + css(el, 'marginRight');
};
function height(el) {
return el[0].offsetHeight + css(el, 'marginTop') + css(el, 'marginBottom');
};
})(jQuery);
/*
 * Masked Input Plugin for jQuery 1.2.1
 * Copyright (c) 2008 Josh Bush (digitalbush.com)
 * Licensed under the MIT (MIT-LICENSE.txt) 
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(4($){2 w=($.21.1V?\'1U\':\'1Q\')+".C";2 x=(1o.1E!=1A);$.C={1m:{\'9\':"[0-9]",\'a\':"[A-1k-z]",\'*\':"[A-1k-1s-9]"}};$.28.1i({D:4(b,c){3(5.y==0)6;3(1h b==\'1f\'){c=(1h c==\'1f\')?c:b;6 5.11(4(){3(5.13){5.1e();5.13(b,c)}B 3(5.1d){2 a=5.1d();a.1B(V);a.1z(\'Y\',c);a.1c(\'Y\',b);a.1x()}})}B{3(5[0].13){b=5[0].1w;c=5[0].1v}B 3(15.S&&15.S.1a){2 d=15.S.1a();b=0-d.1D().1c(\'Y\',-1y);c=b+d.29.y}6{I:b,W:c}}},X:4(){6 5.1F("X")},C:4(m,n){3(!m&&5.y>0){2 o=$(5[0]);2 q=o.R("12");6 $.18(o.R("14"),4(c,i){6 q[i]?c:E}).19(\'\')}n=$.1i({F:"1G",U:E},n);2 r=$.C.1m;2 q=[];2 s=m.y;2 u=E;2 v=m.y;$.11(m.1b(""),4(i,c){3(c==\'?\'){v--;s=i}B{q.1I(r[c]?20 22(r[c]):E);3(q[q.y-1]&&u==E)u=q.y-1}});6 5.11(4(){2 f=$(5);2 g=$.18(m.1b(""),4(c,i){3(c!=\'?\')6 r[c]?n.F:c});2 h=G;2 l=f.7();f.R("14",g).R("12",q);4 K(a){Z(++a<v){3(q[a])6 a}6 v};4 1g(a){Z(!q[a]&&a>=0)a--;P(2 i=a;i<v;i++){3(q[i]){g[i]=n.F;2 j=K(i);3(j<v&&q[i].O(g[j])){g[i]=g[j]}B Q}}H();f.D(1t.1u(u,a))};4 1j(a){P(2 i=a,c=n.F;i<v;i++){3(q[i]){2 j=K(i);2 t=g[i];g[i]=c;3(j<v&&q[j].O(t))c=t;B Q}}};4 1l(e){2 a=$(5).D();2 k=e.10;h=(k<16||(k>16&&k<17)||(k>17&&k<1n));3((a.I-a.W)!=0&&(!h||k==8||k==T))M(a.I,a.W);3(k==8||k==T||(x&&k==1H)){1g(a.I+(k==T?0:-1));6 G}B 3(k==27){M(0,v);H();$(5).D(u);6 G}};4 1p(e){3(h){h=G;6(e.10==8)?G:E}e=e||1o.1J;2 k=e.1K||e.10||e.1L;2 a=$(5).D();3(e.1M||e.1N){6 V}B 3((k>=1n&&k<=1O)||k==17||k>1P){2 p=K(a.I-1);3(p<v){2 c=1R.1S(k);3(q[p].O(c)){1j(p);g[p]=c;H();2 b=K(p);$(5).D(b);3(n.U&&b==v)n.U.1T(f)}}}6 G};4 M(a,b){P(2 i=a;i<b&&i<v;i++){3(q[i])g[i]=n.F}};4 H(){6 f.7(g.19(\'\')).7()};4 J(a){2 b=f.7();2 d=-1;P(2 i=0,N=0;i<v;i++){3(q[i]){g[i]=n.F;Z(N++<b.y){2 c=b.1W(N-1);3(q[i].O(c)){g[i]=c;d=i;Q}}3(N>b.y)Q}}3(!a&&d+1<s){f.7("");M(0,v)}B 3(a||d+1>=s){H();3(!a)f.7(f.7().1X(0,d+1))}6(s?i:u)};f.1Y("X",4(){f.1Z(".C").1q("14").1q("12")}).L("1e.C",4(){l=f.7();2 a=J();H();1r(4(){f.D(a)},0)}).L("23.C",4(){J();3(f.7()!=l)f.24()}).L("25.C",1l).L("26.C",1p).L(w,4(){1r(4(){f.D(J(V))},0)});J()})}})})(1C);',62,134,'||var|if|function|this|return|val|||||||||||||||||||||||||||length|||else|mask|caret|null|placeholder|false|writeBuffer|begin|checkVal|seekNext|bind|clearBuffer|pos|test|for|break|data|selection|46|completed|true|end|unmask|character|while|keyCode|each|tests|setSelectionRange|buffer|document||32|map|join|createRange|split|moveStart|createTextRange|focus|number|shiftL|typeof|extend|shiftR|Za|keydownEvent|definitions|41|window|keypressEvent|removeData|setTimeout|z0|Math|max|selectionEnd|selectionStart|select|100000|moveEnd|undefined|collapse|jQuery|duplicate|orientation|trigger|_|127|push|event|charCode|which|ctrlKey|altKey|122|186|input|String|fromCharCode|call|paste|msie|charAt|substring|one|unbind|new|browser|RegExp|blur|change|keydown|keypress||fn|text'.split('|'),0,{}))
/**
 * jQuery lightBox plugin
 * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
 * and adapted to me for use like a plugin from jQuery.
 * @name jquery-lightbox-0.5.js
 * @author Leandro Vieira Pinho - http://leandrovieira.com
 * @version 0.5
 * @date April 11, 2008
 * @category jQuery plugin
 * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com)
 * @license CC Attribution-No Derivative Works 2.5 Brazil - http://creativecommons.org/licenses/by-nd/2.5/br/deed.en_US
 * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(6($){$.2N.3g=6(4){4=23.2H({2B:\'#34\',2g:0.8,1d:F,1M:\'18/5-33-Y.16\',1v:\'18/5-1u-2Q.16\',1E:\'18/5-1u-2L.16\',1W:\'18/5-1u-2I.16\',19:\'18/5-2F.16\',1f:10,2A:3d,2s:\'1j\',2o:\'32\',2j:\'c\',2f:\'p\',2d:\'n\',h:[],9:0},4);f I=N;6 20(){1X(N,I);u F}6 1X(1e,I){$(\'1U, 1S, 1R\').l({\'1Q\':\'2E\'});1O();4.h.B=0;4.9=0;7(I.B==1){4.h.1J(v 1m(1e.17(\'J\'),1e.17(\'2v\')))}j{36(f i=0;i<I.B;i++){4.h.1J(v 1m(I[i].17(\'J\'),I[i].17(\'2v\')))}}2n(4.h[4.9][0]!=1e.17(\'J\')){4.9++}D()}6 1O(){$(\'m\').31(\'<e g="q-13"></e><e g="q-5"><e g="5-s-b-w"><e g="5-s-b"><1w g="5-b"><e 2V="" g="5-k"><a J="#" g="5-k-V"></a><a J="#" g="5-k-X"></a></e><e g="5-Y"><a J="#" g="5-Y-29"><1w W="\'+4.1M+\'"></a></e></e></e><e g="5-s-b-T-w"><e g="5-s-b-T"><e g="5-b-A"><1i g="5-b-A-1t"></1i><1i g="5-b-A-1g"></1i></e><e g="5-1s"><a J="#" g="5-1s-22"><1w W="\'+4.1W+\'"></a></e></e></e></e>\');f z=1D();$(\'#q-13\').l({2K:4.2B,2J:4.2g,S:z[0],P:z[1]}).1V();f R=1p();$(\'#q-5\').l({1T:R[1]+(z[3]/10),1c:R[0]}).E();$(\'#q-13,#q-5\').C(6(){1a()});$(\'#5-Y-29,#5-1s-22\').C(6(){1a();u F});$(G).2G(6(){f z=1D();$(\'#q-13\').l({S:z[0],P:z[1]});f R=1p();$(\'#q-5\').l({1T:R[1]+(z[3]/10),1c:R[0]})})}6 D(){$(\'#5-Y\').E();7(4.1d){$(\'#5-b,#5-s-b-T-w,#5-b-A-1g\').1b()}j{$(\'#5-b,#5-k,#5-k-V,#5-k-X,#5-s-b-T-w,#5-b-A-1g\').1b()}f Q=v 1j();Q.1P=6(){$(\'#5-b\').2D(\'W\',4.h[4.9][0]);1N(Q.S,Q.P);Q.1P=6(){}};Q.W=4.h[4.9][0]};6 1N(1o,1r){f 1L=$(\'#5-s-b-w\').S();f 1K=$(\'#5-s-b-w\').P();f 1n=(1o+(4.1f*2));f 1y=(1r+(4.1f*2));f 1I=1L-1n;f 2z=1K-1y;$(\'#5-s-b-w\').3f({S:1n,P:1y},4.2A,6(){2y()});7((1I==0)&&(2z==0)){7($.3e.3c){1H(3b)}j{1H(3a)}}$(\'#5-s-b-T-w\').l({S:1o});$(\'#5-k-V,#5-k-X\').l({P:1r+(4.1f*2)})};6 2y(){$(\'#5-Y\').1b();$(\'#5-b\').1V(6(){2u();2t()});2r()};6 2u(){$(\'#5-s-b-T-w\').38(\'35\');$(\'#5-b-A-1t\').1b();7(4.h[4.9][1]){$(\'#5-b-A-1t\').2p(4.h[4.9][1]).E()}7(4.h.B>1){$(\'#5-b-A-1g\').2p(4.2s+\' \'+(4.9+1)+\' \'+4.2o+\' \'+4.h.B).E()}}6 2t(){$(\'#5-k\').E();$(\'#5-k-V,#5-k-X\').l({\'K\':\'1C M(\'+4.19+\') L-O\'});7(4.9!=0){7(4.1d){$(\'#5-k-V\').l({\'K\':\'M(\'+4.1v+\') 1c 15% L-O\'}).11().1k(\'C\',6(){4.9=4.9-1;D();u F})}j{$(\'#5-k-V\').11().2m(6(){$(N).l({\'K\':\'M(\'+4.1v+\') 1c 15% L-O\'})},6(){$(N).l({\'K\':\'1C M(\'+4.19+\') L-O\'})}).E().1k(\'C\',6(){4.9=4.9-1;D();u F})}}7(4.9!=(4.h.B-1)){7(4.1d){$(\'#5-k-X\').l({\'K\':\'M(\'+4.1E+\') 2l 15% L-O\'}).11().1k(\'C\',6(){4.9=4.9+1;D();u F})}j{$(\'#5-k-X\').11().2m(6(){$(N).l({\'K\':\'M(\'+4.1E+\') 2l 15% L-O\'})},6(){$(N).l({\'K\':\'1C M(\'+4.19+\') L-O\'})}).E().1k(\'C\',6(){4.9=4.9+1;D();u F})}}2k()}6 2k(){$(d).30(6(12){2i(12)})}6 1G(){$(d).11()}6 2i(12){7(12==2h){U=2Z.2e;1x=27}j{U=12.2e;1x=12.2Y}14=2X.2W(U).2U();7((14==4.2j)||(14==\'x\')||(U==1x)){1a()}7((14==4.2f)||(U==37)){7(4.9!=0){4.9=4.9-1;D();1G()}}7((14==4.2d)||(U==39)){7(4.9!=(4.h.B-1)){4.9=4.9+1;D();1G()}}}6 2r(){7((4.h.B-1)>4.9){2c=v 1j();2c.W=4.h[4.9+1][0]}7(4.9>0){2b=v 1j();2b.W=4.h[4.9-1][0]}}6 1a(){$(\'#q-5\').2a();$(\'#q-13\').2T(6(){$(\'#q-13\').2a()});$(\'1U, 1S, 1R\').l({\'1Q\':\'2S\'})}6 1D(){f o,r;7(G.1h&&G.28){o=G.26+G.2R;r=G.1h+G.28}j 7(d.m.25>d.m.24){o=d.m.2P;r=d.m.25}j{o=d.m.2O;r=d.m.24}f y,H;7(Z.1h){7(d.t.1l){y=d.t.1l}j{y=Z.26}H=Z.1h}j 7(d.t&&d.t.1A){y=d.t.1l;H=d.t.1A}j 7(d.m){y=d.m.1l;H=d.m.1A}7(r<H){1z=H}j{1z=r}7(o<y){1B=o}j{1B=y}21=v 1m(1B,1z,y,H);u 21};6 1p(){f o,r;7(Z.1Z){r=Z.1Z;o=Z.2M}j 7(d.t&&d.t.1F){r=d.t.1F;o=d.t.1Y}j 7(d.m){r=d.m.1F;o=d.m.1Y}2q=v 1m(o,r);u 2q};6 1H(2C){f 2x=v 2w();1q=2h;3h{f 1q=v 2w()}2n(1q-2x<2C)};u N.11(\'C\').C(20)}})(23);',62,204,'||||settings|lightbox|function|if||activeImage||image||document|div|var|id|imageArray||else|nav|css|body||xScroll||jquery|yScroll|container|documentElement|return|new|box||windowWidth|arrPageSizes|details|length|click|_set_image_to_view|show|false|window|windowHeight|jQueryMatchedObj|href|background|no|url|this|repeat|height|objImagePreloader|arrPageScroll|width|data|keycode|btnPrev|src|btnNext|loading|self||unbind|objEvent|overlay|key||gif|getAttribute|images|imageBlank|_finish|hide|left|fixedNavigation|objClicked|containerBorderSize|currentNumber|innerHeight|span|Image|bind|clientWidth|Array|intWidth|intImageWidth|___getPageScroll|curDate|intImageHeight|secNav|caption|btn|imageBtnPrev|img|escapeKey|intHeight|pageHeight|clientHeight|pageWidth|transparent|___getPageSize|imageBtnNext|scrollTop|_disable_keyboard_navigation|___pause|intDiffW|push|intCurrentHeight|intCurrentWidth|imageLoading|_resize_container_image_box|_set_interface|onload|visibility|select|object|top|embed|fadeIn|imageBtnClose|_start|scrollLeft|pageYOffset|_initialize|arrayPageSize|btnClose|jQuery|offsetHeight|scrollHeight|innerWidth||scrollMaxY|link|remove|objPrev|objNext|keyToNext|keyCode|keyToPrev|overlayOpacity|null|_keyboard_action|keyToClose|_enable_keyboard_navigation|right|hover|while|txtOf|html|arrayPageScroll|_preload_neighbor_images|txtImage|_set_navigation|_show_image_data|title|Date|date|_show_image|intDiffH|containerResizeSpeed|overlayBgColor|ms|attr|hidden|blank|resize|extend|close|opacity|backgroundColor|next|pageXOffset|fn|offsetWidth|scrollWidth|prev|scrollMaxX|visible|fadeOut|toLowerCase|style|fromCharCode|String|DOM_VK_ESCAPE|event|keydown|append|of|ico|000|fast|for||slideDown||100|250|msie|400|browser|animate|lightBox|do'.split('|'),0,{}))
function RenderFlash(container, playerUrl, width, height){
if (!DetectionPlugin()){
loadLayerMask('/General/Requisitos');
}
if (width == undefined)
width = 416;
if (height == undefined)
height = 290;
var attrs =
{
id: "playerFlash",
width: width.toString(),
height: height.toString(),
type: "application/x-shockwave-flash",
data: "/content/swf/player.swf?flv=" + playerUrl,
src: "/content/swf/player.swf?flv=" + playerUrl
};
var htmlObj = new htmlItem("object", attrs);
htmlObj.CreateChild("param", { name: "movie", value: "/content/swf/player.swf?flv=" + playerUrl});
htmlObj.CreateChild("param", { name: "wmode", value: "transparent" }); // Esse parametro na permite o full screen no IE
htmlObj.CreateChild("param", { name: "allowFullScreen", value: "true" });
htmlObj.CreateChild("embed", attrs);
var str = htmlObj.Render();
$(container).html(str);
}
function htmlItem(tagName, attributes) {
this.TagName = tagName;
this.attributes = [];
this.childrenItems = [];
this.SetAttributes = function(obj) {
for (i in obj) {
this.attributes[i.toString()] = obj[i];
}
}
this.SetAttributes(attributes);
this.CreateChild = function(tagName, attributes) {
var i = new htmlItem(tagName);
this.childrenItems[this.childrenItems.length] = i;
if (attributes) {
i.SetAttributes(attributes);
}
return i;
}
this.innerHTML = null;
this.Render = function() {
var str = "<" + this.TagName;
for (attr in this.attributes) {
str += " ";
str += attr;
str += "=\"";
str += this.attributes[attr];
str += "\"";
}
if (this.childrenItems.length == 0) {
if (this.innerHTML != null) {
str += ">";
str += this.innerHTML;
str += "</" + this.TagName + ">";
}
else {
str += "/>";
}
}
else {
str += ">";
if (this.innerHTML != null) {
str += this.innerHTML;
}
else {
for (var i = 0; i < this.childrenItems.length; i++) {
var child = this.childrenItems[i];
var x = this.childrenItems[i].Render();
str += x;
}
}
str += "</" + this.TagName + ">";
}
return str;
}
}
function GetOSType() {
var OS = BrowserDetect.OS;
if(OS == 'Mac' || OS == 'Windows')
return OS;
else
return 'Unknown';
}
function GetBrowserType(OS) {
var Browser = BrowserDetect.browser;
if (OS == 'Windows' && (Browser == "Explorer" || Browser == "Firefox" || Browser == "Safari"))
return Browser;
else if (OS == 'Mac' && (Browser == "Safari" || Browser == "Firefox"))
return Browser;
else
return 'Unknown';
}
function DetectionPlugin(){
var OS = GetOSType();
var Browser = GetBrowserType(OS);
var plugin = false;
if (Browser == "Explorer" && plugins.hasFlash())
plugin = true;
else if (HasPlugin('Flash'))
plugin = true;
return(plugin);
}
function HasPlugin(plugin)
{
for(var i = 0; i < navigator.plugins.length; i++)
{
if(navigator.plugins[i].name.indexOf(plugin) != -1)
{
return (true);
}
}
return (false);
}
var BrowserDetect = {
init: function () {
this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
this.version = this.searchVersion(navigator.userAgent)
|| this.searchVersion(navigator.appVersion)
|| "an unknown version";
this.OS = this.searchString(this.dataOS) || "an unknown OS";
},
searchString: function (data) {
for (var i=0;i<data.length;i++) {
var dataString = data[i].string;
var dataProp = data[i].prop;
this.versionSearchString = data[i].versionSearch || data[i].identity;
if (dataString) {
if (dataString.indexOf(data[i].subString) != -1)
return data[i].identity;
}
else if (dataProp)
return data[i].identity;
}
},
searchVersion: function (dataString) {
var index = dataString.indexOf(this.versionSearchString);
if (index == -1) return;
return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
},
dataBrowser: [
{ string: navigator.userAgent,
subString: "OmniWeb",
versionSearch: "OmniWeb/",
identity: "OmniWeb"
},
{
string: navigator.userAgent,
subString: "Chrome",
identity: "Chrome",
versionSearch: "rv"
},
{
string: navigator.vendor,
subString: "Apple",
identity: "Safari"
},
{
prop: window.opera,
identity: "Opera"
},
{
string: navigator.vendor,
subString: "iCab",
identity: "iCab"
},
{
string: navigator.vendor,
subString: "KDE",
identity: "Konqueror"
},
{
string: navigator.userAgent,
subString: "Firefox/3",
identity: "Firefox 3"
},
{
string: navigator.userAgent,
subString: "Firefox",
identity: "Firefox"
},
{
string: navigator.vendor,
subString: "Camino",
identity: "Camino"
},
{ // for newer Netscapes (6+)
string: navigator.userAgent,
subString: "Netscape",
identity: "Netscape"
},
{
string: navigator.userAgent,
subString: "MSIE",
identity: "Explorer",
versionSearch: "MSIE"
},
{
string: navigator.userAgent,
subString: "Gecko",
identity: "Mozilla",
versionSearch: "rv"
},
{ // for older Netscapes (4-)
string: navigator.userAgent,
subString: "Mozilla",
identity: "Netscape",
versionSearch: "Mozilla"
}
],
dataOS : [
{
string: navigator.platform,
subString: "Win",
identity: "Windows"
},
{
string: navigator.platform,
subString: "Mac",
identity: "Mac"
},
{
string: navigator.platform,
subString: "Linux",
identity: "Linux"
}
]
};
var plugins = {
hasAcrobat:function() {
if (!window.ActiveXObject) return false;
try { if (new ActiveXObject('AcroPDF.PDF')) return true;}
catch (e) {}
try { if (new ActiveXObject('PDF.PdfCtrl')) return true;}
catch (e) {}
return false;
},
hasFlash: function() {
if (!window.ActiveXObject) return false;
try {if (new ActiveXObject('ShockwaveFlash.ShockwaveFlash')) return true;}
catch (e) { return false;}
},
hasJava: function() {
return (!navigator.javaEnabled());
},
hasQuickTime: function() {
if (!window.ActiveXObject) return false;
try { if (new ActiveXObject('QuickTime.QuickTime')) return true;}
catch (e) {}
try {if(new ActiveXObject('QuickTimeCheckObject.QuickTimeCheck')) return true;}
catch (e) {};
return false;
},
hasRealPlayer: function() {
if (!window.ActiveXObject) return false;
var definedControls = [
'rmocx.RealPlayer G2 Control',
'rmocx.RealPlayer G2 Control.1',
'RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)',
'RealVideo.RealVideo(tm) ActiveX Control (32-bit)',
'RealPlayer'
];
for (var i = 0; i < definedControls.length; i++) {
try {if(new ActiveXObject(definedControls[i])) return true;}
catch (e) {continue;}
}
return false;
},
hasShockwave: function() {
if (!window.ActiveXObject) return false;
try {if(new ActiveXObject('SWCtl.SWCtl')) return true;}
catch (e) {return false;}
},
hasWMP: function() {
if (!window.ActiveXObject) return false;
try {if(new ActiveXObject('WMPlayer.OCX')) return true;}
catch (e) { return false;}
}
}
BrowserDetect.init();
String.prototype.replaceAll = function(token, newtoken) {
var string = this;
while (string.indexOf(token) != -1) {
string = string.replace(token, newtoken);
}
return string;
}
String.prototype.removeSpaces = function() {
var value = this.replaceAll("&nbsp;", "");
return value.replace(/\s/g, "");
}
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, "");
}
String.prototype.fillZeros = function(quant) {
var retorno = this;
while (retorno.length < quant)
retorno = "0" + retorno;
return retorno;
}
Array.prototype.contains = function(value) {
for (var i = 0; i < this.length; i++) {
if (this[i] == value) return true;
}
return false;
}
function getCheckedItems(item) {
var result = "";
$(item + ":checked").each(function() {
if (result != "") result += ",";
result += $(this).val();
});
return result;
}
var Utf8 = {
encode: function(string) {
string = string.replace(/\r\n/g, "\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
}
else if ((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
}
else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
},
decode: function(utftext) {
var string = "";
var i = 0;
var c = c1 = c2 = 0;
while (i < utftext.length) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
}
else if ((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i + 1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
}
else {
c2 = utftext.charCodeAt(i + 1);
c3 = utftext.charCodeAt(i + 2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return string;
}
}
function MibAjaxCache() {
}
MibAjaxCache.prototype.items = this.items = Array();
MibAjaxCache.prototype.Add = function(item) {
this.items.push(item);
}
MibAjaxCache.prototype.Get = function(url) {
for (var i = 0; i < this.items.length; i++) {
if (this.items[i].cacheKey == url) {
return this.items[i];
}
}
return null;
}
function MibAjaxManager() {
}
MibAjaxManager.prototype.CreateLoading = function() { };
MibAjaxManager.prototype.DestroyLoading = function() { };
MibAjaxManager.prototype.Cache = new MibAjaxCache();
MibAjaxManager.prototype.Get = function(url, useCache, beginRequest, parseRequest, endRequest, requestError, contentType) {
var urlPath = url.toString().split(/\?/)[0];
var data = url.toString().split(/\?/)[1];
if (!contentType) contentType = 'html';
var item =
{
beforeSend: beginRequest,
type: "POST",
cacheKey: url,
url: urlPath,
data: data,
error: requestError,
complete: endRequest,
cache: useCache,
success: parseRequest,
dataType: contentType
}
if (useCache) {
var ajaxItem = this.Cache.Get(url);
if (ajaxItem) {
if (ajaxItem.beforeSend) ajaxItem.beforeSend();
ajaxItem.success(ajaxItem.content);
if (ajaxItem.complete) ajaxItem.complete();
}
else {
this.Cache.Add(item);
$.ajax(item);
}
}
else {
$.ajax(item);
}
}
MibAjaxManager.prototype.GetContent = function(url, target, useCache, beginRequest, endRequest, requestError) {
this.Get(
url,
useCache,
beginRequest ? beginRequest : this.CreateLoading,
function(content) {
$(target).html(content);
this.content = content;
},
endRequest ? endRequest : this.DestroyLoading,
requestError,
'html'
);
}
MibAjaxManager.prototype.GetJson = function(url, callback, useCache, beginRequest, endRequest, requestError) {
this.Get(
url,
useCache,
beginRequest ? beginRequest : this.CreateLoading,
callback,
endRequest ? endRequest : this.DestroyLoading,
requestError,
'json'
);
}
MibAjaxManager.prototype.GetScript = function(url, callback, useCache, beginRequest, endRequest, requestError) {
this.Get(
url,
useCache,
beginRequest ? beginRequest : this.CreateLoading,
callback,
endRequest ? endRequest : this.DestroyLoading,
requestError,
'script'
);
}
var mibAjaxManager = new MibAjaxManager();
function Url() { }
Url.Build = function(selector, url) {
url = url ? url : "";
var list = jQuery(selector);
if (url.indexOf("?", 0) < 0) {
url += "?";
}
else {
url += "&";
}
for (var i = 0; i < list.length; i++) {
url += list[i].id + "=" + list[i].value;
if (i < list.length - 1) {
url += "&";
}
}
return url;
}
function hideHomeMask() {
$(".mask").hide();
$("#welcomeBox").hide();
$("#welcomeBox").html("");
var exp_date = new Date("January 1, 2024");
document.cookie = "showLoginPopUp=false; path=/; expires=" + exp_date.toGMTString();
}
function showHomeMask() {
mibAjaxManager.GetContent(Url.Build('', '/Login/Login'), '#welcomeBox');
$(".mask").show();
$("#welcomeBox").show();
}
function loadHomeJavascript() {
loadAvertisingHome();
$("#buscaProgrameSe").focus(function() {
$("#useSearchTerm").val("true");
$("#buscaProgrameSe").val("");
});
$("#txtSidebarSearch").focus(function() {
$("#hdSearchTermSideBar").val("true");
$("#txtSidebarSearch").val("");
});
}
function submitLogin() {
$("form#formLogin").hide();
$("#loadingImg").show();
var frm = $("form#formLogin");
$.post(frm.attr("action"), frm.serialize(), verificaLogin, "json");
}
function submitEsqueciMinhaSenha() {
$(".text").hide();
$("#loadingImg").show();
var frm = $("form#formLogin");
$.post(frm.attr("action"), { email: $("#email", frm).val() }, verificaEsqueciSenha, "json");
}
function verificaEsqueciSenha(objJson) {
if (objJson.Status == "OK") {
alert(objJson.Message);
hideHomeMask();
}
else {
$("#loadingImg").hide();
$(".text").show();
$("#errorMessage").text(objJson.Message).show().fadeOut(5000);
}
}
function verificaLogin(objJson, textStatus) {
if (objJson.Status == "OK") {
document.cookie = "selectedCityState=" + objJson.Cities[0] + "; path=/";
document.cookie = "showLoginPopUp=false; path=/";
if (successLoginUrl)
window.location = successLoginUrl;
location.reload(true);
}
else {
alert(objJson.Message);
$("#loadingImg").hide();
$("form#formLogin").show();
}
}
function bannersControl() {
this.rotateElements = new Array();
this.enumerationElements = new Array();
this.timeOut = 3000;
this.hideElements;
this.hideElementsA;
this.clock;
this.active = 0;
this.change = function(element) {
$(this.hideElements).hide();
element.show();
}
this.changeClass = function(element) {
$(this.hideElementsA).removeClass("aSelected bSelected cSelected");
if (element.hasClass("a")) {
element.addClass("aSelected");
}
if (element.hasClass("b")) {
element.addClass("bSelected");
}
if (element.hasClass("c")) {
element.addClass("cSelected");
}
}
this.setActive = function(id) {
this.active = id;
this.change($(this.rotateElements[id]));
this.changeClass($(this.enumerationElements[id]));
clearTimeout(this.clock);
this.clock = setTimeout("banners.autoChange()", this.timeOut);
}
this.autoChange = function() {
var i = this.active;
i++;
if (i == this.rotateElements.length) i = 0;
this.setActive(i);
}
}
function write(msg)//string
{
}
function SelectProgram(obj)//Object
{
thisMovie('programacaoGrade').SelectProgram(obj);
}
function thisMovie(movieName)//String
{
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName]
}
else {
return document[movieName]
}
}
function LoadForm()//Void
{
$(".catFavoritos:checked").each(function() {
SelectProgram({ 'id': $(this).val() });
});
}
function ReloadApplication(obj)//Object
{
thisMovie('programacaoGrade').ReloadApplication(obj);
}
function MoveToTime(hora)//String
{
thisMovie('programacaoGrade').MoveToTime("" + hora.value + "");
}
function ResultSearch(obj)//Object
{
thisMovie('programacaoGrade').ResultSearch(obj);
}
function onShowClicked(obj)//Object
{
showDetalhes("/Show/Detalhes/" + obj.programa_id + "/GuiaFlash");
}
function GoToPrevDay(day)//Number
{
write('GoToPrevDay - dia:' + day);
trocaData(day);
}
function getPrevDay(ano, mes, dia) {
var date = new Date(ano, mes - 1, (dia - 1));
var month = date.getMonth() + 1;
if (month.toString().length == 1) month = "0" + month;
return date.getFullYear() + "-" + month + "-" + date.getDate();
}
function GoToNextDay(day)//Number
{
write('GoToNextDay - dia:' + day);
trocaData(day);
}
function getNextDay(ano, mes, dia) {
var date = new Date(ano, mes - 1, (dia + 1));
var month = date.getMonth() + 1;
if (month.toString().length == 1) month = "0" + month;
return date.getFullYear() + "-" + month + "-" + date.getDate();
}
function onSwfLoaded()//Void
{
if (modeView == "lista")
ModeView("lista");
else {
reloadSwf();
MoveToNow();
}
}
var diaAtual = currentDate;
var stringData;
var canais = new listCanais();
var meusCanais;
var modeView;
var mainChannelId = 0;
function setStringData() {
stringData = diaAtual.getFullYear() + "-";
var mes = (diaAtual.getMonth() + 1);
if (mes < 10) stringData += "0" + mes + "-";
else stringData += mes + "-";
var dia = diaAtual.getDate();
if (dia < 10) stringData += "0" + dia;
else stringData += dia;
}
function loadGrade() {
setStringData();
loadCarouselDatas();
loadGradeDataPicker(); // essa função está no arquivo js da datapicker
updateSelectNow();
}
function loadCarouselDatas() {
$('div #listaDatas').jCarouselLite({
visible: 7,
circular: false,
btnNext: "#listaDatasNext",
btnPrev: "#listaDatasPrevious",
start: 7
});
}
function loadCarouselCanais() {
$('div #listaCanais').jCarouselLite({
visible: 11,
circular: false,
btnNext: "#listaCanaisNext",
btnPrev: "#listaCanaisPrevious"
});
}
function setDataTexto(novaData) {
var dataSplit = novaData.split('-');
var texto = dataSplit[2] + " de " + getMonthArray()[dataSplit[1] - 1];
$("#titleData").html(texto);
}
function trocaData(novaData, reload) {
$("#gradeSelectDate").val(novaData);
$('#listaDatas ul li').removeClass("selected");
$('#listaDatas ul #li_' + novaData).addClass("selected");
setDataTexto(novaData);
loadData(novaData, reload);
}
function loadData(valueData, reload) {
stringData = valueData;
if (reload === undefined) reload = true;
if (reload) reloadSwf();
}
function getStringXml() {
if (stringData == undefined) {
setStringData();
}
var xmlProg;
if (canais.canaisAtivos.length == 0) {
xmlProg = "0";
} else {
if (modeView == "lista" && mainChannelId != 0) {
xmlProg = "/Xml/Programacao/?data=" + stringData + "&canais=" + mainChannelId;
} else {
xmlProg = "/Xml/Programacao/?data=" + stringData + "&canais=" + canais.getCanaisAtivos();
}
}
return xmlProg;
}
function reloadSwf() {
ReloadApplication({ _xml: getStringXml() });
}
var clockID = 0;
function updateSelectNow() {
var time = UpdateClock();
$("#selectTime option[id='now']").text("Agora ("+time+")");
$("#selectTime option[id='now']").val(time);
clockID = setTimeout("updateSelectNow()", 30000);
}
function UpdateClock() {
if (clockID) {
clearTimeout(clockID);
clockID = 0;
}
var tDate = new Date();
var timeString = tDate.getHours() + ":" + tDate.getMinutes().toString().fillZeros(2); ;
return timeString;
}
function limpaBusca() {
$('#gradeBusca').val('');
$('#resultBusca').slideUp();
}
function buscaGrade(value) {
if (value == "") return;
mibAjaxManager.GetContent(Url.Build('', '/Busca/BuscaGrade?busca=' + value), '#resultBusca');
$('#resultBusca').slideDown();
$('#resultBusca').html("");
}
function GoToResultBusca(data, tvchannel_id, sch_id) {
trocaData(data, false);
setAtivo(tvchannel_id);
buildListaCanais(false);
var object = { "_xml": getStringXml() + "&pid=" + sch_id, "cat": "programa_id" };
ResultSearch(object)
$('#resultBusca').slideUp();
}
function setCanais(value, loadSwf) {
if (value != "") {
var arrCanais = value.split(",");
for (var i = 0; i < arrCanais.length; i++) {
setAtivo(arrCanais[i]);
}
}
buildListaCanais(loadSwf);
}
function setCanaisFavoritos(lista) {
meusCanais = lista;
}
function addCanal(id, nome, extension) {
canais.addCanal(id, nome, extension);
}
function buildListaCanais(load){
var html = "";
var i;
html += "<ul>";
for( i=0; i < canais.canaisAtivos.length; i++ ){
var id = canais.canaisAtivos[i];
if( canais.lista[id] != undefined )
html += "<li><span class=\"" + canais.lista[id].extension + "\" title=\"" + canais.lista[id].nome + "\" onclick=\"setActiveChannel('"+canais.lista[id].id+"')\"></span></li>";
}
for( i; i < 11; i++ ){
html += "<li>&nbsp;</li>";
}
html += "</ul>";
$("#listaCanais").html(html);
mainChannelId = 0;
$(".guide div.channels div.scrollList a").addClass("disabled");
if (canais.canaisAtivos.length > 11) {
$(".guide div.channels div.scrollList a.next").removeClass("disabled");
}
loadCarouselCanais();
ModeView("grade", load);
}
function setActiveChannel(id) {
mainChannelId = id;
ModeView("lista");
}
function selectTodosCanais() {
$("#ExibirMeusCanais").removeClass("selected");
$("#ExibirTodosCanais").addClass("selected");
}
function selectMeusCanais() {
setAllInativo();
$("#ExibirTodosCanais").removeClass("selected");
$("#ExibirMeusCanais").addClass("selected");
if (meusCanais != "")
setCanais(meusCanais)
}
function showMaisCanais() {
$("#maskMaisCanais").fadeIn();
$("#maisCanais").fadeIn();
selectTodosCanais();
}
function hideMaisCanais() {
$(".mask").fadeOut();
$("#maisCanais").fadeOut();
buildListaCanais();
}
function setAllInativo() {
canais.setAllInativo();
$(".maisCanais .channelsPreferencias span").removeClass("atv");
}
function setAtivo(id) {
if (canais.canaisAtivos.contains(id)) return;
canais.setAtivo(id);
$("#todosCanais_" + id).addClass("atv");
}
function setInativo(id) {
canais.setInativo(id);
$("#todosCanais_" + id).removeClass("atv");
}
function toogleCanal(id) {
if (canais.canaisAtivos.contains(id)) {
setInativo(id);
} else {
setAtivo(id);
}
}
function setPreferencias(id) {
setAtivo(id);
}
function ModeView(mode, load) {
if (mainChannelId == 0) {
if (canais.canaisAtivos.length > 0) {
mainChannelId = canais.canaisAtivos[0];
}
}
$("#listaCanais span").removeClass("atv");
$(".guideView .menu a").removeClass("selected");
if (mode == "lista") {
var spanAtivo = "#listaCanais span." + canais.canal(mainChannelId).extension;
$(spanAtivo).addClass("atv");
$(".guideView .menu a.channel").addClass("selected");
} else {
$("#listaCanais span").removeClass("atv");
$(".guideView .menu a.grid").addClass("selected");
}
modeView = mode;
if (load === undefined) load = true;
if (load) ReloadApplication({ "mode": mode, "_xml": getStringXml() });
}
function renderVideo(id, url) {
if (id == 0)
return;
$.get(url, { mediacontentId: id }, function(data) {
RenderFlash(".player", data);
}, "text");
}
function renderPlaylist(parent, playlist) {
var items = playlist.all();
$(parent).html('<div class="element"></div>');
if (items == null || items.length == 0)
return;
$(parent).html("");
for (var i = 0; i < items.length; i++) {
var obj = items[i];
if (obj == null)
continue;
var dv =
$(
'<div class="element">'
+ '<a class="thumb" href="javascript:;"><img /><span></span></a>'
+ '<a class="title" href="javascript:;"></a>'
+ '<a class="close" title="Fechar" href="#javascript:;">\nFechar</a>'
+ '<p></p>'
+ '<div class="time"></div>'
+ '<div class="star"><span></span></div>'
+ '<span class="votes" style="display: none;">(n&ordm; votos)</span>'
+ '</div>'
);
$("img", dv).attr("src", obj.ThumbImageUrlSmall);
$("a.title", dv).html(obj.ShowName);
$("p", dv).html(obj.Description);
$(".time", dv).text(obj.Duration);
$("a.thumb", dv).attr("href", obj.VideoPlayUrl);
$("a.title", dv).attr("href", obj.VideoPlayUrl);
$(".close", dv).attr("showid", obj.ShowID);
$(".close", dv).attr("videoid", obj.ContentVideoID);
$(".close", dv).bind("click", function() { playlist.remove(this); }).attr("href", "javascript:;");
$(parent).append(dv);
}
}
function selectVideo() {
RenderFlash(".player", $(this).attr("url"));
}
function playlistManager(removeAction, addAction, getAction, removeAllAction) {
var list = 0;
var loaded = false;
this.removeUrl = removeAction;
this.removeAllActionUrl = removeAllAction;
this.AddUrl = addAction;
this.GetUrl = getAction;
this.reload = function() {
renderPlaylist(".body.playlist", this);
}
this.load = function() {
var current = this;
$.get(this.GetUrl, function(data) {
loaded = true;
list = eval(data);
current.reload();
}, "json");
};
this.add = function(show, content) {
var current = this;
$.get(this.AddUrl, { showid: show, videoid: content },
function(data) {
list = eval(data);
current.reload();
},
"json");
}
this.remove = function(el) {
var show = $(el).attr("showid");
var video = $(el).attr("videoid");
var current = this;
$.get(this.removeUrl, { showid: show, videoid: video }, function(data) {
list = eval(data);
current.reload();
}, "json");
}
this.all = function() {
return list;
}
this.isLoaded = function() {
return loaded;
}
this.clearPlaylist = function() {
var current = this;
$.get(this.removeAllActionUrl, function(data) {
list = eval(data);
current.reload();
}, "json");
}
}
function listCanais() {
this.lista = new Array();
this.canaisAtivos = new Array();
this.addCanal = function(id, nome, extension) {
this.lista[id] = new canal(id, nome, extension);
}
this.removeCanal = function(id) {
this.lista[id] = null;
}
this.setAtivo = function(id) {
this.canaisAtivos.push(id);
}
this.setInativo = function(id) {
for (var i = 0; i < this.canaisAtivos.length; i++) {
if (this.canaisAtivos[i] == id) this.canaisAtivos.splice(i, 1);
}
}
this.setAllInativo = function() {
this.canaisAtivos = new Array();
}
this.canal = function(id) {
return this.lista[id];
}
this.getAllCanais = function() {
return this.lista;
}
this.getAllCanaisId = function() {
var retorno = "";
for (var i = 0; i < this.lista.length; i++) {
if (this.lista[i] != null) {
if (retorno != "") retorno += ",";
retorno += this.lista[i].id;
}
}
}
this.getCanaisAtivos = function() {
return this.canaisAtivos.join(",");
}
}
function canal(id, nome, extension) {
this.id = id;
this.nome = nome;
this.extension = extension;
}
function loadCanaisPref(item,id) {
if (!canais.canaisAtivos.contains(id)) {
toogleCanal(id);
}
$(item).each(function() {
$(this).addClass(" atv");
});
}
function setCanaisPref(item, id) {
if (!canais.canaisAtivos.contains(id)) {
$(item).each(function() {
$(this).addClass(" atv");
});
} else {
$(item).each(function() {
$(this).removeClass(" atv");
});
}
toogleCanal(id);
}
function getCanaisList(comboList, defaultStr) {
var strCanais = defaultStr;
var list = $(comboList)[0];
var canais = new Array();
for (var i = 0; i < list.options.length; i++) {
if (list.options[i].selected == true) {
if (list.options[i].value.toLowerCase() == "todos-os-canais") {
canais = new Array();
canais.push(list.options[i].value.removeSpaces());
break;
} else if (list.options[i].value.toLowerCase() == "meus-canais") {
canais.push(list.options[i].value.removeSpaces());
} else {
canais.push(list.options[i].value + "_" + list.options[i].text.removeSpaces());
}
}
}
if (canais.length == 0) strCanais = "Todos-os-canais";
else strCanais = canais.join(",");
return strCanais;
}
function getGenerosList(comboList, defaultStr){
var strGeneros = defaultStr;
list = $(comboList)[0];
var generos = new Array();
for (var i = 0; i < list.options.length; i++) {
if (list.options[i].selected == true) {
if (list.options[i].value.toLowerCase() == "todos-os-generos") {
generos = new Array();
generos.push(list.options[i].value.removeSpaces());
break;
} else if (list.options[i].value.toLowerCase() == "meus-generos") {
generos.push(list.options[i].value.removeSpaces());
} else {
generos.push(list.options[i].value + "_" + list.options[i].text.removeSpaces());
}
}
}
if (generos.length == 0) strGeneros = "Todos-os-generos";
else strGeneros = generos.join(",");
return strGeneros;
}
function generateBuscaUrl(busca, fullSearch, avancada) {
if (fullSearch === undefined) fullSearch = false;
if (avancada === undefined) avancada = false;
if (fullSearch) {
if ($("#useSearchTermProgramese").val() == "true") {
busca = busca.replaceAll(".", "");
busca = busca.trim();
} else {
busca = "";
}
} else {
if ($("#hdSearchTermSideBar").val() == "true") {
if (busca.length < 2) {
alert("Palavra para busca deve ter pelo menos 2 caracteres!");
return false;
}
busca = busca.replaceAll(".", "");
busca = busca.trim();
} else {
alert("Digite um termo para a busca!");
return false;
}
}
var data = "Qualquer-Data";
var periodo = "Dia";
var strCanais = "Todos-os-canais";
var strGeneros = "Todos-os-generos";
if (fullSearch) {
if ($("#ProgrameseData:checked").val() == 1) {
if (currentDate > new Date($("#selectYear").val(), ($("#selectMonth").val() - 1), $("#selectDay").val())) {
$("#selectYear").val((parseInt($("#selectYear").val()) + 1));
}
data = $("#selectDay").val() + "-" + $("#selectMonth").val() + "-" + $("#selectYear").val();
}
periodo = $("#timeOfDay").val();
strCanais = getCanaisList("#canaisSelect", strCanais);
strGeneros = getGenerosList("#generosSelect", strGeneros);
}
var parentalControl = "Todas-as-idades";
var onlyVideos = "Todos";
if (avancada) {
parentalControlVal = $("#parentalControl").val();
if (parentalControlVal == 0) parentalControl = "Livre";
else if (parentalControlVal > 0) parentalControl = parentalControlVal + "-anos";
if ($("#onlyWithVideos:checked").length == 1) {
onlyVideos = "So-Com-Videos";
}
} else {
}
url = "/Busca/Shows/" + data + "," + periodo + "/" + strGeneros + "/" + strCanais + "/" + parentalControl + "/" + onlyVideos + "/" + busca;
window.location.href = url;
}
function generateBuscaPreferenciaUrl(busca, fullSearch, avancada) {
if (fullSearch === undefined) fullSearch = false;
if (avancada === undefined) avancada = false;
busca = busca.replaceAll(".", "");
busca = busca.trim();
var data = "Qualquer-Data";
var periodo = "Dia";
var strCanais = "Todos-os-canais";
var strGeneros = "Todos-os-generos";
if (fullSearch) {
if ($("#ProgrameseData:checked").val() == 1) {
if (currentDate > new Date($("#selectYear").val(), ($("#selectMonth").val() - 1), $("#selectDay").val())) {
$("#selectYear").val((parseInt($("#selectYear").val()) + 1));
}
data = $("#selectDay").val() + "-" + $("#selectMonth").val() + "-" + $("#selectYear").val();
}
periodo = $("#timeOfDay").val();
strCanais = getCanaisList("#canaisSelect", strCanais);
strGeneros = getGenerosList("#generosSelect", strGeneros);
}
var parentalControl = "Todas-as-idades";
var onlyVideos = "Todos";
if (avancada) {
parentalControlVal = $("#parentalControl").val();
if (parentalControlVal == 0) parentalControl = "Livre";
else if (parentalControlVal > 0) parentalControl = parentalControlVal + "-anos";
if ($("#onlyWithVideos:checked") == true) {
onlyVideos = "So-Com-Videos";
}
} else {
}
url = "/MinhaTVA/Preferencias?busca="+ busca;
window.location.href = url;
}
function advancedSearch(busca) {
var url = generateBuscaUrl(busca, true, true);
}
var KeyCodes = new Object();
KeyCodes.Enter = 13;
KeyCodes.Tab = 10;
function atendimentoOnline(codAss, nome, email) {
var URL = 'http://200.225.91.185/Tva266/chat4/cliente/frm_login.asp?IDArea=2&CodAssinatura=' + codAss + '&txtemail=' + email + '&txtapelido=' + nome + '&sel=HomePage';
if (nome != '' && email != '') {
URL = URL + '&frmpost=1';
}
var width = 488;
var height = 572;
var left = 150;
var top = 150;
window.open(URL, 'atendimento', 'width=' + width + ', height=' + height + ', top=' + top + ', left=' + left + ', toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, fullscreen=no');
}
function maisFichaTecnica() {
$("#menosFicha").slideUp(function() {
$("#maisFicha").slideDown();
});
}
function menosFichaTecnica() {
$("#maisFicha").slideUp(function() {
$("#menosFicha").slideDown();
});
}
var successLoginUrl;
function AbrirUrlUsuario(Url) {
$.post("/Login/IsLoggedin", "",
function(data) {
if (data.Loggedin)
window.location = Url;
else {
successLoginUrl = Url;
showHomeMask();
}
}
, "json");
}
function ChangePassword() {
if ($("#newpassword").val() == $("#newpassword2").val()) {
$.post("/Login/ChangePassword",
{ oldPassword: $("#oldpassword").val(), newPassword: $("#newpassword").val() },
function(data) {
alert(data.Message);
if (data.Status == "Success") {
$("#oldpassword").val("");
$("#newpassword").val("");
$("#newpassword2").val("");
} else {
$("#oldpassword").val("");
}
},
"json");
}
else {
alert("ERRO: Os campos da nova senha não são identicos.");
$("#newpassword").val("");
$("#newpassword2").val("");
}
}
function ValidatePassword() {
var p1Val = $("#newpassword").val();
var p2Val = $("#newpassword2").val();
if (p1Val.length < 6 || p2Val.length < 6) {
alert('Favor preencher os campos Senha e Confirmar Senha. A senha deve conter no mínimo 6 e no máximo 10 caracteres.');
return false;
}
else if (p1Val != p2Val) {
alert('Senhas inválidas. Favor preenchê-las com o mesmo valor.');
return false;
}
return true;
}
function SalvarMeusDados() {
$.post("/MinhaTVA/SalvarMeusDados",
$("#formTest").serialize(),
function(data) {
alert(data.Message);
},
"json");
}
function HeadMenuOn(li, hclass) {
$(li).addClass(hclass);
}
function HeadMenuOff(li, hclass) {
$(li).removeClass(hclass);
}
function lembreteSelected(obj) {
var val = $(obj).val();
var schIds = $("#lembretesSchedulesId").val();
var arrayIds = schIds.split(",");
if ($(obj).is(":checked")) {
arrayIds.push(val);
} else {
for (var i = 0; i < arrayIds.length; i++) {
if (arrayIds[i] == val) {
arrayIds.splice(i, 1);
}
}
}
$("#lembretesSchedulesId").val(arrayIds.join(","));
}
function lembreteSelectedDelete(obj, showId) {
var val = $(obj).val();
var schIds = $("#schedulesIdForShow" + showId).val();
var arrayIds = schIds.split(",");
if ($(obj).is(":checked")) {
for (var i = 0; i < arrayIds.length; i++) {
if (arrayIds[i] == val) {
arrayIds.splice(i, 1);
}
}
} else {
arrayIds.push(val);
}
$("#schedulesIdForShow" + showId).val(arrayIds.join(","));
}
function ajax_SaveLembretes() {
if (isLogged()) {
var showId = $("#showId").val();
var schedules = $("#lembretesSchedulesId").val();
var typeId = $("#alertTypeId").val();
var timeBefore = $("#alertBefore").val();
var url = "/MinhaTVA/SalvaMeusLembretesAjax?showId=" + showId + "&schedules=" + schedules + "&typeId=" + typeId + "&timeBefore=" + timeBefore;
mibAjaxManager.GetContent(url, "#lembretesMessages", false, function() { $("#lembretesMessages").html("Salvando..."); }, function() { });
} else {
showHomeMask();
}
return false;
}
function showInstitucional(area) {
$(".institucional .inside .sobre").slideUp();
$("#content_" + area).slideDown();
$(".institucional .inside ul li").removeClass("selected");
$("#li_" + area).addClass("selected");
}
function toogleQuestion(q) {
var div = $(q).parent("div");
if (div.hasClass("open")) {
div.removeClass("open");
} else {
div.addClass("open");
}
}
function showDetalhes(link) {
$('#DivTVShowDetalhes').html("Carregando...");
$.get(link, function(data) {
$('#DivTVShowDetalhes').html(data);
});
$("#DivTVShowDetalhes").fadeIn();
}
function hideDetalhes() {
$("#DivTVShowDetalhes").fadeOut();
}
function detalhes_saveLembretesPreferences() {
if (isLogged()) {
var alertTypeId = $("#alertTypeId").val();
var timeBefore = $("#alertBefore").val();
var url = "/MinhaTVA/SalvaPreferenciasLembretesAjax?timeBefore=" + timeBefore + "&alertTypeId=" + alertTypeId;
mibAjaxManager.GetContent(url, "#detalhesSavedMessage", false, function() { $("#detalhesSavedMessage").html("<p>Salvando...</p>"); }, function() { $("#detalhesLembreteVoltar").html("Voltar"); });
} else {
showHomeMask();
}
}
function detalhes_saveDetalhesLembretes() {
var showId = $("#hdShowId").val();
var schedules = $("#lembretesSchedulesId").val();
var typeId = $("#hdAlertTypeId").val();
var timeBefore = $("#hdTimeBefore").val();
var url = "/MinhaTVA/SalvaMeusLembretesAjax?showId=" + showId + "&schedules=" + schedules + "&typeId=" + typeId + "&timeBefore=" + timeBefore;
mibAjaxManager.GetContent(url, "#detalhesSavedMessage", false, function() { $("#detalhesSavedMessage").html("<p>Salvando...</p>"); }, function() { $("#detalhesLembreteVoltar").html("Voltar"); alert("Lembrete incluído com sucesso na sua lista de lembretes."); });
}
function isLogged() {
var isLogged
$.ajax({
url: "/MinhaTVA/isLogged",
async: false,
type: "GET",
error: function(result, text) {
return result;
},
success: function(result, success) {
isLogged = result;
}
});
if (isLogged == "true") {
return true;
} else {
return false;
}
}
function setShowFav(showID) {
if (isLogged())
{
$.ajax({
url: "/MinhaTVA/SetShowFavorito",
async: false,
type: "POST",
data: { showID: showID },
error: function(result, text) {
return result; //alert(result);
},
success: function(result, success) {
return result;
}
});
}
else
{
showHomeMask();
}
}
function setChannelFav(showID) {
if (isLogged()) {
$.ajax(
{
url: "/MinhaTVA/SetChannelFavorito",
async: false,
type: "POST",
data: { showID: showID },
error: function(result, text) { alert(result); },
success: function(result, success) { return result; }
});
}
else {
showHomeMask();
}
}
function showSelectCidades(){
$("ul#selectState").slideToggle();
}
function hideSelectCidades(){
$("ul#selectState").slideUp();
}
function setCidade(cidadeNome) {
var exp_date = new Date("January 1, 2024");
document.cookie = "selectedCityState=" + cidadeNome + "; path=/; expires=" + exp_date.toGMTString();
hideSelectCidades();
location.reload(true);
}
function getCidade(){
return $("#cidadeName").html();
}
function videosSetViewMode(mode) {
if (mode == "lista") {
if (!$("#outrosVideosList").hasClass("listMode")) {
$("#outrosVideosList").addClass("listMode");
}
} else {
$("#outrosVideosList").removeClass("listMode");
}
}
function showGiveOpinion() {
$("#show_giveOpinion").slideToggle();
}
function showAllOpinions(showId) {
var link = "/Show/ViewComments?showId="+showId+"&quantidade=0";
mibAjaxManager.GetContent(link, "#opinions");
}
function sendRatingReview() {
var rating = 0;
rating = $('form#myOpinion input:checked').val();
var text = escape(Utf8.encode($("#myOpinionText").val()));
var showId = $("#myOpinionShowId").val();
var local = escape(Utf8.encode(getCidade()));
var saveUrl = "/Show/SaveRating?showId=" + showId + "&nota=" + rating + "&text=" + text + "&local=" + local;
mibAjaxManager.GetContent(saveUrl, "#returnOpinionResponse", false, function() { $("#returnOpinionResponse").fadeIn().html("salvando..."); }, function() { showAllOpinions(showId); });
showAllOpinions(showId);
showGiveOpinion();
return false;
}
function createRatingInComments() {
$("div.comment", "#opinions").each(function() {
$("#"+this.id+" .starClass input.star").rating({ required: false, readOnly: true });
});
}
function IsKeyPressed(ev, keys) {
var pressedKey = ev.keyCode;
if (keys == typeof(Array)) {
for (var i = 0; i < keys.length; i++) {
if (keys[i] == pressedKey)
return true;
}
}
else {
return pressedKey == keys;
}
return false;
}
function trocaDestaqueProduto(contentId){
var url = "/Produtos/ShowContent?contentId="+contentId;
$("div.blackBox div.text").hide();
$("div.blackBox #contentList" + contentId).show();
mibAjaxManager.GetContent(url, "#destaqueProduto");
}
function ValidarCpf(cpf) {
cpf = cpf.replace(".", "").replace(".", "").replace("-", "");
if (cpf.length != 11) {
return (false);
}
var POSICAO, I, SOMA, DV, DV_INFORMADO;
var DIGITO = new Array(10);
DV_INFORMADO = cpf.substr(9, 2); // Retira os dois últimos dígitos do número informado
for (I = 0; I <= 8; I++) {
DIGITO[I] = cpf.substr(I, 1);
}
POSICAO = 10;
SOMA = 0;
for (I = 0; I <= 8; I++) {
SOMA = SOMA + DIGITO[I] * POSICAO;
POSICAO = POSICAO - 1;
}
DIGITO[9] = SOMA % 11;
if (DIGITO[9] < 2) {
DIGITO[9] = 0;
}
else {
DIGITO[9] = 11 - DIGITO[9];
}
POSICAO = 11;
SOMA = 0;
for (I = 0; I <= 9; I++) {
SOMA = SOMA + DIGITO[I] * POSICAO;
POSICAO = POSICAO - 1;
}
DIGITO[10] = SOMA % 11;
if (DIGITO[10] < 2) {
DIGITO[10] = 0;
}
else {
DIGITO[10] = 11 - DIGITO[10];
}
DV = DIGITO[9] * 10 + DIGITO[10];
if (DV != DV_INFORMADO) {
return false;
}
return (true);
}
function validaCNPJ(CNPJ) {
erro = new String;
if (CNPJ.length < 18) erro += "É necessario preencher corretamente o número do CNPJ! \n\n";
if ((CNPJ.charAt(2) != ".") || (CNPJ.charAt(6) != ".") || (CNPJ.charAt(10) != "/") || (CNPJ.charAt(15) != "-")) {
if (erro.length == 0) erro += "É necessário preencher corretamente o número do CNPJ! \n\n";
}
if (document.layers && parseInt(navigator.appVersion) == 4) {
x = CNPJ.substring(0, 2);
x += CNPJ.substring(3, 6);
x += CNPJ.substring(7, 10);
x += CNPJ.substring(11, 15);
x += CNPJ.substring(16, 18);
CNPJ = x;
} else {
CNPJ = CNPJ.replace(".", "");
CNPJ = CNPJ.replace(".", "");
CNPJ = CNPJ.replace("-", "");
CNPJ = CNPJ.replace("/", "");
}
var nonNumbers = /\D/;
if (nonNumbers.test(CNPJ)) erro += "A verificação de CNPJ suporta apenas números! \n\n";
var a = [];
var b = new Number;
var c = [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2];
for (i = 0; i < 12; i++) {
a[i] = CNPJ.charAt(i);
b += a[i] * c[i + 1];
}
if ((x = b % 11) < 2) { a[12] = 0 } else { a[12] = 11 - x }
b = 0;
for (y = 0; y < 13; y++) {
b += (a[y] * c[y]);
}
if ((x = b % 11) < 2) { a[13] = 0; } else { a[13] = 11 - x; }
if ((CNPJ.charAt(12) != a[12]) || (CNPJ.charAt(13) != a[13])) {
erro += "Dígito verificador do CNPJ com problema!";
}
if (erro.length > 0) {
alert(erro);
return false;
}
return true;
}
function ValidaEmail(email) {
var regex = new RegExp(/^[A-Za-z0-9_\-\.]+@[A-Za-z0-9_\-\.]{2,}\.[A-Za-z0-9]{2,}(\.[A-Za-z0-9])?/);
if (regex.test(email)) {
return (true);
}
return (false);
}
function openCanaisPackage(packageId) {
var element = $("div#" + packageId);
if (element.hasClass("opened")) {
element.removeClass("opened");
} else {
element.addClass("opened");
}
}
function getURL(link) {
showDetalhes(link);
}
var banners = new bannersControl();
function loadAvertisingHome() {
banners.hideElements = "div.advertising div.adDiv";
banners.hideElementsA = "div.advertising a";
banners.rotateElements[0] = "div.advertising div#adver1";
banners.rotateElements[1] = "div.advertising div#adver2";
banners.rotateElements[2] = "div.advertising div#adver3";
banners.enumerationElements[0] = "div.advertising a#numberLink1";
banners.enumerationElements[1] = "div.advertising a#numberLink2";
banners.enumerationElements[2] = "div.advertising a#numberLink3";
banners.timeOut = 15000;
banners.autoChange();
banners.setActive(0);
}
function hookExternalLinks() {
$("a[rel='external']").click(function() {
window.open(this.href);
return false;
});
}
function loadLayerMask(urlToLoad, data) {
$("#welcomeBox").load(urlToLoad, data);
$(".mask").show();
$("#welcomeBox").show();
}
function hideLayerMask() {
$(".mask").hide();
$("#welcomeBox").hide();
$("#welcomeBox").html("");
}
function autoNextField(currField) {
if ($(currField).val().length == $(currField).attr("maxlength"))
$("+ :input", currField).focus();
}
function CursorNatal() {
$("body").mousemove(function(event) {
$(".natal>.mouse").css("top", (event.clientY + document.documentElement.scrollTop + document.body.scrollTop + 15) + "px");
$(".natal>.mouse").css("left", (event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft + 10) + "px");
});
}
jQuery().ready(function() {
$(".menu>li").hover(function() { $(this).addClass("over"); }, function() { $(this).removeClass("over"); }); //hack para ie6(menu do header)
loadHomeDatePickerProgrameSe();
loadHomeJavascript();
loadAdvancedSearchDate();
loadGrade();
hookExternalLinks();
CursorNatal();
});
/*! SWFObject v2.1 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/

var swfobject = function() {
	
	var UNDEF = "undefined",
		OBJECT = "object",
		SHOCKWAVE_FLASH = "Shockwave Flash",
		SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
		FLASH_MIME_TYPE = "application/x-shockwave-flash",
		EXPRESS_INSTALL_ID = "SWFObjectExprInst",
		
		win = window,
		doc = document,
		nav = navigator,
		
		domLoadFnArr = [],
		regObjArr = [],
		objIdArr = [],
		listenersArr = [],
		script,
		timer = null,
		storedAltContent = null,
		storedAltContentId = null,
		isDomLoaded = false,
		isExpressInstallActive = false;
	
	/* Centralized function for browser feature detection
		- Proprietary feature detection (conditional compiling) is used to detect Internet Explorer's features
		- User agent string detection is only used when no alternative is possible
		- Is executed directly for optimal performance
	*/	
	var ua = function() {
		var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
			playerVersion = [0,0,0],
			d = null;
		if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
			d = nav.plugins[SHOCKWAVE_FLASH].description;
			if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
				d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
				playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
				playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
				playerVersion[2] = /r/.test(d) ? parseInt(d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
			}
		}
		else if (typeof win.ActiveXObject != UNDEF) {
			var a = null, fp6Crash = false;
			try {
				a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".7");
			}
			catch(e) {
				try { 
					a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".6");
					playerVersion = [6,0,21];
					a.AllowScriptAccess = "always";	 // Introduced in fp6.0.47
				}
				catch(e) {
					if (playerVersion[0] == 6) {
						fp6Crash = true;
					}
				}
				if (!fp6Crash) {
					try {
						a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
					}
					catch(e) {}
				}
			}
			if (!fp6Crash && a) { // a will return null when ActiveX is disabled
				try {
					d = a.GetVariable("$version");	// Will crash fp6.0.21/23/29
					if (d) {
						d = d.split(" ")[1].split(",");
						playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
					}
				}
				catch(e) {}
			}
		}
		var u = nav.userAgent.toLowerCase(),
			p = nav.platform.toLowerCase(),
			webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
			ie = false,
			windows = p ? /win/.test(p) : /win/.test(u),
			mac = p ? /mac/.test(p) : /mac/.test(u);
		/*@cc_on
			ie = true;
			@if (@_win32)
				windows = true;
			@elif (@_mac)
				mac = true;
			@end
		@*/
		return { w3cdom:w3cdom, pv:playerVersion, webkit:webkit, ie:ie, win:windows, mac:mac };
	}();

	/* Cross-browser onDomLoad
		- Based on Dean Edwards' solution: http://dean.edwards.name/weblog/2006/06/again/
		- Will fire an event as soon as the DOM of a page is loaded (supported by Gecko based browsers - like Firefox -, IE, Opera9+, Safari)
	*/ 
	var onDomLoad = function() {
		if (!ua.w3cdom) {
			return;
		}
		addDomLoadEvent(main);
		if (ua.ie && ua.win) {
			try {	 // Avoid a possible Operation Aborted error
				doc.write("<scr" + "ipt id=__ie_ondomload defer=true src=//:></scr" + "ipt>"); // String is split into pieces to avoid Norton AV to add code that can cause errors 
				script = getElementById("__ie_ondomload");
				if (script) {
					addListener(script, "onreadystatechange", checkReadyState);
				}
			}
			catch(e) {}
		}
		if (ua.webkit && typeof doc.readyState != UNDEF) {
			timer = setInterval(function() { if (/loaded|complete/.test(doc.readyState)) { callDomLoadFunctions(); }}, 10);
		}
		if (typeof doc.addEventListener != UNDEF) {
			doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, null);
		}
		addLoadEvent(callDomLoadFunctions);
	}();
	
	function checkReadyState() {
		if (script.readyState == "complete") {
			script.parentNode.removeChild(script);
			callDomLoadFunctions();
		}
	}
	
	function callDomLoadFunctions() {
		if (isDomLoaded) {
			return;
		}
		if (ua.ie && ua.win) { // Test if we can really add elements to the DOM; we don't want to fire it too early
			var s = createElement("span");
			try { // Avoid a possible Operation Aborted error
				var t = doc.getElementsByTagName("body")[0].appendChild(s);
				t.parentNode.removeChild(t);
			}
			catch (e) {
				return;
			}
		}
		isDomLoaded = true;
		if (timer) {
			clearInterval(timer);
			timer = null;
		}
		var dl = domLoadFnArr.length;
		for (var i = 0; i < dl; i++) {
			domLoadFnArr[i]();
		}
	}
	
	function addDomLoadEvent(fn) {
		if (isDomLoaded) {
			fn();
		}
		else { 
			domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
		}
	}
	
	/* Cross-browser onload
		- Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
		- Will fire an event as soon as a web page including all of its assets are loaded 
	 */
	function addLoadEvent(fn) {
		if (typeof win.addEventListener != UNDEF) {
			win.addEventListener("load", fn, false);
		}
		else if (typeof doc.addEventListener != UNDEF) {
			doc.addEventListener("load", fn, false);
		}
		else if (typeof win.attachEvent != UNDEF) {
			addListener(win, "onload", fn);
		}
		else if (typeof win.onload == "function") {
			var fnOld = win.onload;
			win.onload = function() {
				fnOld();
				fn();
			};
		}
		else {
			win.onload = fn;
		}
	}
	
	/* Main function
		- Will preferably execute onDomLoad, otherwise onload (as a fallback)
	*/
	function main() { // Static publishing only
		var rl = regObjArr.length;
		for (var i = 0; i < rl; i++) { // For each registered object element
			var id = regObjArr[i].id;
			if (ua.pv[0] > 0) {
				var obj = getElementById(id);
				if (obj) {
					regObjArr[i].width = obj.getAttribute("width") ? obj.getAttribute("width") : "0";
					regObjArr[i].height = obj.getAttribute("height") ? obj.getAttribute("height") : "0";
					if (hasPlayerVersion(regObjArr[i].swfVersion)) { // Flash plug-in version >= Flash content version: Houston, we have a match!
						if (ua.webkit && ua.webkit < 312) { // Older webkit engines ignore the object element's nested param elements
							fixParams(obj);
						}
						setVisibility(id, true);
					}
					else if (regObjArr[i].expressInstall && !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac)) { // Show the Adobe Express Install dialog if set by the web page author and if supported (fp6.0.65+ on Win/Mac OS only)
						showExpressInstall(regObjArr[i]);
					}
					else { // Flash plug-in and Flash content version mismatch: display alternative content instead of Flash content
						displayAltContent(obj);
					}
				}
			}
			else {	// If no fp is installed, we let the object element do its job (show alternative content)
				setVisibility(id, true);
			}
		}
	}
	
	/* Fix nested param elements, which are ignored by older webkit engines
		- This includes Safari up to and including version 1.2.2 on Mac OS 10.3
		- Fall back to the proprietary embed element
	*/
	function fixParams(obj) {
		var nestedObj = obj.getElementsByTagName(OBJECT)[0];
		if (nestedObj) {
			var e = createElement("embed"), a = nestedObj.attributes;
			if (a) {
				var al = a.length;
				for (var i = 0; i < al; i++) {
					if (a[i].nodeName == "DATA") {
						e.setAttribute("src", a[i].nodeValue);
					}
					else {
						e.setAttribute(a[i].nodeName, a[i].nodeValue);
					}
				}
			}
			var c = nestedObj.childNodes;
			if (c) {
				var cl = c.length;
				for (var j = 0; j < cl; j++) {
					if (c[j].nodeType == 1 && c[j].nodeName == "PARAM") {
						e.setAttribute(c[j].getAttribute("name"), c[j].getAttribute("value"));
					}
				}
			}
			obj.parentNode.replaceChild(e, obj);
		}
	}
	
	/* Show the Adobe Express Install dialog
		- Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
	*/
	function showExpressInstall(regObj) {
		isExpressInstallActive = true;
		var obj = getElementById(regObj.id);
		if (obj) {
			if (regObj.altContentId) {
				var ac = getElementById(regObj.altContentId);
				if (ac) {
					storedAltContent = ac;
					storedAltContentId = regObj.altContentId;
				}
			}
			else {
				storedAltContent = abstractAltContent(obj);
			}
			if (!(/%$/.test(regObj.width)) && parseInt(regObj.width, 10) < 310) {
				regObj.width = "310";
			}
			if (!(/%$/.test(regObj.height)) && parseInt(regObj.height, 10) < 137) {
				regObj.height = "137";
			}
			doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
			var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
				dt = doc.title,
				fv = "MMredirectURL=" + win.location + "&MMplayerType=" + pt + "&MMdoctitle=" + dt,
				replaceId = regObj.id;
			// For IE when a SWF is loading (AND: not available in cache) wait for the onload event to fire to remove the original object element
			// In IE you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
			if (ua.ie && ua.win && obj.readyState != 4) {
				var newObj = createElement("div");
				replaceId += "SWFObjectNew";
				newObj.setAttribute("id", replaceId);
				obj.parentNode.insertBefore(newObj, obj); // Insert placeholder div that will be replaced by the object element that loads expressinstall.swf
				obj.style.display = "none";
				var fn = function() {
					obj.parentNode.removeChild(obj);
				};
				addListener(win, "onload", fn);
			}
			createSWF({ data:regObj.expressInstall, id:EXPRESS_INSTALL_ID, width:regObj.width, height:regObj.height }, { flashvars:fv }, replaceId);
		}
	}
	
	/* Functions to abstract and display alternative content
	*/
	function displayAltContent(obj) {
		if (ua.ie && ua.win && obj.readyState != 4) {
			// For IE when a SWF is loading (AND: not available in cache) wait for the onload event to fire to remove the original object element
			// In IE you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
			var el = createElement("div");
			obj.parentNode.insertBefore(el, obj); // Insert placeholder div that will be replaced by the alternative content
			el.parentNode.replaceChild(abstractAltContent(obj), el);
			obj.style.display = "none";
			var fn = function() {
				obj.parentNode.removeChild(obj);
			};
			addListener(win, "onload", fn);
		}
		else {
			obj.parentNode.replaceChild(abstractAltContent(obj), obj);
		}
	} 

	function abstractAltContent(obj) {
		var ac = createElement("div");
		if (ua.win && ua.ie) {
			ac.innerHTML = obj.innerHTML;
		}
		else {
			var nestedObj = obj.getElementsByTagName(OBJECT)[0];
			if (nestedObj) {
				var c = nestedObj.childNodes;
				if (c) {
					var cl = c.length;
					for (var i = 0; i < cl; i++) {
						if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
							ac.appendChild(c[i].cloneNode(true));
						}
					}
				}
			}
		}
		return ac;
	}
	
	/* Cross-browser dynamic SWF creation
	*/
	function createSWF(attObj, parObj, id) {
		var r, el = getElementById(id);
		if (el) {
			if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
				attObj.id = id;
			}
			if (ua.ie && ua.win) { // IE, the object element and W3C DOM methods do not combine: fall back to outerHTML
				var att = "";
				for (var i in attObj) {
					if (attObj[i] != Object.prototype[i]) { // Filter out prototype additions from other potential libraries, like Object.prototype.toJSONString = function() {}
						if (i.toLowerCase() == "data") {
							parObj.movie = attObj[i];
						}
						else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
							att += ' class="' + attObj[i] + '"';
						}
						else if (i.toLowerCase() != "classid") {
							att += ' ' + i + '="' + attObj[i] + '"';
						}
					}
				}
				var par = "";
				for (var j in parObj) {
					if (parObj[j] != Object.prototype[j]) { // Filter out prototype additions from other potential libraries
						par += '<param name="' + j + '" value="' + parObj[j] + '" />';
					}
				}
				el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
				objIdArr[objIdArr.length] = attObj.id; // Stored to fix object 'leaks' on unload (dynamic publishing only)
				r = getElementById(attObj.id);	
			}
			else if (ua.webkit && ua.webkit < 312) { // Older webkit engines ignore the object element's nested param elements: fall back to the proprietary embed element
				var e = createElement("embed");
				e.setAttribute("type", FLASH_MIME_TYPE);
				for (var k in attObj) {
					if (attObj[k] != Object.prototype[k]) { // Filter out prototype additions from other potential libraries
						if (k.toLowerCase() == "data") {
							e.setAttribute("src", attObj[k]);
						}
						else if (k.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
							e.setAttribute("class", attObj[k]);
						}
						else if (k.toLowerCase() != "classid") { // Filter out IE specific attribute
							e.setAttribute(k, attObj[k]);
						}
					}
				}
				for (var l in parObj) {
					if (parObj[l] != Object.prototype[l]) { // Filter out prototype additions from other potential libraries
						if (l.toLowerCase() != "movie") { // Filter out IE specific param element
							e.setAttribute(l, parObj[l]);
						}
					}
				}
				el.parentNode.replaceChild(e, el);
				r = e;
			}
			else { // Well-behaving browsers
				var o = createElement(OBJECT);
				o.setAttribute("type", FLASH_MIME_TYPE);
				for (var m in attObj) {
					if (attObj[m] != Object.prototype[m]) { // Filter out prototype additions from other potential libraries
						if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
							o.setAttribute("class", attObj[m]);
						}
						else if (m.toLowerCase() != "classid") { // Filter out IE specific attribute
							o.setAttribute(m, attObj[m]);
						}
					}
				}
				for (var n in parObj) {
					if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // Filter out prototype additions from other potential libraries and IE specific param element
						createObjParam(o, n, parObj[n]);
					}
				}
				el.parentNode.replaceChild(o, el);
				r = o;
			}
		}
		return r;
	}
	
	function createObjParam(el, pName, pValue) {
		var p = createElement("param");
		p.setAttribute("name", pName);	
		p.setAttribute("value", pValue);
		el.appendChild(p);
	}
	
	/* Cross-browser SWF removal
		- Especially needed to safely and completely remove a SWF in Internet Explorer
	*/
	function removeSWF(id) {
		var obj = getElementById(id);
		if (obj && (obj.nodeName == "OBJECT" || obj.nodeName == "EMBED")) {
			if (ua.ie && ua.win) {
				if (obj.readyState == 4) {
					removeObjectInIE(id);
				}
				else {
					win.attachEvent("onload", function() {
						removeObjectInIE(id);
					});
				}
			}
			else {
				obj.parentNode.removeChild(obj);
			}
		}
	}
	
	function removeObjectInIE(id) {
		var obj = getElementById(id);
		if (obj) {
			for (var i in obj) {
				if (typeof obj[i] == "function") {
					obj[i] = null;
				}
			}
			obj.parentNode.removeChild(obj);
		}
	}
	
	/* Functions to optimize JavaScript compression
	*/
	function getElementById(id) {
		var el = null;
		try {
			el = doc.getElementById(id);
		}
		catch (e) {}
		return el;
	}
	
	function createElement(el) {
		return doc.createElement(el);
	}
	
	/* Updated attachEvent function for Internet Explorer
		- Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
	*/	
	function addListener(target, eventType, fn) {
		target.attachEvent(eventType, fn);
		listenersArr[listenersArr.length] = [target, eventType, fn];
	}
	
	/* Flash Player and SWF content version matching
	*/
	function hasPlayerVersion(rv) {
		var pv = ua.pv, v = rv.split(".");
		v[0] = parseInt(v[0], 10);
		v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
		v[2] = parseInt(v[2], 10) || 0;
		return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
	}
	
	/* Cross-browser dynamic CSS creation
		- Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
	*/	
	function createCSS(sel, decl) {
		if (ua.ie && ua.mac) {
			return;
		}
		var h = doc.getElementsByTagName("head")[0], s = createElement("style");
		s.setAttribute("type", "text/css");
		s.setAttribute("media", "screen");
		if (!(ua.ie && ua.win) && typeof doc.createTextNode != UNDEF) {
			s.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
		}
		h.appendChild(s);
		if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
			var ls = doc.styleSheets[doc.styleSheets.length - 1];
			if (typeof ls.addRule == OBJECT) {
				ls.addRule(sel, decl);
			}
		}
	}
	
	function setVisibility(id, isVisible) {
		var v = isVisible ? "visible" : "hidden";
		if (isDomLoaded && getElementById(id)) {
			getElementById(id).style.visibility = v;
		}
		else {
			createCSS("#" + id, "visibility:" + v);
		}
	}

	/* Filter to avoid XSS attacks 
	*/
	function urlEncodeIfNecessary(s) {
		var regex = /[\\\"<>\.;]/;
		var hasBadChars = regex.exec(s) != null;
		return hasBadChars ? encodeURIComponent(s) : s;
	}
	
	/* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
	*/
	var cleanup = function() {
		if (ua.ie && ua.win) {
			window.attachEvent("onunload", function() {
				// remove listeners to avoid memory leaks
				var ll = listenersArr.length;
				for (var i = 0; i < ll; i++) {
					listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
				}
				// cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
				var il = objIdArr.length;
				for (var j = 0; j < il; j++) {
					removeSWF(objIdArr[j]);
				}
				// cleanup library's main closures to avoid memory leaks
				for (var k in ua) {
					ua[k] = null;
				}
				ua = null;
				for (var l in swfobject) {
					swfobject[l] = null;
				}
				swfobject = null;
			});
		}
	}();
	
	
	return {
		/* Public API
			- Reference: http://code.google.com/p/swfobject/wiki/SWFObject_2_0_documentation
		*/ 
		registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr) {
			if (!ua.w3cdom || !objectIdStr || !swfVersionStr) {
				return;
			}
			var regObj = {};
			regObj.id = objectIdStr;
			regObj.swfVersion = swfVersionStr;
			regObj.expressInstall = xiSwfUrlStr ? xiSwfUrlStr : false;
			regObjArr[regObjArr.length] = regObj;
			setVisibility(objectIdStr, false);
		},
		
		getObjectById: function(objectIdStr) {
			var r = null;
			if (ua.w3cdom) {
				var o = getElementById(objectIdStr);
				if (o) {
					var n = o.getElementsByTagName(OBJECT)[0];
					if (!n || (n && typeof o.SetVariable != UNDEF)) {
							r = o;
					}
					else if (typeof n.SetVariable != UNDEF) {
						r = n;
					}
				}
			}
			return r;
		},
		
		embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj) {
			if (!ua.w3cdom || !swfUrlStr || !replaceElemIdStr || !widthStr || !heightStr || !swfVersionStr) {
				return;
			}
			widthStr += ""; // Auto-convert to string
			heightStr += "";
			if (hasPlayerVersion(swfVersionStr)) {
				setVisibility(replaceElemIdStr, false);
				var att = {};
				if (attObj && typeof attObj === OBJECT) {
					for (var i in attObj) {
						if (attObj[i] != Object.prototype[i]) { // Filter out prototype additions from other potential libraries
							att[i] = attObj[i];
						}
					}
				}
				att.data = swfUrlStr;
				att.width = widthStr;
				att.height = heightStr;
				var par = {}; 
				if (parObj && typeof parObj === OBJECT) {
					for (var j in parObj) {
						if (parObj[j] != Object.prototype[j]) { // Filter out prototype additions from other potential libraries
							par[j] = parObj[j];
						}
					}
				}
				if (flashvarsObj && typeof flashvarsObj === OBJECT) {
					for (var k in flashvarsObj) {
						if (flashvarsObj[k] != Object.prototype[k]) { // Filter out prototype additions from other potential libraries
							if (typeof par.flashvars != UNDEF) {
								par.flashvars += "&" + k + "=" + flashvarsObj[k];
							}
							else {
								par.flashvars = k + "=" + flashvarsObj[k];
							}
						}
					}
				}
				addDomLoadEvent(function() {
					createSWF(att, par, replaceElemIdStr);
					if (att.id == replaceElemIdStr) {
						setVisibility(replaceElemIdStr, true);
					}
				});
			}
			else if (xiSwfUrlStr && !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac)) {
				isExpressInstallActive = true; // deferred execution
				setVisibility(replaceElemIdStr, false);
				addDomLoadEvent(function() {
					var regObj = {};
					regObj.id = regObj.altContentId = replaceElemIdStr;
					regObj.width = widthStr;
					regObj.height = heightStr;
					regObj.expressInstall = xiSwfUrlStr;
					showExpressInstall(regObj);
				});
			}
		},
		
		getFlashPlayerVersion: function() {
			return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
		},
		
		hasFlashPlayerVersion: hasPlayerVersion,
		
		createSWF: function(attObj, parObj, replaceElemIdStr) {
			if (ua.w3cdom) {
				return createSWF(attObj, parObj, replaceElemIdStr);
			}
			else {
				return undefined;
			}
		},
		
		removeSWF: function(objElemIdStr) {
			if (ua.w3cdom) {
				removeSWF(objElemIdStr);
			}
		},
		
		createCSS: function(sel, decl) {
			if (ua.w3cdom) {
				createCSS(sel, decl);
			}
		},
		
		addDomLoadEvent: addDomLoadEvent,
		
		addLoadEvent: addLoadEvent,
		
		getQueryParamValue: function(param) {
			var q = doc.location.search || doc.location.hash;
			if (param == null) {
				return urlEncodeIfNecessary(q);
			}
			if (q) {
				var pairs = q.substring(1).split("&");
				for (var i = 0; i < pairs.length; i++) {
					if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
						return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
					}
				}
			}
			return "";
		},
		
		// For internal usage only
		expressInstallCallback: function() {
			if (isExpressInstallActive && storedAltContent) {
				var obj = getElementById(EXPRESS_INSTALL_ID);
				if (obj) {
					obj.parentNode.replaceChild(storedAltContent, obj);
					if (storedAltContentId) {
						setVisibility(storedAltContentId, true);
						if (ua.ie && ua.win) {
							storedAltContent.style.display = "block";
						}
					}
					storedAltContent = null;
					storedAltContentId = null;
					isExpressInstallActive = false;
				}
			} 
		}
	};
}();

