/* Last published on : 17-Mar-10 06:51:27 */
/*
* 2010-01-18 : Migration Version 1
*/

/*
 * 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")}})})();
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.7.0
*/
if(typeof YAHOO=="undefined"||!YAHOO){var YAHOO={};}YAHOO.namespace=function(){var A=arguments,E=null,C,B,D;for(C=0;C<A.length;C=C+1){D=(""+A[C]).split(".");E=YAHOO;for(B=(D[0]=="YAHOO")?1:0;B<D.length;B=B+1){E[D[B]]=E[D[B]]||{};E=E[D[B]];}}return E;};YAHOO.log=function(D,A,C){var B=YAHOO.widget.Logger;if(B&&B.log){return B.log(D,A,C);}else{return false;}};YAHOO.register=function(A,E,D){var I=YAHOO.env.modules,B,H,G,F,C;if(!I[A]){I[A]={versions:[],builds:[]};}B=I[A];H=D.version;G=D.build;F=YAHOO.env.listeners;B.name=A;B.version=H;B.build=G;B.versions.push(H);B.builds.push(G);B.mainClass=E;for(C=0;C<F.length;C=C+1){F[C](B);}if(E){E.VERSION=H;E.BUILD=G;}else{YAHOO.log("mainClass is undefined for module "+A,"warn");}};YAHOO.env=YAHOO.env||{modules:[],listeners:[]};YAHOO.env.getVersion=function(A){return YAHOO.env.modules[A]||null;};YAHOO.env.ua=function(){var C={ie:0,opera:0,gecko:0,webkit:0,mobile:null,air:0,caja:0},B=navigator.userAgent,A;if((/KHTML/).test(B)){C.webkit=1;}A=B.match(/AppleWebKit\/([^\s]*)/);if(A&&A[1]){C.webkit=parseFloat(A[1]);if(/ Mobile\//.test(B)){C.mobile="Apple";}else{A=B.match(/NokiaN[^\/]*/);if(A){C.mobile=A[0];}}A=B.match(/AdobeAIR\/([^\s]*)/);if(A){C.air=A[0];}}if(!C.webkit){A=B.match(/Opera[\s\/]([^\s]*)/);if(A&&A[1]){C.opera=parseFloat(A[1]);A=B.match(/Opera Mini[^;]*/);if(A){C.mobile=A[0];}}else{A=B.match(/MSIE\s([^;]*)/);if(A&&A[1]){C.ie=parseFloat(A[1]);}else{A=B.match(/Gecko\/([^\s]*)/);if(A){C.gecko=1;A=B.match(/rv:([^\s\)]*)/);if(A&&A[1]){C.gecko=parseFloat(A[1]);}}}}}A=B.match(/Caja\/([^\s]*)/);if(A&&A[1]){C.caja=parseFloat(A[1]);}return C;}();(function(){YAHOO.namespace("util","widget","example");if("undefined"!==typeof YAHOO_config){var B=YAHOO_config.listener,A=YAHOO.env.listeners,D=true,C;if(B){for(C=0;C<A.length;C=C+1){if(A[C]==B){D=false;break;}}if(D){A.push(B);}}}})();YAHOO.lang=YAHOO.lang||{};(function(){var B=YAHOO.lang,F="[object Array]",C="[object Function]",A=Object.prototype,E=["toString","valueOf"],D={isArray:function(G){return A.toString.apply(G)===F;},isBoolean:function(G){return typeof G==="boolean";},isFunction:function(G){return A.toString.apply(G)===C;},isNull:function(G){return G===null;},isNumber:function(G){return typeof G==="number"&&isFinite(G);},isObject:function(G){return(G&&(typeof G==="object"||B.isFunction(G)))||false;},isString:function(G){return typeof G==="string";},isUndefined:function(G){return typeof G==="undefined";},_IEEnumFix:(YAHOO.env.ua.ie)?function(I,H){var G,K,J;for(G=0;G<E.length;G=G+1){K=E[G];J=H[K];if(B.isFunction(J)&&J!=A[K]){I[K]=J;}}}:function(){},extend:function(J,K,I){if(!K||!J){throw new Error("extend failed, please check that "+"all dependencies are included.");}var H=function(){},G;H.prototype=K.prototype;J.prototype=new H();J.prototype.constructor=J;J.superclass=K.prototype;if(K.prototype.constructor==A.constructor){K.prototype.constructor=K;}if(I){for(G in I){if(B.hasOwnProperty(I,G)){J.prototype[G]=I[G];}}B._IEEnumFix(J.prototype,I);}},augmentObject:function(K,J){if(!J||!K){throw new Error("Absorb failed, verify dependencies.");}var G=arguments,I,L,H=G[2];if(H&&H!==true){for(I=2;I<G.length;I=I+1){K[G[I]]=J[G[I]];}}else{for(L in J){if(H||!(L in K)){K[L]=J[L];}}B._IEEnumFix(K,J);}},augmentProto:function(J,I){if(!I||!J){throw new Error("Augment failed, verify dependencies.");}var G=[J.prototype,I.prototype],H;for(H=2;H<arguments.length;H=H+1){G.push(arguments[H]);}B.augmentObject.apply(this,G);},dump:function(G,L){var I,K,N=[],O="{...}",H="f(){...}",M=", ",J=" => ";if(!B.isObject(G)){return G+"";}else{if(G instanceof Date||("nodeType" in G&&"tagName" in G)){return G;}else{if(B.isFunction(G)){return H;}}}L=(B.isNumber(L))?L:3;if(B.isArray(G)){N.push("[");for(I=0,K=G.length;I<K;I=I+1){if(B.isObject(G[I])){N.push((L>0)?B.dump(G[I],L-1):O);}else{N.push(G[I]);}N.push(M);}if(N.length>1){N.pop();}N.push("]");}else{N.push("{");for(I in G){if(B.hasOwnProperty(G,I)){N.push(I+J);if(B.isObject(G[I])){N.push((L>0)?B.dump(G[I],L-1):O);}else{N.push(G[I]);}N.push(M);}}if(N.length>1){N.pop();}N.push("}");}return N.join("");},substitute:function(V,H,O){var L,K,J,R,S,U,Q=[],I,M="dump",P=" ",G="{",T="}",N;for(;;){L=V.lastIndexOf(G);if(L<0){break;}K=V.indexOf(T,L);if(L+1>=K){break;}I=V.substring(L+1,K);R=I;U=null;J=R.indexOf(P);if(J>-1){U=R.substring(J+1);R=R.substring(0,J);}S=H[R];if(O){S=O(R,S,U);}if(B.isObject(S)){if(B.isArray(S)){S=B.dump(S,parseInt(U,10));}else{U=U||"";N=U.indexOf(M);if(N>-1){U=U.substring(4);}if(S.toString===A.toString||N>-1){S=B.dump(S,parseInt(U,10));}else{S=S.toString();}}}else{if(!B.isString(S)&&!B.isNumber(S)){S="~-"+Q.length+"-~";Q[Q.length]=I;}}V=V.substring(0,L)+S+V.substring(K+1);}for(L=Q.length-1;L>=0;L=L-1){V=V.replace(new RegExp("~-"+L+"-~"),"{"+Q[L]+"}","g");}return V;},trim:function(G){try{return G.replace(/^\s+|\s+$/g,"");}catch(H){return G;}},merge:function(){var J={},H=arguments,G=H.length,I;for(I=0;I<G;I=I+1){B.augmentObject(J,H[I],true);}return J;},later:function(N,H,O,J,K){N=N||0;H=H||{};var I=O,M=J,L,G;if(B.isString(O)){I=H[O];}if(!I){throw new TypeError("method undefined");}if(!B.isArray(M)){M=[J];}L=function(){I.apply(H,M);};G=(K)?setInterval(L,N):setTimeout(L,N);return{interval:K,cancel:function(){if(this.interval){clearInterval(G);}else{clearTimeout(G);}}};},isValue:function(G){return(B.isObject(G)||B.isString(G)||B.isNumber(G)||B.isBoolean(G));}};B.hasOwnProperty=(A.hasOwnProperty)?function(G,H){return G&&G.hasOwnProperty(H);}:function(G,H){return !B.isUndefined(G[H])&&G.constructor.prototype[H]!==G[H];};D.augmentObject(B,D,true);YAHOO.util.Lang=B;B.augment=B.augmentProto;YAHOO.augment=B.augmentProto;YAHOO.extend=B.extend;})();YAHOO.register("yahoo",YAHOO,{version:"2.7.0",build:"1799"});(function(){YAHOO.env._id_counter=YAHOO.env._id_counter||0;var E=YAHOO.util,L=YAHOO.lang,m=YAHOO.env.ua,A=YAHOO.lang.trim,d={},h={},N=/^t(?:able|d|h)$/i,X=/color$/i,K=window.document,W=K.documentElement,e="ownerDocument",n="defaultView",v="documentElement",t="compatMode",b="offsetLeft",P="offsetTop",u="offsetParent",Z="parentNode",l="nodeType",C="tagName",O="scrollLeft",i="scrollTop",Q="getBoundingClientRect",w="getComputedStyle",a="currentStyle",M="CSS1Compat",c="BackCompat",g="class",F="className",J="",B=" ",s="(?:^|\\s)",k="(?= |$)",U="g",p="position",f="fixed",V="relative",j="left",o="top",r="medium",q="borderLeftWidth",R="borderTopWidth",D=m.opera,I=m.webkit,H=m.gecko,T=m.ie;E.Dom={CUSTOM_ATTRIBUTES:(!W.hasAttribute)?{"for":"htmlFor","class":F}:{"htmlFor":"for","className":g},get:function(y){var AA,Y,z,x,G;if(y){if(y[l]||y.item){return y;}if(typeof y==="string"){AA=y;y=K.getElementById(y);if(y&&y.id===AA){return y;}else{if(y&&K.all){y=null;Y=K.all[AA];for(x=0,G=Y.length;x<G;++x){if(Y[x].id===AA){return Y[x];}}}}return y;}if(y.DOM_EVENTS){y=y.get("element");}if("length" in y){z=[];for(x=0,G=y.length;x<G;++x){z[z.length]=E.Dom.get(y[x]);}return z;}return y;}return null;},getComputedStyle:function(G,Y){if(window[w]){return G[e][n][w](G,null)[Y];}else{if(G[a]){return E.Dom.IE_ComputedStyle.get(G,Y);}}},getStyle:function(G,Y){return E.Dom.batch(G,E.Dom._getStyle,Y);},_getStyle:function(){if(window[w]){return function(G,y){y=(y==="float")?y="cssFloat":E.Dom._toCamel(y);var x=G.style[y],Y;if(!x){Y=G[e][n][w](G,null);if(Y){x=Y[y];}}return x;};}else{if(W[a]){return function(G,y){var x;switch(y){case"opacity":x=100;try{x=G.filters["DXImageTransform.Microsoft.Alpha"].opacity;}catch(z){try{x=G.filters("alpha").opacity;}catch(Y){}}return x/100;case"float":y="styleFloat";default:y=E.Dom._toCamel(y);x=G[a]?G[a][y]:null;return(G.style[y]||x);}};}}}(),setStyle:function(G,Y,x){E.Dom.batch(G,E.Dom._setStyle,{prop:Y,val:x});},_setStyle:function(){if(T){return function(Y,G){var x=E.Dom._toCamel(G.prop),y=G.val;if(Y){switch(x){case"opacity":if(L.isString(Y.style.filter)){Y.style.filter="alpha(opacity="+y*100+")";if(!Y[a]||!Y[a].hasLayout){Y.style.zoom=1;}}break;case"float":x="styleFloat";default:Y.style[x]=y;}}else{}};}else{return function(Y,G){var x=E.Dom._toCamel(G.prop),y=G.val;if(Y){if(x=="float"){x="cssFloat";}Y.style[x]=y;}else{}};}}(),getXY:function(G){return E.Dom.batch(G,E.Dom._getXY);},_canPosition:function(G){return(E.Dom._getStyle(G,"display")!=="none"&&E.Dom._inDoc(G));},_getXY:function(){if(K[v][Q]){return function(y){var z,Y,AA,AF,AE,AD,AC,G,x,AB=Math.floor,AG=false;if(E.Dom._canPosition(y)){AA=y[Q]();AF=y[e];z=E.Dom.getDocumentScrollLeft(AF);Y=E.Dom.getDocumentScrollTop(AF);AG=[AB(AA[j]),AB(AA[o])];if(T&&m.ie<8){AE=2;AD=2;AC=AF[t];G=S(AF[v],q);x=S(AF[v],R);if(m.ie===6){if(AC!==c){AE=0;AD=0;}}if((AC==c)){if(G!==r){AE=parseInt(G,10);}if(x!==r){AD=parseInt(x,10);}}AG[0]-=AE;AG[1]-=AD;}if((Y||z)){AG[0]+=z;AG[1]+=Y;}AG[0]=AB(AG[0]);AG[1]=AB(AG[1]);}else{}return AG;};}else{return function(y){var x,Y,AA,AB,AC,z=false,G=y;if(E.Dom._canPosition(y)){z=[y[b],y[P]];x=E.Dom.getDocumentScrollLeft(y[e]);Y=E.Dom.getDocumentScrollTop(y[e]);AC=((H||m.webkit>519)?true:false);while((G=G[u])){z[0]+=G[b];z[1]+=G[P];if(AC){z=E.Dom._calcBorders(G,z);}}if(E.Dom._getStyle(y,p)!==f){G=y;while((G=G[Z])&&G[C]){AA=G[i];AB=G[O];if(H&&(E.Dom._getStyle(G,"overflow")!=="visible")){z=E.Dom._calcBorders(G,z);}if(AA||AB){z[0]-=AB;z[1]-=AA;}}z[0]+=x;z[1]+=Y;}else{if(D){z[0]-=x;z[1]-=Y;}else{if(I||H){z[0]+=x;z[1]+=Y;}}}z[0]=Math.floor(z[0]);z[1]=Math.floor(z[1]);}else{}return z;};}}(),getX:function(G){var Y=function(x){return E.Dom.getXY(x)[0];};return E.Dom.batch(G,Y,E.Dom,true);},getY:function(G){var Y=function(x){return E.Dom.getXY(x)[1];};return E.Dom.batch(G,Y,E.Dom,true);},setXY:function(G,x,Y){E.Dom.batch(G,E.Dom._setXY,{pos:x,noRetry:Y});},_setXY:function(G,z){var AA=E.Dom._getStyle(G,p),y=E.Dom.setStyle,AD=z.pos,Y=z.noRetry,AB=[parseInt(E.Dom.getComputedStyle(G,j),10),parseInt(E.Dom.getComputedStyle(G,o),10)],AC,x;if(AA=="static"){AA=V;y(G,p,AA);}AC=E.Dom._getXY(G);if(!AD||AC===false){return false;}if(isNaN(AB[0])){AB[0]=(AA==V)?0:G[b];}if(isNaN(AB[1])){AB[1]=(AA==V)?0:G[P];}if(AD[0]!==null){y(G,j,AD[0]-AC[0]+AB[0]+"px");}if(AD[1]!==null){y(G,o,AD[1]-AC[1]+AB[1]+"px");}if(!Y){x=E.Dom._getXY(G);if((AD[0]!==null&&x[0]!=AD[0])||(AD[1]!==null&&x[1]!=AD[1])){E.Dom._setXY(G,{pos:AD,noRetry:true});}}},setX:function(Y,G){E.Dom.setXY(Y,[G,null]);},setY:function(G,Y){E.Dom.setXY(G,[null,Y]);},getRegion:function(G){var Y=function(x){var y=false;if(E.Dom._canPosition(x)){y=E.Region.getRegion(x);}else{}return y;};return E.Dom.batch(G,Y,E.Dom,true);},getClientWidth:function(){return E.Dom.getViewportWidth();},getClientHeight:function(){return E.Dom.getViewportHeight();},getElementsByClassName:function(AB,AF,AC,AE,x,AD){AB=L.trim(AB);AF=AF||"*";AC=(AC)?E.Dom.get(AC):null||K;if(!AC){return[];}var Y=[],G=AC.getElementsByTagName(AF),z=E.Dom.hasClass;for(var y=0,AA=G.length;y<AA;++y){if(z(G[y],AB)){Y[Y.length]=G[y];}}if(AE){E.Dom.batch(Y,AE,x,AD);}return Y;},hasClass:function(Y,G){return E.Dom.batch(Y,E.Dom._hasClass,G);},_hasClass:function(x,Y){var G=false,y;if(x&&Y){y=E.Dom.getAttribute(x,F)||J;if(Y.exec){G=Y.test(y);}else{G=Y&&(B+y+B).indexOf(B+Y+B)>-1;}}else{}return G;},addClass:function(Y,G){return E.Dom.batch(Y,E.Dom._addClass,G);},_addClass:function(x,Y){var G=false,y;if(x&&Y){y=E.Dom.getAttribute(x,F)||J;if(!E.Dom._hasClass(x,Y)){E.Dom.setAttribute(x,F,A(y+B+Y));G=true;}}else{}return G;},removeClass:function(Y,G){return E.Dom.batch(Y,E.Dom._removeClass,G);},_removeClass:function(y,x){var Y=false,AA,z,G;if(y&&x){AA=E.Dom.getAttribute(y,F)||J;E.Dom.setAttribute(y,F,AA.replace(E.Dom._getClassRegex(x),J));z=E.Dom.getAttribute(y,F);if(AA!==z){E.Dom.setAttribute(y,F,A(z));Y=true;if(E.Dom.getAttribute(y,F)===""){G=(y.hasAttribute&&y.hasAttribute(g))?g:F;y.removeAttribute(G);}}}else{}return Y;},replaceClass:function(x,Y,G){return E.Dom.batch(x,E.Dom._replaceClass,{from:Y,to:G});
},_replaceClass:function(y,x){var Y,AB,AA,G=false,z;if(y&&x){AB=x.from;AA=x.to;if(!AA){G=false;}else{if(!AB){G=E.Dom._addClass(y,x.to);}else{if(AB!==AA){z=E.Dom.getAttribute(y,F)||J;Y=(B+z.replace(E.Dom._getClassRegex(AB),B+AA)).split(E.Dom._getClassRegex(AA));Y.splice(1,0,B+AA);E.Dom.setAttribute(y,F,A(Y.join(J)));G=true;}}}}else{}return G;},generateId:function(G,x){x=x||"yui-gen";var Y=function(y){if(y&&y.id){return y.id;}var z=x+YAHOO.env._id_counter++;if(y){if(y[e].getElementById(z)){return E.Dom.generateId(y,z+x);}y.id=z;}return z;};return E.Dom.batch(G,Y,E.Dom,true)||Y.apply(E.Dom,arguments);},isAncestor:function(Y,x){Y=E.Dom.get(Y);x=E.Dom.get(x);var G=false;if((Y&&x)&&(Y[l]&&x[l])){if(Y.contains&&Y!==x){G=Y.contains(x);}else{if(Y.compareDocumentPosition){G=!!(Y.compareDocumentPosition(x)&16);}}}else{}return G;},inDocument:function(G,Y){return E.Dom._inDoc(E.Dom.get(G),Y);},_inDoc:function(Y,x){var G=false;if(Y&&Y[C]){x=x||Y[e];G=E.Dom.isAncestor(x[v],Y);}else{}return G;},getElementsBy:function(Y,AF,AB,AD,y,AC,AE){AF=AF||"*";AB=(AB)?E.Dom.get(AB):null||K;if(!AB){return[];}var x=[],G=AB.getElementsByTagName(AF);for(var z=0,AA=G.length;z<AA;++z){if(Y(G[z])){if(AE){x=G[z];break;}else{x[x.length]=G[z];}}}if(AD){E.Dom.batch(x,AD,y,AC);}return x;},getElementBy:function(x,G,Y){return E.Dom.getElementsBy(x,G,Y,null,null,null,true);},batch:function(x,AB,AA,z){var y=[],Y=(z)?AA:window;x=(x&&(x[C]||x.item))?x:E.Dom.get(x);if(x&&AB){if(x[C]||x.length===undefined){return AB.call(Y,x,AA);}for(var G=0;G<x.length;++G){y[y.length]=AB.call(Y,x[G],AA);}}else{return false;}return y;},getDocumentHeight:function(){var Y=(K[t]!=M||I)?K.body.scrollHeight:W.scrollHeight,G=Math.max(Y,E.Dom.getViewportHeight());return G;},getDocumentWidth:function(){var Y=(K[t]!=M||I)?K.body.scrollWidth:W.scrollWidth,G=Math.max(Y,E.Dom.getViewportWidth());return G;},getViewportHeight:function(){var G=self.innerHeight,Y=K[t];if((Y||T)&&!D){G=(Y==M)?W.clientHeight:K.body.clientHeight;}return G;},getViewportWidth:function(){var G=self.innerWidth,Y=K[t];if(Y||T){G=(Y==M)?W.clientWidth:K.body.clientWidth;}return G;},getAncestorBy:function(G,Y){while((G=G[Z])){if(E.Dom._testElement(G,Y)){return G;}}return null;},getAncestorByClassName:function(Y,G){Y=E.Dom.get(Y);if(!Y){return null;}var x=function(y){return E.Dom.hasClass(y,G);};return E.Dom.getAncestorBy(Y,x);},getAncestorByTagName:function(Y,G){Y=E.Dom.get(Y);if(!Y){return null;}var x=function(y){return y[C]&&y[C].toUpperCase()==G.toUpperCase();};return E.Dom.getAncestorBy(Y,x);},getPreviousSiblingBy:function(G,Y){while(G){G=G.previousSibling;if(E.Dom._testElement(G,Y)){return G;}}return null;},getPreviousSibling:function(G){G=E.Dom.get(G);if(!G){return null;}return E.Dom.getPreviousSiblingBy(G);},getNextSiblingBy:function(G,Y){while(G){G=G.nextSibling;if(E.Dom._testElement(G,Y)){return G;}}return null;},getNextSibling:function(G){G=E.Dom.get(G);if(!G){return null;}return E.Dom.getNextSiblingBy(G);},getFirstChildBy:function(G,x){var Y=(E.Dom._testElement(G.firstChild,x))?G.firstChild:null;return Y||E.Dom.getNextSiblingBy(G.firstChild,x);},getFirstChild:function(G,Y){G=E.Dom.get(G);if(!G){return null;}return E.Dom.getFirstChildBy(G);},getLastChildBy:function(G,x){if(!G){return null;}var Y=(E.Dom._testElement(G.lastChild,x))?G.lastChild:null;return Y||E.Dom.getPreviousSiblingBy(G.lastChild,x);},getLastChild:function(G){G=E.Dom.get(G);return E.Dom.getLastChildBy(G);},getChildrenBy:function(Y,y){var x=E.Dom.getFirstChildBy(Y,y),G=x?[x]:[];E.Dom.getNextSiblingBy(x,function(z){if(!y||y(z)){G[G.length]=z;}return false;});return G;},getChildren:function(G){G=E.Dom.get(G);if(!G){}return E.Dom.getChildrenBy(G);},getDocumentScrollLeft:function(G){G=G||K;return Math.max(G[v].scrollLeft,G.body.scrollLeft);},getDocumentScrollTop:function(G){G=G||K;return Math.max(G[v].scrollTop,G.body.scrollTop);},insertBefore:function(Y,G){Y=E.Dom.get(Y);G=E.Dom.get(G);if(!Y||!G||!G[Z]){return null;}return G[Z].insertBefore(Y,G);},insertAfter:function(Y,G){Y=E.Dom.get(Y);G=E.Dom.get(G);if(!Y||!G||!G[Z]){return null;}if(G.nextSibling){return G[Z].insertBefore(Y,G.nextSibling);}else{return G[Z].appendChild(Y);}},getClientRegion:function(){var x=E.Dom.getDocumentScrollTop(),Y=E.Dom.getDocumentScrollLeft(),y=E.Dom.getViewportWidth()+Y,G=E.Dom.getViewportHeight()+x;return new E.Region(x,y,G,Y);},setAttribute:function(Y,G,x){G=E.Dom.CUSTOM_ATTRIBUTES[G]||G;Y.setAttribute(G,x);},getAttribute:function(Y,G){G=E.Dom.CUSTOM_ATTRIBUTES[G]||G;return Y.getAttribute(G);},_toCamel:function(Y){var x=d;function G(y,z){return z.toUpperCase();}return x[Y]||(x[Y]=Y.indexOf("-")===-1?Y:Y.replace(/-([a-z])/gi,G));},_getClassRegex:function(Y){var G;if(Y!==undefined){if(Y.exec){G=Y;}else{G=h[Y];if(!G){Y=Y.replace(E.Dom._patterns.CLASS_RE_TOKENS,"\\$1");G=h[Y]=new RegExp(s+Y+k,U);}}}return G;},_patterns:{ROOT_TAG:/^body|html$/i,CLASS_RE_TOKENS:/([\.\(\)\^\$\*\+\?\|\[\]\{\}])/g},_testElement:function(G,Y){return G&&G[l]==1&&(!Y||Y(G));},_calcBorders:function(x,y){var Y=parseInt(E.Dom[w](x,R),10)||0,G=parseInt(E.Dom[w](x,q),10)||0;if(H){if(N.test(x[C])){Y=0;G=0;}}y[0]+=G;y[1]+=Y;return y;}};var S=E.Dom[w];if(m.opera){E.Dom[w]=function(Y,G){var x=S(Y,G);if(X.test(G)){x=E.Dom.Color.toRGB(x);}return x;};}if(m.webkit){E.Dom[w]=function(Y,G){var x=S(Y,G);if(x==="rgba(0, 0, 0, 0)"){x="transparent";}return x;};}})();YAHOO.util.Region=function(C,D,A,B){this.top=C;this.y=C;this[1]=C;this.right=D;this.bottom=A;this.left=B;this.x=B;this[0]=B;this.width=this.right-this.left;this.height=this.bottom-this.top;};YAHOO.util.Region.prototype.contains=function(A){return(A.left>=this.left&&A.right<=this.right&&A.top>=this.top&&A.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(E){var C=Math.max(this.top,E.top),D=Math.min(this.right,E.right),A=Math.min(this.bottom,E.bottom),B=Math.max(this.left,E.left);if(A>=C&&D>=B){return new YAHOO.util.Region(C,D,A,B);
}else{return null;}};YAHOO.util.Region.prototype.union=function(E){var C=Math.min(this.top,E.top),D=Math.max(this.right,E.right),A=Math.max(this.bottom,E.bottom),B=Math.min(this.left,E.left);return new YAHOO.util.Region(C,D,A,B);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+", height: "+this.height+", width: "+this.width+"}");};YAHOO.util.Region.getRegion=function(D){var F=YAHOO.util.Dom.getXY(D),C=F[1],E=F[0]+D.offsetWidth,A=F[1]+D.offsetHeight,B=F[0];return new YAHOO.util.Region(C,E,A,B);};YAHOO.util.Point=function(A,B){if(YAHOO.lang.isArray(A)){B=A[1];A=A[0];}YAHOO.util.Point.superclass.constructor.call(this,B,A,B,A);};YAHOO.extend(YAHOO.util.Point,YAHOO.util.Region);(function(){var B=YAHOO.util,A="clientTop",F="clientLeft",J="parentNode",K="right",W="hasLayout",I="px",U="opacity",L="auto",D="borderLeftWidth",G="borderTopWidth",P="borderRightWidth",V="borderBottomWidth",S="visible",Q="transparent",N="height",E="width",H="style",T="currentStyle",R=/^width|height$/,O=/^(\d[.\d]*)+(em|ex|px|gd|rem|vw|vh|vm|ch|mm|cm|in|pt|pc|deg|rad|ms|s|hz|khz|%){1}?/i,M={get:function(X,Z){var Y="",a=X[T][Z];if(Z===U){Y=B.Dom.getStyle(X,U);}else{if(!a||(a.indexOf&&a.indexOf(I)>-1)){Y=a;}else{if(B.Dom.IE_COMPUTED[Z]){Y=B.Dom.IE_COMPUTED[Z](X,Z);}else{if(O.test(a)){Y=B.Dom.IE.ComputedStyle.getPixel(X,Z);}else{Y=a;}}}}return Y;},getOffset:function(Z,e){var b=Z[T][e],X=e.charAt(0).toUpperCase()+e.substr(1),c="offset"+X,Y="pixel"+X,a="",d;if(b==L){d=Z[c];if(d===undefined){a=0;}a=d;if(R.test(e)){Z[H][e]=d;if(Z[c]>d){a=d-(Z[c]-d);}Z[H][e]=L;}}else{if(!Z[H][Y]&&!Z[H][e]){Z[H][e]=b;}a=Z[H][Y];}return a+I;},getBorderWidth:function(X,Z){var Y=null;if(!X[T][W]){X[H].zoom=1;}switch(Z){case G:Y=X[A];break;case V:Y=X.offsetHeight-X.clientHeight-X[A];break;case D:Y=X[F];break;case P:Y=X.offsetWidth-X.clientWidth-X[F];break;}return Y+I;},getPixel:function(Y,X){var a=null,b=Y[T][K],Z=Y[T][X];Y[H][K]=Z;a=Y[H].pixelRight;Y[H][K]=b;return a+I;},getMargin:function(Y,X){var Z;if(Y[T][X]==L){Z=0+I;}else{Z=B.Dom.IE.ComputedStyle.getPixel(Y,X);}return Z;},getVisibility:function(Y,X){var Z;while((Z=Y[T])&&Z[X]=="inherit"){Y=Y[J];}return(Z)?Z[X]:S;},getColor:function(Y,X){return B.Dom.Color.toRGB(Y[T][X])||Q;},getBorderColor:function(Y,X){var Z=Y[T],a=Z[X]||Z.color;return B.Dom.Color.toRGB(B.Dom.Color.toHex(a));}},C={};C.top=C.right=C.bottom=C.left=C[E]=C[N]=M.getOffset;C.color=M.getColor;C[G]=C[P]=C[V]=C[D]=M.getBorderWidth;C.marginTop=C.marginRight=C.marginBottom=C.marginLeft=M.getMargin;C.visibility=M.getVisibility;C.borderColor=C.borderTopColor=C.borderRightColor=C.borderBottomColor=C.borderLeftColor=M.getBorderColor;B.Dom.IE_COMPUTED=C;B.Dom.IE_ComputedStyle=M;})();(function(){var C="toString",A=parseInt,B=RegExp,D=YAHOO.util;D.Dom.Color={KEYWORDS:{black:"000",silver:"c0c0c0",gray:"808080",white:"fff",maroon:"800000",red:"f00",purple:"800080",fuchsia:"f0f",green:"008000",lime:"0f0",olive:"808000",yellow:"ff0",navy:"000080",blue:"00f",teal:"008080",aqua:"0ff"},re_RGB:/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i,re_hex:/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i,re_hex3:/([0-9A-F])/gi,toRGB:function(E){if(!D.Dom.Color.re_RGB.test(E)){E=D.Dom.Color.toHex(E);}if(D.Dom.Color.re_hex.exec(E)){E="rgb("+[A(B.$1,16),A(B.$2,16),A(B.$3,16)].join(", ")+")";}return E;},toHex:function(H){H=D.Dom.Color.KEYWORDS[H]||H;if(D.Dom.Color.re_RGB.exec(H)){var G=(B.$1.length===1)?"0"+B.$1:Number(B.$1),F=(B.$2.length===1)?"0"+B.$2:Number(B.$2),E=(B.$3.length===1)?"0"+B.$3:Number(B.$3);H=[G[C](16),F[C](16),E[C](16)].join("");}if(H.length<6){H=H.replace(D.Dom.Color.re_hex3,"$1$1");}if(H!=="transparent"&&H.indexOf("#")<0){H="#"+H;}return H.toLowerCase();}};}());YAHOO.register("dom",YAHOO.util.Dom,{version:"2.7.0",build:"1799"});YAHOO.util.CustomEvent=function(D,C,B,A){this.type=D;this.scope=C||window;this.silent=B;this.signature=A||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var E="_YUICEOnSubscribe";if(D!==E){this.subscribeEvent=new YAHOO.util.CustomEvent(E,this,true);}this.lastError=null;};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(A,B,C){if(!A){throw new Error("Invalid callback for subscriber to '"+this.type+"'");}if(this.subscribeEvent){this.subscribeEvent.fire(A,B,C);}this.subscribers.push(new YAHOO.util.Subscriber(A,B,C));},unsubscribe:function(D,F){if(!D){return this.unsubscribeAll();}var E=false;for(var B=0,A=this.subscribers.length;B<A;++B){var C=this.subscribers[B];if(C&&C.contains(D,F)){this._delete(B);E=true;}}return E;},fire:function(){this.lastError=null;var K=[],E=this.subscribers.length;if(!E&&this.silent){return true;}var I=[].slice.call(arguments,0),G=true,D,J=false;if(!this.silent){}var C=this.subscribers.slice(),A=YAHOO.util.Event.throwErrors;for(D=0;D<E;++D){var M=C[D];if(!M){J=true;}else{if(!this.silent){}var L=M.getScope(this.scope);if(this.signature==YAHOO.util.CustomEvent.FLAT){var B=null;if(I.length>0){B=I[0];}try{G=M.fn.call(L,B,M.obj);}catch(F){this.lastError=F;if(A){throw F;}}}else{try{G=M.fn.call(L,this.type,I,M.obj);}catch(H){this.lastError=H;if(A){throw H;}}}if(false===G){if(!this.silent){}break;}}}return(G!==false);},unsubscribeAll:function(){var A=this.subscribers.length,B;for(B=A-1;B>-1;B--){this._delete(B);}this.subscribers=[];return A;},_delete:function(A){var B=this.subscribers[A];if(B){delete B.fn;delete B.obj;}this.subscribers.splice(A,1);},toString:function(){return"CustomEvent: "+"'"+this.type+"', "+"context: "+this.scope;}};YAHOO.util.Subscriber=function(A,B,C){this.fn=A;this.obj=YAHOO.lang.isUndefined(B)?null:B;this.overrideContext=C;};YAHOO.util.Subscriber.prototype.getScope=function(A){if(this.overrideContext){if(this.overrideContext===true){return this.obj;}else{return this.overrideContext;}}return A;};YAHOO.util.Subscriber.prototype.contains=function(A,B){if(B){return(this.fn==A&&this.obj==B);}else{return(this.fn==A);}};YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+this.obj+", overrideContext: "+(this.overrideContext||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var H=false;var I=[];var J=[];var G=[];var E=[];var C=0;var F=[];var B=[];var A=0;var D={63232:38,63233:40,63234:37,63235:39,63276:33,63277:34,25:9};var K=YAHOO.env.ua.ie?"focusin":"focus";var L=YAHOO.env.ua.ie?"focusout":"blur";return{POLL_RETRYS:2000,POLL_INTERVAL:20,EL:0,TYPE:1,FN:2,WFN:3,UNLOAD_OBJ:3,ADJ_SCOPE:4,OBJ:5,OVERRIDE:6,lastError:null,isSafari:YAHOO.env.ua.webkit,webkit:YAHOO.env.ua.webkit,isIE:YAHOO.env.ua.ie,_interval:null,_dri:null,DOMReady:false,throwErrors:false,startInterval:function(){if(!this._interval){var M=this;var N=function(){M._tryPreloadAttach();};this._interval=setInterval(N,this.POLL_INTERVAL);}},onAvailable:function(S,O,Q,R,P){var M=(YAHOO.lang.isString(S))?[S]:S;for(var N=0;N<M.length;N=N+1){F.push({id:M[N],fn:O,obj:Q,overrideContext:R,checkReady:P});}C=this.POLL_RETRYS;this.startInterval();},onContentReady:function(P,M,N,O){this.onAvailable(P,M,N,O,true);},onDOMReady:function(M,N,O){if(this.DOMReady){setTimeout(function(){var P=window;if(O){if(O===true){P=N;}else{P=O;}}M.call(P,"DOMReady",[],N);},0);}else{this.DOMReadyEvent.subscribe(M,N,O);}},_addListener:function(O,M,Y,S,W,b){if(!Y||!Y.call){return false;}if(this._isValidCollection(O)){var Z=true;for(var T=0,V=O.length;T<V;++T){Z=this.on(O[T],M,Y,S,W)&&Z;}return Z;}else{if(YAHOO.lang.isString(O)){var R=this.getEl(O);if(R){O=R;}else{this.onAvailable(O,function(){YAHOO.util.Event.on(O,M,Y,S,W);});return true;}}}if(!O){return false;}if("unload"==M&&S!==this){J[J.length]=[O,M,Y,S,W];return true;}var N=O;if(W){if(W===true){N=S;}else{N=W;}}var P=function(c){return Y.call(N,YAHOO.util.Event.getEvent(c,O),S);};var a=[O,M,Y,P,N,S,W];var U=I.length;I[U]=a;if(this.useLegacyEvent(O,M)){var Q=this.getLegacyIndex(O,M);if(Q==-1||O!=G[Q][0]){Q=G.length;B[O.id+M]=Q;G[Q]=[O,M,O["on"+M]];E[Q]=[];O["on"+M]=function(c){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(c),Q);};}E[Q].push(a);}else{try{this._simpleAdd(O,M,P,b);}catch(X){this.lastError=X;this.removeListener(O,M,Y);return false;}}return true;},addListener:function(N,Q,M,O,P){return this._addListener(N,Q,M,O,P,false);},addFocusListener:function(N,M,O,P){return this._addListener(N,K,M,O,P,true);},removeFocusListener:function(N,M){return this.removeListener(N,K,M);},addBlurListener:function(N,M,O,P){return this._addListener(N,L,M,O,P,true);},removeBlurListener:function(N,M){return this.removeListener(N,L,M);},fireLegacyEvent:function(R,P){var T=true,M,V,U,N,S;V=E[P].slice();for(var O=0,Q=V.length;O<Q;++O){U=V[O];if(U&&U[this.WFN]){N=U[this.ADJ_SCOPE];S=U[this.WFN].call(N,R);T=(T&&S);}}M=G[P];if(M&&M[2]){M[2](R);}return T;},getLegacyIndex:function(N,O){var M=this.generateId(N)+O;if(typeof B[M]=="undefined"){return -1;}else{return B[M];}},useLegacyEvent:function(M,N){return(this.webkit&&this.webkit<419&&("click"==N||"dblclick"==N));},removeListener:function(N,M,V){var Q,T,X;if(typeof N=="string"){N=this.getEl(N);}else{if(this._isValidCollection(N)){var W=true;for(Q=N.length-1;Q>-1;Q--){W=(this.removeListener(N[Q],M,V)&&W);}return W;}}if(!V||!V.call){return this.purgeElement(N,false,M);}if("unload"==M){for(Q=J.length-1;Q>-1;Q--){X=J[Q];if(X&&X[0]==N&&X[1]==M&&X[2]==V){J.splice(Q,1);return true;}}return false;}var R=null;var S=arguments[3];if("undefined"===typeof S){S=this._getCacheIndex(N,M,V);}if(S>=0){R=I[S];}if(!N||!R){return false;}if(this.useLegacyEvent(N,M)){var P=this.getLegacyIndex(N,M);var O=E[P];if(O){for(Q=0,T=O.length;Q<T;++Q){X=O[Q];if(X&&X[this.EL]==N&&X[this.TYPE]==M&&X[this.FN]==V){O.splice(Q,1);break;}}}}else{try{this._simpleRemove(N,M,R[this.WFN],false);}catch(U){this.lastError=U;return false;}}delete I[S][this.WFN];delete I[S][this.FN];
I.splice(S,1);return true;},getTarget:function(O,N){var M=O.target||O.srcElement;return this.resolveTextNode(M);},resolveTextNode:function(N){try{if(N&&3==N.nodeType){return N.parentNode;}}catch(M){}return N;},getPageX:function(N){var M=N.pageX;if(!M&&0!==M){M=N.clientX||0;if(this.isIE){M+=this._getScrollLeft();}}return M;},getPageY:function(M){var N=M.pageY;if(!N&&0!==N){N=M.clientY||0;if(this.isIE){N+=this._getScrollTop();}}return N;},getXY:function(M){return[this.getPageX(M),this.getPageY(M)];},getRelatedTarget:function(N){var M=N.relatedTarget;if(!M){if(N.type=="mouseout"){M=N.toElement;}else{if(N.type=="mouseover"){M=N.fromElement;}}}return this.resolveTextNode(M);},getTime:function(O){if(!O.time){var N=new Date().getTime();try{O.time=N;}catch(M){this.lastError=M;return N;}}return O.time;},stopEvent:function(M){this.stopPropagation(M);this.preventDefault(M);},stopPropagation:function(M){if(M.stopPropagation){M.stopPropagation();}else{M.cancelBubble=true;}},preventDefault:function(M){if(M.preventDefault){M.preventDefault();}else{M.returnValue=false;}},getEvent:function(O,M){var N=O||window.event;if(!N){var P=this.getEvent.caller;while(P){N=P.arguments[0];if(N&&Event==N.constructor){break;}P=P.caller;}}return N;},getCharCode:function(N){var M=N.keyCode||N.charCode||0;if(YAHOO.env.ua.webkit&&(M in D)){M=D[M];}return M;},_getCacheIndex:function(Q,R,P){for(var O=0,N=I.length;O<N;O=O+1){var M=I[O];if(M&&M[this.FN]==P&&M[this.EL]==Q&&M[this.TYPE]==R){return O;}}return -1;},generateId:function(M){var N=M.id;if(!N){N="yuievtautoid-"+A;++A;M.id=N;}return N;},_isValidCollection:function(N){try{return(N&&typeof N!=="string"&&N.length&&!N.tagName&&!N.alert&&typeof N[0]!=="undefined");}catch(M){return false;}},elCache:{},getEl:function(M){return(typeof M==="string")?document.getElementById(M):M;},clearCache:function(){},DOMReadyEvent:new YAHOO.util.CustomEvent("DOMReady",this),_load:function(N){if(!H){H=true;var M=YAHOO.util.Event;M._ready();M._tryPreloadAttach();}},_ready:function(N){var M=YAHOO.util.Event;if(!M.DOMReady){M.DOMReady=true;M.DOMReadyEvent.fire();M._simpleRemove(document,"DOMContentLoaded",M._ready);}},_tryPreloadAttach:function(){if(F.length===0){C=0;if(this._interval){clearInterval(this._interval);this._interval=null;}return;}if(this.locked){return;}if(this.isIE){if(!this.DOMReady){this.startInterval();return;}}this.locked=true;var S=!H;if(!S){S=(C>0&&F.length>0);}var R=[];var T=function(V,W){var U=V;if(W.overrideContext){if(W.overrideContext===true){U=W.obj;}else{U=W.overrideContext;}}W.fn.call(U,W.obj);};var N,M,Q,P,O=[];for(N=0,M=F.length;N<M;N=N+1){Q=F[N];if(Q){P=this.getEl(Q.id);if(P){if(Q.checkReady){if(H||P.nextSibling||!S){O.push(Q);F[N]=null;}}else{T(P,Q);F[N]=null;}}else{R.push(Q);}}}for(N=0,M=O.length;N<M;N=N+1){Q=O[N];T(this.getEl(Q.id),Q);}C--;if(S){for(N=F.length-1;N>-1;N--){Q=F[N];if(!Q||!Q.id){F.splice(N,1);}}this.startInterval();}else{if(this._interval){clearInterval(this._interval);this._interval=null;}}this.locked=false;},purgeElement:function(Q,R,T){var O=(YAHOO.lang.isString(Q))?this.getEl(Q):Q;var S=this.getListeners(O,T),P,M;if(S){for(P=S.length-1;P>-1;P--){var N=S[P];this.removeListener(O,N.type,N.fn);}}if(R&&O&&O.childNodes){for(P=0,M=O.childNodes.length;P<M;++P){this.purgeElement(O.childNodes[P],R,T);}}},getListeners:function(O,M){var R=[],N;if(!M){N=[I,J];}else{if(M==="unload"){N=[J];}else{N=[I];}}var T=(YAHOO.lang.isString(O))?this.getEl(O):O;for(var Q=0;Q<N.length;Q=Q+1){var V=N[Q];if(V){for(var S=0,U=V.length;S<U;++S){var P=V[S];if(P&&P[this.EL]===T&&(!M||M===P[this.TYPE])){R.push({type:P[this.TYPE],fn:P[this.FN],obj:P[this.OBJ],adjust:P[this.OVERRIDE],scope:P[this.ADJ_SCOPE],index:S});}}}}return(R.length)?R:null;},_unload:function(T){var N=YAHOO.util.Event,Q,P,O,S,R,U=J.slice(),M;for(Q=0,S=J.length;Q<S;++Q){O=U[Q];if(O){M=window;if(O[N.ADJ_SCOPE]){if(O[N.ADJ_SCOPE]===true){M=O[N.UNLOAD_OBJ];}else{M=O[N.ADJ_SCOPE];}}O[N.FN].call(M,N.getEvent(T,O[N.EL]),O[N.UNLOAD_OBJ]);U[Q]=null;}}O=null;M=null;J=null;if(I){for(P=I.length-1;P>-1;P--){O=I[P];if(O){N.removeListener(O[N.EL],O[N.TYPE],O[N.FN],P);}}O=null;}G=null;N._simpleRemove(window,"unload",N._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var M=document.documentElement,N=document.body;if(M&&(M.scrollTop||M.scrollLeft)){return[M.scrollTop,M.scrollLeft];}else{if(N){return[N.scrollTop,N.scrollLeft];}else{return[0,0];}}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(O,P,N,M){O.addEventListener(P,N,(M));};}else{if(window.attachEvent){return function(O,P,N,M){O.attachEvent("on"+P,N);};}else{return function(){};}}}(),_simpleRemove:function(){if(window.removeEventListener){return function(O,P,N,M){O.removeEventListener(P,N,(M));};}else{if(window.detachEvent){return function(N,O,M){N.detachEvent("on"+O,M);};}else{return function(){};}}}()};}();(function(){var EU=YAHOO.util.Event;EU.on=EU.addListener;EU.onFocus=EU.addFocusListener;EU.onBlur=EU.addBlurListener;
/* DOMReady: based on work by: Dean Edwards/John Resig/Matthias Miller */
if(EU.isIE){YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true);var n=document.createElement("p");EU._dri=setInterval(function(){try{n.doScroll("left");clearInterval(EU._dri);EU._dri=null;EU._ready();n=null;}catch(ex){}},EU.POLL_INTERVAL);}else{if(EU.webkit&&EU.webkit<525){EU._dri=setInterval(function(){var rs=document.readyState;if("loaded"==rs||"complete"==rs){clearInterval(EU._dri);EU._dri=null;EU._ready();}},EU.POLL_INTERVAL);}else{EU._simpleAdd(document,"DOMContentLoaded",EU._ready);}}EU._simpleAdd(window,"load",EU._load);EU._simpleAdd(window,"unload",EU._unload);EU._tryPreloadAttach();})();}YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(A,C,F,E){this.__yui_events=this.__yui_events||{};var D=this.__yui_events[A];if(D){D.subscribe(C,F,E);
}else{this.__yui_subscribers=this.__yui_subscribers||{};var B=this.__yui_subscribers;if(!B[A]){B[A]=[];}B[A].push({fn:C,obj:F,overrideContext:E});}},unsubscribe:function(C,E,G){this.__yui_events=this.__yui_events||{};var A=this.__yui_events;if(C){var F=A[C];if(F){return F.unsubscribe(E,G);}}else{var B=true;for(var D in A){if(YAHOO.lang.hasOwnProperty(A,D)){B=B&&A[D].unsubscribe(E,G);}}return B;}return false;},unsubscribeAll:function(A){return this.unsubscribe(A);},createEvent:function(G,D){this.__yui_events=this.__yui_events||{};var A=D||{};var I=this.__yui_events;if(I[G]){}else{var H=A.scope||this;var E=(A.silent);var B=new YAHOO.util.CustomEvent(G,H,E,YAHOO.util.CustomEvent.FLAT);I[G]=B;if(A.onSubscribeCallback){B.subscribeEvent.subscribe(A.onSubscribeCallback);}this.__yui_subscribers=this.__yui_subscribers||{};var F=this.__yui_subscribers[G];if(F){for(var C=0;C<F.length;++C){B.subscribe(F[C].fn,F[C].obj,F[C].overrideContext);}}}return I[G];},fireEvent:function(E,D,A,C){this.__yui_events=this.__yui_events||{};var G=this.__yui_events[E];if(!G){return null;}var B=[];for(var F=1;F<arguments.length;++F){B.push(arguments[F]);}return G.fire.apply(G,B);},hasEvent:function(A){if(this.__yui_events){if(this.__yui_events[A]){return true;}}return false;}};(function(){var A=YAHOO.util.Event,C=YAHOO.lang;YAHOO.util.KeyListener=function(D,I,E,F){if(!D){}else{if(!I){}else{if(!E){}}}if(!F){F=YAHOO.util.KeyListener.KEYDOWN;}var G=new YAHOO.util.CustomEvent("keyPressed");this.enabledEvent=new YAHOO.util.CustomEvent("enabled");this.disabledEvent=new YAHOO.util.CustomEvent("disabled");if(C.isString(D)){D=document.getElementById(D);}if(C.isFunction(E)){G.subscribe(E);}else{G.subscribe(E.fn,E.scope,E.correctScope);}function H(O,N){if(!I.shift){I.shift=false;}if(!I.alt){I.alt=false;}if(!I.ctrl){I.ctrl=false;}if(O.shiftKey==I.shift&&O.altKey==I.alt&&O.ctrlKey==I.ctrl){var J,M=I.keys,L;if(YAHOO.lang.isArray(M)){for(var K=0;K<M.length;K++){J=M[K];L=A.getCharCode(O);if(J==L){G.fire(L,O);break;}}}else{L=A.getCharCode(O);if(M==L){G.fire(L,O);}}}}this.enable=function(){if(!this.enabled){A.on(D,F,H);this.enabledEvent.fire(I);}this.enabled=true;};this.disable=function(){if(this.enabled){A.removeListener(D,F,H);this.disabledEvent.fire(I);}this.enabled=false;};this.toString=function(){return"KeyListener ["+I.keys+"] "+D.tagName+(D.id?"["+D.id+"]":"");};};var B=YAHOO.util.KeyListener;B.KEYDOWN="keydown";B.KEYUP="keyup";B.KEY={ALT:18,BACK_SPACE:8,CAPS_LOCK:20,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,META:224,NUM_LOCK:144,PAGE_DOWN:34,PAGE_UP:33,PAUSE:19,PRINTSCREEN:44,RIGHT:39,SCROLL_LOCK:145,SHIFT:16,SPACE:32,TAB:9,UP:38};})();YAHOO.register("event",YAHOO.util.Event,{version:"2.7.0",build:"1799"});YAHOO.register("yahoo-dom-event", YAHOO, {version: "2.7.0", build: "1799"});
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.7.0
*/
YAHOO.util.Get=function(){var M={},L=0,R=0,E=false,N=YAHOO.env.ua,S=YAHOO.lang;var J=function(W,T,X){var U=X||window,Y=U.document,Z=Y.createElement(W);for(var V in T){if(T[V]&&YAHOO.lang.hasOwnProperty(T,V)){Z.setAttribute(V,T[V]);}}return Z;};var I=function(T,U,W){var V=W||"utf-8";return J("link",{"id":"yui__dyn_"+(R++),"type":"text/css","charset":V,"rel":"stylesheet","href":T},U);};var P=function(T,U,W){var V=W||"utf-8";return J("script",{"id":"yui__dyn_"+(R++),"type":"text/javascript","charset":V,"src":T},U);};var A=function(T,U){return{tId:T.tId,win:T.win,data:T.data,nodes:T.nodes,msg:U,purge:function(){D(this.tId);}};};var B=function(T,W){var U=M[W],V=(S.isString(T))?U.win.document.getElementById(T):T;if(!V){Q(W,"target node not found: "+T);}return V;};var Q=function(W,V){var T=M[W];if(T.onFailure){var U=T.scope||T.win;T.onFailure.call(U,A(T,V));}};var C=function(W){var T=M[W];T.finished=true;if(T.aborted){var V="transaction "+W+" was aborted";Q(W,V);return;}if(T.onSuccess){var U=T.scope||T.win;T.onSuccess.call(U,A(T));}};var O=function(V){var T=M[V];if(T.onTimeout){var U=T.scope||T;T.onTimeout.call(U,A(T));}};var G=function(V,Z){var U=M[V];if(U.timer){U.timer.cancel();}if(U.aborted){var X="transaction "+V+" was aborted";Q(V,X);return;}if(Z){U.url.shift();if(U.varName){U.varName.shift();}}else{U.url=(S.isString(U.url))?[U.url]:U.url;if(U.varName){U.varName=(S.isString(U.varName))?[U.varName]:U.varName;}}var c=U.win,b=c.document,a=b.getElementsByTagName("head")[0],W;if(U.url.length===0){if(U.type==="script"&&N.webkit&&N.webkit<420&&!U.finalpass&&!U.varName){var Y=P(null,U.win,U.charset);Y.innerHTML='YAHOO.util.Get._finalize("'+V+'");';U.nodes.push(Y);a.appendChild(Y);}else{C(V);}return;}var T=U.url[0];if(!T){U.url.shift();return G(V);}if(U.timeout){U.timer=S.later(U.timeout,U,O,V);}if(U.type==="script"){W=P(T,c,U.charset);}else{W=I(T,c,U.charset);}F(U.type,W,V,T,c,U.url.length);U.nodes.push(W);if(U.insertBefore){var e=B(U.insertBefore,V);if(e){e.parentNode.insertBefore(W,e);}}else{a.appendChild(W);}if((N.webkit||N.gecko)&&U.type==="css"){G(V,T);}};var K=function(){if(E){return;}E=true;for(var T in M){var U=M[T];if(U.autopurge&&U.finished){D(U.tId);delete M[T];}}E=false;};var D=function(a){var X=M[a];if(X){var Z=X.nodes,T=Z.length,Y=X.win.document,W=Y.getElementsByTagName("head")[0];if(X.insertBefore){var V=B(X.insertBefore,a);if(V){W=V.parentNode;}}for(var U=0;U<T;U=U+1){W.removeChild(Z[U]);}X.nodes=[];}};var H=function(U,T,V){var X="q"+(L++);V=V||{};if(L%YAHOO.util.Get.PURGE_THRESH===0){K();}M[X]=S.merge(V,{tId:X,type:U,url:T,finished:false,aborted:false,nodes:[]});var W=M[X];W.win=W.win||window;W.scope=W.scope||W.win;W.autopurge=("autopurge" in W)?W.autopurge:(U==="script")?true:false;S.later(0,W,G,X);return{tId:X};};var F=function(c,X,W,U,Y,Z,b){var a=b||G;if(N.ie){X.onreadystatechange=function(){var d=this.readyState;if("loaded"===d||"complete"===d){X.onreadystatechange=null;a(W,U);}};}else{if(N.webkit){if(c==="script"){if(N.webkit>=420){X.addEventListener("load",function(){a(W,U);});}else{var T=M[W];if(T.varName){var V=YAHOO.util.Get.POLL_FREQ;T.maxattempts=YAHOO.util.Get.TIMEOUT/V;T.attempts=0;T._cache=T.varName[0].split(".");T.timer=S.later(V,T,function(j){var f=this._cache,e=f.length,d=this.win,g;for(g=0;g<e;g=g+1){d=d[f[g]];if(!d){this.attempts++;if(this.attempts++>this.maxattempts){var h="Over retry limit, giving up";T.timer.cancel();Q(W,h);}else{}return;}}T.timer.cancel();a(W,U);},null,true);}else{S.later(YAHOO.util.Get.POLL_FREQ,null,a,[W,U]);}}}}else{X.onload=function(){a(W,U);};}}};return{POLL_FREQ:10,PURGE_THRESH:20,TIMEOUT:2000,_finalize:function(T){S.later(0,null,C,T);},abort:function(U){var V=(S.isString(U))?U:U.tId;var T=M[V];if(T){T.aborted=true;}},script:function(T,U){return H("script",T,U);},css:function(T,U){return H("css",T,U);}};}();YAHOO.register("get",YAHOO.util.Get,{version:"2.7.0",build:"1799"});
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.7.0
*/
YAHOO.util.CustomEvent=function(D,C,B,A){this.type=D;this.scope=C||window;this.silent=B;this.signature=A||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var E="_YUICEOnSubscribe";if(D!==E){this.subscribeEvent=new YAHOO.util.CustomEvent(E,this,true);}this.lastError=null;};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(A,B,C){if(!A){throw new Error("Invalid callback for subscriber to '"+this.type+"'");}if(this.subscribeEvent){this.subscribeEvent.fire(A,B,C);}this.subscribers.push(new YAHOO.util.Subscriber(A,B,C));},unsubscribe:function(D,F){if(!D){return this.unsubscribeAll();}var E=false;for(var B=0,A=this.subscribers.length;B<A;++B){var C=this.subscribers[B];if(C&&C.contains(D,F)){this._delete(B);E=true;}}return E;},fire:function(){this.lastError=null;var K=[],E=this.subscribers.length;if(!E&&this.silent){return true;}var I=[].slice.call(arguments,0),G=true,D,J=false;if(!this.silent){}var C=this.subscribers.slice(),A=YAHOO.util.Event.throwErrors;for(D=0;D<E;++D){var M=C[D];if(!M){J=true;}else{if(!this.silent){}var L=M.getScope(this.scope);if(this.signature==YAHOO.util.CustomEvent.FLAT){var B=null;if(I.length>0){B=I[0];}try{G=M.fn.call(L,B,M.obj);}catch(F){this.lastError=F;if(A){throw F;}}}else{try{G=M.fn.call(L,this.type,I,M.obj);}catch(H){this.lastError=H;if(A){throw H;}}}if(false===G){if(!this.silent){}break;}}}return(G!==false);},unsubscribeAll:function(){var A=this.subscribers.length,B;for(B=A-1;B>-1;B--){this._delete(B);}this.subscribers=[];return A;},_delete:function(A){var B=this.subscribers[A];if(B){delete B.fn;delete B.obj;}this.subscribers.splice(A,1);},toString:function(){return"CustomEvent: "+"'"+this.type+"', "+"context: "+this.scope;}};YAHOO.util.Subscriber=function(A,B,C){this.fn=A;this.obj=YAHOO.lang.isUndefined(B)?null:B;this.overrideContext=C;};YAHOO.util.Subscriber.prototype.getScope=function(A){if(this.overrideContext){if(this.overrideContext===true){return this.obj;}else{return this.overrideContext;}}return A;};YAHOO.util.Subscriber.prototype.contains=function(A,B){if(B){return(this.fn==A&&this.obj==B);}else{return(this.fn==A);}};YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+this.obj+", overrideContext: "+(this.overrideContext||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var H=false;var I=[];var J=[];var G=[];var E=[];var C=0;var F=[];var B=[];var A=0;var D={63232:38,63233:40,63234:37,63235:39,63276:33,63277:34,25:9};var K=YAHOO.env.ua.ie?"focusin":"focus";var L=YAHOO.env.ua.ie?"focusout":"blur";return{POLL_RETRYS:2000,POLL_INTERVAL:20,EL:0,TYPE:1,FN:2,WFN:3,UNLOAD_OBJ:3,ADJ_SCOPE:4,OBJ:5,OVERRIDE:6,lastError:null,isSafari:YAHOO.env.ua.webkit,webkit:YAHOO.env.ua.webkit,isIE:YAHOO.env.ua.ie,_interval:null,_dri:null,DOMReady:false,throwErrors:false,startInterval:function(){if(!this._interval){var M=this;var N=function(){M._tryPreloadAttach();};this._interval=setInterval(N,this.POLL_INTERVAL);}},onAvailable:function(S,O,Q,R,P){var M=(YAHOO.lang.isString(S))?[S]:S;for(var N=0;N<M.length;N=N+1){F.push({id:M[N],fn:O,obj:Q,overrideContext:R,checkReady:P});}C=this.POLL_RETRYS;this.startInterval();},onContentReady:function(P,M,N,O){this.onAvailable(P,M,N,O,true);},onDOMReady:function(M,N,O){if(this.DOMReady){setTimeout(function(){var P=window;if(O){if(O===true){P=N;}else{P=O;}}M.call(P,"DOMReady",[],N);},0);}else{this.DOMReadyEvent.subscribe(M,N,O);}},_addListener:function(O,M,Y,S,W,b){if(!Y||!Y.call){return false;}if(this._isValidCollection(O)){var Z=true;for(var T=0,V=O.length;T<V;++T){Z=this.on(O[T],M,Y,S,W)&&Z;}return Z;}else{if(YAHOO.lang.isString(O)){var R=this.getEl(O);if(R){O=R;}else{this.onAvailable(O,function(){YAHOO.util.Event.on(O,M,Y,S,W);});return true;}}}if(!O){return false;}if("unload"==M&&S!==this){J[J.length]=[O,M,Y,S,W];return true;}var N=O;if(W){if(W===true){N=S;}else{N=W;}}var P=function(c){return Y.call(N,YAHOO.util.Event.getEvent(c,O),S);};var a=[O,M,Y,P,N,S,W];var U=I.length;I[U]=a;if(this.useLegacyEvent(O,M)){var Q=this.getLegacyIndex(O,M);if(Q==-1||O!=G[Q][0]){Q=G.length;B[O.id+M]=Q;G[Q]=[O,M,O["on"+M]];E[Q]=[];O["on"+M]=function(c){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(c),Q);};}E[Q].push(a);}else{try{this._simpleAdd(O,M,P,b);}catch(X){this.lastError=X;this.removeListener(O,M,Y);return false;}}return true;},addListener:function(N,Q,M,O,P){return this._addListener(N,Q,M,O,P,false);},addFocusListener:function(N,M,O,P){return this._addListener(N,K,M,O,P,true);},removeFocusListener:function(N,M){return this.removeListener(N,K,M);},addBlurListener:function(N,M,O,P){return this._addListener(N,L,M,O,P,true);},removeBlurListener:function(N,M){return this.removeListener(N,L,M);},fireLegacyEvent:function(R,P){var T=true,M,V,U,N,S;V=E[P].slice();for(var O=0,Q=V.length;O<Q;++O){U=V[O];if(U&&U[this.WFN]){N=U[this.ADJ_SCOPE];S=U[this.WFN].call(N,R);T=(T&&S);}}M=G[P];if(M&&M[2]){M[2](R);}return T;},getLegacyIndex:function(N,O){var M=this.generateId(N)+O;if(typeof B[M]=="undefined"){return -1;}else{return B[M];}},useLegacyEvent:function(M,N){return(this.webkit&&this.webkit<419&&("click"==N||"dblclick"==N));},removeListener:function(N,M,V){var Q,T,X;if(typeof N=="string"){N=this.getEl(N);}else{if(this._isValidCollection(N)){var W=true;for(Q=N.length-1;Q>-1;Q--){W=(this.removeListener(N[Q],M,V)&&W);}return W;}}if(!V||!V.call){return this.purgeElement(N,false,M);}if("unload"==M){for(Q=J.length-1;Q>-1;Q--){X=J[Q];if(X&&X[0]==N&&X[1]==M&&X[2]==V){J.splice(Q,1);return true;}}return false;}var R=null;var S=arguments[3];if("undefined"===typeof S){S=this._getCacheIndex(N,M,V);}if(S>=0){R=I[S];}if(!N||!R){return false;}if(this.useLegacyEvent(N,M)){var P=this.getLegacyIndex(N,M);var O=E[P];if(O){for(Q=0,T=O.length;Q<T;++Q){X=O[Q];if(X&&X[this.EL]==N&&X[this.TYPE]==M&&X[this.FN]==V){O.splice(Q,1);break;}}}}else{try{this._simpleRemove(N,M,R[this.WFN],false);}catch(U){this.lastError=U;return false;}}delete I[S][this.WFN];delete I[S][this.FN];
I.splice(S,1);return true;},getTarget:function(O,N){var M=O.target||O.srcElement;return this.resolveTextNode(M);},resolveTextNode:function(N){try{if(N&&3==N.nodeType){return N.parentNode;}}catch(M){}return N;},getPageX:function(N){var M=N.pageX;if(!M&&0!==M){M=N.clientX||0;if(this.isIE){M+=this._getScrollLeft();}}return M;},getPageY:function(M){var N=M.pageY;if(!N&&0!==N){N=M.clientY||0;if(this.isIE){N+=this._getScrollTop();}}return N;},getXY:function(M){return[this.getPageX(M),this.getPageY(M)];},getRelatedTarget:function(N){var M=N.relatedTarget;if(!M){if(N.type=="mouseout"){M=N.toElement;}else{if(N.type=="mouseover"){M=N.fromElement;}}}return this.resolveTextNode(M);},getTime:function(O){if(!O.time){var N=new Date().getTime();try{O.time=N;}catch(M){this.lastError=M;return N;}}return O.time;},stopEvent:function(M){this.stopPropagation(M);this.preventDefault(M);},stopPropagation:function(M){if(M.stopPropagation){M.stopPropagation();}else{M.cancelBubble=true;}},preventDefault:function(M){if(M.preventDefault){M.preventDefault();}else{M.returnValue=false;}},getEvent:function(O,M){var N=O||window.event;if(!N){var P=this.getEvent.caller;while(P){N=P.arguments[0];if(N&&Event==N.constructor){break;}P=P.caller;}}return N;},getCharCode:function(N){var M=N.keyCode||N.charCode||0;if(YAHOO.env.ua.webkit&&(M in D)){M=D[M];}return M;},_getCacheIndex:function(Q,R,P){for(var O=0,N=I.length;O<N;O=O+1){var M=I[O];if(M&&M[this.FN]==P&&M[this.EL]==Q&&M[this.TYPE]==R){return O;}}return -1;},generateId:function(M){var N=M.id;if(!N){N="yuievtautoid-"+A;++A;M.id=N;}return N;},_isValidCollection:function(N){try{return(N&&typeof N!=="string"&&N.length&&!N.tagName&&!N.alert&&typeof N[0]!=="undefined");}catch(M){return false;}},elCache:{},getEl:function(M){return(typeof M==="string")?document.getElementById(M):M;},clearCache:function(){},DOMReadyEvent:new YAHOO.util.CustomEvent("DOMReady",this),_load:function(N){if(!H){H=true;var M=YAHOO.util.Event;M._ready();M._tryPreloadAttach();}},_ready:function(N){var M=YAHOO.util.Event;if(!M.DOMReady){M.DOMReady=true;M.DOMReadyEvent.fire();M._simpleRemove(document,"DOMContentLoaded",M._ready);}},_tryPreloadAttach:function(){if(F.length===0){C=0;if(this._interval){clearInterval(this._interval);this._interval=null;}return;}if(this.locked){return;}if(this.isIE){if(!this.DOMReady){this.startInterval();return;}}this.locked=true;var S=!H;if(!S){S=(C>0&&F.length>0);}var R=[];var T=function(V,W){var U=V;if(W.overrideContext){if(W.overrideContext===true){U=W.obj;}else{U=W.overrideContext;}}W.fn.call(U,W.obj);};var N,M,Q,P,O=[];for(N=0,M=F.length;N<M;N=N+1){Q=F[N];if(Q){P=this.getEl(Q.id);if(P){if(Q.checkReady){if(H||P.nextSibling||!S){O.push(Q);F[N]=null;}}else{T(P,Q);F[N]=null;}}else{R.push(Q);}}}for(N=0,M=O.length;N<M;N=N+1){Q=O[N];T(this.getEl(Q.id),Q);}C--;if(S){for(N=F.length-1;N>-1;N--){Q=F[N];if(!Q||!Q.id){F.splice(N,1);}}this.startInterval();}else{if(this._interval){clearInterval(this._interval);this._interval=null;}}this.locked=false;},purgeElement:function(Q,R,T){var O=(YAHOO.lang.isString(Q))?this.getEl(Q):Q;var S=this.getListeners(O,T),P,M;if(S){for(P=S.length-1;P>-1;P--){var N=S[P];this.removeListener(O,N.type,N.fn);}}if(R&&O&&O.childNodes){for(P=0,M=O.childNodes.length;P<M;++P){this.purgeElement(O.childNodes[P],R,T);}}},getListeners:function(O,M){var R=[],N;if(!M){N=[I,J];}else{if(M==="unload"){N=[J];}else{N=[I];}}var T=(YAHOO.lang.isString(O))?this.getEl(O):O;for(var Q=0;Q<N.length;Q=Q+1){var V=N[Q];if(V){for(var S=0,U=V.length;S<U;++S){var P=V[S];if(P&&P[this.EL]===T&&(!M||M===P[this.TYPE])){R.push({type:P[this.TYPE],fn:P[this.FN],obj:P[this.OBJ],adjust:P[this.OVERRIDE],scope:P[this.ADJ_SCOPE],index:S});}}}}return(R.length)?R:null;},_unload:function(T){var N=YAHOO.util.Event,Q,P,O,S,R,U=J.slice(),M;for(Q=0,S=J.length;Q<S;++Q){O=U[Q];if(O){M=window;if(O[N.ADJ_SCOPE]){if(O[N.ADJ_SCOPE]===true){M=O[N.UNLOAD_OBJ];}else{M=O[N.ADJ_SCOPE];}}O[N.FN].call(M,N.getEvent(T,O[N.EL]),O[N.UNLOAD_OBJ]);U[Q]=null;}}O=null;M=null;J=null;if(I){for(P=I.length-1;P>-1;P--){O=I[P];if(O){N.removeListener(O[N.EL],O[N.TYPE],O[N.FN],P);}}O=null;}G=null;N._simpleRemove(window,"unload",N._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var M=document.documentElement,N=document.body;if(M&&(M.scrollTop||M.scrollLeft)){return[M.scrollTop,M.scrollLeft];}else{if(N){return[N.scrollTop,N.scrollLeft];}else{return[0,0];}}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(O,P,N,M){O.addEventListener(P,N,(M));};}else{if(window.attachEvent){return function(O,P,N,M){O.attachEvent("on"+P,N);};}else{return function(){};}}}(),_simpleRemove:function(){if(window.removeEventListener){return function(O,P,N,M){O.removeEventListener(P,N,(M));};}else{if(window.detachEvent){return function(N,O,M){N.detachEvent("on"+O,M);};}else{return function(){};}}}()};}();(function(){var EU=YAHOO.util.Event;EU.on=EU.addListener;EU.onFocus=EU.addFocusListener;EU.onBlur=EU.addBlurListener;
/* DOMReady: based on work by: Dean Edwards/John Resig/Matthias Miller */
if(EU.isIE){YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true);var n=document.createElement("p");EU._dri=setInterval(function(){try{n.doScroll("left");clearInterval(EU._dri);EU._dri=null;EU._ready();n=null;}catch(ex){}},EU.POLL_INTERVAL);}else{if(EU.webkit&&EU.webkit<525){EU._dri=setInterval(function(){var rs=document.readyState;if("loaded"==rs||"complete"==rs){clearInterval(EU._dri);EU._dri=null;EU._ready();}},EU.POLL_INTERVAL);}else{EU._simpleAdd(document,"DOMContentLoaded",EU._ready);}}EU._simpleAdd(window,"load",EU._load);EU._simpleAdd(window,"unload",EU._unload);EU._tryPreloadAttach();})();}YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(A,C,F,E){this.__yui_events=this.__yui_events||{};var D=this.__yui_events[A];if(D){D.subscribe(C,F,E);
}else{this.__yui_subscribers=this.__yui_subscribers||{};var B=this.__yui_subscribers;if(!B[A]){B[A]=[];}B[A].push({fn:C,obj:F,overrideContext:E});}},unsubscribe:function(C,E,G){this.__yui_events=this.__yui_events||{};var A=this.__yui_events;if(C){var F=A[C];if(F){return F.unsubscribe(E,G);}}else{var B=true;for(var D in A){if(YAHOO.lang.hasOwnProperty(A,D)){B=B&&A[D].unsubscribe(E,G);}}return B;}return false;},unsubscribeAll:function(A){return this.unsubscribe(A);},createEvent:function(G,D){this.__yui_events=this.__yui_events||{};var A=D||{};var I=this.__yui_events;if(I[G]){}else{var H=A.scope||this;var E=(A.silent);var B=new YAHOO.util.CustomEvent(G,H,E,YAHOO.util.CustomEvent.FLAT);I[G]=B;if(A.onSubscribeCallback){B.subscribeEvent.subscribe(A.onSubscribeCallback);}this.__yui_subscribers=this.__yui_subscribers||{};var F=this.__yui_subscribers[G];if(F){for(var C=0;C<F.length;++C){B.subscribe(F[C].fn,F[C].obj,F[C].overrideContext);}}}return I[G];},fireEvent:function(E,D,A,C){this.__yui_events=this.__yui_events||{};var G=this.__yui_events[E];if(!G){return null;}var B=[];for(var F=1;F<arguments.length;++F){B.push(arguments[F]);}return G.fire.apply(G,B);},hasEvent:function(A){if(this.__yui_events){if(this.__yui_events[A]){return true;}}return false;}};(function(){var A=YAHOO.util.Event,C=YAHOO.lang;YAHOO.util.KeyListener=function(D,I,E,F){if(!D){}else{if(!I){}else{if(!E){}}}if(!F){F=YAHOO.util.KeyListener.KEYDOWN;}var G=new YAHOO.util.CustomEvent("keyPressed");this.enabledEvent=new YAHOO.util.CustomEvent("enabled");this.disabledEvent=new YAHOO.util.CustomEvent("disabled");if(C.isString(D)){D=document.getElementById(D);}if(C.isFunction(E)){G.subscribe(E);}else{G.subscribe(E.fn,E.scope,E.correctScope);}function H(O,N){if(!I.shift){I.shift=false;}if(!I.alt){I.alt=false;}if(!I.ctrl){I.ctrl=false;}if(O.shiftKey==I.shift&&O.altKey==I.alt&&O.ctrlKey==I.ctrl){var J,M=I.keys,L;if(YAHOO.lang.isArray(M)){for(var K=0;K<M.length;K++){J=M[K];L=A.getCharCode(O);if(J==L){G.fire(L,O);break;}}}else{L=A.getCharCode(O);if(M==L){G.fire(L,O);}}}}this.enable=function(){if(!this.enabled){A.on(D,F,H);this.enabledEvent.fire(I);}this.enabled=true;};this.disable=function(){if(this.enabled){A.removeListener(D,F,H);this.disabledEvent.fire(I);}this.enabled=false;};this.toString=function(){return"KeyListener ["+I.keys+"] "+D.tagName+(D.id?"["+D.id+"]":"");};};var B=YAHOO.util.KeyListener;B.KEYDOWN="keydown";B.KEYUP="keyup";B.KEY={ALT:18,BACK_SPACE:8,CAPS_LOCK:20,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,META:224,NUM_LOCK:144,PAGE_DOWN:34,PAGE_UP:33,PAUSE:19,PRINTSCREEN:44,RIGHT:39,SCROLL_LOCK:145,SHIFT:16,SPACE:32,TAB:9,UP:38};})();YAHOO.register("event",YAHOO.util.Event,{version:"2.7.0",build:"1799"});
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.7.0
*/
(function(){YAHOO.util.Config=function(D){if(D){this.init(D);}};var B=YAHOO.lang,C=YAHOO.util.CustomEvent,A=YAHOO.util.Config;A.CONFIG_CHANGED_EVENT="configChanged";A.BOOLEAN_TYPE="boolean";A.prototype={owner:null,queueInProgress:false,config:null,initialConfig:null,eventQueue:null,configChangedEvent:null,init:function(D){this.owner=D;this.configChangedEvent=this.createEvent(A.CONFIG_CHANGED_EVENT);this.configChangedEvent.signature=C.LIST;this.queueInProgress=false;this.config={};this.initialConfig={};this.eventQueue=[];},checkBoolean:function(D){return(typeof D==A.BOOLEAN_TYPE);},checkNumber:function(D){return(!isNaN(D));},fireEvent:function(D,F){var E=this.config[D];if(E&&E.event){E.event.fire(F);}},addProperty:function(E,D){E=E.toLowerCase();this.config[E]=D;D.event=this.createEvent(E,{scope:this.owner});D.event.signature=C.LIST;D.key=E;if(D.handler){D.event.subscribe(D.handler,this.owner);}this.setProperty(E,D.value,true);if(!D.suppressEvent){this.queueProperty(E,D.value);}},getConfig:function(){var D={},F=this.config,G,E;for(G in F){if(B.hasOwnProperty(F,G)){E=F[G];if(E&&E.event){D[G]=E.value;}}}return D;},getProperty:function(D){var E=this.config[D.toLowerCase()];if(E&&E.event){return E.value;}else{return undefined;}},resetProperty:function(D){D=D.toLowerCase();var E=this.config[D];if(E&&E.event){if(this.initialConfig[D]&&!B.isUndefined(this.initialConfig[D])){this.setProperty(D,this.initialConfig[D]);return true;}}else{return false;}},setProperty:function(E,G,D){var F;E=E.toLowerCase();if(this.queueInProgress&&!D){this.queueProperty(E,G);return true;}else{F=this.config[E];if(F&&F.event){if(F.validator&&!F.validator(G)){return false;}else{F.value=G;if(!D){this.fireEvent(E,G);this.configChangedEvent.fire([E,G]);}return true;}}else{return false;}}},queueProperty:function(S,P){S=S.toLowerCase();var R=this.config[S],K=false,J,G,H,I,O,Q,F,M,N,D,L,T,E;if(R&&R.event){if(!B.isUndefined(P)&&R.validator&&!R.validator(P)){return false;}else{if(!B.isUndefined(P)){R.value=P;}else{P=R.value;}K=false;J=this.eventQueue.length;for(L=0;L<J;L++){G=this.eventQueue[L];if(G){H=G[0];I=G[1];if(H==S){this.eventQueue[L]=null;this.eventQueue.push([S,(!B.isUndefined(P)?P:I)]);K=true;break;}}}if(!K&&!B.isUndefined(P)){this.eventQueue.push([S,P]);}}if(R.supercedes){O=R.supercedes.length;for(T=0;T<O;T++){Q=R.supercedes[T];F=this.eventQueue.length;for(E=0;E<F;E++){M=this.eventQueue[E];if(M){N=M[0];D=M[1];if(N==Q.toLowerCase()){this.eventQueue.push([N,D]);this.eventQueue[E]=null;break;}}}}}return true;}else{return false;}},refireEvent:function(D){D=D.toLowerCase();var E=this.config[D];if(E&&E.event&&!B.isUndefined(E.value)){if(this.queueInProgress){this.queueProperty(D);}else{this.fireEvent(D,E.value);}}},applyConfig:function(D,G){var F,E;if(G){E={};for(F in D){if(B.hasOwnProperty(D,F)){E[F.toLowerCase()]=D[F];}}this.initialConfig=E;}for(F in D){if(B.hasOwnProperty(D,F)){this.queueProperty(F,D[F]);}}},refresh:function(){var D;for(D in this.config){if(B.hasOwnProperty(this.config,D)){this.refireEvent(D);}}},fireQueue:function(){var E,H,D,G,F;this.queueInProgress=true;for(E=0;E<this.eventQueue.length;E++){H=this.eventQueue[E];if(H){D=H[0];G=H[1];F=this.config[D];F.value=G;this.eventQueue[E]=null;this.fireEvent(D,G);}}this.queueInProgress=false;this.eventQueue=[];},subscribeToConfigEvent:function(E,F,H,D){var G=this.config[E.toLowerCase()];if(G&&G.event){if(!A.alreadySubscribed(G.event,F,H)){G.event.subscribe(F,H,D);}return true;}else{return false;}},unsubscribeFromConfigEvent:function(D,E,G){var F=this.config[D.toLowerCase()];if(F&&F.event){return F.event.unsubscribe(E,G);}else{return false;}},toString:function(){var D="Config";if(this.owner){D+=" ["+this.owner.toString()+"]";}return D;},outputEventQueue:function(){var D="",G,E,F=this.eventQueue.length;for(E=0;E<F;E++){G=this.eventQueue[E];if(G){D+=G[0]+"="+G[1]+", ";}}return D;},destroy:function(){var E=this.config,D,F;for(D in E){if(B.hasOwnProperty(E,D)){F=E[D];F.event.unsubscribeAll();F.event=null;}}this.configChangedEvent.unsubscribeAll();this.configChangedEvent=null;this.owner=null;this.config=null;this.initialConfig=null;this.eventQueue=null;}};A.alreadySubscribed=function(E,H,I){var F=E.subscribers.length,D,G;if(F>0){G=F-1;do{D=E.subscribers[G];if(D&&D.obj==I&&D.fn==H){return true;}}while(G--);}return false;};YAHOO.lang.augmentProto(A,YAHOO.util.EventProvider);}());YAHOO.widget.DateMath={DAY:"D",WEEK:"W",YEAR:"Y",MONTH:"M",ONE_DAY_MS:1000*60*60*24,WEEK_ONE_JAN_DATE:1,add:function(A,D,C){var F=new Date(A.getTime());switch(D){case this.MONTH:var E=A.getMonth()+C;var B=0;if(E<0){while(E<0){E+=12;B-=1;}}else{if(E>11){while(E>11){E-=12;B+=1;}}}F.setMonth(E);F.setFullYear(A.getFullYear()+B);break;case this.DAY:this._addDays(F,C);break;case this.YEAR:F.setFullYear(A.getFullYear()+C);break;case this.WEEK:this._addDays(F,(C*7));break;}return F;},_addDays:function(D,C){if(YAHOO.env.ua.webkit&&YAHOO.env.ua.webkit<420){if(C<0){for(var B=-128;C<B;C-=B){D.setDate(D.getDate()+B);}}else{for(var A=96;C>A;C-=A){D.setDate(D.getDate()+A);}}}D.setDate(D.getDate()+C);},subtract:function(A,C,B){return this.add(A,C,(B*-1));},before:function(C,B){var A=B.getTime();if(C.getTime()<A){return true;}else{return false;}},after:function(C,B){var A=B.getTime();if(C.getTime()>A){return true;}else{return false;}},between:function(B,A,C){if(this.after(B,A)&&this.before(B,C)){return true;}else{return false;}},getJan1:function(A){return this.getDate(A,0,1);},getDayOffset:function(B,D){var C=this.getJan1(D);var A=Math.ceil((B.getTime()-C.getTime())/this.ONE_DAY_MS);return A;},getWeekNumber:function(E,B,H){B=B||0;H=H||this.WEEK_ONE_JAN_DATE;var I=this.clearTime(E),M,N;if(I.getDay()===B){M=I;}else{M=this.getFirstDayOfWeek(I,B);}var J=M.getFullYear(),C=M.getTime();N=new Date(M.getTime()+6*this.ONE_DAY_MS);var G;if(J!==N.getFullYear()&&N.getDate()>=H){G=1;}else{var F=this.clearTime(this.getDate(J,0,H)),A=this.getFirstDayOfWeek(F,B);var K=Math.round((I.getTime()-A.getTime())/this.ONE_DAY_MS);var L=K%7;
var D=(K-L)/7;G=D+1;}return G;},getFirstDayOfWeek:function(D,A){A=A||0;var B=D.getDay(),C=(B-A+7)%7;return this.subtract(D,this.DAY,C);},isYearOverlapWeek:function(A){var C=false;var B=this.add(A,this.DAY,6);if(B.getFullYear()!=A.getFullYear()){C=true;}return C;},isMonthOverlapWeek:function(A){var C=false;var B=this.add(A,this.DAY,6);if(B.getMonth()!=A.getMonth()){C=true;}return C;},findMonthStart:function(A){var B=this.getDate(A.getFullYear(),A.getMonth(),1);return B;},findMonthEnd:function(B){var D=this.findMonthStart(B);var C=this.add(D,this.MONTH,1);var A=this.subtract(C,this.DAY,1);return A;},clearTime:function(A){A.setHours(12,0,0,0);return A;},getDate:function(D,A,C){var B=null;if(YAHOO.lang.isUndefined(C)){C=1;}if(D>=100){B=new Date(D,A,C);}else{B=new Date();B.setFullYear(D);B.setMonth(A);B.setDate(C);B.setHours(0,0,0,0);}return B;}};(function(){var C=YAHOO.util.Dom,A=YAHOO.util.Event,E=YAHOO.lang,D=YAHOO.widget.DateMath;function F(I,G,H){this.init.apply(this,arguments);}F.IMG_ROOT=null;F.DATE="D";F.MONTH_DAY="MD";F.WEEKDAY="WD";F.RANGE="R";F.MONTH="M";F.DISPLAY_DAYS=42;F.STOP_RENDER="S";F.SHORT="short";F.LONG="long";F.MEDIUM="medium";F.ONE_CHAR="1char";F._DEFAULT_CONFIG={PAGEDATE:{key:"pagedate",value:null},SELECTED:{key:"selected",value:null},TITLE:{key:"title",value:""},CLOSE:{key:"close",value:false},IFRAME:{key:"iframe",value:(YAHOO.env.ua.ie&&YAHOO.env.ua.ie<=6)?true:false},MINDATE:{key:"mindate",value:null},MAXDATE:{key:"maxdate",value:null},MULTI_SELECT:{key:"multi_select",value:false},START_WEEKDAY:{key:"start_weekday",value:0},SHOW_WEEKDAYS:{key:"show_weekdays",value:true},SHOW_WEEK_HEADER:{key:"show_week_header",value:false},SHOW_WEEK_FOOTER:{key:"show_week_footer",value:false},HIDE_BLANK_WEEKS:{key:"hide_blank_weeks",value:false},NAV_ARROW_LEFT:{key:"nav_arrow_left",value:null},NAV_ARROW_RIGHT:{key:"nav_arrow_right",value:null},MONTHS_SHORT:{key:"months_short",value:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},MONTHS_LONG:{key:"months_long",value:["January","February","March","April","May","June","July","August","September","October","November","December"]},WEEKDAYS_1CHAR:{key:"weekdays_1char",value:["S","M","T","W","T","F","S"]},WEEKDAYS_SHORT:{key:"weekdays_short",value:["Su","Mo","Tu","We","Th","Fr","Sa"]},WEEKDAYS_MEDIUM:{key:"weekdays_medium",value:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},WEEKDAYS_LONG:{key:"weekdays_long",value:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},LOCALE_MONTHS:{key:"locale_months",value:"long"},LOCALE_WEEKDAYS:{key:"locale_weekdays",value:"short"},DATE_DELIMITER:{key:"date_delimiter",value:","},DATE_FIELD_DELIMITER:{key:"date_field_delimiter",value:"/"},DATE_RANGE_DELIMITER:{key:"date_range_delimiter",value:"-"},MY_MONTH_POSITION:{key:"my_month_position",value:1},MY_YEAR_POSITION:{key:"my_year_position",value:2},MD_MONTH_POSITION:{key:"md_month_position",value:1},MD_DAY_POSITION:{key:"md_day_position",value:2},MDY_MONTH_POSITION:{key:"mdy_month_position",value:1},MDY_DAY_POSITION:{key:"mdy_day_position",value:2},MDY_YEAR_POSITION:{key:"mdy_year_position",value:3},MY_LABEL_MONTH_POSITION:{key:"my_label_month_position",value:1},MY_LABEL_YEAR_POSITION:{key:"my_label_year_position",value:2},MY_LABEL_MONTH_SUFFIX:{key:"my_label_month_suffix",value:" "},MY_LABEL_YEAR_SUFFIX:{key:"my_label_year_suffix",value:""},NAV:{key:"navigator",value:null},STRINGS:{key:"strings",value:{previousMonth:"Previous Month",nextMonth:"Next Month",close:"Close"},supercedes:["close","title"]}};var B=F._DEFAULT_CONFIG;F._EVENT_TYPES={BEFORE_SELECT:"beforeSelect",SELECT:"select",BEFORE_DESELECT:"beforeDeselect",DESELECT:"deselect",CHANGE_PAGE:"changePage",BEFORE_RENDER:"beforeRender",RENDER:"render",BEFORE_DESTROY:"beforeDestroy",DESTROY:"destroy",RESET:"reset",CLEAR:"clear",BEFORE_HIDE:"beforeHide",HIDE:"hide",BEFORE_SHOW:"beforeShow",SHOW:"show",BEFORE_HIDE_NAV:"beforeHideNav",HIDE_NAV:"hideNav",BEFORE_SHOW_NAV:"beforeShowNav",SHOW_NAV:"showNav",BEFORE_RENDER_NAV:"beforeRenderNav",RENDER_NAV:"renderNav"};F._STYLES={CSS_ROW_HEADER:"calrowhead",CSS_ROW_FOOTER:"calrowfoot",CSS_CELL:"calcell",CSS_CELL_SELECTOR:"selector",CSS_CELL_SELECTED:"selected",CSS_CELL_SELECTABLE:"selectable",CSS_CELL_RESTRICTED:"restricted",CSS_CELL_TODAY:"today",CSS_CELL_OOM:"oom",CSS_CELL_OOB:"previous",CSS_HEADER:"calheader",CSS_HEADER_TEXT:"calhead",CSS_BODY:"calbody",CSS_WEEKDAY_CELL:"calweekdaycell",CSS_WEEKDAY_ROW:"calweekdayrow",CSS_FOOTER:"calfoot",CSS_CALENDAR:"yui-calendar",CSS_SINGLE:"single",CSS_CONTAINER:"yui-calcontainer",CSS_NAV_LEFT:"calnavleft",CSS_NAV_RIGHT:"calnavright",CSS_NAV:"calnav",CSS_CLOSE:"calclose",CSS_CELL_TOP:"calcelltop",CSS_CELL_LEFT:"calcellleft",CSS_CELL_RIGHT:"calcellright",CSS_CELL_BOTTOM:"calcellbottom",CSS_CELL_HOVER:"calcellhover",CSS_CELL_HIGHLIGHT1:"highlight1",CSS_CELL_HIGHLIGHT2:"highlight2",CSS_CELL_HIGHLIGHT3:"highlight3",CSS_CELL_HIGHLIGHT4:"highlight4"};F.prototype={Config:null,parent:null,index:-1,cells:null,cellDates:null,id:null,containerId:null,oDomContainer:null,today:null,renderStack:null,_renderStack:null,oNavigator:null,_selectedDates:null,domEventMap:null,_parseArgs:function(H){var G={id:null,container:null,config:null};if(H&&H.length&&H.length>0){switch(H.length){case 1:G.id=null;G.container=H[0];G.config=null;break;case 2:if(E.isObject(H[1])&&!H[1].tagName&&!(H[1] instanceof String)){G.id=null;G.container=H[0];G.config=H[1];}else{G.id=H[0];G.container=H[1];G.config=null;}break;default:G.id=H[0];G.container=H[1];G.config=H[2];break;}}else{}return G;},init:function(J,H,I){var G=this._parseArgs(arguments);J=G.id;H=G.container;I=G.config;this.oDomContainer=C.get(H);if(!this.oDomContainer.id){this.oDomContainer.id=C.generateId();}if(!J){J=this.oDomContainer.id+"_t";}this.id=J;this.containerId=this.oDomContainer.id;this.initEvents();this.today=new Date();D.clearTime(this.today);this.cfg=new YAHOO.util.Config(this);this.Options={};this.Locale={};this.initStyles();C.addClass(this.oDomContainer,this.Style.CSS_CONTAINER);
C.addClass(this.oDomContainer,this.Style.CSS_SINGLE);this.cellDates=[];this.cells=[];this.renderStack=[];this._renderStack=[];this.setupConfig();if(I){this.cfg.applyConfig(I,true);}this.cfg.fireQueue();},configIframe:function(I,H,J){var G=H[0];if(!this.parent){if(C.inDocument(this.oDomContainer)){if(G){var K=C.getStyle(this.oDomContainer,"position");if(K=="absolute"||K=="relative"){if(!C.inDocument(this.iframe)){this.iframe=document.createElement("iframe");this.iframe.src="javascript:false;";C.setStyle(this.iframe,"opacity","0");if(YAHOO.env.ua.ie&&YAHOO.env.ua.ie<=6){C.addClass(this.iframe,"fixedsize");}this.oDomContainer.insertBefore(this.iframe,this.oDomContainer.firstChild);}}}else{if(this.iframe){if(this.iframe.parentNode){this.iframe.parentNode.removeChild(this.iframe);}this.iframe=null;}}}}},configTitle:function(H,G,I){var K=G[0];if(K){this.createTitleBar(K);}else{var J=this.cfg.getProperty(B.CLOSE.key);if(!J){this.removeTitleBar();}else{this.createTitleBar("&#160;");}}},configClose:function(H,G,I){var K=G[0],J=this.cfg.getProperty(B.TITLE.key);if(K){if(!J){this.createTitleBar("&#160;");}this.createCloseButton();}else{this.removeCloseButton();if(!J){this.removeTitleBar();}}},initEvents:function(){var G=F._EVENT_TYPES,I=YAHOO.util.CustomEvent,H=this;H.beforeSelectEvent=new I(G.BEFORE_SELECT);H.selectEvent=new I(G.SELECT);H.beforeDeselectEvent=new I(G.BEFORE_DESELECT);H.deselectEvent=new I(G.DESELECT);H.changePageEvent=new I(G.CHANGE_PAGE);H.beforeRenderEvent=new I(G.BEFORE_RENDER);H.renderEvent=new I(G.RENDER);H.beforeDestroyEvent=new I(G.BEFORE_DESTROY);H.destroyEvent=new I(G.DESTROY);H.resetEvent=new I(G.RESET);H.clearEvent=new I(G.CLEAR);H.beforeShowEvent=new I(G.BEFORE_SHOW);H.showEvent=new I(G.SHOW);H.beforeHideEvent=new I(G.BEFORE_HIDE);H.hideEvent=new I(G.HIDE);H.beforeShowNavEvent=new I(G.BEFORE_SHOW_NAV);H.showNavEvent=new I(G.SHOW_NAV);H.beforeHideNavEvent=new I(G.BEFORE_HIDE_NAV);H.hideNavEvent=new I(G.HIDE_NAV);H.beforeRenderNavEvent=new I(G.BEFORE_RENDER_NAV);H.renderNavEvent=new I(G.RENDER_NAV);H.beforeSelectEvent.subscribe(H.onBeforeSelect,this,true);H.selectEvent.subscribe(H.onSelect,this,true);H.beforeDeselectEvent.subscribe(H.onBeforeDeselect,this,true);H.deselectEvent.subscribe(H.onDeselect,this,true);H.changePageEvent.subscribe(H.onChangePage,this,true);H.renderEvent.subscribe(H.onRender,this,true);H.resetEvent.subscribe(H.onReset,this,true);H.clearEvent.subscribe(H.onClear,this,true);},doPreviousMonthNav:function(H,G){A.preventDefault(H);setTimeout(function(){G.previousMonth();var I=C.getElementsByClassName(G.Style.CSS_NAV_LEFT,"a",G.oDomContainer);if(I&&I[0]){try{I[0].focus();}catch(J){}}},0);},doNextMonthNav:function(H,G){A.preventDefault(H);setTimeout(function(){G.nextMonth();var I=C.getElementsByClassName(G.Style.CSS_NAV_RIGHT,"a",G.oDomContainer);if(I&&I[0]){try{I[0].focus();}catch(J){}}},0);},doSelectCell:function(M,G){var R,O,I,L;var N=A.getTarget(M),H=N.tagName.toLowerCase(),K=false;while(H!="td"&&!C.hasClass(N,G.Style.CSS_CELL_SELECTABLE)){if(!K&&H=="a"&&C.hasClass(N,G.Style.CSS_CELL_SELECTOR)){K=true;}N=N.parentNode;H=N.tagName.toLowerCase();if(N==this.oDomContainer||H=="html"){return;}}if(K){A.preventDefault(M);}R=N;if(C.hasClass(R,G.Style.CSS_CELL_SELECTABLE)){L=G.getIndexFromId(R.id);if(L>-1){O=G.cellDates[L];if(O){I=D.getDate(O[0],O[1]-1,O[2]);var Q;if(G.Options.MULTI_SELECT){Q=R.getElementsByTagName("a")[0];if(Q){Q.blur();}var J=G.cellDates[L];var P=G._indexOfSelectedFieldArray(J);if(P>-1){G.deselectCell(L);}else{G.selectCell(L);}}else{Q=R.getElementsByTagName("a")[0];if(Q){Q.blur();}G.selectCell(L);}}}}},doCellMouseOver:function(I,H){var G;if(I){G=A.getTarget(I);}else{G=this;}while(G.tagName&&G.tagName.toLowerCase()!="td"){G=G.parentNode;if(!G.tagName||G.tagName.toLowerCase()=="html"){return;}}if(C.hasClass(G,H.Style.CSS_CELL_SELECTABLE)){C.addClass(G,H.Style.CSS_CELL_HOVER);}},doCellMouseOut:function(I,H){var G;if(I){G=A.getTarget(I);}else{G=this;}while(G.tagName&&G.tagName.toLowerCase()!="td"){G=G.parentNode;if(!G.tagName||G.tagName.toLowerCase()=="html"){return;}}if(C.hasClass(G,H.Style.CSS_CELL_SELECTABLE)){C.removeClass(G,H.Style.CSS_CELL_HOVER);}},setupConfig:function(){var G=this.cfg;G.addProperty(B.PAGEDATE.key,{value:new Date(),handler:this.configPageDate});G.addProperty(B.SELECTED.key,{value:[],handler:this.configSelected});G.addProperty(B.TITLE.key,{value:B.TITLE.value,handler:this.configTitle});G.addProperty(B.CLOSE.key,{value:B.CLOSE.value,handler:this.configClose});G.addProperty(B.IFRAME.key,{value:B.IFRAME.value,handler:this.configIframe,validator:G.checkBoolean});G.addProperty(B.MINDATE.key,{value:B.MINDATE.value,handler:this.configMinDate});G.addProperty(B.MAXDATE.key,{value:B.MAXDATE.value,handler:this.configMaxDate});G.addProperty(B.MULTI_SELECT.key,{value:B.MULTI_SELECT.value,handler:this.configOptions,validator:G.checkBoolean});G.addProperty(B.START_WEEKDAY.key,{value:B.START_WEEKDAY.value,handler:this.configOptions,validator:G.checkNumber});G.addProperty(B.SHOW_WEEKDAYS.key,{value:B.SHOW_WEEKDAYS.value,handler:this.configOptions,validator:G.checkBoolean});G.addProperty(B.SHOW_WEEK_HEADER.key,{value:B.SHOW_WEEK_HEADER.value,handler:this.configOptions,validator:G.checkBoolean});G.addProperty(B.SHOW_WEEK_FOOTER.key,{value:B.SHOW_WEEK_FOOTER.value,handler:this.configOptions,validator:G.checkBoolean});G.addProperty(B.HIDE_BLANK_WEEKS.key,{value:B.HIDE_BLANK_WEEKS.value,handler:this.configOptions,validator:G.checkBoolean});G.addProperty(B.NAV_ARROW_LEFT.key,{value:B.NAV_ARROW_LEFT.value,handler:this.configOptions});G.addProperty(B.NAV_ARROW_RIGHT.key,{value:B.NAV_ARROW_RIGHT.value,handler:this.configOptions});G.addProperty(B.MONTHS_SHORT.key,{value:B.MONTHS_SHORT.value,handler:this.configLocale});G.addProperty(B.MONTHS_LONG.key,{value:B.MONTHS_LONG.value,handler:this.configLocale});G.addProperty(B.WEEKDAYS_1CHAR.key,{value:B.WEEKDAYS_1CHAR.value,handler:this.configLocale});G.addProperty(B.WEEKDAYS_SHORT.key,{value:B.WEEKDAYS_SHORT.value,handler:this.configLocale});
G.addProperty(B.WEEKDAYS_MEDIUM.key,{value:B.WEEKDAYS_MEDIUM.value,handler:this.configLocale});G.addProperty(B.WEEKDAYS_LONG.key,{value:B.WEEKDAYS_LONG.value,handler:this.configLocale});var H=function(){G.refireEvent(B.LOCALE_MONTHS.key);G.refireEvent(B.LOCALE_WEEKDAYS.key);};G.subscribeToConfigEvent(B.START_WEEKDAY.key,H,this,true);G.subscribeToConfigEvent(B.MONTHS_SHORT.key,H,this,true);G.subscribeToConfigEvent(B.MONTHS_LONG.key,H,this,true);G.subscribeToConfigEvent(B.WEEKDAYS_1CHAR.key,H,this,true);G.subscribeToConfigEvent(B.WEEKDAYS_SHORT.key,H,this,true);G.subscribeToConfigEvent(B.WEEKDAYS_MEDIUM.key,H,this,true);G.subscribeToConfigEvent(B.WEEKDAYS_LONG.key,H,this,true);G.addProperty(B.LOCALE_MONTHS.key,{value:B.LOCALE_MONTHS.value,handler:this.configLocaleValues});G.addProperty(B.LOCALE_WEEKDAYS.key,{value:B.LOCALE_WEEKDAYS.value,handler:this.configLocaleValues});G.addProperty(B.DATE_DELIMITER.key,{value:B.DATE_DELIMITER.value,handler:this.configLocale});G.addProperty(B.DATE_FIELD_DELIMITER.key,{value:B.DATE_FIELD_DELIMITER.value,handler:this.configLocale});G.addProperty(B.DATE_RANGE_DELIMITER.key,{value:B.DATE_RANGE_DELIMITER.value,handler:this.configLocale});G.addProperty(B.MY_MONTH_POSITION.key,{value:B.MY_MONTH_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MY_YEAR_POSITION.key,{value:B.MY_YEAR_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MD_MONTH_POSITION.key,{value:B.MD_MONTH_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MD_DAY_POSITION.key,{value:B.MD_DAY_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MDY_MONTH_POSITION.key,{value:B.MDY_MONTH_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MDY_DAY_POSITION.key,{value:B.MDY_DAY_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MDY_YEAR_POSITION.key,{value:B.MDY_YEAR_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MY_LABEL_MONTH_POSITION.key,{value:B.MY_LABEL_MONTH_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MY_LABEL_YEAR_POSITION.key,{value:B.MY_LABEL_YEAR_POSITION.value,handler:this.configLocale,validator:G.checkNumber});G.addProperty(B.MY_LABEL_MONTH_SUFFIX.key,{value:B.MY_LABEL_MONTH_SUFFIX.value,handler:this.configLocale});G.addProperty(B.MY_LABEL_YEAR_SUFFIX.key,{value:B.MY_LABEL_YEAR_SUFFIX.value,handler:this.configLocale});G.addProperty(B.NAV.key,{value:B.NAV.value,handler:this.configNavigator});G.addProperty(B.STRINGS.key,{value:B.STRINGS.value,handler:this.configStrings,validator:function(I){return E.isObject(I);},supercedes:B.STRINGS.supercedes});},configStrings:function(H,G,I){var J=E.merge(B.STRINGS.value,G[0]);this.cfg.setProperty(B.STRINGS.key,J,true);},configPageDate:function(H,G,I){this.cfg.setProperty(B.PAGEDATE.key,this._parsePageDate(G[0]),true);},configMinDate:function(H,G,I){var J=G[0];if(E.isString(J)){J=this._parseDate(J);this.cfg.setProperty(B.MINDATE.key,D.getDate(J[0],(J[1]-1),J[2]));}},configMaxDate:function(H,G,I){var J=G[0];if(E.isString(J)){J=this._parseDate(J);this.cfg.setProperty(B.MAXDATE.key,D.getDate(J[0],(J[1]-1),J[2]));}},configSelected:function(I,G,K){var H=G[0],J=B.SELECTED.key;if(H){if(E.isString(H)){this.cfg.setProperty(J,this._parseDates(H),true);}}if(!this._selectedDates){this._selectedDates=this.cfg.getProperty(J);}},configOptions:function(H,G,I){this.Options[H.toUpperCase()]=G[0];},configLocale:function(H,G,I){this.Locale[H.toUpperCase()]=G[0];this.cfg.refireEvent(B.LOCALE_MONTHS.key);this.cfg.refireEvent(B.LOCALE_WEEKDAYS.key);},configLocaleValues:function(J,I,K){J=J.toLowerCase();var M=I[0],H=this.cfg,N=this.Locale;switch(J){case B.LOCALE_MONTHS.key:switch(M){case F.SHORT:N.LOCALE_MONTHS=H.getProperty(B.MONTHS_SHORT.key).concat();break;case F.LONG:N.LOCALE_MONTHS=H.getProperty(B.MONTHS_LONG.key).concat();break;}break;case B.LOCALE_WEEKDAYS.key:switch(M){case F.ONE_CHAR:N.LOCALE_WEEKDAYS=H.getProperty(B.WEEKDAYS_1CHAR.key).concat();break;case F.SHORT:N.LOCALE_WEEKDAYS=H.getProperty(B.WEEKDAYS_SHORT.key).concat();break;case F.MEDIUM:N.LOCALE_WEEKDAYS=H.getProperty(B.WEEKDAYS_MEDIUM.key).concat();break;case F.LONG:N.LOCALE_WEEKDAYS=H.getProperty(B.WEEKDAYS_LONG.key).concat();break;}var L=H.getProperty(B.START_WEEKDAY.key);if(L>0){for(var G=0;G<L;++G){N.LOCALE_WEEKDAYS.push(N.LOCALE_WEEKDAYS.shift());}}break;}},configNavigator:function(H,G,I){var J=G[0];if(YAHOO.widget.CalendarNavigator&&(J===true||E.isObject(J))){if(!this.oNavigator){this.oNavigator=new YAHOO.widget.CalendarNavigator(this);this.beforeRenderEvent.subscribe(function(){if(!this.pages){this.oNavigator.erase();}},this,true);}}else{if(this.oNavigator){this.oNavigator.destroy();this.oNavigator=null;}}},initStyles:function(){var G=F._STYLES;this.Style={CSS_ROW_HEADER:G.CSS_ROW_HEADER,CSS_ROW_FOOTER:G.CSS_ROW_FOOTER,CSS_CELL:G.CSS_CELL,CSS_CELL_SELECTOR:G.CSS_CELL_SELECTOR,CSS_CELL_SELECTED:G.CSS_CELL_SELECTED,CSS_CELL_SELECTABLE:G.CSS_CELL_SELECTABLE,CSS_CELL_RESTRICTED:G.CSS_CELL_RESTRICTED,CSS_CELL_TODAY:G.CSS_CELL_TODAY,CSS_CELL_OOM:G.CSS_CELL_OOM,CSS_CELL_OOB:G.CSS_CELL_OOB,CSS_HEADER:G.CSS_HEADER,CSS_HEADER_TEXT:G.CSS_HEADER_TEXT,CSS_BODY:G.CSS_BODY,CSS_WEEKDAY_CELL:G.CSS_WEEKDAY_CELL,CSS_WEEKDAY_ROW:G.CSS_WEEKDAY_ROW,CSS_FOOTER:G.CSS_FOOTER,CSS_CALENDAR:G.CSS_CALENDAR,CSS_SINGLE:G.CSS_SINGLE,CSS_CONTAINER:G.CSS_CONTAINER,CSS_NAV_LEFT:G.CSS_NAV_LEFT,CSS_NAV_RIGHT:G.CSS_NAV_RIGHT,CSS_NAV:G.CSS_NAV,CSS_CLOSE:G.CSS_CLOSE,CSS_CELL_TOP:G.CSS_CELL_TOP,CSS_CELL_LEFT:G.CSS_CELL_LEFT,CSS_CELL_RIGHT:G.CSS_CELL_RIGHT,CSS_CELL_BOTTOM:G.CSS_CELL_BOTTOM,CSS_CELL_HOVER:G.CSS_CELL_HOVER,CSS_CELL_HIGHLIGHT1:G.CSS_CELL_HIGHLIGHT1,CSS_CELL_HIGHLIGHT2:G.CSS_CELL_HIGHLIGHT2,CSS_CELL_HIGHLIGHT3:G.CSS_CELL_HIGHLIGHT3,CSS_CELL_HIGHLIGHT4:G.CSS_CELL_HIGHLIGHT4};},buildMonthLabel:function(){return this._buildMonthLabel(this.cfg.getProperty(B.PAGEDATE.key));},_buildMonthLabel:function(G){var I=this.Locale.LOCALE_MONTHS[G.getMonth()]+this.Locale.MY_LABEL_MONTH_SUFFIX,H=G.getFullYear()+this.Locale.MY_LABEL_YEAR_SUFFIX;
if(this.Locale.MY_LABEL_MONTH_POSITION==2||this.Locale.MY_LABEL_YEAR_POSITION==1){return H+I;}else{return I+H;}},buildDayLabel:function(G){return G.getDate();},createTitleBar:function(G){var H=C.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE,"div",this.oDomContainer)[0]||document.createElement("div");H.className=YAHOO.widget.CalendarGroup.CSS_2UPTITLE;H.innerHTML=G;this.oDomContainer.insertBefore(H,this.oDomContainer.firstChild);C.addClass(this.oDomContainer,"withtitle");return H;},removeTitleBar:function(){var G=C.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE,"div",this.oDomContainer)[0]||null;if(G){A.purgeElement(G);this.oDomContainer.removeChild(G);}C.removeClass(this.oDomContainer,"withtitle");},createCloseButton:function(){var J=YAHOO.widget.CalendarGroup.CSS_2UPCLOSE,L="us/my/bn/x_d.gif",K=C.getElementsByClassName("link-close","a",this.oDomContainer)[0],G=this.cfg.getProperty(B.STRINGS.key),H=(G&&G.close)?G.close:"";if(!K){K=document.createElement("a");A.addListener(K,"click",function(N,M){M.hide();A.preventDefault(N);},this);}K.href="#";K.className="link-close";if(F.IMG_ROOT!==null){var I=C.getElementsByClassName(J,"img",K)[0]||document.createElement("img");I.src=F.IMG_ROOT+L;I.className=J;K.appendChild(I);}else{K.innerHTML='<span class="'+J+" "+this.Style.CSS_CLOSE+'">'+H+"</span>";}this.oDomContainer.appendChild(K);return K;},removeCloseButton:function(){var G=C.getElementsByClassName("link-close","a",this.oDomContainer)[0]||null;if(G){A.purgeElement(G);this.oDomContainer.removeChild(G);}},renderHeader:function(Q){var P=7,O="us/tr/callt.gif",G="us/tr/calrt.gif",N=this.cfg,K=N.getProperty(B.PAGEDATE.key),L=N.getProperty(B.STRINGS.key),V=(L&&L.previousMonth)?L.previousMonth:"",H=(L&&L.nextMonth)?L.nextMonth:"",M;if(N.getProperty(B.SHOW_WEEK_HEADER.key)){P+=1;}if(N.getProperty(B.SHOW_WEEK_FOOTER.key)){P+=1;}Q[Q.length]="<thead>";Q[Q.length]="<tr>";Q[Q.length]='<th colspan="'+P+'" class="'+this.Style.CSS_HEADER_TEXT+'">';Q[Q.length]='<div class="'+this.Style.CSS_HEADER+'">';var X,U=false;if(this.parent){if(this.index===0){X=true;}if(this.index==(this.parent.cfg.getProperty("pages")-1)){U=true;}}else{X=true;U=true;}if(X){M=this._buildMonthLabel(D.subtract(K,D.MONTH,1));var R=N.getProperty(B.NAV_ARROW_LEFT.key);if(R===null&&F.IMG_ROOT!==null){R=F.IMG_ROOT+O;}var I=(R===null)?"":' style="background-image:url('+R+')"';Q[Q.length]='<a class="'+this.Style.CSS_NAV_LEFT+'"'+I+' href="#">'+V+" ("+M+")"+"</a>";}var W=this.buildMonthLabel();var S=this.parent||this;if(S.cfg.getProperty("navigator")){W='<a class="'+this.Style.CSS_NAV+'" href="#">'+W+"</a>";}Q[Q.length]=W;if(U){M=this._buildMonthLabel(D.add(K,D.MONTH,1));var T=N.getProperty(B.NAV_ARROW_RIGHT.key);if(T===null&&F.IMG_ROOT!==null){T=F.IMG_ROOT+G;}var J=(T===null)?"":' style="background-image:url('+T+')"';Q[Q.length]='<a class="'+this.Style.CSS_NAV_RIGHT+'"'+J+' href="#">'+H+" ("+M+")"+"</a>";}Q[Q.length]="</div>\n</th>\n</tr>";if(N.getProperty(B.SHOW_WEEKDAYS.key)){Q=this.buildWeekdays(Q);}Q[Q.length]="</thead>";return Q;},buildWeekdays:function(H){H[H.length]='<tr class="'+this.Style.CSS_WEEKDAY_ROW+'">';if(this.cfg.getProperty(B.SHOW_WEEK_HEADER.key)){H[H.length]="<th>&#160;</th>";}for(var G=0;G<this.Locale.LOCALE_WEEKDAYS.length;++G){H[H.length]='<th class="calweekdaycell">'+this.Locale.LOCALE_WEEKDAYS[G]+"</th>";}if(this.cfg.getProperty(B.SHOW_WEEK_FOOTER.key)){H[H.length]="<th>&#160;</th>";}H[H.length]="</tr>";return H;},renderBody:function(l,j){var AJ=this.cfg.getProperty(B.START_WEEKDAY.key);this.preMonthDays=l.getDay();if(AJ>0){this.preMonthDays-=AJ;}if(this.preMonthDays<0){this.preMonthDays+=7;}this.monthDays=D.findMonthEnd(l).getDate();this.postMonthDays=F.DISPLAY_DAYS-this.preMonthDays-this.monthDays;l=D.subtract(l,D.DAY,this.preMonthDays);var X,N,M="w",e="_cell",b="wd",v="d",P,q,AB=this.today,O=this.cfg,V=AB.getFullYear(),u=AB.getMonth(),J=AB.getDate(),AA=O.getProperty(B.PAGEDATE.key),I=O.getProperty(B.HIDE_BLANK_WEEKS.key),h=O.getProperty(B.SHOW_WEEK_FOOTER.key),a=O.getProperty(B.SHOW_WEEK_HEADER.key),T=O.getProperty(B.MINDATE.key),Z=O.getProperty(B.MAXDATE.key);if(T){T=D.clearTime(T);}if(Z){Z=D.clearTime(Z);}j[j.length]='<tbody class="m'+(AA.getMonth()+1)+" "+this.Style.CSS_BODY+'">';var AH=0,Q=document.createElement("div"),k=document.createElement("td");Q.appendChild(k);var z=this.parent||this;for(var AD=0;AD<6;AD++){X=D.getWeekNumber(l,AJ);N=M+X;if(AD!==0&&I===true&&l.getMonth()!=AA.getMonth()){break;}else{j[j.length]='<tr class="'+N+'">';if(a){j=this.renderRowHeader(X,j);}for(var AI=0;AI<7;AI++){P=[];this.clearElement(k);k.className=this.Style.CSS_CELL;k.id=this.id+e+AH;if(l.getDate()==J&&l.getMonth()==u&&l.getFullYear()==V){P[P.length]=z.renderCellStyleToday;}var Y=[l.getFullYear(),l.getMonth()+1,l.getDate()];this.cellDates[this.cellDates.length]=Y;if(l.getMonth()!=AA.getMonth()){P[P.length]=z.renderCellNotThisMonth;}else{C.addClass(k,b+l.getDay());C.addClass(k,v+l.getDate());for(var AC=0;AC<this.renderStack.length;++AC){q=null;var w=this.renderStack[AC],AK=w[0],H,c,L;switch(AK){case F.DATE:H=w[1][1];c=w[1][2];L=w[1][0];if(l.getMonth()+1==H&&l.getDate()==c&&l.getFullYear()==L){q=w[2];this.renderStack.splice(AC,1);}break;case F.MONTH_DAY:H=w[1][0];c=w[1][1];if(l.getMonth()+1==H&&l.getDate()==c){q=w[2];this.renderStack.splice(AC,1);}break;case F.RANGE:var g=w[1][0],f=w[1][1],m=g[1],S=g[2],W=g[0],AG=D.getDate(W,m-1,S),K=f[1],o=f[2],G=f[0],AF=D.getDate(G,K-1,o);if(l.getTime()>=AG.getTime()&&l.getTime()<=AF.getTime()){q=w[2];if(l.getTime()==AF.getTime()){this.renderStack.splice(AC,1);}}break;case F.WEEKDAY:var R=w[1][0];if(l.getDay()+1==R){q=w[2];}break;case F.MONTH:H=w[1][0];if(l.getMonth()+1==H){q=w[2];}break;}if(q){P[P.length]=q;}}}if(this._indexOfSelectedFieldArray(Y)>-1){P[P.length]=z.renderCellStyleSelected;}if((T&&(l.getTime()<T.getTime()))||(Z&&(l.getTime()>Z.getTime()))){P[P.length]=z.renderOutOfBoundsDate;}else{P[P.length]=z.styleCellDefault;P[P.length]=z.renderCellDefault;}for(var y=0;
y<P.length;++y){if(P[y].call(z,l,k)==F.STOP_RENDER){break;}}l.setTime(l.getTime()+D.ONE_DAY_MS);l=D.clearTime(l);if(AH>=0&&AH<=6){C.addClass(k,this.Style.CSS_CELL_TOP);}if((AH%7)===0){C.addClass(k,this.Style.CSS_CELL_LEFT);}if(((AH+1)%7)===0){C.addClass(k,this.Style.CSS_CELL_RIGHT);}var n=this.postMonthDays;if(I&&n>=7){var U=Math.floor(n/7);for(var AE=0;AE<U;++AE){n-=7;}}if(AH>=((this.preMonthDays+n+this.monthDays)-7)){C.addClass(k,this.Style.CSS_CELL_BOTTOM);}j[j.length]=Q.innerHTML;AH++;}if(h){j=this.renderRowFooter(X,j);}j[j.length]="</tr>";}}j[j.length]="</tbody>";return j;},renderFooter:function(G){return G;},render:function(){this.beforeRenderEvent.fire();var H=D.findMonthStart(this.cfg.getProperty(B.PAGEDATE.key));this.resetRenderers();this.cellDates.length=0;A.purgeElement(this.oDomContainer,true);var G=[];G[G.length]='<table cellSpacing="0" class="'+this.Style.CSS_CALENDAR+" y"+H.getFullYear()+'" id="'+this.id+'">';G=this.renderHeader(G);G=this.renderBody(H,G);G=this.renderFooter(G);G[G.length]="</table>";this.oDomContainer.innerHTML=G.join("\n");this.applyListeners();this.cells=this.oDomContainer.getElementsByTagName("td");this.cfg.refireEvent(B.TITLE.key);this.cfg.refireEvent(B.CLOSE.key);this.cfg.refireEvent(B.IFRAME.key);this.renderEvent.fire();},applyListeners:function(){var P=this.oDomContainer,H=this.parent||this,L="a",S="click";var M=C.getElementsByClassName(this.Style.CSS_NAV_LEFT,L,P),I=C.getElementsByClassName(this.Style.CSS_NAV_RIGHT,L,P);if(M&&M.length>0){this.linkLeft=M[0];A.addListener(this.linkLeft,S,this.doPreviousMonthNav,H,true);}if(I&&I.length>0){this.linkRight=I[0];A.addListener(this.linkRight,S,this.doNextMonthNav,H,true);}if(H.cfg.getProperty("navigator")!==null){this.applyNavListeners();}if(this.domEventMap){var J,G;for(var R in this.domEventMap){if(E.hasOwnProperty(this.domEventMap,R)){var N=this.domEventMap[R];if(!(N instanceof Array)){N=[N];}for(var K=0;K<N.length;K++){var Q=N[K];G=C.getElementsByClassName(R,Q.tag,this.oDomContainer);for(var O=0;O<G.length;O++){J=G[O];A.addListener(J,Q.event,Q.handler,Q.scope,Q.correct);}}}}}A.addListener(this.oDomContainer,"click",this.doSelectCell,this);A.addListener(this.oDomContainer,"mouseover",this.doCellMouseOver,this);A.addListener(this.oDomContainer,"mouseout",this.doCellMouseOut,this);},applyNavListeners:function(){var H=this.parent||this,I=this,G=C.getElementsByClassName(this.Style.CSS_NAV,"a",this.oDomContainer);if(G.length>0){A.addListener(G,"click",function(N,M){var L=A.getTarget(N);if(this===L||C.isAncestor(this,L)){A.preventDefault(N);}var J=H.oNavigator;if(J){var K=I.cfg.getProperty("pagedate");J.setYear(K.getFullYear());J.setMonth(K.getMonth());J.show();}});}},getDateByCellId:function(H){var G=this.getDateFieldsByCellId(H);return(G)?D.getDate(G[0],G[1]-1,G[2]):null;},getDateFieldsByCellId:function(G){G=this.getIndexFromId(G);return(G>-1)?this.cellDates[G]:null;},getCellIndex:function(I){var H=-1;if(I){var G=I.getMonth(),N=I.getFullYear(),M=I.getDate(),K=this.cellDates;for(var J=0;J<K.length;++J){var L=K[J];if(L[0]===N&&L[1]===G+1&&L[2]===M){H=J;break;}}}return H;},getIndexFromId:function(I){var H=-1,G=I.lastIndexOf("_cell");if(G>-1){H=parseInt(I.substring(G+5),10);}return H;},renderOutOfBoundsDate:function(H,G){C.addClass(G,this.Style.CSS_CELL_OOB);G.innerHTML=H.getDate();return F.STOP_RENDER;},renderRowHeader:function(H,G){G[G.length]='<th class="calrowhead">'+H+"</th>";return G;},renderRowFooter:function(H,G){G[G.length]='<th class="calrowfoot">'+H+"</th>";return G;},renderCellDefault:function(H,G){G.innerHTML='<a href="#" class="'+this.Style.CSS_CELL_SELECTOR+'">'+this.buildDayLabel(H)+"</a>";},styleCellDefault:function(H,G){C.addClass(G,this.Style.CSS_CELL_SELECTABLE);},renderCellStyleHighlight1:function(H,G){C.addClass(G,this.Style.CSS_CELL_HIGHLIGHT1);},renderCellStyleHighlight2:function(H,G){C.addClass(G,this.Style.CSS_CELL_HIGHLIGHT2);},renderCellStyleHighlight3:function(H,G){C.addClass(G,this.Style.CSS_CELL_HIGHLIGHT3);},renderCellStyleHighlight4:function(H,G){C.addClass(G,this.Style.CSS_CELL_HIGHLIGHT4);},renderCellStyleToday:function(H,G){C.addClass(G,this.Style.CSS_CELL_TODAY);},renderCellStyleSelected:function(H,G){C.addClass(G,this.Style.CSS_CELL_SELECTED);},renderCellNotThisMonth:function(H,G){C.addClass(G,this.Style.CSS_CELL_OOM);G.innerHTML=H.getDate();return F.STOP_RENDER;},renderBodyCellRestricted:function(H,G){C.addClass(G,this.Style.CSS_CELL);C.addClass(G,this.Style.CSS_CELL_RESTRICTED);G.innerHTML=H.getDate();return F.STOP_RENDER;},addMonths:function(H){var G=B.PAGEDATE.key;this.cfg.setProperty(G,D.add(this.cfg.getProperty(G),D.MONTH,H));this.resetRenderers();this.changePageEvent.fire();},subtractMonths:function(H){var G=B.PAGEDATE.key;this.cfg.setProperty(G,D.subtract(this.cfg.getProperty(G),D.MONTH,H));this.resetRenderers();this.changePageEvent.fire();},addYears:function(H){var G=B.PAGEDATE.key;this.cfg.setProperty(G,D.add(this.cfg.getProperty(G),D.YEAR,H));this.resetRenderers();this.changePageEvent.fire();},subtractYears:function(H){var G=B.PAGEDATE.key;this.cfg.setProperty(G,D.subtract(this.cfg.getProperty(G),D.YEAR,H));this.resetRenderers();this.changePageEvent.fire();},nextMonth:function(){this.addMonths(1);},previousMonth:function(){this.subtractMonths(1);},nextYear:function(){this.addYears(1);},previousYear:function(){this.subtractYears(1);},reset:function(){this.cfg.resetProperty(B.SELECTED.key);this.cfg.resetProperty(B.PAGEDATE.key);this.resetEvent.fire();},clear:function(){this.cfg.setProperty(B.SELECTED.key,[]);this.cfg.setProperty(B.PAGEDATE.key,new Date(this.today.getTime()));this.clearEvent.fire();},select:function(I){var L=this._toFieldArray(I),H=[],K=[],M=B.SELECTED.key;for(var G=0;G<L.length;++G){var J=L[G];if(!this.isDateOOB(this._toDate(J))){if(H.length===0){this.beforeSelectEvent.fire();K=this.cfg.getProperty(M);}H.push(J);if(this._indexOfSelectedFieldArray(J)==-1){K[K.length]=J;}}}if(H.length>0){if(this.parent){this.parent.cfg.setProperty(M,K);}else{this.cfg.setProperty(M,K);
}this.selectEvent.fire(H);}return this.getSelectedDates();},selectCell:function(J){var H=this.cells[J],N=this.cellDates[J],M=this._toDate(N),I=C.hasClass(H,this.Style.CSS_CELL_SELECTABLE);if(I){this.beforeSelectEvent.fire();var L=B.SELECTED.key;var K=this.cfg.getProperty(L);var G=N.concat();if(this._indexOfSelectedFieldArray(G)==-1){K[K.length]=G;}if(this.parent){this.parent.cfg.setProperty(L,K);}else{this.cfg.setProperty(L,K);}this.renderCellStyleSelected(M,H);this.selectEvent.fire([G]);this.doCellMouseOut.call(H,null,this);}return this.getSelectedDates();},deselect:function(K){var G=this._toFieldArray(K),J=[],M=[],N=B.SELECTED.key;for(var H=0;H<G.length;++H){var L=G[H];if(!this.isDateOOB(this._toDate(L))){if(J.length===0){this.beforeDeselectEvent.fire();M=this.cfg.getProperty(N);}J.push(L);var I=this._indexOfSelectedFieldArray(L);if(I!=-1){M.splice(I,1);}}}if(J.length>0){if(this.parent){this.parent.cfg.setProperty(N,M);}else{this.cfg.setProperty(N,M);}this.deselectEvent.fire(J);}return this.getSelectedDates();},deselectCell:function(K){var H=this.cells[K],N=this.cellDates[K],I=this._indexOfSelectedFieldArray(N);var J=C.hasClass(H,this.Style.CSS_CELL_SELECTABLE);if(J){this.beforeDeselectEvent.fire();var L=this.cfg.getProperty(B.SELECTED.key),M=this._toDate(N),G=N.concat();if(I>-1){if(this.cfg.getProperty(B.PAGEDATE.key).getMonth()==M.getMonth()&&this.cfg.getProperty(B.PAGEDATE.key).getFullYear()==M.getFullYear()){C.removeClass(H,this.Style.CSS_CELL_SELECTED);}L.splice(I,1);}if(this.parent){this.parent.cfg.setProperty(B.SELECTED.key,L);}else{this.cfg.setProperty(B.SELECTED.key,L);}this.deselectEvent.fire([G]);}return this.getSelectedDates();},deselectAll:function(){this.beforeDeselectEvent.fire();var J=B.SELECTED.key,G=this.cfg.getProperty(J),H=G.length,I=G.concat();if(this.parent){this.parent.cfg.setProperty(J,[]);}else{this.cfg.setProperty(J,[]);}if(H>0){this.deselectEvent.fire(I);}return this.getSelectedDates();},_toFieldArray:function(H){var G=[];if(H instanceof Date){G=[[H.getFullYear(),H.getMonth()+1,H.getDate()]];}else{if(E.isString(H)){G=this._parseDates(H);}else{if(E.isArray(H)){for(var I=0;I<H.length;++I){var J=H[I];G[G.length]=[J.getFullYear(),J.getMonth()+1,J.getDate()];}}}}return G;},toDate:function(G){return this._toDate(G);},_toDate:function(G){if(G instanceof Date){return G;}else{return D.getDate(G[0],G[1]-1,G[2]);}},_fieldArraysAreEqual:function(I,H){var G=false;if(I[0]==H[0]&&I[1]==H[1]&&I[2]==H[2]){G=true;}return G;},_indexOfSelectedFieldArray:function(K){var J=-1,G=this.cfg.getProperty(B.SELECTED.key);for(var I=0;I<G.length;++I){var H=G[I];if(K[0]==H[0]&&K[1]==H[1]&&K[2]==H[2]){J=I;break;}}return J;},isDateOOM:function(G){return(G.getMonth()!=this.cfg.getProperty(B.PAGEDATE.key).getMonth());},isDateOOB:function(I){var J=this.cfg.getProperty(B.MINDATE.key),K=this.cfg.getProperty(B.MAXDATE.key),H=D;if(J){J=H.clearTime(J);}if(K){K=H.clearTime(K);}var G=new Date(I.getTime());G=H.clearTime(G);return((J&&G.getTime()<J.getTime())||(K&&G.getTime()>K.getTime()));},_parsePageDate:function(G){var J;if(G){if(G instanceof Date){J=D.findMonthStart(G);}else{var K,I,H;H=G.split(this.cfg.getProperty(B.DATE_FIELD_DELIMITER.key));K=parseInt(H[this.cfg.getProperty(B.MY_MONTH_POSITION.key)-1],10)-1;I=parseInt(H[this.cfg.getProperty(B.MY_YEAR_POSITION.key)-1],10);J=D.getDate(I,K,1);}}else{J=D.getDate(this.today.getFullYear(),this.today.getMonth(),1);}return J;},onBeforeSelect:function(){if(this.cfg.getProperty(B.MULTI_SELECT.key)===false){if(this.parent){this.parent.callChildFunction("clearAllBodyCellStyles",this.Style.CSS_CELL_SELECTED);this.parent.deselectAll();}else{this.clearAllBodyCellStyles(this.Style.CSS_CELL_SELECTED);this.deselectAll();}}},onSelect:function(G){},onBeforeDeselect:function(){},onDeselect:function(G){},onChangePage:function(){this.render();},onRender:function(){},onReset:function(){this.render();},onClear:function(){this.render();},validate:function(){return true;},_parseDate:function(I){var J=I.split(this.Locale.DATE_FIELD_DELIMITER),G;if(J.length==2){G=[J[this.Locale.MD_MONTH_POSITION-1],J[this.Locale.MD_DAY_POSITION-1]];G.type=F.MONTH_DAY;}else{G=[J[this.Locale.MDY_YEAR_POSITION-1],J[this.Locale.MDY_MONTH_POSITION-1],J[this.Locale.MDY_DAY_POSITION-1]];G.type=F.DATE;}for(var H=0;H<G.length;H++){G[H]=parseInt(G[H],10);}return G;},_parseDates:function(H){var O=[],N=H.split(this.Locale.DATE_DELIMITER);for(var M=0;M<N.length;++M){var L=N[M];if(L.indexOf(this.Locale.DATE_RANGE_DELIMITER)!=-1){var G=L.split(this.Locale.DATE_RANGE_DELIMITER),K=this._parseDate(G[0]),P=this._parseDate(G[1]),J=this._parseRange(K,P);O=O.concat(J);}else{var I=this._parseDate(L);O.push(I);}}return O;},_parseRange:function(G,K){var H=D.add(D.getDate(G[0],G[1]-1,G[2]),D.DAY,1),J=D.getDate(K[0],K[1]-1,K[2]),I=[];I.push(G);while(H.getTime()<=J.getTime()){I.push([H.getFullYear(),H.getMonth()+1,H.getDate()]);H=D.add(H,D.DAY,1);}return I;},resetRenderers:function(){this.renderStack=this._renderStack.concat();},removeRenderers:function(){this._renderStack=[];this.renderStack=[];},clearElement:function(G){G.innerHTML="&#160;";G.className="";},addRenderer:function(G,H){var J=this._parseDates(G);for(var I=0;I<J.length;++I){var K=J[I];if(K.length==2){if(K[0] instanceof Array){this._addRenderer(F.RANGE,K,H);}else{this._addRenderer(F.MONTH_DAY,K,H);}}else{if(K.length==3){this._addRenderer(F.DATE,K,H);}}}},_addRenderer:function(H,I,G){var J=[H,I,G];this.renderStack.unshift(J);this._renderStack=this.renderStack.concat();},addMonthRenderer:function(H,G){this._addRenderer(F.MONTH,[H],G);},addWeekdayRenderer:function(H,G){this._addRenderer(F.WEEKDAY,[H],G);},clearAllBodyCellStyles:function(G){for(var H=0;H<this.cells.length;++H){C.removeClass(this.cells[H],G);}},setMonth:function(I){var G=B.PAGEDATE.key,H=this.cfg.getProperty(G);H.setMonth(parseInt(I,10));this.cfg.setProperty(G,H);},setYear:function(H){var G=B.PAGEDATE.key,I=this.cfg.getProperty(G);I.setFullYear(parseInt(H,10));this.cfg.setProperty(G,I);},getSelectedDates:function(){var I=[],H=this.cfg.getProperty(B.SELECTED.key);
for(var K=0;K<H.length;++K){var J=H[K];var G=D.getDate(J[0],J[1]-1,J[2]);I.push(G);}I.sort(function(M,L){return M-L;});return I;},hide:function(){if(this.beforeHideEvent.fire()){this.oDomContainer.style.display="none";this.hideEvent.fire();}},show:function(){if(this.beforeShowEvent.fire()){this.oDomContainer.style.display="block";this.showEvent.fire();}},browser:(function(){var G=navigator.userAgent.toLowerCase();if(G.indexOf("opera")!=-1){return"opera";}else{if(G.indexOf("msie 7")!=-1){return"ie7";}else{if(G.indexOf("msie")!=-1){return"ie";}else{if(G.indexOf("safari")!=-1){return"safari";}else{if(G.indexOf("gecko")!=-1){return"gecko";}else{return false;}}}}}})(),toString:function(){return"Calendar "+this.id;},destroy:function(){if(this.beforeDestroyEvent.fire()){var G=this;if(G.navigator){G.navigator.destroy();}if(G.cfg){G.cfg.destroy();}A.purgeElement(G.oDomContainer,true);C.removeClass(G.oDomContainer,"withtitle");C.removeClass(G.oDomContainer,G.Style.CSS_CONTAINER);C.removeClass(G.oDomContainer,G.Style.CSS_SINGLE);G.oDomContainer.innerHTML="";G.oDomContainer=null;G.cells=null;this.destroyEvent.fire();}}};YAHOO.widget.Calendar=F;YAHOO.widget.Calendar_Core=YAHOO.widget.Calendar;YAHOO.widget.Cal_Core=YAHOO.widget.Calendar;})();(function(){var D=YAHOO.util.Dom,F=YAHOO.widget.DateMath,A=YAHOO.util.Event,E=YAHOO.lang,G=YAHOO.widget.Calendar;function B(J,H,I){if(arguments.length>0){this.init.apply(this,arguments);}}B._DEFAULT_CONFIG=G._DEFAULT_CONFIG;B._DEFAULT_CONFIG.PAGES={key:"pages",value:2};var C=B._DEFAULT_CONFIG;B.prototype={init:function(K,I,J){var H=this._parseArgs(arguments);K=H.id;I=H.container;J=H.config;this.oDomContainer=D.get(I);if(!this.oDomContainer.id){this.oDomContainer.id=D.generateId();}if(!K){K=this.oDomContainer.id+"_t";}this.id=K;this.containerId=this.oDomContainer.id;this.initEvents();this.initStyles();this.pages=[];D.addClass(this.oDomContainer,B.CSS_CONTAINER);D.addClass(this.oDomContainer,B.CSS_MULTI_UP);this.cfg=new YAHOO.util.Config(this);this.Options={};this.Locale={};this.setupConfig();if(J){this.cfg.applyConfig(J,true);}this.cfg.fireQueue();if(YAHOO.env.ua.opera){this.renderEvent.subscribe(this._fixWidth,this,true);this.showEvent.subscribe(this._fixWidth,this,true);}},setupConfig:function(){var H=this.cfg;H.addProperty(C.PAGES.key,{value:C.PAGES.value,validator:H.checkNumber,handler:this.configPages});H.addProperty(C.PAGEDATE.key,{value:new Date(),handler:this.configPageDate});H.addProperty(C.SELECTED.key,{value:[],handler:this.configSelected});H.addProperty(C.TITLE.key,{value:C.TITLE.value,handler:this.configTitle});H.addProperty(C.CLOSE.key,{value:C.CLOSE.value,handler:this.configClose});H.addProperty(C.IFRAME.key,{value:C.IFRAME.value,handler:this.configIframe,validator:H.checkBoolean});H.addProperty(C.MINDATE.key,{value:C.MINDATE.value,handler:this.delegateConfig});H.addProperty(C.MAXDATE.key,{value:C.MAXDATE.value,handler:this.delegateConfig});H.addProperty(C.MULTI_SELECT.key,{value:C.MULTI_SELECT.value,handler:this.delegateConfig,validator:H.checkBoolean});H.addProperty(C.START_WEEKDAY.key,{value:C.START_WEEKDAY.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.SHOW_WEEKDAYS.key,{value:C.SHOW_WEEKDAYS.value,handler:this.delegateConfig,validator:H.checkBoolean});H.addProperty(C.SHOW_WEEK_HEADER.key,{value:C.SHOW_WEEK_HEADER.value,handler:this.delegateConfig,validator:H.checkBoolean});H.addProperty(C.SHOW_WEEK_FOOTER.key,{value:C.SHOW_WEEK_FOOTER.value,handler:this.delegateConfig,validator:H.checkBoolean});H.addProperty(C.HIDE_BLANK_WEEKS.key,{value:C.HIDE_BLANK_WEEKS.value,handler:this.delegateConfig,validator:H.checkBoolean});H.addProperty(C.NAV_ARROW_LEFT.key,{value:C.NAV_ARROW_LEFT.value,handler:this.delegateConfig});H.addProperty(C.NAV_ARROW_RIGHT.key,{value:C.NAV_ARROW_RIGHT.value,handler:this.delegateConfig});H.addProperty(C.MONTHS_SHORT.key,{value:C.MONTHS_SHORT.value,handler:this.delegateConfig});H.addProperty(C.MONTHS_LONG.key,{value:C.MONTHS_LONG.value,handler:this.delegateConfig});H.addProperty(C.WEEKDAYS_1CHAR.key,{value:C.WEEKDAYS_1CHAR.value,handler:this.delegateConfig});H.addProperty(C.WEEKDAYS_SHORT.key,{value:C.WEEKDAYS_SHORT.value,handler:this.delegateConfig});H.addProperty(C.WEEKDAYS_MEDIUM.key,{value:C.WEEKDAYS_MEDIUM.value,handler:this.delegateConfig});H.addProperty(C.WEEKDAYS_LONG.key,{value:C.WEEKDAYS_LONG.value,handler:this.delegateConfig});H.addProperty(C.LOCALE_MONTHS.key,{value:C.LOCALE_MONTHS.value,handler:this.delegateConfig});H.addProperty(C.LOCALE_WEEKDAYS.key,{value:C.LOCALE_WEEKDAYS.value,handler:this.delegateConfig});H.addProperty(C.DATE_DELIMITER.key,{value:C.DATE_DELIMITER.value,handler:this.delegateConfig});H.addProperty(C.DATE_FIELD_DELIMITER.key,{value:C.DATE_FIELD_DELIMITER.value,handler:this.delegateConfig});H.addProperty(C.DATE_RANGE_DELIMITER.key,{value:C.DATE_RANGE_DELIMITER.value,handler:this.delegateConfig});H.addProperty(C.MY_MONTH_POSITION.key,{value:C.MY_MONTH_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.MY_YEAR_POSITION.key,{value:C.MY_YEAR_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.MD_MONTH_POSITION.key,{value:C.MD_MONTH_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.MD_DAY_POSITION.key,{value:C.MD_DAY_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.MDY_MONTH_POSITION.key,{value:C.MDY_MONTH_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.MDY_DAY_POSITION.key,{value:C.MDY_DAY_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.MDY_YEAR_POSITION.key,{value:C.MDY_YEAR_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.MY_LABEL_MONTH_POSITION.key,{value:C.MY_LABEL_MONTH_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber});H.addProperty(C.MY_LABEL_YEAR_POSITION.key,{value:C.MY_LABEL_YEAR_POSITION.value,handler:this.delegateConfig,validator:H.checkNumber});
H.addProperty(C.MY_LABEL_MONTH_SUFFIX.key,{value:C.MY_LABEL_MONTH_SUFFIX.value,handler:this.delegateConfig});H.addProperty(C.MY_LABEL_YEAR_SUFFIX.key,{value:C.MY_LABEL_YEAR_SUFFIX.value,handler:this.delegateConfig});H.addProperty(C.NAV.key,{value:C.NAV.value,handler:this.configNavigator});H.addProperty(C.STRINGS.key,{value:C.STRINGS.value,handler:this.configStrings,validator:function(I){return E.isObject(I);},supercedes:C.STRINGS.supercedes});},initEvents:function(){var J=this,L="Event",M=YAHOO.util.CustomEvent;var I=function(O,R,N){for(var Q=0;Q<J.pages.length;++Q){var P=J.pages[Q];P[this.type+L].subscribe(O,R,N);}};var H=function(N,Q){for(var P=0;P<J.pages.length;++P){var O=J.pages[P];O[this.type+L].unsubscribe(N,Q);}};var K=G._EVENT_TYPES;J.beforeSelectEvent=new M(K.BEFORE_SELECT);J.beforeSelectEvent.subscribe=I;J.beforeSelectEvent.unsubscribe=H;J.selectEvent=new M(K.SELECT);J.selectEvent.subscribe=I;J.selectEvent.unsubscribe=H;J.beforeDeselectEvent=new M(K.BEFORE_DESELECT);J.beforeDeselectEvent.subscribe=I;J.beforeDeselectEvent.unsubscribe=H;J.deselectEvent=new M(K.DESELECT);J.deselectEvent.subscribe=I;J.deselectEvent.unsubscribe=H;J.changePageEvent=new M(K.CHANGE_PAGE);J.changePageEvent.subscribe=I;J.changePageEvent.unsubscribe=H;J.beforeRenderEvent=new M(K.BEFORE_RENDER);J.beforeRenderEvent.subscribe=I;J.beforeRenderEvent.unsubscribe=H;J.renderEvent=new M(K.RENDER);J.renderEvent.subscribe=I;J.renderEvent.unsubscribe=H;J.resetEvent=new M(K.RESET);J.resetEvent.subscribe=I;J.resetEvent.unsubscribe=H;J.clearEvent=new M(K.CLEAR);J.clearEvent.subscribe=I;J.clearEvent.unsubscribe=H;J.beforeShowEvent=new M(K.BEFORE_SHOW);J.showEvent=new M(K.SHOW);J.beforeHideEvent=new M(K.BEFORE_HIDE);J.hideEvent=new M(K.HIDE);J.beforeShowNavEvent=new M(K.BEFORE_SHOW_NAV);J.showNavEvent=new M(K.SHOW_NAV);J.beforeHideNavEvent=new M(K.BEFORE_HIDE_NAV);J.hideNavEvent=new M(K.HIDE_NAV);J.beforeRenderNavEvent=new M(K.BEFORE_RENDER_NAV);J.renderNavEvent=new M(K.RENDER_NAV);J.beforeDestroyEvent=new M(K.BEFORE_DESTROY);J.destroyEvent=new M(K.DESTROY);},configPages:function(T,R,N){var L=R[0],J=C.PAGEDATE.key,W="_",M,O=null,S="groupcal",V="first-of-type",K="last-of-type";for(var I=0;I<L;++I){var U=this.id+W+I,Q=this.containerId+W+I,P=this.cfg.getConfig();P.close=false;P.title=false;P.navigator=null;if(I>0){M=new Date(O);this._setMonthOnDate(M,M.getMonth()+I);P.pageDate=M;}var H=this.constructChild(U,Q,P);D.removeClass(H.oDomContainer,this.Style.CSS_SINGLE);D.addClass(H.oDomContainer,S);if(I===0){O=H.cfg.getProperty(J);D.addClass(H.oDomContainer,V);}if(I==(L-1)){D.addClass(H.oDomContainer,K);}H.parent=this;H.index=I;this.pages[this.pages.length]=H;}},configPageDate:function(O,N,L){var J=N[0],M;var K=C.PAGEDATE.key;for(var I=0;I<this.pages.length;++I){var H=this.pages[I];if(I===0){M=H._parsePageDate(J);H.cfg.setProperty(K,M);}else{var P=new Date(M);this._setMonthOnDate(P,P.getMonth()+I);H.cfg.setProperty(K,P);}}},configSelected:function(J,H,L){var K=C.SELECTED.key;this.delegateConfig(J,H,L);var I=(this.pages.length>0)?this.pages[0].cfg.getProperty(K):[];this.cfg.setProperty(K,I,true);},delegateConfig:function(I,H,L){var M=H[0];var K;for(var J=0;J<this.pages.length;J++){K=this.pages[J];K.cfg.setProperty(I,M);}},setChildFunction:function(K,I){var H=this.cfg.getProperty(C.PAGES.key);for(var J=0;J<H;++J){this.pages[J][K]=I;}},callChildFunction:function(M,I){var H=this.cfg.getProperty(C.PAGES.key);for(var L=0;L<H;++L){var K=this.pages[L];if(K[M]){var J=K[M];J.call(K,I);}}},constructChild:function(K,I,J){var H=document.getElementById(I);if(!H){H=document.createElement("div");H.id=I;this.oDomContainer.appendChild(H);}return new G(K,I,J);},setMonth:function(L){L=parseInt(L,10);var M;var I=C.PAGEDATE.key;for(var K=0;K<this.pages.length;++K){var J=this.pages[K];var H=J.cfg.getProperty(I);if(K===0){M=H.getFullYear();}else{H.setFullYear(M);}this._setMonthOnDate(H,L+K);J.cfg.setProperty(I,H);}},setYear:function(J){var I=C.PAGEDATE.key;J=parseInt(J,10);for(var L=0;L<this.pages.length;++L){var K=this.pages[L];var H=K.cfg.getProperty(I);if((H.getMonth()+1)==1&&L>0){J+=1;}K.setYear(J);}},render:function(){this.renderHeader();for(var I=0;I<this.pages.length;++I){var H=this.pages[I];H.render();}this.renderFooter();},select:function(H){for(var J=0;J<this.pages.length;++J){var I=this.pages[J];I.select(H);}return this.getSelectedDates();},selectCell:function(H){for(var J=0;J<this.pages.length;++J){var I=this.pages[J];I.selectCell(H);}return this.getSelectedDates();},deselect:function(H){for(var J=0;J<this.pages.length;++J){var I=this.pages[J];I.deselect(H);}return this.getSelectedDates();},deselectAll:function(){for(var I=0;I<this.pages.length;++I){var H=this.pages[I];H.deselectAll();}return this.getSelectedDates();},deselectCell:function(H){for(var J=0;J<this.pages.length;++J){var I=this.pages[J];I.deselectCell(H);}return this.getSelectedDates();},reset:function(){for(var I=0;I<this.pages.length;++I){var H=this.pages[I];H.reset();}},clear:function(){for(var I=0;I<this.pages.length;++I){var H=this.pages[I];H.clear();}this.cfg.setProperty(C.SELECTED.key,[]);this.cfg.setProperty(C.PAGEDATE.key,new Date(this.pages[0].today.getTime()));this.render();},nextMonth:function(){for(var I=0;I<this.pages.length;++I){var H=this.pages[I];H.nextMonth();}},previousMonth:function(){for(var I=this.pages.length-1;I>=0;--I){var H=this.pages[I];H.previousMonth();}},nextYear:function(){for(var I=0;I<this.pages.length;++I){var H=this.pages[I];H.nextYear();}},previousYear:function(){for(var I=0;I<this.pages.length;++I){var H=this.pages[I];H.previousYear();}},getSelectedDates:function(){var J=[];var I=this.cfg.getProperty(C.SELECTED.key);for(var L=0;L<I.length;++L){var K=I[L];var H=F.getDate(K[0],K[1]-1,K[2]);J.push(H);}J.sort(function(N,M){return N-M;});return J;},addRenderer:function(H,I){for(var K=0;K<this.pages.length;++K){var J=this.pages[K];J.addRenderer(H,I);}},addMonthRenderer:function(K,H){for(var J=0;J<this.pages.length;++J){var I=this.pages[J];I.addMonthRenderer(K,H);
}},addWeekdayRenderer:function(I,H){for(var K=0;K<this.pages.length;++K){var J=this.pages[K];J.addWeekdayRenderer(I,H);}},removeRenderers:function(){this.callChildFunction("removeRenderers");},renderHeader:function(){},renderFooter:function(){},addMonths:function(H){this.callChildFunction("addMonths",H);},subtractMonths:function(H){this.callChildFunction("subtractMonths",H);},addYears:function(H){this.callChildFunction("addYears",H);},subtractYears:function(H){this.callChildFunction("subtractYears",H);},getCalendarPage:function(K){var M=null;if(K){var N=K.getFullYear(),J=K.getMonth();var I=this.pages;for(var L=0;L<I.length;++L){var H=I[L].cfg.getProperty("pagedate");if(H.getFullYear()===N&&H.getMonth()===J){M=I[L];break;}}}return M;},_setMonthOnDate:function(I,J){if(YAHOO.env.ua.webkit&&YAHOO.env.ua.webkit<420&&(J<0||J>11)){var H=F.add(I,F.MONTH,J-I.getMonth());I.setTime(H.getTime());}else{I.setMonth(J);}},_fixWidth:function(){var H=0;for(var J=0;J<this.pages.length;++J){var I=this.pages[J];H+=I.oDomContainer.offsetWidth;}if(H>0){this.oDomContainer.style.width=H+"px";}},toString:function(){return"CalendarGroup "+this.id;},destroy:function(){if(this.beforeDestroyEvent.fire()){var J=this;if(J.navigator){J.navigator.destroy();}if(J.cfg){J.cfg.destroy();}A.purgeElement(J.oDomContainer,true);D.removeClass(J.oDomContainer,B.CSS_CONTAINER);D.removeClass(J.oDomContainer,B.CSS_MULTI_UP);for(var I=0,H=J.pages.length;I<H;I++){J.pages[I].destroy();J.pages[I]=null;}J.oDomContainer.innerHTML="";J.oDomContainer=null;this.destroyEvent.fire();}}};B.CSS_CONTAINER="yui-calcontainer";B.CSS_MULTI_UP="multi";B.CSS_2UPTITLE="title";B.CSS_2UPCLOSE="close-icon";YAHOO.lang.augmentProto(B,G,"buildDayLabel","buildMonthLabel","renderOutOfBoundsDate","renderRowHeader","renderRowFooter","renderCellDefault","styleCellDefault","renderCellStyleHighlight1","renderCellStyleHighlight2","renderCellStyleHighlight3","renderCellStyleHighlight4","renderCellStyleToday","renderCellStyleSelected","renderCellNotThisMonth","renderBodyCellRestricted","initStyles","configTitle","configClose","configIframe","configStrings","configNavigator","createTitleBar","createCloseButton","removeTitleBar","removeCloseButton","hide","show","toDate","_toDate","_parseArgs","browser");YAHOO.widget.CalGrp=B;YAHOO.widget.CalendarGroup=B;YAHOO.widget.Calendar2up=function(J,H,I){this.init(J,H,I);};YAHOO.extend(YAHOO.widget.Calendar2up,B);YAHOO.widget.Cal2up=YAHOO.widget.Calendar2up;})();YAHOO.widget.CalendarNavigator=function(A){this.init(A);};(function(){var A=YAHOO.widget.CalendarNavigator;A.CLASSES={NAV:"yui-cal-nav",NAV_VISIBLE:"yui-cal-nav-visible",MASK:"yui-cal-nav-mask",YEAR:"yui-cal-nav-y",MONTH:"yui-cal-nav-m",BUTTONS:"yui-cal-nav-b",BUTTON:"yui-cal-nav-btn",ERROR:"yui-cal-nav-e",YEAR_CTRL:"yui-cal-nav-yc",MONTH_CTRL:"yui-cal-nav-mc",INVALID:"yui-invalid",DEFAULT:"yui-default"};A._DEFAULT_CFG={strings:{month:"Month",year:"Year",submit:"Okay",cancel:"Cancel",invalidYear:"Year needs to be a number"},monthFormat:YAHOO.widget.Calendar.LONG,initialFocus:"year"};A.ID_SUFFIX="_nav";A.MONTH_SUFFIX="_month";A.YEAR_SUFFIX="_year";A.ERROR_SUFFIX="_error";A.CANCEL_SUFFIX="_cancel";A.SUBMIT_SUFFIX="_submit";A.YR_MAX_DIGITS=4;A.YR_MINOR_INC=1;A.YR_MAJOR_INC=10;A.UPDATE_DELAY=50;A.YR_PATTERN=/^\d+$/;A.TRIM=/^\s*(.*?)\s*$/;})();YAHOO.widget.CalendarNavigator.prototype={id:null,cal:null,navEl:null,maskEl:null,yearEl:null,monthEl:null,errorEl:null,submitEl:null,cancelEl:null,firstCtrl:null,lastCtrl:null,_doc:null,_year:null,_month:0,__rendered:false,init:function(A){var C=A.oDomContainer;this.cal=A;this.id=C.id+YAHOO.widget.CalendarNavigator.ID_SUFFIX;this._doc=C.ownerDocument;var B=YAHOO.env.ua.ie;this.__isIEQuirks=(B&&((B<=6)||(this._doc.compatMode=="BackCompat")));},show:function(){var A=YAHOO.widget.CalendarNavigator.CLASSES;if(this.cal.beforeShowNavEvent.fire()){if(!this.__rendered){this.render();}this.clearErrors();this._updateMonthUI();this._updateYearUI();this._show(this.navEl,true);this.setInitialFocus();this.showMask();YAHOO.util.Dom.addClass(this.cal.oDomContainer,A.NAV_VISIBLE);this.cal.showNavEvent.fire();}},hide:function(){var A=YAHOO.widget.CalendarNavigator.CLASSES;if(this.cal.beforeHideNavEvent.fire()){this._show(this.navEl,false);this.hideMask();YAHOO.util.Dom.removeClass(this.cal.oDomContainer,A.NAV_VISIBLE);this.cal.hideNavEvent.fire();}},showMask:function(){this._show(this.maskEl,true);if(this.__isIEQuirks){this._syncMask();}},hideMask:function(){this._show(this.maskEl,false);},getMonth:function(){return this._month;},getYear:function(){return this._year;},setMonth:function(A){if(A>=0&&A<12){this._month=A;}this._updateMonthUI();},setYear:function(B){var A=YAHOO.widget.CalendarNavigator.YR_PATTERN;if(YAHOO.lang.isNumber(B)&&A.test(B+"")){this._year=B;}this._updateYearUI();},render:function(){this.cal.beforeRenderNavEvent.fire();if(!this.__rendered){this.createNav();this.createMask();this.applyListeners();this.__rendered=true;}this.cal.renderNavEvent.fire();},createNav:function(){var B=YAHOO.widget.CalendarNavigator;var C=this._doc;var D=C.createElement("div");D.className=B.CLASSES.NAV;var A=this.renderNavContents([]);D.innerHTML=A.join("");this.cal.oDomContainer.appendChild(D);this.navEl=D;this.yearEl=C.getElementById(this.id+B.YEAR_SUFFIX);this.monthEl=C.getElementById(this.id+B.MONTH_SUFFIX);this.errorEl=C.getElementById(this.id+B.ERROR_SUFFIX);this.submitEl=C.getElementById(this.id+B.SUBMIT_SUFFIX);this.cancelEl=C.getElementById(this.id+B.CANCEL_SUFFIX);if(YAHOO.env.ua.gecko&&this.yearEl&&this.yearEl.type=="text"){this.yearEl.setAttribute("autocomplete","off");}this._setFirstLastElements();},createMask:function(){var B=YAHOO.widget.CalendarNavigator.CLASSES;var A=this._doc.createElement("div");A.className=B.MASK;this.cal.oDomContainer.appendChild(A);this.maskEl=A;},_syncMask:function(){var B=this.cal.oDomContainer;if(B&&this.maskEl){var A=YAHOO.util.Dom.getRegion(B);YAHOO.util.Dom.setStyle(this.maskEl,"width",A.right-A.left+"px");YAHOO.util.Dom.setStyle(this.maskEl,"height",A.bottom-A.top+"px");
}},renderNavContents:function(A){var D=YAHOO.widget.CalendarNavigator,E=D.CLASSES,B=A;B[B.length]='<div class="'+E.MONTH+'">';this.renderMonth(B);B[B.length]="</div>";B[B.length]='<div class="'+E.YEAR+'">';this.renderYear(B);B[B.length]="</div>";B[B.length]='<div class="'+E.BUTTONS+'">';this.renderButtons(B);B[B.length]="</div>";B[B.length]='<div class="'+E.ERROR+'" id="'+this.id+D.ERROR_SUFFIX+'"></div>';return B;},renderMonth:function(D){var G=YAHOO.widget.CalendarNavigator,H=G.CLASSES;var I=this.id+G.MONTH_SUFFIX,F=this.__getCfg("monthFormat"),A=this.cal.cfg.getProperty((F==YAHOO.widget.Calendar.SHORT)?"MONTHS_SHORT":"MONTHS_LONG"),E=D;if(A&&A.length>0){E[E.length]='<label for="'+I+'">';E[E.length]=this.__getCfg("month",true);E[E.length]="</label>";E[E.length]='<select name="'+I+'" id="'+I+'" class="'+H.MONTH_CTRL+'">';for(var B=0;B<A.length;B++){E[E.length]='<option value="'+B+'">';E[E.length]=A[B];E[E.length]="</option>";}E[E.length]="</select>";}return E;},renderYear:function(B){var E=YAHOO.widget.CalendarNavigator,F=E.CLASSES;var G=this.id+E.YEAR_SUFFIX,A=E.YR_MAX_DIGITS,D=B;D[D.length]='<label for="'+G+'">';D[D.length]=this.__getCfg("year",true);D[D.length]="</label>";D[D.length]='<input type="text" name="'+G+'" id="'+G+'" class="'+F.YEAR_CTRL+'" maxlength="'+A+'"/>';return D;},renderButtons:function(A){var D=YAHOO.widget.CalendarNavigator.CLASSES;var B=A;B[B.length]='<span class="'+D.BUTTON+" "+D.DEFAULT+'">';B[B.length]='<button type="button" id="'+this.id+"_submit"+'">';B[B.length]=this.__getCfg("submit",true);B[B.length]="</button>";B[B.length]="</span>";B[B.length]='<span class="'+D.BUTTON+'">';B[B.length]='<button type="button" id="'+this.id+"_cancel"+'">';B[B.length]=this.__getCfg("cancel",true);B[B.length]="</button>";B[B.length]="</span>";return B;},applyListeners:function(){var B=YAHOO.util.Event;function A(){if(this.validate()){this.setYear(this._getYearFromUI());}}function C(){this.setMonth(this._getMonthFromUI());}B.on(this.submitEl,"click",this.submit,this,true);B.on(this.cancelEl,"click",this.cancel,this,true);B.on(this.yearEl,"blur",A,this,true);B.on(this.monthEl,"change",C,this,true);if(this.__isIEQuirks){YAHOO.util.Event.on(this.cal.oDomContainer,"resize",this._syncMask,this,true);}this.applyKeyListeners();},purgeListeners:function(){var A=YAHOO.util.Event;A.removeListener(this.submitEl,"click",this.submit);A.removeListener(this.cancelEl,"click",this.cancel);A.removeListener(this.yearEl,"blur");A.removeListener(this.monthEl,"change");if(this.__isIEQuirks){A.removeListener(this.cal.oDomContainer,"resize",this._syncMask);}this.purgeKeyListeners();},applyKeyListeners:function(){var D=YAHOO.util.Event,A=YAHOO.env.ua;var C=(A.ie||A.webkit)?"keydown":"keypress";var B=(A.ie||A.opera||A.webkit)?"keydown":"keypress";D.on(this.yearEl,"keypress",this._handleEnterKey,this,true);D.on(this.yearEl,C,this._handleDirectionKeys,this,true);D.on(this.lastCtrl,B,this._handleTabKey,this,true);D.on(this.firstCtrl,B,this._handleShiftTabKey,this,true);},purgeKeyListeners:function(){var D=YAHOO.util.Event,A=YAHOO.env.ua;var C=(A.ie||A.webkit)?"keydown":"keypress";var B=(A.ie||A.opera||A.webkit)?"keydown":"keypress";D.removeListener(this.yearEl,"keypress",this._handleEnterKey);D.removeListener(this.yearEl,C,this._handleDirectionKeys);D.removeListener(this.lastCtrl,B,this._handleTabKey);D.removeListener(this.firstCtrl,B,this._handleShiftTabKey);},submit:function(){if(this.validate()){this.hide();this.setMonth(this._getMonthFromUI());this.setYear(this._getYearFromUI());var B=this.cal;var A=YAHOO.widget.CalendarNavigator.UPDATE_DELAY;if(A>0){var C=this;window.setTimeout(function(){C._update(B);},A);}else{this._update(B);}}},_update:function(A){A.setYear(this.getYear());A.setMonth(this.getMonth());A.render();},cancel:function(){this.hide();},validate:function(){if(this._getYearFromUI()!==null){this.clearErrors();return true;}else{this.setYearError();this.setError(this.__getCfg("invalidYear",true));return false;}},setError:function(A){if(this.errorEl){this.errorEl.innerHTML=A;this._show(this.errorEl,true);}},clearError:function(){if(this.errorEl){this.errorEl.innerHTML="";this._show(this.errorEl,false);}},setYearError:function(){YAHOO.util.Dom.addClass(this.yearEl,YAHOO.widget.CalendarNavigator.CLASSES.INVALID);},clearYearError:function(){YAHOO.util.Dom.removeClass(this.yearEl,YAHOO.widget.CalendarNavigator.CLASSES.INVALID);},clearErrors:function(){this.clearError();this.clearYearError();},setInitialFocus:function(){var A=this.submitEl,C=this.__getCfg("initialFocus");if(C&&C.toLowerCase){C=C.toLowerCase();if(C=="year"){A=this.yearEl;try{this.yearEl.select();}catch(B){}}else{if(C=="month"){A=this.monthEl;}}}if(A&&YAHOO.lang.isFunction(A.focus)){try{A.focus();}catch(D){}}},erase:function(){if(this.__rendered){this.purgeListeners();this.yearEl=null;this.monthEl=null;this.errorEl=null;this.submitEl=null;this.cancelEl=null;this.firstCtrl=null;this.lastCtrl=null;if(this.navEl){this.navEl.innerHTML="";}var B=this.navEl.parentNode;if(B){B.removeChild(this.navEl);}this.navEl=null;var A=this.maskEl.parentNode;if(A){A.removeChild(this.maskEl);}this.maskEl=null;this.__rendered=false;}},destroy:function(){this.erase();this._doc=null;this.cal=null;this.id=null;},_show:function(B,A){if(B){YAHOO.util.Dom.setStyle(B,"display",(A)?"block":"none");}},_getMonthFromUI:function(){if(this.monthEl){return this.monthEl.selectedIndex;}else{return 0;}},_getYearFromUI:function(){var B=YAHOO.widget.CalendarNavigator;var A=null;if(this.yearEl){var C=this.yearEl.value;C=C.replace(B.TRIM,"$1");if(B.YR_PATTERN.test(C)){A=parseInt(C,10);}}return A;},_updateYearUI:function(){if(this.yearEl&&this._year!==null){this.yearEl.value=this._year;}},_updateMonthUI:function(){if(this.monthEl){this.monthEl.selectedIndex=this._month;}},_setFirstLastElements:function(){this.firstCtrl=this.monthEl;this.lastCtrl=this.cancelEl;if(this.__isMac){if(YAHOO.env.ua.webkit&&YAHOO.env.ua.webkit<420){this.firstCtrl=this.monthEl;this.lastCtrl=this.yearEl;
}if(YAHOO.env.ua.gecko){this.firstCtrl=this.yearEl;this.lastCtrl=this.yearEl;}}},_handleEnterKey:function(B){var A=YAHOO.util.KeyListener.KEY;if(YAHOO.util.Event.getCharCode(B)==A.ENTER){YAHOO.util.Event.preventDefault(B);this.submit();}},_handleDirectionKeys:function(H){var G=YAHOO.util.Event,A=YAHOO.util.KeyListener.KEY,D=YAHOO.widget.CalendarNavigator;var F=(this.yearEl.value)?parseInt(this.yearEl.value,10):null;if(isFinite(F)){var B=false;switch(G.getCharCode(H)){case A.UP:this.yearEl.value=F+D.YR_MINOR_INC;B=true;break;case A.DOWN:this.yearEl.value=Math.max(F-D.YR_MINOR_INC,0);B=true;break;case A.PAGE_UP:this.yearEl.value=F+D.YR_MAJOR_INC;B=true;break;case A.PAGE_DOWN:this.yearEl.value=Math.max(F-D.YR_MAJOR_INC,0);B=true;break;default:break;}if(B){G.preventDefault(H);try{this.yearEl.select();}catch(C){}}}},_handleTabKey:function(D){var C=YAHOO.util.Event,A=YAHOO.util.KeyListener.KEY;if(C.getCharCode(D)==A.TAB&&!D.shiftKey){try{C.preventDefault(D);this.firstCtrl.focus();}catch(B){}}},_handleShiftTabKey:function(D){var C=YAHOO.util.Event,A=YAHOO.util.KeyListener.KEY;if(D.shiftKey&&C.getCharCode(D)==A.TAB){try{C.preventDefault(D);this.lastCtrl.focus();}catch(B){}}},__getCfg:function(D,B){var C=YAHOO.widget.CalendarNavigator._DEFAULT_CFG;var A=this.cal.cfg.getProperty("navigator");if(B){return(A!==true&&A.strings&&A.strings[D])?A.strings[D]:C.strings[D];}else{return(A!==true&&A[D])?A[D]:C[D];}},__isMac:(navigator.userAgent.toLowerCase().indexOf("macintosh")!=-1)};YAHOO.register("calendar",YAHOO.widget.Calendar,{version:"2.7.0",build:"1799"});
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.7.0
*/
(function(){var lang=YAHOO.lang,util=YAHOO.util,Ev=util.Event;util.DataSourceBase=function(oLiveData,oConfigs){if(oLiveData===null||oLiveData===undefined){return;}this.liveData=oLiveData;this._oQueue={interval:null,conn:null,requests:[]};this.responseSchema={};if(oConfigs&&(oConfigs.constructor==Object)){for(var sConfig in oConfigs){if(sConfig){this[sConfig]=oConfigs[sConfig];}}}var maxCacheEntries=this.maxCacheEntries;if(!lang.isNumber(maxCacheEntries)||(maxCacheEntries<0)){maxCacheEntries=0;}this._aIntervals=[];this.createEvent("cacheRequestEvent");this.createEvent("cacheResponseEvent");this.createEvent("requestEvent");this.createEvent("responseEvent");this.createEvent("responseParseEvent");this.createEvent("responseCacheEvent");this.createEvent("dataErrorEvent");this.createEvent("cacheFlushEvent");var DS=util.DataSourceBase;this._sName="DataSource instance"+DS._nIndex;DS._nIndex++;};var DS=util.DataSourceBase;lang.augmentObject(DS,{TYPE_UNKNOWN:-1,TYPE_JSARRAY:0,TYPE_JSFUNCTION:1,TYPE_XHR:2,TYPE_JSON:3,TYPE_XML:4,TYPE_TEXT:5,TYPE_HTMLTABLE:6,TYPE_SCRIPTNODE:7,TYPE_LOCAL:8,ERROR_DATAINVALID:"Invalid data",ERROR_DATANULL:"Null data",_nIndex:0,_nTransactionId:0,issueCallback:function(callback,params,error,scope){if(lang.isFunction(callback)){callback.apply(scope,params);}else{if(lang.isObject(callback)){scope=callback.scope||scope||window;var callbackFunc=callback.success;if(error){callbackFunc=callback.failure;}if(callbackFunc){callbackFunc.apply(scope,params.concat([callback.argument]));}}}},parseString:function(oData){if(!lang.isValue(oData)){return null;}var string=oData+"";if(lang.isString(string)){return string;}else{return null;}},parseNumber:function(oData){if(!lang.isValue(oData)||(oData==="")){return null;}var number=oData*1;if(lang.isNumber(number)){return number;}else{return null;}},convertNumber:function(oData){return DS.parseNumber(oData);},parseDate:function(oData){var date=null;if(!(oData instanceof Date)){date=new Date(oData);}else{return oData;}if(date instanceof Date){return date;}else{return null;}},convertDate:function(oData){return DS.parseDate(oData);}});DS.Parser={string:DS.parseString,number:DS.parseNumber,date:DS.parseDate};DS.prototype={_sName:null,_aCache:null,_oQueue:null,_aIntervals:null,maxCacheEntries:0,liveData:null,dataType:DS.TYPE_UNKNOWN,responseType:DS.TYPE_UNKNOWN,responseSchema:null,toString:function(){return this._sName;},getCachedResponse:function(oRequest,oCallback,oCaller){var aCache=this._aCache;if(this.maxCacheEntries>0){if(!aCache){this._aCache=[];}else{var nCacheLength=aCache.length;if(nCacheLength>0){var oResponse=null;this.fireEvent("cacheRequestEvent",{request:oRequest,callback:oCallback,caller:oCaller});for(var i=nCacheLength-1;i>=0;i--){var oCacheElem=aCache[i];if(this.isCacheHit(oRequest,oCacheElem.request)){oResponse=oCacheElem.response;this.fireEvent("cacheResponseEvent",{request:oRequest,response:oResponse,callback:oCallback,caller:oCaller});if(i<nCacheLength-1){aCache.splice(i,1);this.addToCache(oRequest,oResponse);}oResponse.cached=true;break;}}return oResponse;}}}else{if(aCache){this._aCache=null;}}return null;},isCacheHit:function(oRequest,oCachedRequest){return(oRequest===oCachedRequest);},addToCache:function(oRequest,oResponse){var aCache=this._aCache;if(!aCache){return;}while(aCache.length>=this.maxCacheEntries){aCache.shift();}var oCacheElem={request:oRequest,response:oResponse};aCache[aCache.length]=oCacheElem;this.fireEvent("responseCacheEvent",{request:oRequest,response:oResponse});},flushCache:function(){if(this._aCache){this._aCache=[];this.fireEvent("cacheFlushEvent");}},setInterval:function(nMsec,oRequest,oCallback,oCaller){if(lang.isNumber(nMsec)&&(nMsec>=0)){var oSelf=this;var nId=setInterval(function(){oSelf.makeConnection(oRequest,oCallback,oCaller);},nMsec);this._aIntervals.push(nId);return nId;}else{}},clearInterval:function(nId){var tracker=this._aIntervals||[];for(var i=tracker.length-1;i>-1;i--){if(tracker[i]===nId){tracker.splice(i,1);clearInterval(nId);}}},clearAllIntervals:function(){var tracker=this._aIntervals||[];for(var i=tracker.length-1;i>-1;i--){clearInterval(tracker[i]);}tracker=[];},sendRequest:function(oRequest,oCallback,oCaller){var oCachedResponse=this.getCachedResponse(oRequest,oCallback,oCaller);if(oCachedResponse){DS.issueCallback(oCallback,[oRequest,oCachedResponse],false,oCaller);return null;}return this.makeConnection(oRequest,oCallback,oCaller);},makeConnection:function(oRequest,oCallback,oCaller){var tId=DS._nTransactionId++;this.fireEvent("requestEvent",{tId:tId,request:oRequest,callback:oCallback,caller:oCaller});var oRawResponse=this.liveData;this.handleResponse(oRequest,oRawResponse,oCallback,oCaller,tId);return tId;},handleResponse:function(oRequest,oRawResponse,oCallback,oCaller,tId){this.fireEvent("responseEvent",{tId:tId,request:oRequest,response:oRawResponse,callback:oCallback,caller:oCaller});var xhr=(this.dataType==DS.TYPE_XHR)?true:false;var oParsedResponse=null;var oFullResponse=oRawResponse;if(this.responseType===DS.TYPE_UNKNOWN){var ctype=(oRawResponse&&oRawResponse.getResponseHeader)?oRawResponse.getResponseHeader["Content-Type"]:null;if(ctype){if(ctype.indexOf("text/xml")>-1){this.responseType=DS.TYPE_XML;}else{if(ctype.indexOf("application/json")>-1){this.responseType=DS.TYPE_JSON;}else{if(ctype.indexOf("text/plain")>-1){this.responseType=DS.TYPE_TEXT;}}}}else{if(YAHOO.lang.isArray(oRawResponse)){this.responseType=DS.TYPE_JSARRAY;}else{if(oRawResponse&&oRawResponse.nodeType&&oRawResponse.nodeType==9){this.responseType=DS.TYPE_XML;}else{if(oRawResponse&&oRawResponse.nodeName&&(oRawResponse.nodeName.toLowerCase()=="table")){this.responseType=DS.TYPE_HTMLTABLE;}else{if(YAHOO.lang.isObject(oRawResponse)){this.responseType=DS.TYPE_JSON;}else{if(YAHOO.lang.isString(oRawResponse)){this.responseType=DS.TYPE_TEXT;}}}}}}}switch(this.responseType){case DS.TYPE_JSARRAY:if(xhr&&oRawResponse&&oRawResponse.responseText){oFullResponse=oRawResponse.responseText;}try{if(lang.isString(oFullResponse)){var parseArgs=[oFullResponse].concat(this.parseJSONArgs);
if(lang.JSON){oFullResponse=lang.JSON.parse.apply(lang.JSON,parseArgs);}else{if(window.JSON&&JSON.parse){oFullResponse=JSON.parse.apply(JSON,parseArgs);}else{if(oFullResponse.parseJSON){oFullResponse=oFullResponse.parseJSON.apply(oFullResponse,parseArgs.slice(1));}else{while(oFullResponse.length>0&&(oFullResponse.charAt(0)!="{")&&(oFullResponse.charAt(0)!="[")){oFullResponse=oFullResponse.substring(1,oFullResponse.length);}if(oFullResponse.length>0){var arrayEnd=Math.max(oFullResponse.lastIndexOf("]"),oFullResponse.lastIndexOf("}"));oFullResponse=oFullResponse.substring(0,arrayEnd+1);oFullResponse=eval("("+oFullResponse+")");}}}}}}catch(e1){}oFullResponse=this.doBeforeParseData(oRequest,oFullResponse,oCallback);oParsedResponse=this.parseArrayData(oRequest,oFullResponse);break;case DS.TYPE_JSON:if(xhr&&oRawResponse&&oRawResponse.responseText){oFullResponse=oRawResponse.responseText;}try{if(lang.isString(oFullResponse)){var parseArgs=[oFullResponse].concat(this.parseJSONArgs);if(lang.JSON){oFullResponse=lang.JSON.parse.apply(lang.JSON,parseArgs);}else{if(window.JSON&&JSON.parse){oFullResponse=JSON.parse.apply(JSON,parseArgs);}else{if(oFullResponse.parseJSON){oFullResponse=oFullResponse.parseJSON.apply(oFullResponse,parseArgs.slice(1));}else{while(oFullResponse.length>0&&(oFullResponse.charAt(0)!="{")&&(oFullResponse.charAt(0)!="[")){oFullResponse=oFullResponse.substring(1,oFullResponse.length);}if(oFullResponse.length>0){var objEnd=Math.max(oFullResponse.lastIndexOf("]"),oFullResponse.lastIndexOf("}"));oFullResponse=oFullResponse.substring(0,objEnd+1);oFullResponse=eval("("+oFullResponse+")");}}}}}}catch(e){}oFullResponse=this.doBeforeParseData(oRequest,oFullResponse,oCallback);oParsedResponse=this.parseJSONData(oRequest,oFullResponse);break;case DS.TYPE_HTMLTABLE:if(xhr&&oRawResponse.responseText){var el=document.createElement("div");el.innerHTML=oRawResponse.responseText;oFullResponse=el.getElementsByTagName("table")[0];}oFullResponse=this.doBeforeParseData(oRequest,oFullResponse,oCallback);oParsedResponse=this.parseHTMLTableData(oRequest,oFullResponse);break;case DS.TYPE_XML:if(xhr&&oRawResponse.responseXML){oFullResponse=oRawResponse.responseXML;}oFullResponse=this.doBeforeParseData(oRequest,oFullResponse,oCallback);oParsedResponse=this.parseXMLData(oRequest,oFullResponse);break;case DS.TYPE_TEXT:if(xhr&&lang.isString(oRawResponse.responseText)){oFullResponse=oRawResponse.responseText;}oFullResponse=this.doBeforeParseData(oRequest,oFullResponse,oCallback);oParsedResponse=this.parseTextData(oRequest,oFullResponse);break;default:oFullResponse=this.doBeforeParseData(oRequest,oFullResponse,oCallback);oParsedResponse=this.parseData(oRequest,oFullResponse);break;}oParsedResponse=oParsedResponse||{};if(!oParsedResponse.results){oParsedResponse.results=[];}if(!oParsedResponse.meta){oParsedResponse.meta={};}if(oParsedResponse&&!oParsedResponse.error){oParsedResponse=this.doBeforeCallback(oRequest,oFullResponse,oParsedResponse,oCallback);this.fireEvent("responseParseEvent",{request:oRequest,response:oParsedResponse,callback:oCallback,caller:oCaller});this.addToCache(oRequest,oParsedResponse);}else{oParsedResponse.error=true;this.fireEvent("dataErrorEvent",{request:oRequest,response:oRawResponse,callback:oCallback,caller:oCaller,message:DS.ERROR_DATANULL});}oParsedResponse.tId=tId;DS.issueCallback(oCallback,[oRequest,oParsedResponse],oParsedResponse.error,oCaller);},doBeforeParseData:function(oRequest,oFullResponse,oCallback){return oFullResponse;},doBeforeCallback:function(oRequest,oFullResponse,oParsedResponse,oCallback){return oParsedResponse;},parseData:function(oRequest,oFullResponse){if(lang.isValue(oFullResponse)){var oParsedResponse={results:oFullResponse,meta:{}};return oParsedResponse;}return null;},parseArrayData:function(oRequest,oFullResponse){if(lang.isArray(oFullResponse)){var results=[],i,j,rec,field,data;if(lang.isArray(this.responseSchema.fields)){var fields=this.responseSchema.fields;for(i=fields.length-1;i>=0;--i){if(typeof fields[i]!=="object"){fields[i]={key:fields[i]};}}var parsers={},p;for(i=fields.length-1;i>=0;--i){p=(typeof fields[i].parser==="function"?fields[i].parser:DS.Parser[fields[i].parser+""])||fields[i].converter;if(p){parsers[fields[i].key]=p;}}var arrType=lang.isArray(oFullResponse[0]);for(i=oFullResponse.length-1;i>-1;i--){var oResult={};rec=oFullResponse[i];if(typeof rec==="object"){for(j=fields.length-1;j>-1;j--){field=fields[j];data=arrType?rec[j]:rec[field.key];if(parsers[field.key]){data=parsers[field.key].call(this,data);}if(data===undefined){data=null;}oResult[field.key]=data;}}else{if(lang.isString(rec)){for(j=fields.length-1;j>-1;j--){field=fields[j];data=rec;if(parsers[field.key]){data=parsers[field.key].call(this,data);}if(data===undefined){data=null;}oResult[field.key]=data;}}}results[i]=oResult;}}else{results=oFullResponse;}var oParsedResponse={results:results};return oParsedResponse;}return null;},parseTextData:function(oRequest,oFullResponse){if(lang.isString(oFullResponse)){if(lang.isString(this.responseSchema.recordDelim)&&lang.isString(this.responseSchema.fieldDelim)){var oParsedResponse={results:[]};var recDelim=this.responseSchema.recordDelim;var fieldDelim=this.responseSchema.fieldDelim;if(oFullResponse.length>0){var newLength=oFullResponse.length-recDelim.length;if(oFullResponse.substr(newLength)==recDelim){oFullResponse=oFullResponse.substr(0,newLength);}if(oFullResponse.length>0){var recordsarray=oFullResponse.split(recDelim);for(var i=0,len=recordsarray.length,recIdx=0;i<len;++i){var bError=false,sRecord=recordsarray[i];if(lang.isString(sRecord)&&(sRecord.length>0)){var fielddataarray=recordsarray[i].split(fieldDelim);var oResult={};if(lang.isArray(this.responseSchema.fields)){var fields=this.responseSchema.fields;for(var j=fields.length-1;j>-1;j--){try{var data=fielddataarray[j];if(lang.isString(data)){if(data.charAt(0)=='"'){data=data.substr(1);}if(data.charAt(data.length-1)=='"'){data=data.substr(0,data.length-1);}var field=fields[j];
var key=(lang.isValue(field.key))?field.key:field;if(!field.parser&&field.converter){field.parser=field.converter;}var parser=(typeof field.parser==="function")?field.parser:DS.Parser[field.parser+""];if(parser){data=parser.call(this,data);}if(data===undefined){data=null;}oResult[key]=data;}else{bError=true;}}catch(e){bError=true;}}}else{oResult=fielddataarray;}if(!bError){oParsedResponse.results[recIdx++]=oResult;}}}}}return oParsedResponse;}}return null;},parseXMLResult:function(result){var oResult={},schema=this.responseSchema;try{for(var m=schema.fields.length-1;m>=0;m--){var field=schema.fields[m];var key=(lang.isValue(field.key))?field.key:field;var data=null;var xmlAttr=result.attributes.getNamedItem(key);if(xmlAttr){data=xmlAttr.value;}else{var xmlNode=result.getElementsByTagName(key);if(xmlNode&&xmlNode.item(0)){var item=xmlNode.item(0);data=(item)?((item.text)?item.text:(item.textContent)?item.textContent:null):null;if(!data){var datapieces=[];for(var j=0,len=item.childNodes.length;j<len;j++){if(item.childNodes[j].nodeValue){datapieces[datapieces.length]=item.childNodes[j].nodeValue;}}if(datapieces.length>0){data=datapieces.join("");}}}}if(data===null){data="";}if(!field.parser&&field.converter){field.parser=field.converter;}var parser=(typeof field.parser==="function")?field.parser:DS.Parser[field.parser+""];if(parser){data=parser.call(this,data);}if(data===undefined){data=null;}oResult[key]=data;}}catch(e){}return oResult;},parseXMLData:function(oRequest,oFullResponse){var bError=false,schema=this.responseSchema,oParsedResponse={meta:{}},xmlList=null,metaNode=schema.metaNode,metaLocators=schema.metaFields||{},i,k,loc,v;try{xmlList=(schema.resultNode)?oFullResponse.getElementsByTagName(schema.resultNode):null;metaNode=metaNode?oFullResponse.getElementsByTagName(metaNode)[0]:oFullResponse;if(metaNode){for(k in metaLocators){if(lang.hasOwnProperty(metaLocators,k)){loc=metaLocators[k];v=metaNode.getElementsByTagName(loc)[0];if(v){v=v.firstChild.nodeValue;}else{v=metaNode.attributes.getNamedItem(loc);if(v){v=v.value;}}if(lang.isValue(v)){oParsedResponse.meta[k]=v;}}}}}catch(e){}if(!xmlList||!lang.isArray(schema.fields)){bError=true;}else{oParsedResponse.results=[];for(i=xmlList.length-1;i>=0;--i){var oResult=this.parseXMLResult(xmlList.item(i));oParsedResponse.results[i]=oResult;}}if(bError){oParsedResponse.error=true;}else{}return oParsedResponse;},parseJSONData:function(oRequest,oFullResponse){var oParsedResponse={results:[],meta:{}};if(lang.isObject(oFullResponse)&&this.responseSchema.resultsList){var schema=this.responseSchema,fields=schema.fields,resultsList=oFullResponse,results=[],metaFields=schema.metaFields||{},fieldParsers=[],fieldPaths=[],simpleFields=[],bError=false,i,len,j,v,key,parser,path;var buildPath=function(needle){var path=null,keys=[],i=0;if(needle){needle=needle.replace(/\[(['"])(.*?)\1\]/g,function(x,$1,$2){keys[i]=$2;return".@"+(i++);}).replace(/\[(\d+)\]/g,function(x,$1){keys[i]=parseInt($1,10)|0;return".@"+(i++);}).replace(/^\./,"");if(!/[^\w\.\$@]/.test(needle)){path=needle.split(".");for(i=path.length-1;i>=0;--i){if(path[i].charAt(0)==="@"){path[i]=keys[parseInt(path[i].substr(1),10)];}}}else{}}return path;};var walkPath=function(path,origin){var v=origin,i=0,len=path.length;for(;i<len&&v;++i){v=v[path[i]];}return v;};path=buildPath(schema.resultsList);if(path){resultsList=walkPath(path,oFullResponse);if(resultsList===undefined){bError=true;}}else{bError=true;}if(!resultsList){resultsList=[];}if(!lang.isArray(resultsList)){resultsList=[resultsList];}if(!bError){if(schema.fields){var field;for(i=0,len=fields.length;i<len;i++){field=fields[i];key=field.key||field;parser=((typeof field.parser==="function")?field.parser:DS.Parser[field.parser+""])||field.converter;path=buildPath(key);if(parser){fieldParsers[fieldParsers.length]={key:key,parser:parser};}if(path){if(path.length>1){fieldPaths[fieldPaths.length]={key:key,path:path};}else{simpleFields[simpleFields.length]={key:key,path:path[0]};}}else{}}for(i=resultsList.length-1;i>=0;--i){var r=resultsList[i],rec={};if(r){for(j=simpleFields.length-1;j>=0;--j){rec[simpleFields[j].key]=(r[simpleFields[j].path]!==undefined)?r[simpleFields[j].path]:r[j];}for(j=fieldPaths.length-1;j>=0;--j){rec[fieldPaths[j].key]=walkPath(fieldPaths[j].path,r);}for(j=fieldParsers.length-1;j>=0;--j){var p=fieldParsers[j].key;rec[p]=fieldParsers[j].parser(rec[p]);if(rec[p]===undefined){rec[p]=null;}}}results[i]=rec;}}else{results=resultsList;}for(key in metaFields){if(lang.hasOwnProperty(metaFields,key)){path=buildPath(metaFields[key]);if(path){v=walkPath(path,oFullResponse);oParsedResponse.meta[key]=v;}}}}else{oParsedResponse.error=true;}oParsedResponse.results=results;}else{oParsedResponse.error=true;}return oParsedResponse;},parseHTMLTableData:function(oRequest,oFullResponse){var bError=false;var elTable=oFullResponse;var fields=this.responseSchema.fields;var oParsedResponse={results:[]};if(lang.isArray(fields)){for(var i=0;i<elTable.tBodies.length;i++){var elTbody=elTable.tBodies[i];for(var j=elTbody.rows.length-1;j>-1;j--){var elRow=elTbody.rows[j];var oResult={};for(var k=fields.length-1;k>-1;k--){var field=fields[k];var key=(lang.isValue(field.key))?field.key:field;var data=elRow.cells[k].innerHTML;if(!field.parser&&field.converter){field.parser=field.converter;}var parser=(typeof field.parser==="function")?field.parser:DS.Parser[field.parser+""];if(parser){data=parser.call(this,data);}if(data===undefined){data=null;}oResult[key]=data;}oParsedResponse.results[j]=oResult;}}}else{bError=true;}if(bError){oParsedResponse.error=true;}else{}return oParsedResponse;}};lang.augmentProto(DS,util.EventProvider);util.LocalDataSource=function(oLiveData,oConfigs){this.dataType=DS.TYPE_LOCAL;if(oLiveData){if(YAHOO.lang.isArray(oLiveData)){this.responseType=DS.TYPE_JSARRAY;}else{if(oLiveData.nodeType&&oLiveData.nodeType==9){this.responseType=DS.TYPE_XML;}else{if(oLiveData.nodeName&&(oLiveData.nodeName.toLowerCase()=="table")){this.responseType=DS.TYPE_HTMLTABLE;
oLiveData=oLiveData.cloneNode(true);}else{if(YAHOO.lang.isString(oLiveData)){this.responseType=DS.TYPE_TEXT;}else{if(YAHOO.lang.isObject(oLiveData)){this.responseType=DS.TYPE_JSON;}}}}}}else{oLiveData=[];this.responseType=DS.TYPE_JSARRAY;}util.LocalDataSource.superclass.constructor.call(this,oLiveData,oConfigs);};lang.extend(util.LocalDataSource,DS);lang.augmentObject(util.LocalDataSource,DS);util.FunctionDataSource=function(oLiveData,oConfigs){this.dataType=DS.TYPE_JSFUNCTION;oLiveData=oLiveData||function(){};util.FunctionDataSource.superclass.constructor.call(this,oLiveData,oConfigs);};lang.extend(util.FunctionDataSource,DS,{scope:null,makeConnection:function(oRequest,oCallback,oCaller){var tId=DS._nTransactionId++;this.fireEvent("requestEvent",{tId:tId,request:oRequest,callback:oCallback,caller:oCaller});var oRawResponse=(this.scope)?this.liveData.call(this.scope,oRequest,this):this.liveData(oRequest);if(this.responseType===DS.TYPE_UNKNOWN){if(YAHOO.lang.isArray(oRawResponse)){this.responseType=DS.TYPE_JSARRAY;}else{if(oRawResponse&&oRawResponse.nodeType&&oRawResponse.nodeType==9){this.responseType=DS.TYPE_XML;}else{if(oRawResponse&&oRawResponse.nodeName&&(oRawResponse.nodeName.toLowerCase()=="table")){this.responseType=DS.TYPE_HTMLTABLE;}else{if(YAHOO.lang.isObject(oRawResponse)){this.responseType=DS.TYPE_JSON;}else{if(YAHOO.lang.isString(oRawResponse)){this.responseType=DS.TYPE_TEXT;}}}}}}this.handleResponse(oRequest,oRawResponse,oCallback,oCaller,tId);return tId;}});lang.augmentObject(util.FunctionDataSource,DS);util.ScriptNodeDataSource=function(oLiveData,oConfigs){this.dataType=DS.TYPE_SCRIPTNODE;oLiveData=oLiveData||"";util.ScriptNodeDataSource.superclass.constructor.call(this,oLiveData,oConfigs);};lang.extend(util.ScriptNodeDataSource,DS,{getUtility:util.Get,asyncMode:"allowAll",scriptCallbackParam:"callback",generateRequestCallback:function(id){return"&"+this.scriptCallbackParam+"=YAHOO.util.ScriptNodeDataSource.callbacks["+id+"]";},doBeforeGetScriptNode:function(sUri){return sUri;},makeConnection:function(oRequest,oCallback,oCaller){var tId=DS._nTransactionId++;this.fireEvent("requestEvent",{tId:tId,request:oRequest,callback:oCallback,caller:oCaller});if(util.ScriptNodeDataSource._nPending===0){util.ScriptNodeDataSource.callbacks=[];util.ScriptNodeDataSource._nId=0;}var id=util.ScriptNodeDataSource._nId;util.ScriptNodeDataSource._nId++;var oSelf=this;util.ScriptNodeDataSource.callbacks[id]=function(oRawResponse){if((oSelf.asyncMode!=="ignoreStaleResponses")||(id===util.ScriptNodeDataSource.callbacks.length-1)){if(oSelf.responseType===DS.TYPE_UNKNOWN){if(YAHOO.lang.isArray(oRawResponse)){oSelf.responseType=DS.TYPE_JSARRAY;}else{if(oRawResponse.nodeType&&oRawResponse.nodeType==9){oSelf.responseType=DS.TYPE_XML;}else{if(oRawResponse.nodeName&&(oRawResponse.nodeName.toLowerCase()=="table")){oSelf.responseType=DS.TYPE_HTMLTABLE;}else{if(YAHOO.lang.isObject(oRawResponse)){oSelf.responseType=DS.TYPE_JSON;}else{if(YAHOO.lang.isString(oRawResponse)){oSelf.responseType=DS.TYPE_TEXT;}}}}}}oSelf.handleResponse(oRequest,oRawResponse,oCallback,oCaller,tId);}else{}delete util.ScriptNodeDataSource.callbacks[id];};util.ScriptNodeDataSource._nPending++;var sUri=this.liveData+oRequest+this.generateRequestCallback(id);sUri=this.doBeforeGetScriptNode(sUri);this.getUtility.script(sUri,{autopurge:true,onsuccess:util.ScriptNodeDataSource._bumpPendingDown,onfail:util.ScriptNodeDataSource._bumpPendingDown});return tId;}});lang.augmentObject(util.ScriptNodeDataSource,DS);lang.augmentObject(util.ScriptNodeDataSource,{_nId:0,_nPending:0,callbacks:[]});util.XHRDataSource=function(oLiveData,oConfigs){this.dataType=DS.TYPE_XHR;this.connMgr=this.connMgr||util.Connect;oLiveData=oLiveData||"";util.XHRDataSource.superclass.constructor.call(this,oLiveData,oConfigs);};lang.extend(util.XHRDataSource,DS,{connMgr:null,connXhrMode:"allowAll",connMethodPost:false,connTimeout:0,makeConnection:function(oRequest,oCallback,oCaller){var oRawResponse=null;var tId=DS._nTransactionId++;this.fireEvent("requestEvent",{tId:tId,request:oRequest,callback:oCallback,caller:oCaller});var oSelf=this;var oConnMgr=this.connMgr;var oQueue=this._oQueue;var _xhrSuccess=function(oResponse){if(oResponse&&(this.connXhrMode=="ignoreStaleResponses")&&(oResponse.tId!=oQueue.conn.tId)){return null;}else{if(!oResponse){this.fireEvent("dataErrorEvent",{request:oRequest,callback:oCallback,caller:oCaller,message:DS.ERROR_DATANULL});DS.issueCallback(oCallback,[oRequest,{error:true}],true,oCaller);return null;}else{if(this.responseType===DS.TYPE_UNKNOWN){var ctype=(oResponse.getResponseHeader)?oResponse.getResponseHeader["Content-Type"]:null;if(ctype){if(ctype.indexOf("text/xml")>-1){this.responseType=DS.TYPE_XML;}else{if(ctype.indexOf("application/json")>-1){this.responseType=DS.TYPE_JSON;}else{if(ctype.indexOf("text/plain")>-1){this.responseType=DS.TYPE_TEXT;}}}}}this.handleResponse(oRequest,oResponse,oCallback,oCaller,tId);}}};var _xhrFailure=function(oResponse){this.fireEvent("dataErrorEvent",{request:oRequest,callback:oCallback,caller:oCaller,message:DS.ERROR_DATAINVALID});if(lang.isString(this.liveData)&&lang.isString(oRequest)&&(this.liveData.lastIndexOf("?")!==this.liveData.length-1)&&(oRequest.indexOf("?")!==0)){}oResponse=oResponse||{};oResponse.error=true;DS.issueCallback(oCallback,[oRequest,oResponse],true,oCaller);return null;};var _xhrCallback={success:_xhrSuccess,failure:_xhrFailure,scope:this};if(lang.isNumber(this.connTimeout)){_xhrCallback.timeout=this.connTimeout;}if(this.connXhrMode=="cancelStaleRequests"){if(oQueue.conn){if(oConnMgr.abort){oConnMgr.abort(oQueue.conn);oQueue.conn=null;}else{}}}if(oConnMgr&&oConnMgr.asyncRequest){var sLiveData=this.liveData;var isPost=this.connMethodPost;var sMethod=(isPost)?"POST":"GET";var sUri=(isPost||!lang.isValue(oRequest))?sLiveData:sLiveData+oRequest;var sRequest=(isPost)?oRequest:null;if(this.connXhrMode!="queueRequests"){oQueue.conn=oConnMgr.asyncRequest(sMethod,sUri,_xhrCallback,sRequest);}else{if(oQueue.conn){var allRequests=oQueue.requests;
allRequests.push({request:oRequest,callback:_xhrCallback});if(!oQueue.interval){oQueue.interval=setInterval(function(){if(oConnMgr.isCallInProgress(oQueue.conn)){return;}else{if(allRequests.length>0){sUri=(isPost||!lang.isValue(allRequests[0].request))?sLiveData:sLiveData+allRequests[0].request;sRequest=(isPost)?allRequests[0].request:null;oQueue.conn=oConnMgr.asyncRequest(sMethod,sUri,allRequests[0].callback,sRequest);allRequests.shift();}else{clearInterval(oQueue.interval);oQueue.interval=null;}}},50);}}else{oQueue.conn=oConnMgr.asyncRequest(sMethod,sUri,_xhrCallback,sRequest);}}}else{DS.issueCallback(oCallback,[oRequest,{error:true}],true,oCaller);}return tId;}});lang.augmentObject(util.XHRDataSource,DS);util.DataSource=function(oLiveData,oConfigs){oConfigs=oConfigs||{};var dataType=oConfigs.dataType;if(dataType){if(dataType==DS.TYPE_LOCAL){lang.augmentObject(util.DataSource,util.LocalDataSource);return new util.LocalDataSource(oLiveData,oConfigs);}else{if(dataType==DS.TYPE_XHR){lang.augmentObject(util.DataSource,util.XHRDataSource);return new util.XHRDataSource(oLiveData,oConfigs);}else{if(dataType==DS.TYPE_SCRIPTNODE){lang.augmentObject(util.DataSource,util.ScriptNodeDataSource);return new util.ScriptNodeDataSource(oLiveData,oConfigs);}else{if(dataType==DS.TYPE_JSFUNCTION){lang.augmentObject(util.DataSource,util.FunctionDataSource);return new util.FunctionDataSource(oLiveData,oConfigs);}}}}}if(YAHOO.lang.isString(oLiveData)){lang.augmentObject(util.DataSource,util.XHRDataSource);return new util.XHRDataSource(oLiveData,oConfigs);}else{if(YAHOO.lang.isFunction(oLiveData)){lang.augmentObject(util.DataSource,util.FunctionDataSource);return new util.FunctionDataSource(oLiveData,oConfigs);}else{lang.augmentObject(util.DataSource,util.LocalDataSource);return new util.LocalDataSource(oLiveData,oConfigs);}}};lang.augmentObject(util.DataSource,DS);})();YAHOO.util.Number={format:function(C,G){var B=YAHOO.lang;if(!B.isValue(C)||(C==="")){return"";}G=G||{};if(!B.isNumber(C)){C*=1;}if(B.isNumber(C)){var E=(C<0);var K=C+"";var H=(G.decimalSeparator)?G.decimalSeparator:".";var I;if(B.isNumber(G.decimalPlaces)){var J=G.decimalPlaces;var D=Math.pow(10,J);K=Math.round(C*D)/D+"";I=K.lastIndexOf(".");if(J>0){if(I<0){K+=H;I=K.length-1;}else{if(H!=="."){K=K.replace(".",H);}}while((K.length-1-I)<J){K+="0";}}}if(G.thousandsSeparator){var M=G.thousandsSeparator;I=K.lastIndexOf(H);I=(I>-1)?I:K.length;var L=K.substring(I);var A=-1;for(var F=I;F>0;F--){A++;if((A%3===0)&&(F!==I)&&(!E||(F>1))){L=M+L;}L=K.charAt(F-1)+L;}K=L;}K=(G.prefix)?G.prefix+K:K;K=(G.suffix)?K+G.suffix:K;return K;}else{return C;}}};(function(){var A=function(C,E,D){if(typeof D==="undefined"){D=10;}for(;parseInt(C,10)<D&&D>1;D/=10){C=E.toString()+C;}return C.toString();};var B={formats:{a:function(D,C){return C.a[D.getDay()];},A:function(D,C){return C.A[D.getDay()];},b:function(D,C){return C.b[D.getMonth()];},B:function(D,C){return C.B[D.getMonth()];},C:function(C){return A(parseInt(C.getFullYear()/100,10),0);},d:["getDate","0"],e:["getDate"," "],g:function(C){return A(parseInt(B.formats.G(C)%100,10),0);},G:function(E){var F=E.getFullYear();var D=parseInt(B.formats.V(E),10);var C=parseInt(B.formats.W(E),10);if(C>D){F++;}else{if(C===0&&D>=52){F--;}}return F;},H:["getHours","0"],I:function(D){var C=D.getHours()%12;return A(C===0?12:C,0);},j:function(G){var F=new Date(""+G.getFullYear()+"/1/1 GMT");var D=new Date(""+G.getFullYear()+"/"+(G.getMonth()+1)+"/"+G.getDate()+" GMT");var C=D-F;var E=parseInt(C/60000/60/24,10)+1;return A(E,0,100);},k:["getHours"," "],l:function(D){var C=D.getHours()%12;return A(C===0?12:C," ");},m:function(C){return A(C.getMonth()+1,0);},M:["getMinutes","0"],p:function(D,C){return C.p[D.getHours()>=12?1:0];},P:function(D,C){return C.P[D.getHours()>=12?1:0];},s:function(D,C){return parseInt(D.getTime()/1000,10);},S:["getSeconds","0"],u:function(C){var D=C.getDay();return D===0?7:D;},U:function(F){var C=parseInt(B.formats.j(F),10);var E=6-F.getDay();var D=parseInt((C+E)/7,10);return A(D,0);},V:function(F){var E=parseInt(B.formats.W(F),10);var C=(new Date(""+F.getFullYear()+"/1/1")).getDay();var D=E+(C>4||C<=1?0:1);if(D===53&&(new Date(""+F.getFullYear()+"/12/31")).getDay()<4){D=1;}else{if(D===0){D=B.formats.V(new Date(""+(F.getFullYear()-1)+"/12/31"));}}return A(D,0);},w:"getDay",W:function(F){var C=parseInt(B.formats.j(F),10);var E=7-B.formats.u(F);var D=parseInt((C+E)/7,10);return A(D,0,10);},y:function(C){return A(C.getFullYear()%100,0);},Y:"getFullYear",z:function(E){var D=E.getTimezoneOffset();var C=A(parseInt(Math.abs(D/60),10),0);var F=A(Math.abs(D%60),0);return(D>0?"-":"+")+C+F;},Z:function(C){var D=C.toString().replace(/^.*:\d\d( GMT[+-]\d+)? \(?([A-Za-z ]+)\)?\d*$/,"$2").replace(/[a-z ]/g,"");if(D.length>4){D=B.formats.z(C);}return D;},"%":function(C){return"%";}},aggregates:{c:"locale",D:"%m/%d/%y",F:"%Y-%m-%d",h:"%b",n:"\n",r:"locale",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"},format:function(G,F,D){F=F||{};if(!(G instanceof Date)){return YAHOO.lang.isValue(G)?G:"";}var H=F.format||"%m/%d/%Y";if(H==="YYYY/MM/DD"){H="%Y/%m/%d";}else{if(H==="DD/MM/YYYY"){H="%d/%m/%Y";}else{if(H==="MM/DD/YYYY"){H="%m/%d/%Y";}}}D=D||"en";if(!(D in YAHOO.util.DateLocale)){if(D.replace(/-[a-zA-Z]+$/,"") in YAHOO.util.DateLocale){D=D.replace(/-[a-zA-Z]+$/,"");}else{D="en";}}var J=YAHOO.util.DateLocale[D];var C=function(L,K){var M=B.aggregates[K];return(M==="locale"?J[K]:M);};var E=function(L,K){var M=B.formats[K];if(typeof M==="string"){return G[M]();}else{if(typeof M==="function"){return M.call(G,G,J);}else{if(typeof M==="object"&&typeof M[0]==="string"){return A(G[M[0]](),M[1]);}else{return K;}}}};while(H.match(/%[cDFhnrRtTxX]/)){H=H.replace(/%([cDFhnrRtTxX])/g,C);}var I=H.replace(/%([aAbBCdegGHIjklmMpPsSuUVwWyYzZ%])/g,E);C=E=undefined;return I;}};YAHOO.namespace("YAHOO.util");YAHOO.util.Date=B;YAHOO.util.DateLocale={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %T %Z",p:["AM","PM"],P:["am","pm"],r:"%I:%M:%S %p",x:"%d/%m/%y",X:"%T"};
YAHOO.util.DateLocale["en"]=YAHOO.lang.merge(YAHOO.util.DateLocale,{});YAHOO.util.DateLocale["en-US"]=YAHOO.lang.merge(YAHOO.util.DateLocale["en"],{c:"%a %d %b %Y %I:%M:%S %p %Z",x:"%m/%d/%Y",X:"%I:%M:%S %p"});YAHOO.util.DateLocale["en-GB"]=YAHOO.lang.merge(YAHOO.util.DateLocale["en"],{r:"%l:%M:%S %P %Z"});YAHOO.util.DateLocale["en-AU"]=YAHOO.lang.merge(YAHOO.util.DateLocale["en"]);})();YAHOO.register("datasource",YAHOO.util.DataSource,{version:"2.7.0",build:"1799"});
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.7.0
*/
YAHOO.widget.DS_JSArray=YAHOO.util.LocalDataSource;YAHOO.widget.DS_JSFunction=YAHOO.util.FunctionDataSource;YAHOO.widget.DS_XHR=function(B,A,D){var C=new YAHOO.util.XHRDataSource(B,D);C._aDeprecatedSchema=A;return C;};YAHOO.widget.DS_ScriptNode=function(B,A,D){var C=new YAHOO.util.ScriptNodeDataSource(B,D);C._aDeprecatedSchema=A;return C;};YAHOO.widget.DS_XHR.TYPE_JSON=YAHOO.util.DataSourceBase.TYPE_JSON;YAHOO.widget.DS_XHR.TYPE_XML=YAHOO.util.DataSourceBase.TYPE_XML;YAHOO.widget.DS_XHR.TYPE_FLAT=YAHOO.util.DataSourceBase.TYPE_TEXT;YAHOO.widget.AutoComplete=function(G,B,J,C){if(G&&B&&J){if(J instanceof YAHOO.util.DataSourceBase){this.dataSource=J;}else{return;}this.key=0;var D=J.responseSchema;if(J._aDeprecatedSchema){var K=J._aDeprecatedSchema;if(YAHOO.lang.isArray(K)){if((J.responseType===YAHOO.util.DataSourceBase.TYPE_JSON)||(J.responseType===YAHOO.util.DataSourceBase.TYPE_UNKNOWN)){D.resultsList=K[0];this.key=K[1];D.fields=(K.length<3)?null:K.slice(1);}else{if(J.responseType===YAHOO.util.DataSourceBase.TYPE_XML){D.resultNode=K[0];this.key=K[1];D.fields=K.slice(1);}else{if(J.responseType===YAHOO.util.DataSourceBase.TYPE_TEXT){D.recordDelim=K[0];D.fieldDelim=K[1];}}}J.responseSchema=D;}}if(YAHOO.util.Dom.inDocument(G)){if(YAHOO.lang.isString(G)){this._sName="instance"+YAHOO.widget.AutoComplete._nIndex+" "+G;this._elTextbox=document.getElementById(G);}else{this._sName=(G.id)?"instance"+YAHOO.widget.AutoComplete._nIndex+" "+G.id:"instance"+YAHOO.widget.AutoComplete._nIndex;this._elTextbox=G;}YAHOO.util.Dom.addClass(this._elTextbox,"yui-ac-input");}else{return;}if(YAHOO.util.Dom.inDocument(B)){if(YAHOO.lang.isString(B)){this._elContainer=document.getElementById(B);}else{this._elContainer=B;}if(this._elContainer.style.display=="none"){}var E=this._elContainer.parentNode;var A=E.tagName.toLowerCase();if(A=="div"){YAHOO.util.Dom.addClass(E,"yui-ac");}else{}}else{return;}if(this.dataSource.dataType===YAHOO.util.DataSourceBase.TYPE_LOCAL){this.applyLocalFilter=true;}if(C&&(C.constructor==Object)){for(var I in C){if(I){this[I]=C[I];}}}this._initContainerEl();this._initProps();this._initListEl();this._initContainerHelperEls();var H=this;var F=this._elTextbox;YAHOO.util.Event.addListener(F,"keyup",H._onTextboxKeyUp,H);YAHOO.util.Event.addListener(F,"keydown",H._onTextboxKeyDown,H);YAHOO.util.Event.addListener(F,"focus",H._onTextboxFocus,H);YAHOO.util.Event.addListener(F,"blur",H._onTextboxBlur,H);YAHOO.util.Event.addListener(B,"mouseover",H._onContainerMouseover,H);YAHOO.util.Event.addListener(B,"mouseout",H._onContainerMouseout,H);YAHOO.util.Event.addListener(B,"click",H._onContainerClick,H);YAHOO.util.Event.addListener(B,"scroll",H._onContainerScroll,H);YAHOO.util.Event.addListener(B,"resize",H._onContainerResize,H);YAHOO.util.Event.addListener(F,"keypress",H._onTextboxKeyPress,H);YAHOO.util.Event.addListener(window,"unload",H._onWindowUnload,H);this.textboxFocusEvent=new YAHOO.util.CustomEvent("textboxFocus",this);this.textboxKeyEvent=new YAHOO.util.CustomEvent("textboxKey",this);this.dataRequestEvent=new YAHOO.util.CustomEvent("dataRequest",this);this.dataReturnEvent=new YAHOO.util.CustomEvent("dataReturn",this);this.dataErrorEvent=new YAHOO.util.CustomEvent("dataError",this);this.containerPopulateEvent=new YAHOO.util.CustomEvent("containerPopulate",this);this.containerExpandEvent=new YAHOO.util.CustomEvent("containerExpand",this);this.typeAheadEvent=new YAHOO.util.CustomEvent("typeAhead",this);this.itemMouseOverEvent=new YAHOO.util.CustomEvent("itemMouseOver",this);this.itemMouseOutEvent=new YAHOO.util.CustomEvent("itemMouseOut",this);this.itemArrowToEvent=new YAHOO.util.CustomEvent("itemArrowTo",this);this.itemArrowFromEvent=new YAHOO.util.CustomEvent("itemArrowFrom",this);this.itemSelectEvent=new YAHOO.util.CustomEvent("itemSelect",this);this.unmatchedItemSelectEvent=new YAHOO.util.CustomEvent("unmatchedItemSelect",this);this.selectionEnforceEvent=new YAHOO.util.CustomEvent("selectionEnforce",this);this.containerCollapseEvent=new YAHOO.util.CustomEvent("containerCollapse",this);this.textboxBlurEvent=new YAHOO.util.CustomEvent("textboxBlur",this);this.textboxChangeEvent=new YAHOO.util.CustomEvent("textboxChange",this);F.setAttribute("autocomplete","off");YAHOO.widget.AutoComplete._nIndex++;}else{}};YAHOO.widget.AutoComplete.prototype.dataSource=null;YAHOO.widget.AutoComplete.prototype.applyLocalFilter=null;YAHOO.widget.AutoComplete.prototype.queryMatchCase=false;YAHOO.widget.AutoComplete.prototype.queryMatchContains=false;YAHOO.widget.AutoComplete.prototype.queryMatchSubset=false;YAHOO.widget.AutoComplete.prototype.minQueryLength=1;YAHOO.widget.AutoComplete.prototype.maxResultsDisplayed=10;YAHOO.widget.AutoComplete.prototype.queryDelay=0.2;YAHOO.widget.AutoComplete.prototype.typeAheadDelay=0.5;YAHOO.widget.AutoComplete.prototype.queryInterval=500;YAHOO.widget.AutoComplete.prototype.highlightClassName="yui-ac-highlight";YAHOO.widget.AutoComplete.prototype.prehighlightClassName=null;YAHOO.widget.AutoComplete.prototype.delimChar=null;YAHOO.widget.AutoComplete.prototype.autoHighlight=true;YAHOO.widget.AutoComplete.prototype.typeAhead=false;YAHOO.widget.AutoComplete.prototype.animHoriz=false;YAHOO.widget.AutoComplete.prototype.animVert=true;YAHOO.widget.AutoComplete.prototype.animSpeed=0.3;YAHOO.widget.AutoComplete.prototype.forceSelection=false;YAHOO.widget.AutoComplete.prototype.allowBrowserAutocomplete=true;YAHOO.widget.AutoComplete.prototype.alwaysShowContainer=false;YAHOO.widget.AutoComplete.prototype.useIFrame=false;YAHOO.widget.AutoComplete.prototype.useShadow=false;YAHOO.widget.AutoComplete.prototype.suppressInputUpdate=false;YAHOO.widget.AutoComplete.prototype.resultTypeList=true;YAHOO.widget.AutoComplete.prototype.queryQuestionMark=true;YAHOO.widget.AutoComplete.prototype.toString=function(){return"AutoComplete "+this._sName;};YAHOO.widget.AutoComplete.prototype.getInputEl=function(){return this._elTextbox;};YAHOO.widget.AutoComplete.prototype.getContainerEl=function(){return this._elContainer;
};YAHOO.widget.AutoComplete.prototype.isFocused=function(){return(this._bFocused===null)?false:this._bFocused;};YAHOO.widget.AutoComplete.prototype.isContainerOpen=function(){return this._bContainerOpen;};YAHOO.widget.AutoComplete.prototype.getListEl=function(){return this._elList;};YAHOO.widget.AutoComplete.prototype.getListItemMatch=function(A){if(A._sResultMatch){return A._sResultMatch;}else{return null;}};YAHOO.widget.AutoComplete.prototype.getListItemData=function(A){if(A._oResultData){return A._oResultData;}else{return null;}};YAHOO.widget.AutoComplete.prototype.getListItemIndex=function(A){if(YAHOO.lang.isNumber(A._nItemIndex)){return A._nItemIndex;}else{return null;}};YAHOO.widget.AutoComplete.prototype.setHeader=function(B){if(this._elHeader){var A=this._elHeader;if(B){A.innerHTML=B;A.style.display="block";}else{A.innerHTML="";A.style.display="none";}}};YAHOO.widget.AutoComplete.prototype.setFooter=function(B){if(this._elFooter){var A=this._elFooter;if(B){A.innerHTML=B;A.style.display="block";}else{A.innerHTML="";A.style.display="none";}}};YAHOO.widget.AutoComplete.prototype.setBody=function(A){if(this._elBody){var B=this._elBody;YAHOO.util.Event.purgeElement(B,true);if(A){B.innerHTML=A;B.style.display="block";}else{B.innerHTML="";B.style.display="none";}this._elList=null;}};YAHOO.widget.AutoComplete.prototype.generateRequest=function(B){var A=this.dataSource.dataType;if(A===YAHOO.util.DataSourceBase.TYPE_XHR){if(!this.dataSource.connMethodPost){B=(this.queryQuestionMark?"?":"")+(this.dataSource.scriptQueryParam||"query")+"="+B+(this.dataSource.scriptQueryAppend?("&"+this.dataSource.scriptQueryAppend):"");}else{B=(this.dataSource.scriptQueryParam||"query")+"="+B+(this.dataSource.scriptQueryAppend?("&"+this.dataSource.scriptQueryAppend):"");}}else{if(A===YAHOO.util.DataSourceBase.TYPE_SCRIPTNODE){B="&"+(this.dataSource.scriptQueryParam||"query")+"="+B+(this.dataSource.scriptQueryAppend?("&"+this.dataSource.scriptQueryAppend):"");}}return B;};YAHOO.widget.AutoComplete.prototype.sendQuery=function(B){this._bFocused=null;var A=(this.delimChar)?this._elTextbox.value+B:B;this._sendQuery(A);};YAHOO.widget.AutoComplete.prototype.collapseContainer=function(){this._toggleContainer(false);};YAHOO.widget.AutoComplete.prototype.getSubsetMatches=function(E){var D,C,A;for(var B=E.length;B>=this.minQueryLength;B--){A=this.generateRequest(E.substr(0,B));this.dataRequestEvent.fire(this,D,A);C=this.dataSource.getCachedResponse(A);if(C){return this.filterResults.apply(this.dataSource,[E,C,C,{scope:this}]);}}return null;};YAHOO.widget.AutoComplete.prototype.preparseRawResponse=function(C,B,A){var D=((this.responseStripAfter!=="")&&(B.indexOf))?B.indexOf(this.responseStripAfter):-1;if(D!=-1){B=B.substring(0,D);}return B;};YAHOO.widget.AutoComplete.prototype.filterResults=function(J,L,P,K){if(K&&K.argument&&K.argument.query){J=K.argument.query;}if(J&&J!==""){P=YAHOO.widget.AutoComplete._cloneObject(P);var H=K.scope,O=this,B=P.results,M=[],D=false,I=(O.queryMatchCase||H.queryMatchCase),A=(O.queryMatchContains||H.queryMatchContains);for(var C=B.length-1;C>=0;C--){var F=B[C];var E=null;if(YAHOO.lang.isString(F)){E=F;}else{if(YAHOO.lang.isArray(F)){E=F[0];}else{if(this.responseSchema.fields){var N=this.responseSchema.fields[0].key||this.responseSchema.fields[0];E=F[N];}else{if(this.key){E=F[this.key];}}}}if(YAHOO.lang.isString(E)){var G=(I)?E.indexOf(decodeURIComponent(J)):E.toLowerCase().indexOf(decodeURIComponent(J).toLowerCase());if((!A&&(G===0))||(A&&(G>-1))){M.unshift(F);}}}P.results=M;}else{}return P;};YAHOO.widget.AutoComplete.prototype.handleResponse=function(C,A,B){if((this instanceof YAHOO.widget.AutoComplete)&&this._sName){this._populateList(C,A,B);}};YAHOO.widget.AutoComplete.prototype.doBeforeLoadData=function(C,A,B){return true;};YAHOO.widget.AutoComplete.prototype.formatResult=function(B,D,A){var C=(A)?A:"";return C;};YAHOO.widget.AutoComplete.prototype.doBeforeExpandContainer=function(D,A,C,B){return true;};YAHOO.widget.AutoComplete.prototype.destroy=function(){var B=this.toString();var A=this._elTextbox;var D=this._elContainer;this.textboxFocusEvent.unsubscribeAll();this.textboxKeyEvent.unsubscribeAll();this.dataRequestEvent.unsubscribeAll();this.dataReturnEvent.unsubscribeAll();this.dataErrorEvent.unsubscribeAll();this.containerPopulateEvent.unsubscribeAll();this.containerExpandEvent.unsubscribeAll();this.typeAheadEvent.unsubscribeAll();this.itemMouseOverEvent.unsubscribeAll();this.itemMouseOutEvent.unsubscribeAll();this.itemArrowToEvent.unsubscribeAll();this.itemArrowFromEvent.unsubscribeAll();this.itemSelectEvent.unsubscribeAll();this.unmatchedItemSelectEvent.unsubscribeAll();this.selectionEnforceEvent.unsubscribeAll();this.containerCollapseEvent.unsubscribeAll();this.textboxBlurEvent.unsubscribeAll();this.textboxChangeEvent.unsubscribeAll();YAHOO.util.Event.purgeElement(A,true);YAHOO.util.Event.purgeElement(D,true);D.innerHTML="";for(var C in this){if(YAHOO.lang.hasOwnProperty(this,C)){this[C]=null;}}};YAHOO.widget.AutoComplete.prototype.textboxFocusEvent=null;YAHOO.widget.AutoComplete.prototype.textboxKeyEvent=null;YAHOO.widget.AutoComplete.prototype.dataRequestEvent=null;YAHOO.widget.AutoComplete.prototype.dataReturnEvent=null;YAHOO.widget.AutoComplete.prototype.dataErrorEvent=null;YAHOO.widget.AutoComplete.prototype.containerPopulateEvent=null;YAHOO.widget.AutoComplete.prototype.containerExpandEvent=null;YAHOO.widget.AutoComplete.prototype.typeAheadEvent=null;YAHOO.widget.AutoComplete.prototype.itemMouseOverEvent=null;YAHOO.widget.AutoComplete.prototype.itemMouseOutEvent=null;YAHOO.widget.AutoComplete.prototype.itemArrowToEvent=null;YAHOO.widget.AutoComplete.prototype.itemArrowFromEvent=null;YAHOO.widget.AutoComplete.prototype.itemSelectEvent=null;YAHOO.widget.AutoComplete.prototype.unmatchedItemSelectEvent=null;YAHOO.widget.AutoComplete.prototype.selectionEnforceEvent=null;YAHOO.widget.AutoComplete.prototype.containerCollapseEvent=null;YAHOO.widget.AutoComplete.prototype.textboxBlurEvent=null;
YAHOO.widget.AutoComplete.prototype.textboxChangeEvent=null;YAHOO.widget.AutoComplete._nIndex=0;YAHOO.widget.AutoComplete.prototype._sName=null;YAHOO.widget.AutoComplete.prototype._elTextbox=null;YAHOO.widget.AutoComplete.prototype._elContainer=null;YAHOO.widget.AutoComplete.prototype._elContent=null;YAHOO.widget.AutoComplete.prototype._elHeader=null;YAHOO.widget.AutoComplete.prototype._elBody=null;YAHOO.widget.AutoComplete.prototype._elFooter=null;YAHOO.widget.AutoComplete.prototype._elShadow=null;YAHOO.widget.AutoComplete.prototype._elIFrame=null;YAHOO.widget.AutoComplete.prototype._bFocused=null;YAHOO.widget.AutoComplete.prototype._oAnim=null;YAHOO.widget.AutoComplete.prototype._bContainerOpen=false;YAHOO.widget.AutoComplete.prototype._bOverContainer=false;YAHOO.widget.AutoComplete.prototype._elList=null;YAHOO.widget.AutoComplete.prototype._nDisplayedItems=0;YAHOO.widget.AutoComplete.prototype._sCurQuery=null;YAHOO.widget.AutoComplete.prototype._sPastSelections="";YAHOO.widget.AutoComplete.prototype._sInitInputValue=null;YAHOO.widget.AutoComplete.prototype._elCurListItem=null;YAHOO.widget.AutoComplete.prototype._bItemSelected=false;YAHOO.widget.AutoComplete.prototype._nKeyCode=null;YAHOO.widget.AutoComplete.prototype._nDelayID=-1;YAHOO.widget.AutoComplete.prototype._nTypeAheadDelayID=-1;YAHOO.widget.AutoComplete.prototype._iFrameSrc="javascript:false;";YAHOO.widget.AutoComplete.prototype._queryInterval=null;YAHOO.widget.AutoComplete.prototype._sLastTextboxValue=null;YAHOO.widget.AutoComplete.prototype._initProps=function(){var B=this.minQueryLength;if(!YAHOO.lang.isNumber(B)){this.minQueryLength=1;}var E=this.maxResultsDisplayed;if(!YAHOO.lang.isNumber(E)||(E<1)){this.maxResultsDisplayed=10;}var F=this.queryDelay;if(!YAHOO.lang.isNumber(F)||(F<0)){this.queryDelay=0.2;}var C=this.typeAheadDelay;if(!YAHOO.lang.isNumber(C)||(C<0)){this.typeAheadDelay=0.2;}var A=this.delimChar;if(YAHOO.lang.isString(A)&&(A.length>0)){this.delimChar=[A];}else{if(!YAHOO.lang.isArray(A)){this.delimChar=null;}}var D=this.animSpeed;if((this.animHoriz||this.animVert)&&YAHOO.util.Anim){if(!YAHOO.lang.isNumber(D)||(D<0)){this.animSpeed=0.3;}if(!this._oAnim){this._oAnim=new YAHOO.util.Anim(this._elContent,{},this.animSpeed);}else{this._oAnim.duration=this.animSpeed;}}if(this.forceSelection&&A){}};YAHOO.widget.AutoComplete.prototype._initContainerHelperEls=function(){if(this.useShadow&&!this._elShadow){var A=document.createElement("div");A.className="yui-ac-shadow";A.style.width=0;A.style.height=0;this._elShadow=this._elContainer.appendChild(A);}if(this.useIFrame&&!this._elIFrame){var B=document.createElement("iframe");B.src=this._iFrameSrc;B.frameBorder=0;B.scrolling="no";B.style.position="absolute";B.style.width=0;B.style.height=0;B.tabIndex=-1;B.style.padding=0;this._elIFrame=this._elContainer.appendChild(B);}};YAHOO.widget.AutoComplete.prototype._initContainerEl=function(){YAHOO.util.Dom.addClass(this._elContainer,"yui-ac-container");if(!this._elContent){var C=document.createElement("div");C.className="yui-ac-content";C.style.display="none";this._elContent=this._elContainer.appendChild(C);var B=document.createElement("div");B.className="yui-ac-hd";B.style.display="none";this._elHeader=this._elContent.appendChild(B);var D=document.createElement("div");D.className="yui-ac-bd";this._elBody=this._elContent.appendChild(D);var A=document.createElement("div");A.className="yui-ac-ft";A.style.display="none";this._elFooter=this._elContent.appendChild(A);}else{}};YAHOO.widget.AutoComplete.prototype._initListEl=function(){var C=this.maxResultsDisplayed;var A=this._elList||document.createElement("ul");var B;while(A.childNodes.length<C){B=document.createElement("li");B.style.display="none";B._nItemIndex=A.childNodes.length;A.appendChild(B);}if(!this._elList){var D=this._elBody;YAHOO.util.Event.purgeElement(D,true);D.innerHTML="";this._elList=D.appendChild(A);}};YAHOO.widget.AutoComplete.prototype._focus=function(){var A=this;setTimeout(function(){try{A._elTextbox.focus();}catch(B){}},0);};YAHOO.widget.AutoComplete.prototype._enableIntervalDetection=function(){var A=this;if(!A._queryInterval&&A.queryInterval){A._queryInterval=setInterval(function(){A._onInterval();},A.queryInterval);}};YAHOO.widget.AutoComplete.prototype._onInterval=function(){var A=this._elTextbox.value;var B=this._sLastTextboxValue;if(A!=B){this._sLastTextboxValue=A;this._sendQuery(A);}};YAHOO.widget.AutoComplete.prototype._clearInterval=function(){if(this._queryInterval){clearInterval(this._queryInterval);this._queryInterval=null;}};YAHOO.widget.AutoComplete.prototype._isIgnoreKey=function(A){if((A==9)||(A==13)||(A==16)||(A==17)||(A>=18&&A<=20)||(A==27)||(A>=33&&A<=35)||(A>=36&&A<=40)||(A>=44&&A<=45)||(A==229)){return true;}return false;};YAHOO.widget.AutoComplete.prototype._sendQuery=function(D){if(this.minQueryLength<0){this._toggleContainer(false);return;}if(this.delimChar){var A=this._extractQuery(D);D=A.query;this._sPastSelections=A.previous;}if((D&&(D.length<this.minQueryLength))||(!D&&this.minQueryLength>0)){if(this._nDelayID!=-1){clearTimeout(this._nDelayID);}this._toggleContainer(false);return;}D=encodeURIComponent(D);this._nDelayID=-1;if(this.dataSource.queryMatchSubset||this.queryMatchSubset){var C=this.getSubsetMatches(D);if(C){this.handleResponse(D,C,{query:D});return;}}if(this.responseStripAfter){this.dataSource.doBeforeParseData=this.preparseRawResponse;}if(this.applyLocalFilter){this.dataSource.doBeforeCallback=this.filterResults;}var B=this.generateRequest(D);this.dataRequestEvent.fire(this,D,B);this.dataSource.sendRequest(B,{success:this.handleResponse,failure:this.handleResponse,scope:this,argument:{query:D}});};YAHOO.widget.AutoComplete.prototype._populateList=function(K,F,C){if(this._nTypeAheadDelayID!=-1){clearTimeout(this._nTypeAheadDelayID);}K=(C&&C.query)?C.query:K;var H=this.doBeforeLoadData(K,F,C);if(H&&!F.error){this.dataReturnEvent.fire(this,K,F.results);if(this._bFocused||(this._bFocused===null)){var M=decodeURIComponent(K);this._sCurQuery=M;
this._bItemSelected=false;var R=F.results,A=Math.min(R.length,this.maxResultsDisplayed),J=(this.dataSource.responseSchema.fields)?(this.dataSource.responseSchema.fields[0].key||this.dataSource.responseSchema.fields[0]):0;if(A>0){if(!this._elList||(this._elList.childNodes.length<A)){this._initListEl();}this._initContainerHelperEls();var I=this._elList.childNodes;for(var Q=A-1;Q>=0;Q--){var P=I[Q],E=R[Q];if(this.resultTypeList){var B=[];B[0]=(YAHOO.lang.isString(E))?E:E[J]||E[this.key];var L=this.dataSource.responseSchema.fields;if(YAHOO.lang.isArray(L)&&(L.length>1)){for(var N=1,S=L.length;N<S;N++){B[B.length]=E[L[N].key||L[N]];}}else{if(YAHOO.lang.isArray(E)){B=E;}else{if(YAHOO.lang.isString(E)){B=[E];}else{B[1]=E;}}}E=B;}P._sResultMatch=(YAHOO.lang.isString(E))?E:(YAHOO.lang.isArray(E))?E[0]:(E[J]||"");P._oResultData=E;P.innerHTML=this.formatResult(E,M,P._sResultMatch);P.style.display="";}if(A<I.length){var G;for(var O=I.length-1;O>=A;O--){G=I[O];G.style.display="none";}}this._nDisplayedItems=A;this.containerPopulateEvent.fire(this,K,R);if(this.autoHighlight){var D=this._elList.firstChild;this._toggleHighlight(D,"to");this.itemArrowToEvent.fire(this,D);this._typeAhead(D,K);}else{this._toggleHighlight(this._elCurListItem,"from");}H=this.doBeforeExpandContainer(this._elTextbox,this._elContainer,K,R);this._toggleContainer(H);}else{this._toggleContainer(false);}return;}}else{this.dataErrorEvent.fire(this,K);}};YAHOO.widget.AutoComplete.prototype._clearSelection=function(){var A=(this.delimChar)?this._extractQuery(this._elTextbox.value):{previous:"",query:this._elTextbox.value};this._elTextbox.value=A.previous;this.selectionEnforceEvent.fire(this,A.query);};YAHOO.widget.AutoComplete.prototype._textMatchesOption=function(){var A=null;for(var B=0;B<this._nDisplayedItems;B++){var C=this._elList.childNodes[B];var D=(""+C._sResultMatch).toLowerCase();if(D==this._sCurQuery.toLowerCase()){A=C;break;}}return(A);};YAHOO.widget.AutoComplete.prototype._typeAhead=function(B,D){if(!this.typeAhead||(this._nKeyCode==8)){return;}var A=this,C=this._elTextbox;if(C.setSelectionRange||C.createTextRange){this._nTypeAheadDelayID=setTimeout(function(){var F=C.value.length;A._updateValue(B);var G=C.value.length;A._selectText(C,F,G);var E=C.value.substr(F,G);A.typeAheadEvent.fire(A,D,E);},(this.typeAheadDelay*1000));}};YAHOO.widget.AutoComplete.prototype._selectText=function(D,A,B){if(D.setSelectionRange){D.setSelectionRange(A,B);}else{if(D.createTextRange){var C=D.createTextRange();C.moveStart("character",A);C.moveEnd("character",B-D.value.length);C.select();}else{D.select();}}};YAHOO.widget.AutoComplete.prototype._extractQuery=function(H){var C=this.delimChar,F=-1,G,E,B=C.length-1,D;for(;B>=0;B--){G=H.lastIndexOf(C[B]);if(G>F){F=G;}}if(C[B]==" "){for(var A=C.length-1;A>=0;A--){if(H[F-1]==C[A]){F--;break;}}}if(F>-1){E=F+1;while(H.charAt(E)==" "){E+=1;}D=H.substring(0,E);H=H.substr(E);}else{D="";}return{previous:D,query:H};};YAHOO.widget.AutoComplete.prototype._toggleContainerHelpers=function(D){var E=this._elContent.offsetWidth+"px";var B=this._elContent.offsetHeight+"px";if(this.useIFrame&&this._elIFrame){var C=this._elIFrame;if(D){C.style.width=E;C.style.height=B;C.style.padding="";}else{C.style.width=0;C.style.height=0;C.style.padding=0;}}if(this.useShadow&&this._elShadow){var A=this._elShadow;if(D){A.style.width=E;A.style.height=B;}else{A.style.width=0;A.style.height=0;}}};YAHOO.widget.AutoComplete.prototype._toggleContainer=function(I){var D=this._elContainer;if(this.alwaysShowContainer&&this._bContainerOpen){return;}if(!I){this._toggleHighlight(this._elCurListItem,"from");this._nDisplayedItems=0;this._sCurQuery=null;if(this._elContent.style.display=="none"){return;}}var A=this._oAnim;if(A&&A.getEl()&&(this.animHoriz||this.animVert)){if(A.isAnimated()){A.stop(true);}var G=this._elContent.cloneNode(true);D.appendChild(G);G.style.top="-9000px";G.style.width="";G.style.height="";G.style.display="";var F=G.offsetWidth;var C=G.offsetHeight;var B=(this.animHoriz)?0:F;var E=(this.animVert)?0:C;A.attributes=(I)?{width:{to:F},height:{to:C}}:{width:{to:B},height:{to:E}};if(I&&!this._bContainerOpen){this._elContent.style.width=B+"px";this._elContent.style.height=E+"px";}else{this._elContent.style.width=F+"px";this._elContent.style.height=C+"px";}D.removeChild(G);G=null;var H=this;var J=function(){A.onComplete.unsubscribeAll();if(I){H._toggleContainerHelpers(true);H._bContainerOpen=I;H.containerExpandEvent.fire(H);}else{H._elContent.style.display="none";H._bContainerOpen=I;H.containerCollapseEvent.fire(H);}};this._toggleContainerHelpers(false);this._elContent.style.display="";A.onComplete.subscribe(J);A.animate();}else{if(I){this._elContent.style.display="";this._toggleContainerHelpers(true);this._bContainerOpen=I;this.containerExpandEvent.fire(this);}else{this._toggleContainerHelpers(false);this._elContent.style.display="none";this._bContainerOpen=I;this.containerCollapseEvent.fire(this);}}};YAHOO.widget.AutoComplete.prototype._toggleHighlight=function(A,C){if(A){var B=this.highlightClassName;if(this._elCurListItem){YAHOO.util.Dom.removeClass(this._elCurListItem,B);this._elCurListItem=null;}if((C=="to")&&B){YAHOO.util.Dom.addClass(A,B);this._elCurListItem=A;}}};YAHOO.widget.AutoComplete.prototype._togglePrehighlight=function(B,C){if(B==this._elCurListItem){return;}var A=this.prehighlightClassName;if((C=="mouseover")&&A){YAHOO.util.Dom.addClass(B,A);}else{YAHOO.util.Dom.removeClass(B,A);}};YAHOO.widget.AutoComplete.prototype._updateValue=function(C){if(!this.suppressInputUpdate){var F=this._elTextbox;var E=(this.delimChar)?(this.delimChar[0]||this.delimChar):null;var B=C._sResultMatch;var D="";if(E){D=this._sPastSelections;D+=B+E;if(E!=" "){D+=" ";}}else{D=B;}F.value=D;if(F.type=="textarea"){F.scrollTop=F.scrollHeight;}var A=F.value.length;this._selectText(F,A,A);this._elCurListItem=C;}};YAHOO.widget.AutoComplete.prototype._selectItem=function(A){this._bItemSelected=true;this._updateValue(A);this._sPastSelections=this._elTextbox.value;
this._clearInterval();this.itemSelectEvent.fire(this,A,A._oResultData);this._toggleContainer(false);};YAHOO.widget.AutoComplete.prototype._jumpSelection=function(){if(this._elCurListItem){this._selectItem(this._elCurListItem);}else{this._toggleContainer(false);}};YAHOO.widget.AutoComplete.prototype._moveSelection=function(G){if(this._bContainerOpen){var H=this._elCurListItem,D=-1;if(H){D=H._nItemIndex;}var E=(G==40)?(D+1):(D-1);if(E<-2||E>=this._nDisplayedItems){return;}if(H){this._toggleHighlight(H,"from");this.itemArrowFromEvent.fire(this,H);}if(E==-1){if(this.delimChar){this._elTextbox.value=this._sPastSelections+this._sCurQuery;}else{this._elTextbox.value=this._sCurQuery;}return;}if(E==-2){this._toggleContainer(false);return;}var F=this._elList.childNodes[E],B=this._elContent,C=YAHOO.util.Dom.getStyle(B,"overflow"),I=YAHOO.util.Dom.getStyle(B,"overflowY"),A=((C=="auto")||(C=="scroll")||(I=="auto")||(I=="scroll"));if(A&&(E>-1)&&(E<this._nDisplayedItems)){if(G==40){if((F.offsetTop+F.offsetHeight)>(B.scrollTop+B.offsetHeight)){B.scrollTop=(F.offsetTop+F.offsetHeight)-B.offsetHeight;}else{if((F.offsetTop+F.offsetHeight)<B.scrollTop){B.scrollTop=F.offsetTop;}}}else{if(F.offsetTop<B.scrollTop){this._elContent.scrollTop=F.offsetTop;}else{if(F.offsetTop>(B.scrollTop+B.offsetHeight)){this._elContent.scrollTop=(F.offsetTop+F.offsetHeight)-B.offsetHeight;}}}}this._toggleHighlight(F,"to");this.itemArrowToEvent.fire(this,F);if(this.typeAhead){this._updateValue(F);}}};YAHOO.widget.AutoComplete.prototype._onContainerMouseover=function(A,C){var D=YAHOO.util.Event.getTarget(A);var B=D.nodeName.toLowerCase();while(D&&(B!="table")){switch(B){case"body":return;case"li":if(C.prehighlightClassName){C._togglePrehighlight(D,"mouseover");}else{C._toggleHighlight(D,"to");}C.itemMouseOverEvent.fire(C,D);break;case"div":if(YAHOO.util.Dom.hasClass(D,"yui-ac-container")){C._bOverContainer=true;return;}break;default:break;}D=D.parentNode;if(D){B=D.nodeName.toLowerCase();}}};YAHOO.widget.AutoComplete.prototype._onContainerMouseout=function(A,C){var D=YAHOO.util.Event.getTarget(A);var B=D.nodeName.toLowerCase();while(D&&(B!="table")){switch(B){case"body":return;case"li":if(C.prehighlightClassName){C._togglePrehighlight(D,"mouseout");}else{C._toggleHighlight(D,"from");}C.itemMouseOutEvent.fire(C,D);break;case"ul":C._toggleHighlight(C._elCurListItem,"to");break;case"div":if(YAHOO.util.Dom.hasClass(D,"yui-ac-container")){C._bOverContainer=false;return;}break;default:break;}D=D.parentNode;if(D){B=D.nodeName.toLowerCase();}}};YAHOO.widget.AutoComplete.prototype._onContainerClick=function(A,C){var D=YAHOO.util.Event.getTarget(A);var B=D.nodeName.toLowerCase();while(D&&(B!="table")){switch(B){case"body":return;case"li":C._toggleHighlight(D,"to");C._selectItem(D);return;default:break;}D=D.parentNode;if(D){B=D.nodeName.toLowerCase();}}};YAHOO.widget.AutoComplete.prototype._onContainerScroll=function(A,B){B._focus();};YAHOO.widget.AutoComplete.prototype._onContainerResize=function(A,B){B._toggleContainerHelpers(B._bContainerOpen);};YAHOO.widget.AutoComplete.prototype._onTextboxKeyDown=function(A,B){var C=A.keyCode;if(B._nTypeAheadDelayID!=-1){clearTimeout(B._nTypeAheadDelayID);}switch(C){case 9:if(!YAHOO.env.ua.opera&&(navigator.userAgent.toLowerCase().indexOf("mac")==-1)||(YAHOO.env.ua.webkit>420)){if(B._elCurListItem){if(B.delimChar&&(B._nKeyCode!=C)){if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);}}B._selectItem(B._elCurListItem);}else{B._toggleContainer(false);}}break;case 13:if(!YAHOO.env.ua.opera&&(navigator.userAgent.toLowerCase().indexOf("mac")==-1)||(YAHOO.env.ua.webkit>420)){if(B._elCurListItem){if(B._nKeyCode!=C){if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);}}B._selectItem(B._elCurListItem);}else{B._toggleContainer(false);}}break;case 27:B._toggleContainer(false);return;case 39:B._jumpSelection();break;case 38:if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);B._moveSelection(C);}break;case 40:if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);B._moveSelection(C);}break;default:B._bItemSelected=false;B._toggleHighlight(B._elCurListItem,"from");B.textboxKeyEvent.fire(B,C);break;}if(C===18){B._enableIntervalDetection();}B._nKeyCode=C;};YAHOO.widget.AutoComplete.prototype._onTextboxKeyPress=function(A,B){var C=A.keyCode;if(YAHOO.env.ua.opera||(navigator.userAgent.toLowerCase().indexOf("mac")!=-1)&&(YAHOO.env.ua.webkit<420)){switch(C){case 9:if(B._bContainerOpen){if(B.delimChar){YAHOO.util.Event.stopEvent(A);}if(B._elCurListItem){B._selectItem(B._elCurListItem);}else{B._toggleContainer(false);}}break;case 13:if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);if(B._elCurListItem){B._selectItem(B._elCurListItem);}else{B._toggleContainer(false);}}break;default:break;}}else{if(C==229){B._enableIntervalDetection();}}};YAHOO.widget.AutoComplete.prototype._onTextboxKeyUp=function(A,C){var B=this.value;C._initProps();var D=A.keyCode;if(C._isIgnoreKey(D)){return;}if(C._nDelayID!=-1){clearTimeout(C._nDelayID);}C._nDelayID=setTimeout(function(){C._sendQuery(B);},(C.queryDelay*1000));};YAHOO.widget.AutoComplete.prototype._onTextboxFocus=function(A,B){if(!B._bFocused){B._elTextbox.setAttribute("autocomplete","off");B._bFocused=true;B._sInitInputValue=B._elTextbox.value;B.textboxFocusEvent.fire(B);}};YAHOO.widget.AutoComplete.prototype._onTextboxBlur=function(A,C){if(!C._bOverContainer||(C._nKeyCode==9)){if(!C._bItemSelected){var B=C._textMatchesOption();if(!C._bContainerOpen||(C._bContainerOpen&&(B===null))){if(C.forceSelection){C._clearSelection();}else{C.unmatchedItemSelectEvent.fire(C,C._sCurQuery);}}else{if(C.forceSelection){C._selectItem(B);}}}C._clearInterval();C._bFocused=false;if(C._sInitInputValue!==C._elTextbox.value){C.textboxChangeEvent.fire(C);}C.textboxBlurEvent.fire(C);C._toggleContainer(false);}else{C._focus();}};YAHOO.widget.AutoComplete.prototype._onWindowUnload=function(A,B){if(B&&B._elTextbox&&B.allowBrowserAutocomplete){B._elTextbox.setAttribute("autocomplete","on");}};YAHOO.widget.AutoComplete.prototype.doBeforeSendQuery=function(A){return this.generateRequest(A);
};YAHOO.widget.AutoComplete.prototype.getListItems=function(){var C=[],B=this._elList.childNodes;for(var A=B.length-1;A>=0;A--){C[A]=B[A];}return C;};YAHOO.widget.AutoComplete._cloneObject=function(D){if(!YAHOO.lang.isValue(D)){return D;}var F={};if(YAHOO.lang.isFunction(D)){F=D;}else{if(YAHOO.lang.isArray(D)){var E=[];for(var C=0,B=D.length;C<B;C++){E[C]=YAHOO.widget.AutoComplete._cloneObject(D[C]);}F=E;}else{if(YAHOO.lang.isObject(D)){for(var A in D){if(YAHOO.lang.hasOwnProperty(D,A)){if(YAHOO.lang.isValue(D[A])&&YAHOO.lang.isObject(D[A])||YAHOO.lang.isArray(D[A])){F[A]=YAHOO.widget.AutoComplete._cloneObject(D[A]);}else{F[A]=D[A];}}}}else{F=D;}}}return F;};YAHOO.register("autocomplete",YAHOO.widget.AutoComplete,{version:"2.7.0",build:"1799"});
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.7.0
*/
YAHOO.util.Connect={_msxml_progid:["Microsoft.XMLHTTP","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP"],_http_headers:{},_has_http_headers:false,_use_default_post_header:true,_default_post_header:"application/x-www-form-urlencoded; charset=UTF-8",_default_form_header:"application/x-www-form-urlencoded",_use_default_xhr_header:true,_default_xhr_header:"XMLHttpRequest",_has_default_headers:true,_default_headers:{},_isFormSubmit:false,_isFileUpload:false,_formNode:null,_sFormData:null,_poll:{},_timeOut:{},_polling_interval:50,_transaction_id:0,_submitElementValue:null,_hasSubmitListener:(function(){if(YAHOO.util.Event){YAHOO.util.Event.addListener(document,"click",function(C){var B=YAHOO.util.Event.getTarget(C),A=B.nodeName.toLowerCase();if((A==="input"||A==="button")&&(B.type&&B.type.toLowerCase()=="submit")){YAHOO.util.Connect._submitElementValue=encodeURIComponent(B.name)+"="+encodeURIComponent(B.value);}});return true;}return false;})(),startEvent:new YAHOO.util.CustomEvent("start"),completeEvent:new YAHOO.util.CustomEvent("complete"),successEvent:new YAHOO.util.CustomEvent("success"),failureEvent:new YAHOO.util.CustomEvent("failure"),uploadEvent:new YAHOO.util.CustomEvent("upload"),abortEvent:new YAHOO.util.CustomEvent("abort"),_customEvents:{onStart:["startEvent","start"],onComplete:["completeEvent","complete"],onSuccess:["successEvent","success"],onFailure:["failureEvent","failure"],onUpload:["uploadEvent","upload"],onAbort:["abortEvent","abort"]},setProgId:function(A){this._msxml_progid.unshift(A);},setDefaultPostHeader:function(A){if(typeof A=="string"){this._default_post_header=A;}else{if(typeof A=="boolean"){this._use_default_post_header=A;}}},setDefaultXhrHeader:function(A){if(typeof A=="string"){this._default_xhr_header=A;}else{this._use_default_xhr_header=A;}},setPollingInterval:function(A){if(typeof A=="number"&&isFinite(A)){this._polling_interval=A;}},createXhrObject:function(F){var E,A;try{A=new XMLHttpRequest();E={conn:A,tId:F};}catch(D){for(var B=0;B<this._msxml_progid.length;++B){try{A=new ActiveXObject(this._msxml_progid[B]);E={conn:A,tId:F};break;}catch(C){}}}finally{return E;}},getConnectionObject:function(A){var C;var D=this._transaction_id;try{if(!A){C=this.createXhrObject(D);}else{C={};C.tId=D;C.isUpload=true;}if(C){this._transaction_id++;}}catch(B){}finally{return C;}},asyncRequest:function(F,C,E,A){var D=(this._isFileUpload)?this.getConnectionObject(true):this.getConnectionObject();var B=(E&&E.argument)?E.argument:null;if(!D){return null;}else{if(E&&E.customevents){this.initCustomEvents(D,E);}if(this._isFormSubmit){if(this._isFileUpload){this.uploadFile(D,E,C,A);return D;}if(F.toUpperCase()=="GET"){if(this._sFormData.length!==0){C+=((C.indexOf("?")==-1)?"?":"&")+this._sFormData;}}else{if(F.toUpperCase()=="POST"){A=A?this._sFormData+"&"+A:this._sFormData;}}}if(F.toUpperCase()=="GET"&&(E&&E.cache===false)){C+=((C.indexOf("?")==-1)?"?":"&")+"rnd="+new Date().valueOf().toString();}D.conn.open(F,C,true);if(this._use_default_xhr_header){if(!this._default_headers["X-Requested-With"]){this.initHeader("X-Requested-With",this._default_xhr_header,true);}}if((F.toUpperCase()==="POST"&&this._use_default_post_header)&&this._isFormSubmit===false){this.initHeader("Content-Type",this._default_post_header);}if(this._has_default_headers||this._has_http_headers){this.setHeader(D);}this.handleReadyState(D,E);D.conn.send(A||"");if(this._isFormSubmit===true){this.resetFormState();}this.startEvent.fire(D,B);if(D.startEvent){D.startEvent.fire(D,B);}return D;}},initCustomEvents:function(A,C){var B;for(B in C.customevents){if(this._customEvents[B][0]){A[this._customEvents[B][0]]=new YAHOO.util.CustomEvent(this._customEvents[B][1],(C.scope)?C.scope:null);A[this._customEvents[B][0]].subscribe(C.customevents[B]);}}},handleReadyState:function(C,D){var B=this;var A=(D&&D.argument)?D.argument:null;if(D&&D.timeout){this._timeOut[C.tId]=window.setTimeout(function(){B.abort(C,D,true);},D.timeout);}this._poll[C.tId]=window.setInterval(function(){if(C.conn&&C.conn.readyState===4){window.clearInterval(B._poll[C.tId]);delete B._poll[C.tId];if(D&&D.timeout){window.clearTimeout(B._timeOut[C.tId]);delete B._timeOut[C.tId];}B.completeEvent.fire(C,A);if(C.completeEvent){C.completeEvent.fire(C,A);}B.handleTransactionResponse(C,D);}},this._polling_interval);},handleTransactionResponse:function(F,G,A){var D,C;var B=(G&&G.argument)?G.argument:null;try{if(F.conn.status!==undefined&&F.conn.status!==0){D=F.conn.status;}else{D=13030;}}catch(E){D=13030;}if(D>=200&&D<300||D===1223){C=this.createResponseObject(F,B);if(G&&G.success){if(!G.scope){G.success(C);}else{G.success.apply(G.scope,[C]);}}this.successEvent.fire(C);if(F.successEvent){F.successEvent.fire(C);}}else{switch(D){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:C=this.createExceptionObject(F.tId,B,(A?A:false));if(G&&G.failure){if(!G.scope){G.failure(C);}else{G.failure.apply(G.scope,[C]);}}break;default:C=this.createResponseObject(F,B);if(G&&G.failure){if(!G.scope){G.failure(C);}else{G.failure.apply(G.scope,[C]);}}}this.failureEvent.fire(C);if(F.failureEvent){F.failureEvent.fire(C);}}this.releaseObject(F);C=null;},createResponseObject:function(A,G){var D={};var I={};try{var C=A.conn.getAllResponseHeaders();var F=C.split("\n");for(var E=0;E<F.length;E++){var B=F[E].indexOf(":");if(B!=-1){I[F[E].substring(0,B)]=F[E].substring(B+2);}}}catch(H){}D.tId=A.tId;D.status=(A.conn.status==1223)?204:A.conn.status;D.statusText=(A.conn.status==1223)?"No Content":A.conn.statusText;D.getResponseHeader=I;D.getAllResponseHeaders=C;D.responseText=A.conn.responseText;D.responseXML=A.conn.responseXML;if(G){D.argument=G;}return D;},createExceptionObject:function(H,D,A){var F=0;var G="communication failure";var C=-1;var B="transaction aborted";var E={};E.tId=H;if(A){E.status=C;E.statusText=B;}else{E.status=F;E.statusText=G;}if(D){E.argument=D;}return E;},initHeader:function(A,D,C){var B=(C)?this._default_headers:this._http_headers;B[A]=D;if(C){this._has_default_headers=true;
}else{this._has_http_headers=true;}},setHeader:function(A){var B;if(this._has_default_headers){for(B in this._default_headers){if(YAHOO.lang.hasOwnProperty(this._default_headers,B)){A.conn.setRequestHeader(B,this._default_headers[B]);}}}if(this._has_http_headers){for(B in this._http_headers){if(YAHOO.lang.hasOwnProperty(this._http_headers,B)){A.conn.setRequestHeader(B,this._http_headers[B]);}}delete this._http_headers;this._http_headers={};this._has_http_headers=false;}},resetDefaultHeaders:function(){delete this._default_headers;this._default_headers={};this._has_default_headers=false;},setForm:function(M,H,C){var L,B,K,I,P,J=false,F=[],O=0,E,G,D,N,A;this.resetFormState();if(typeof M=="string"){L=(document.getElementById(M)||document.forms[M]);}else{if(typeof M=="object"){L=M;}else{return;}}if(H){this.createFrame(C?C:null);this._isFormSubmit=true;this._isFileUpload=true;this._formNode=L;return;}for(E=0,G=L.elements.length;E<G;++E){B=L.elements[E];P=B.disabled;K=B.name;if(!P&&K){K=encodeURIComponent(K)+"=";I=encodeURIComponent(B.value);switch(B.type){case"select-one":if(B.selectedIndex>-1){A=B.options[B.selectedIndex];F[O++]=K+encodeURIComponent((A.attributes.value&&A.attributes.value.specified)?A.value:A.text);}break;case"select-multiple":if(B.selectedIndex>-1){for(D=B.selectedIndex,N=B.options.length;D<N;++D){A=B.options[D];if(A.selected){F[O++]=K+encodeURIComponent((A.attributes.value&&A.attributes.value.specified)?A.value:A.text);}}}break;case"radio":case"checkbox":if(B.checked){F[O++]=K+I;}break;case"file":case undefined:case"reset":case"button":break;case"submit":if(J===false){if(this._hasSubmitListener&&this._submitElementValue){F[O++]=this._submitElementValue;}J=true;}break;default:F[O++]=K+I;}}}this._isFormSubmit=true;this._sFormData=F.join("&");this.initHeader("Content-Type",this._default_form_header);return this._sFormData;},resetFormState:function(){this._isFormSubmit=false;this._isFileUpload=false;this._formNode=null;this._sFormData="";},createFrame:function(A){var B="yuiIO"+this._transaction_id;var C;if(YAHOO.env.ua.ie){C=document.createElement('<iframe id="'+B+'" name="'+B+'" />');if(typeof A=="boolean"){C.src="javascript:false";}}else{C=document.createElement("iframe");C.id=B;C.name=B;}C.style.position="absolute";C.style.top="-1000px";C.style.left="-1000px";document.body.appendChild(C);},appendPostData:function(A){var D=[],B=A.split("&"),C,E;for(C=0;C<B.length;C++){E=B[C].indexOf("=");if(E!=-1){D[C]=document.createElement("input");D[C].type="hidden";D[C].name=decodeURIComponent(B[C].substring(0,E));D[C].value=decodeURIComponent(B[C].substring(E+1));this._formNode.appendChild(D[C]);}}return D;},uploadFile:function(D,N,E,C){var I="yuiIO"+D.tId,J="multipart/form-data",L=document.getElementById(I),O=this,K=(N&&N.argument)?N.argument:null,M,H,B,G;var A={action:this._formNode.getAttribute("action"),method:this._formNode.getAttribute("method"),target:this._formNode.getAttribute("target")};this._formNode.setAttribute("action",E);this._formNode.setAttribute("method","POST");this._formNode.setAttribute("target",I);if(YAHOO.env.ua.ie){this._formNode.setAttribute("encoding",J);}else{this._formNode.setAttribute("enctype",J);}if(C){M=this.appendPostData(C);}this._formNode.submit();this.startEvent.fire(D,K);if(D.startEvent){D.startEvent.fire(D,K);}if(N&&N.timeout){this._timeOut[D.tId]=window.setTimeout(function(){O.abort(D,N,true);},N.timeout);}if(M&&M.length>0){for(H=0;H<M.length;H++){this._formNode.removeChild(M[H]);}}for(B in A){if(YAHOO.lang.hasOwnProperty(A,B)){if(A[B]){this._formNode.setAttribute(B,A[B]);}else{this._formNode.removeAttribute(B);}}}this.resetFormState();var F=function(){if(N&&N.timeout){window.clearTimeout(O._timeOut[D.tId]);delete O._timeOut[D.tId];}O.completeEvent.fire(D,K);if(D.completeEvent){D.completeEvent.fire(D,K);}G={tId:D.tId,argument:N.argument};try{G.responseText=L.contentWindow.document.body?L.contentWindow.document.body.innerHTML:L.contentWindow.document.documentElement.textContent;G.responseXML=L.contentWindow.document.XMLDocument?L.contentWindow.document.XMLDocument:L.contentWindow.document;}catch(P){}if(N&&N.upload){if(!N.scope){N.upload(G);}else{N.upload.apply(N.scope,[G]);}}O.uploadEvent.fire(G);if(D.uploadEvent){D.uploadEvent.fire(G);}YAHOO.util.Event.removeListener(L,"load",F);setTimeout(function(){document.body.removeChild(L);O.releaseObject(D);},100);};YAHOO.util.Event.addListener(L,"load",F);},abort:function(E,G,A){var D;var B=(G&&G.argument)?G.argument:null;if(E&&E.conn){if(this.isCallInProgress(E)){E.conn.abort();window.clearInterval(this._poll[E.tId]);delete this._poll[E.tId];if(A){window.clearTimeout(this._timeOut[E.tId]);delete this._timeOut[E.tId];}D=true;}}else{if(E&&E.isUpload===true){var C="yuiIO"+E.tId;var F=document.getElementById(C);if(F){YAHOO.util.Event.removeListener(F,"load");document.body.removeChild(F);if(A){window.clearTimeout(this._timeOut[E.tId]);delete this._timeOut[E.tId];}D=true;}}else{D=false;}}if(D===true){this.abortEvent.fire(E,B);if(E.abortEvent){E.abortEvent.fire(E,B);}this.handleTransactionResponse(E,G,true);}return D;},isCallInProgress:function(B){if(B&&B.conn){return B.conn.readyState!==4&&B.conn.readyState!==0;}else{if(B&&B.isUpload===true){var A="yuiIO"+B.tId;return document.getElementById(A)?true:false;}else{return false;}}},releaseObject:function(A){if(A&&A.conn){A.conn=null;A=null;}}};YAHOO.register("connection",YAHOO.util.Connect,{version:"2.7.0",build:"1799"});
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.7.0
*/
YAHOO.namespace("util");YAHOO.util.Cookie={_createCookieString:function(B,D,C,A){var F=YAHOO.lang;var E=encodeURIComponent(B)+"="+(C?encodeURIComponent(D):D);if(F.isObject(A)){if(A.expires instanceof Date){E+="; expires="+A.expires.toGMTString();}if(F.isString(A.path)&&A.path!=""){E+="; path="+A.path;}if(F.isString(A.domain)&&A.domain!=""){E+="; domain="+A.domain;}if(A.secure===true){E+="; secure";}}return E;},_createCookieHashString:function(B){var D=YAHOO.lang;if(!D.isObject(B)){throw new TypeError("Cookie._createCookieHashString(): Argument must be an object.");}var C=new Array();for(var A in B){if(D.hasOwnProperty(B,A)&&!D.isFunction(B[A])&&!D.isUndefined(B[A])){C.push(encodeURIComponent(A)+"="+encodeURIComponent(String(B[A])));}}return C.join("&");},_parseCookieHash:function(E){var D=E.split("&"),F=null,C=new Object();if(E.length>0){for(var B=0,A=D.length;B<A;B++){F=D[B].split("=");C[decodeURIComponent(F[0])]=decodeURIComponent(F[1]);}}return C;},_parseCookieString:function(J,A){var K=new Object();if(YAHOO.lang.isString(J)&&J.length>0){var B=(A===false?function(L){return L;}:decodeURIComponent);if(/[^=]+=[^=;]?(?:; [^=]+=[^=]?)?/.test(J)){var H=J.split(/;\s/g),I=null,C=null,E=null;for(var D=0,F=H.length;D<F;D++){E=H[D].match(/([^=]+)=/i);if(E instanceof Array){try{I=decodeURIComponent(E[1]);C=B(H[D].substring(E[1].length+1));}catch(G){}}else{I=decodeURIComponent(H[D]);C=I;}K[I]=C;}}}return K;},get:function(A,B){var D=YAHOO.lang;var C=this._parseCookieString(document.cookie);if(!D.isString(A)||A===""){throw new TypeError("Cookie.get(): Cookie name must be a non-empty string.");}if(D.isUndefined(C[A])){return null;}if(!D.isFunction(B)){return C[A];}else{return B(C[A]);}},getSub:function(A,C,B){var E=YAHOO.lang;var D=this.getSubs(A);if(D!==null){if(!E.isString(C)||C===""){throw new TypeError("Cookie.getSub(): Subcookie name must be a non-empty string.");}if(E.isUndefined(D[C])){return null;}if(!E.isFunction(B)){return D[C];}else{return B(D[C]);}}else{return null;}},getSubs:function(A){if(!YAHOO.lang.isString(A)||A===""){throw new TypeError("Cookie.getSubs(): Cookie name must be a non-empty string.");}var B=this._parseCookieString(document.cookie,false);if(YAHOO.lang.isString(B[A])){return this._parseCookieHash(B[A]);}return null;},remove:function(B,A){if(!YAHOO.lang.isString(B)||B===""){throw new TypeError("Cookie.remove(): Cookie name must be a non-empty string.");}A=A||{};A.expires=new Date(0);return this.set(B,"",A);},removeSub:function(B,D,A){if(!YAHOO.lang.isString(B)||B===""){throw new TypeError("Cookie.removeSub(): Cookie name must be a non-empty string.");}if(!YAHOO.lang.isString(D)||D===""){throw new TypeError("Cookie.removeSub(): Subcookie name must be a non-empty string.");}var C=this.getSubs(B);if(YAHOO.lang.isObject(C)&&YAHOO.lang.hasOwnProperty(C,D)){delete C[D];return this.setSubs(B,C,A);}else{return"";}},set:function(B,C,A){var E=YAHOO.lang;if(!E.isString(B)){throw new TypeError("Cookie.set(): Cookie name must be a string.");}if(E.isUndefined(C)){throw new TypeError("Cookie.set(): Value cannot be undefined.");}var D=this._createCookieString(B,C,true,A);document.cookie=D;return D;},setSub:function(B,D,C,A){var F=YAHOO.lang;if(!F.isString(B)||B===""){throw new TypeError("Cookie.setSub(): Cookie name must be a non-empty string.");}if(!F.isString(D)||D===""){throw new TypeError("Cookie.setSub(): Subcookie name must be a non-empty string.");}if(F.isUndefined(C)){throw new TypeError("Cookie.setSub(): Subcookie value cannot be undefined.");}var E=this.getSubs(B);if(!F.isObject(E)){E=new Object();}E[D]=C;return this.setSubs(B,E,A);},setSubs:function(B,C,A){var E=YAHOO.lang;if(!E.isString(B)){throw new TypeError("Cookie.setSubs(): Cookie name must be a string.");}if(!E.isObject(C)){throw new TypeError("Cookie.setSubs(): Cookie value must be an object.");}var D=this._createCookieString(B,this._createCookieHashString(C),false,A);document.cookie=D;return D;}};YAHOO.register("cookie",YAHOO.util.Cookie,{version:"2.7.0",build:"1799"});
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.7.0
*/
(function(){var A=YAHOO.util;A.Selector={_foundCache:[],_regexCache:{},_re:{nth:/^(?:([-]?\d*)(n){1}|(odd|even)$)*([-+]?\d*)$/,attr:/(\[.*\])/g,urls:/^(?:href|src)/},document:window.document,attrAliases:{},shorthand:{"\\#(-?[_a-z]+[-\\w]*)":"[id=$1]","\\.(-?[_a-z]+[-\\w]*)":"[class~=$1]"},operators:{"=":function(B,C){return B===C;},"!=":function(B,C){return B!==C;},"~=":function(B,D){var C=" ";return(C+B+C).indexOf((C+D+C))>-1;},"|=":function(B,C){return B===C||B.slice(0,C.length+1)===C+"-";},"^=":function(B,C){return B.indexOf(C)===0;},"$=":function(B,C){return B.slice(-C.length)===C;},"*=":function(B,C){return B.indexOf(C)>-1;},"":function(B,C){return B;}},pseudos:{"root":function(B){return B===B.ownerDocument.documentElement;},"nth-child":function(B,C){return A.Selector._getNth(B,C);},"nth-last-child":function(B,C){return A.Selector._getNth(B,C,null,true);},"nth-of-type":function(B,C){return A.Selector._getNth(B,C,B.tagName);},"nth-last-of-type":function(B,C){return A.Selector._getNth(B,C,B.tagName,true);},"first-child":function(B){return A.Selector._getChildren(B.parentNode)[0]===B;},"last-child":function(C){var B=A.Selector._getChildren(C.parentNode);return B[B.length-1]===C;},"first-of-type":function(B,C){return A.Selector._getChildren(B.parentNode,B.tagName)[0];},"last-of-type":function(C,D){var B=A.Selector._getChildren(C.parentNode,C.tagName);return B[B.length-1];},"only-child":function(C){var B=A.Selector._getChildren(C.parentNode);return B.length===1&&B[0]===C;},"only-of-type":function(B){return A.Selector._getChildren(B.parentNode,B.tagName).length===1;},"empty":function(B){return B.childNodes.length===0;},"not":function(B,C){return !A.Selector.test(B,C);},"contains":function(B,D){var C=B.innerText||B.textContent||"";return C.indexOf(D)>-1;},"checked":function(B){return B.checked===true;}},test:function(F,D){F=A.Selector.document.getElementById(F)||F;if(!F){return false;}var C=D?D.split(","):[];if(C.length){for(var E=0,B=C.length;E<B;++E){if(A.Selector._test(F,C[E])){return true;}}return false;}return A.Selector._test(F,D);},_test:function(D,G,F,E){F=F||A.Selector._tokenize(G).pop()||{};if(!D.tagName||(F.tag!=="*"&&D.tagName!==F.tag)||(E&&D._found)){return false;}if(F.attributes.length){var B,H,C=A.Selector._re.urls;if(!D.attributes||!D.attributes.length){return false;}for(var I=0,K;K=F.attributes[I++];){H=(C.test(K[0]))?2:0;B=D.getAttribute(K[0],H);if(B===null||B===undefined){return false;}if(A.Selector.operators[K[1]]&&!A.Selector.operators[K[1]](B,K[2])){return false;}}}if(F.pseudos.length){for(var I=0,J=F.pseudos.length;I<J;++I){if(A.Selector.pseudos[F.pseudos[I][0]]&&!A.Selector.pseudos[F.pseudos[I][0]](D,F.pseudos[I][1])){return false;}}}return(F.previous&&F.previous.combinator!==",")?A.Selector._combinators[F.previous.combinator](D,F):true;},filter:function(E,D){E=E||[];var G,C=[],H=A.Selector._tokenize(D);if(!E.item){for(var F=0,B=E.length;F<B;++F){if(!E[F].tagName){G=A.Selector.document.getElementById(E[F]);if(G){E[F]=G;}else{}}}}C=A.Selector._filter(E,A.Selector._tokenize(D)[0]);return C;},_filter:function(E,G,H,D){var C=H?null:[],I=A.Selector._foundCache;for(var F=0,B=E.length;F<B;F++){if(!A.Selector._test(E[F],"",G,D)){continue;}if(H){return E[F];}if(D){if(E[F]._found){continue;}E[F]._found=true;I[I.length]=E[F];}C[C.length]=E[F];}return C;},query:function(C,D,E){var B=A.Selector._query(C,D,E);return B;},_query:function(H,M,N,F){var P=(N)?null:[],E;if(!H){return P;}var D=H.split(",");if(D.length>1){var O;for(var I=0,J=D.length;I<J;++I){O=arguments.callee(D[I],M,N,true);P=N?O:P.concat(O);}A.Selector._clearFoundCache();return P;}if(M&&!M.nodeName){M=A.Selector.document.getElementById(M);if(!M){return P;}}M=M||A.Selector.document;if(M.nodeName!=="#document"){A.Dom.generateId(M);H=M.tagName+"#"+M.id+" "+H;E=M;M=M.ownerDocument;}var L=A.Selector._tokenize(H);var K=L[A.Selector._getIdTokenIndex(L)],B=[],C,G=L.pop()||{};if(K){C=A.Selector._getId(K.attributes);}if(C){E=E||A.Selector.document.getElementById(C);if(E&&(M.nodeName==="#document"||A.Dom.isAncestor(M,E))){if(A.Selector._test(E,null,K)){if(K===G){B=[E];}else{if(K.combinator===" "||K.combinator===">"){M=E;}}}}else{return P;}}if(M&&!B.length){B=M.getElementsByTagName(G.tag);}if(B.length){P=A.Selector._filter(B,G,N,F);}return P;},_clearFoundCache:function(){var E=A.Selector._foundCache;for(var C=0,B=E.length;C<B;++C){try{delete E[C]._found;}catch(D){E[C].removeAttribute("_found");}}E=[];},_getRegExp:function(D,B){var C=A.Selector._regexCache;B=B||"";if(!C[D+B]){C[D+B]=new RegExp(D,B);}return C[D+B];},_getChildren:function(){if(document.documentElement.children){return function(C,B){return(B)?C.children.tags(B):C.children||[];};}else{return function(F,C){if(F._children){return F._children;}var E=[],G=F.childNodes;for(var D=0,B=G.length;D<B;++D){if(G[D].tagName){if(!C||G[D].tagName===C){E[E.length]=G[D];}}}F._children=E;return E;};}}(),_combinators:{" ":function(C,B){while((C=C.parentNode)){if(A.Selector._test(C,"",B.previous)){return true;}}return false;},">":function(C,B){return A.Selector._test(C.parentNode,null,B.previous);},"+":function(D,C){var B=D.previousSibling;while(B&&B.nodeType!==1){B=B.previousSibling;}if(B&&A.Selector._test(B,null,C.previous)){return true;}return false;},"~":function(D,C){var B=D.previousSibling;while(B){if(B.nodeType===1&&A.Selector._test(B,null,C.previous)){return true;}B=B.previousSibling;}return false;}},_getNth:function(C,L,N,G){A.Selector._re.nth.test(L);var K=parseInt(RegExp.$1,10),B=RegExp.$2,H=RegExp.$3,I=parseInt(RegExp.$4,10)||0,M=[],E;var J=A.Selector._getChildren(C.parentNode,N);if(H){K=2;E="+";B="n";I=(H==="odd")?1:0;}else{if(isNaN(K)){K=(B)?1:0;}}if(K===0){if(G){I=J.length-I+1;}if(J[I-1]===C){return true;}else{return false;}}else{if(K<0){G=!!G;K=Math.abs(K);}}if(!G){for(var D=I-1,F=J.length;D<F;D+=K){if(D>=0&&J[D]===C){return true;}}}else{for(var D=J.length-I,F=J.length;D>=0;D-=K){if(D<F&&J[D]===C){return true;}}}return false;},_getId:function(C){for(var D=0,B=C.length;D<B;
++D){if(C[D][0]=="id"&&C[D][1]==="="){return C[D][2];}}},_getIdTokenIndex:function(D){for(var C=0,B=D.length;C<B;++C){if(A.Selector._getId(D[C].attributes)){return C;}}return -1;},_patterns:{tag:/^((?:-?[_a-z]+[\w-]*)|\*)/i,attributes:/^\[([a-z]+\w*)+([~\|\^\$\*!=]=?)?['"]?([^\]]*?)['"]?\]/i,pseudos:/^:([-\w]+)(?:\(['"]?(.+)['"]?\))*/i,combinator:/^\s*([>+~]|\s)\s*/},_tokenize:function(B){var D={},H=[],I,G=false,F=A.Selector._patterns,C;B=A.Selector._replaceShorthand(B);do{G=false;for(var E in F){if(YAHOO.lang.hasOwnProperty(F,E)){if(E!="tag"&&E!="combinator"){D[E]=D[E]||[];}if((C=F[E].exec(B))){G=true;if(E!="tag"&&E!="combinator"){if(E==="attributes"&&C[1]==="id"){D.id=C[3];}D[E].push(C.slice(1));}else{D[E]=C[1];}B=B.replace(C[0],"");if(E==="combinator"||!B.length){D.attributes=A.Selector._fixAttributes(D.attributes);D.pseudos=D.pseudos||[];D.tag=D.tag?D.tag.toUpperCase():"*";H.push(D);D={previous:D};}}}}}while(G);return H;},_fixAttributes:function(C){var D=A.Selector.attrAliases;C=C||[];for(var E=0,B=C.length;E<B;++E){if(D[C[E][0]]){C[E][0]=D[C[E][0]];}if(!C[E][1]){C[E][1]="";}}return C;},_replaceShorthand:function(C){var D=A.Selector.shorthand;var E=C.match(A.Selector._re.attr);if(E){C=C.replace(A.Selector._re.attr,"REPLACED_ATTRIBUTE");}for(var G in D){if(YAHOO.lang.hasOwnProperty(D,G)){C=C.replace(A.Selector._getRegExp(G,"gi"),D[G]);}}if(E){for(var F=0,B=E.length;F<B;++F){C=C.replace("REPLACED_ATTRIBUTE",E[F]);}}return C;}};if(YAHOO.env.ua.ie&&YAHOO.env.ua.ie<8){A.Selector.attrAliases["class"]="className";A.Selector.attrAliases["for"]="htmlFor";}})();YAHOO.register("selector",YAHOO.util.Selector,{version:"2.7.0",build:"1796"});
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.7.0
*/
(function(){YAHOO.util.Config=function(D){if(D){this.init(D);}};var B=YAHOO.lang,C=YAHOO.util.CustomEvent,A=YAHOO.util.Config;A.CONFIG_CHANGED_EVENT="configChanged";A.BOOLEAN_TYPE="boolean";A.prototype={owner:null,queueInProgress:false,config:null,initialConfig:null,eventQueue:null,configChangedEvent:null,init:function(D){this.owner=D;this.configChangedEvent=this.createEvent(A.CONFIG_CHANGED_EVENT);this.configChangedEvent.signature=C.LIST;this.queueInProgress=false;this.config={};this.initialConfig={};this.eventQueue=[];},checkBoolean:function(D){return(typeof D==A.BOOLEAN_TYPE);},checkNumber:function(D){return(!isNaN(D));},fireEvent:function(D,F){var E=this.config[D];if(E&&E.event){E.event.fire(F);}},addProperty:function(E,D){E=E.toLowerCase();this.config[E]=D;D.event=this.createEvent(E,{scope:this.owner});D.event.signature=C.LIST;D.key=E;if(D.handler){D.event.subscribe(D.handler,this.owner);}this.setProperty(E,D.value,true);if(!D.suppressEvent){this.queueProperty(E,D.value);}},getConfig:function(){var D={},F=this.config,G,E;for(G in F){if(B.hasOwnProperty(F,G)){E=F[G];if(E&&E.event){D[G]=E.value;}}}return D;},getProperty:function(D){var E=this.config[D.toLowerCase()];if(E&&E.event){return E.value;}else{return undefined;}},resetProperty:function(D){D=D.toLowerCase();var E=this.config[D];if(E&&E.event){if(this.initialConfig[D]&&!B.isUndefined(this.initialConfig[D])){this.setProperty(D,this.initialConfig[D]);return true;}}else{return false;}},setProperty:function(E,G,D){var F;E=E.toLowerCase();if(this.queueInProgress&&!D){this.queueProperty(E,G);return true;}else{F=this.config[E];if(F&&F.event){if(F.validator&&!F.validator(G)){return false;}else{F.value=G;if(!D){this.fireEvent(E,G);this.configChangedEvent.fire([E,G]);}return true;}}else{return false;}}},queueProperty:function(S,P){S=S.toLowerCase();var R=this.config[S],K=false,J,G,H,I,O,Q,F,M,N,D,L,T,E;if(R&&R.event){if(!B.isUndefined(P)&&R.validator&&!R.validator(P)){return false;}else{if(!B.isUndefined(P)){R.value=P;}else{P=R.value;}K=false;J=this.eventQueue.length;for(L=0;L<J;L++){G=this.eventQueue[L];if(G){H=G[0];I=G[1];if(H==S){this.eventQueue[L]=null;this.eventQueue.push([S,(!B.isUndefined(P)?P:I)]);K=true;break;}}}if(!K&&!B.isUndefined(P)){this.eventQueue.push([S,P]);}}if(R.supercedes){O=R.supercedes.length;for(T=0;T<O;T++){Q=R.supercedes[T];F=this.eventQueue.length;for(E=0;E<F;E++){M=this.eventQueue[E];if(M){N=M[0];D=M[1];if(N==Q.toLowerCase()){this.eventQueue.push([N,D]);this.eventQueue[E]=null;break;}}}}}return true;}else{return false;}},refireEvent:function(D){D=D.toLowerCase();var E=this.config[D];if(E&&E.event&&!B.isUndefined(E.value)){if(this.queueInProgress){this.queueProperty(D);}else{this.fireEvent(D,E.value);}}},applyConfig:function(D,G){var F,E;if(G){E={};for(F in D){if(B.hasOwnProperty(D,F)){E[F.toLowerCase()]=D[F];}}this.initialConfig=E;}for(F in D){if(B.hasOwnProperty(D,F)){this.queueProperty(F,D[F]);}}},refresh:function(){var D;for(D in this.config){if(B.hasOwnProperty(this.config,D)){this.refireEvent(D);}}},fireQueue:function(){var E,H,D,G,F;this.queueInProgress=true;for(E=0;E<this.eventQueue.length;E++){H=this.eventQueue[E];if(H){D=H[0];G=H[1];F=this.config[D];F.value=G;this.eventQueue[E]=null;this.fireEvent(D,G);}}this.queueInProgress=false;this.eventQueue=[];},subscribeToConfigEvent:function(E,F,H,D){var G=this.config[E.toLowerCase()];if(G&&G.event){if(!A.alreadySubscribed(G.event,F,H)){G.event.subscribe(F,H,D);}return true;}else{return false;}},unsubscribeFromConfigEvent:function(D,E,G){var F=this.config[D.toLowerCase()];if(F&&F.event){return F.event.unsubscribe(E,G);}else{return false;}},toString:function(){var D="Config";if(this.owner){D+=" ["+this.owner.toString()+"]";}return D;},outputEventQueue:function(){var D="",G,E,F=this.eventQueue.length;for(E=0;E<F;E++){G=this.eventQueue[E];if(G){D+=G[0]+"="+G[1]+", ";}}return D;},destroy:function(){var E=this.config,D,F;for(D in E){if(B.hasOwnProperty(E,D)){F=E[D];F.event.unsubscribeAll();F.event=null;}}this.configChangedEvent.unsubscribeAll();this.configChangedEvent=null;this.owner=null;this.config=null;this.initialConfig=null;this.eventQueue=null;}};A.alreadySubscribed=function(E,H,I){var F=E.subscribers.length,D,G;if(F>0){G=F-1;do{D=E.subscribers[G];if(D&&D.obj==I&&D.fn==H){return true;}}while(G--);}return false;};YAHOO.lang.augmentProto(A,YAHOO.util.EventProvider);}());(function(){YAHOO.widget.Module=function(R,Q){if(R){this.init(R,Q);}else{}};var F=YAHOO.util.Dom,D=YAHOO.util.Config,N=YAHOO.util.Event,M=YAHOO.util.CustomEvent,G=YAHOO.widget.Module,I=YAHOO.env.ua,H,P,O,E,A={"BEFORE_INIT":"beforeInit","INIT":"init","APPEND":"append","BEFORE_RENDER":"beforeRender","RENDER":"render","CHANGE_HEADER":"changeHeader","CHANGE_BODY":"changeBody","CHANGE_FOOTER":"changeFooter","CHANGE_CONTENT":"changeContent","DESTORY":"destroy","BEFORE_SHOW":"beforeShow","SHOW":"show","BEFORE_HIDE":"beforeHide","HIDE":"hide"},J={"VISIBLE":{key:"visible",value:true,validator:YAHOO.lang.isBoolean},"EFFECT":{key:"effect",suppressEvent:true,supercedes:["visible"]},"MONITOR_RESIZE":{key:"monitorresize",value:true},"APPEND_TO_DOCUMENT_BODY":{key:"appendtodocumentbody",value:false}};G.IMG_ROOT=null;G.IMG_ROOT_SSL=null;G.CSS_MODULE="yui-module";G.CSS_HEADER="hd";G.CSS_BODY="bd";G.CSS_FOOTER="ft";G.RESIZE_MONITOR_SECURE_URL="javascript:false;";G.RESIZE_MONITOR_BUFFER=1;G.textResizeEvent=new M("textResize");G.forceDocumentRedraw=function(){var Q=document.documentElement;if(Q){Q.className+=" ";Q.className=YAHOO.lang.trim(Q.className);}};function L(){if(!H){H=document.createElement("div");H.innerHTML=('<div class="'+G.CSS_HEADER+'"></div>'+'<div class="'+G.CSS_BODY+'"></div><div class="'+G.CSS_FOOTER+'"></div>');P=H.firstChild;O=P.nextSibling;E=O.nextSibling;}return H;}function K(){if(!P){L();}return(P.cloneNode(false));}function B(){if(!O){L();}return(O.cloneNode(false));}function C(){if(!E){L();}return(E.cloneNode(false));}G.prototype={constructor:G,element:null,header:null,body:null,footer:null,id:null,imageRoot:G.IMG_ROOT,initEvents:function(){var Q=M.LIST;
this.beforeInitEvent=this.createEvent(A.BEFORE_INIT);this.beforeInitEvent.signature=Q;this.initEvent=this.createEvent(A.INIT);this.initEvent.signature=Q;this.appendEvent=this.createEvent(A.APPEND);this.appendEvent.signature=Q;this.beforeRenderEvent=this.createEvent(A.BEFORE_RENDER);this.beforeRenderEvent.signature=Q;this.renderEvent=this.createEvent(A.RENDER);this.renderEvent.signature=Q;this.changeHeaderEvent=this.createEvent(A.CHANGE_HEADER);this.changeHeaderEvent.signature=Q;this.changeBodyEvent=this.createEvent(A.CHANGE_BODY);this.changeBodyEvent.signature=Q;this.changeFooterEvent=this.createEvent(A.CHANGE_FOOTER);this.changeFooterEvent.signature=Q;this.changeContentEvent=this.createEvent(A.CHANGE_CONTENT);this.changeContentEvent.signature=Q;this.destroyEvent=this.createEvent(A.DESTORY);this.destroyEvent.signature=Q;this.beforeShowEvent=this.createEvent(A.BEFORE_SHOW);this.beforeShowEvent.signature=Q;this.showEvent=this.createEvent(A.SHOW);this.showEvent.signature=Q;this.beforeHideEvent=this.createEvent(A.BEFORE_HIDE);this.beforeHideEvent.signature=Q;this.hideEvent=this.createEvent(A.HIDE);this.hideEvent.signature=Q;},platform:function(){var Q=navigator.userAgent.toLowerCase();if(Q.indexOf("windows")!=-1||Q.indexOf("win32")!=-1){return"windows";}else{if(Q.indexOf("macintosh")!=-1){return"mac";}else{return false;}}}(),browser:function(){var Q=navigator.userAgent.toLowerCase();if(Q.indexOf("opera")!=-1){return"opera";}else{if(Q.indexOf("msie 7")!=-1){return"ie7";}else{if(Q.indexOf("msie")!=-1){return"ie";}else{if(Q.indexOf("safari")!=-1){return"safari";}else{if(Q.indexOf("gecko")!=-1){return"gecko";}else{return false;}}}}}}(),isSecure:function(){if(window.location.href.toLowerCase().indexOf("https")===0){return true;}else{return false;}}(),initDefaultConfig:function(){this.cfg.addProperty(J.VISIBLE.key,{handler:this.configVisible,value:J.VISIBLE.value,validator:J.VISIBLE.validator});this.cfg.addProperty(J.EFFECT.key,{suppressEvent:J.EFFECT.suppressEvent,supercedes:J.EFFECT.supercedes});this.cfg.addProperty(J.MONITOR_RESIZE.key,{handler:this.configMonitorResize,value:J.MONITOR_RESIZE.value});this.cfg.addProperty(J.APPEND_TO_DOCUMENT_BODY.key,{value:J.APPEND_TO_DOCUMENT_BODY.value});},init:function(V,U){var S,W;this.initEvents();this.beforeInitEvent.fire(G);this.cfg=new D(this);if(this.isSecure){this.imageRoot=G.IMG_ROOT_SSL;}if(typeof V=="string"){S=V;V=document.getElementById(V);if(!V){V=(L()).cloneNode(false);V.id=S;}}this.id=F.generateId(V);this.element=V;W=this.element.firstChild;if(W){var R=false,Q=false,T=false;do{if(1==W.nodeType){if(!R&&F.hasClass(W,G.CSS_HEADER)){this.header=W;R=true;}else{if(!Q&&F.hasClass(W,G.CSS_BODY)){this.body=W;Q=true;}else{if(!T&&F.hasClass(W,G.CSS_FOOTER)){this.footer=W;T=true;}}}}}while((W=W.nextSibling));}this.initDefaultConfig();F.addClass(this.element,G.CSS_MODULE);if(U){this.cfg.applyConfig(U,true);}if(!D.alreadySubscribed(this.renderEvent,this.cfg.fireQueue,this.cfg)){this.renderEvent.subscribe(this.cfg.fireQueue,this.cfg,true);}this.initEvent.fire(G);},initResizeMonitor:function(){var R=(I.gecko&&this.platform=="windows");if(R){var Q=this;setTimeout(function(){Q._initResizeMonitor();},0);}else{this._initResizeMonitor();}},_initResizeMonitor:function(){var Q,S,U;function W(){G.textResizeEvent.fire();}if(!I.opera){S=F.get("_yuiResizeMonitor");var V=this._supportsCWResize();if(!S){S=document.createElement("iframe");if(this.isSecure&&G.RESIZE_MONITOR_SECURE_URL&&I.ie){S.src=G.RESIZE_MONITOR_SECURE_URL;}if(!V){U=["<html><head><script ",'type="text/javascript">',"window.onresize=function(){window.parent.","YAHOO.widget.Module.textResizeEvent.","fire();};<","/script></head>","<body></body></html>"].join("");S.src="data:text/html;charset=utf-8,"+encodeURIComponent(U);}S.id="_yuiResizeMonitor";S.title="Text Resize Monitor";S.style.position="absolute";S.style.visibility="hidden";var R=document.body,T=R.firstChild;if(T){R.insertBefore(S,T);}else{R.appendChild(S);}S.style.width="2em";S.style.height="2em";S.style.top=(-1*(S.offsetHeight+G.RESIZE_MONITOR_BUFFER))+"px";S.style.left="0";S.style.borderWidth="0";S.style.visibility="visible";if(I.webkit){Q=S.contentWindow.document;Q.open();Q.close();}}if(S&&S.contentWindow){G.textResizeEvent.subscribe(this.onDomResize,this,true);if(!G.textResizeInitialized){if(V){if(!N.on(S.contentWindow,"resize",W)){N.on(S,"resize",W);}}G.textResizeInitialized=true;}this.resizeMonitor=S;}}},_supportsCWResize:function(){var Q=true;if(I.gecko&&I.gecko<=1.8){Q=false;}return Q;},onDomResize:function(S,R){var Q=-1*(this.resizeMonitor.offsetHeight+G.RESIZE_MONITOR_BUFFER);this.resizeMonitor.style.top=Q+"px";this.resizeMonitor.style.left="0";},setHeader:function(R){var Q=this.header||(this.header=K());if(R.nodeName){Q.innerHTML="";Q.appendChild(R);}else{Q.innerHTML=R;}this.changeHeaderEvent.fire(R);this.changeContentEvent.fire();},appendToHeader:function(R){var Q=this.header||(this.header=K());Q.appendChild(R);this.changeHeaderEvent.fire(R);this.changeContentEvent.fire();},setBody:function(R){var Q=this.body||(this.body=B());if(R.nodeName){Q.innerHTML="";Q.appendChild(R);}else{Q.innerHTML=R;}this.changeBodyEvent.fire(R);this.changeContentEvent.fire();},appendToBody:function(R){var Q=this.body||(this.body=B());Q.appendChild(R);this.changeBodyEvent.fire(R);this.changeContentEvent.fire();},setFooter:function(R){var Q=this.footer||(this.footer=C());if(R.nodeName){Q.innerHTML="";Q.appendChild(R);}else{Q.innerHTML=R;}this.changeFooterEvent.fire(R);this.changeContentEvent.fire();},appendToFooter:function(R){var Q=this.footer||(this.footer=C());Q.appendChild(R);this.changeFooterEvent.fire(R);this.changeContentEvent.fire();},render:function(S,Q){var T=this,U;function R(V){if(typeof V=="string"){V=document.getElementById(V);}if(V){T._addToParent(V,T.element);T.appendEvent.fire();}}this.beforeRenderEvent.fire();if(!Q){Q=this.element;}if(S){R(S);}else{if(!F.inDocument(this.element)){return false;}}if(this.header&&!F.inDocument(this.header)){U=Q.firstChild;
if(U){Q.insertBefore(this.header,U);}else{Q.appendChild(this.header);}}if(this.body&&!F.inDocument(this.body)){if(this.footer&&F.isAncestor(this.moduleElement,this.footer)){Q.insertBefore(this.body,this.footer);}else{Q.appendChild(this.body);}}if(this.footer&&!F.inDocument(this.footer)){Q.appendChild(this.footer);}this.renderEvent.fire();return true;},destroy:function(){var Q;if(this.element){N.purgeElement(this.element,true);Q=this.element.parentNode;}if(Q){Q.removeChild(this.element);}this.element=null;this.header=null;this.body=null;this.footer=null;G.textResizeEvent.unsubscribe(this.onDomResize,this);this.cfg.destroy();this.cfg=null;this.destroyEvent.fire();},show:function(){this.cfg.setProperty("visible",true);},hide:function(){this.cfg.setProperty("visible",false);},configVisible:function(R,Q,S){var T=Q[0];if(T){this.beforeShowEvent.fire();F.setStyle(this.element,"display","block");this.showEvent.fire();}else{this.beforeHideEvent.fire();F.setStyle(this.element,"display","none");this.hideEvent.fire();}},configMonitorResize:function(S,R,T){var Q=R[0];if(Q){this.initResizeMonitor();}else{G.textResizeEvent.unsubscribe(this.onDomResize,this,true);this.resizeMonitor=null;}},_addToParent:function(Q,R){if(!this.cfg.getProperty("appendtodocumentbody")&&Q===document.body&&Q.firstChild){Q.insertBefore(R,Q.firstChild);}else{Q.appendChild(R);}},toString:function(){return"Module "+this.id;}};YAHOO.lang.augmentProto(G,YAHOO.util.EventProvider);}());(function(){YAHOO.widget.Overlay=function(P,O){YAHOO.widget.Overlay.superclass.constructor.call(this,P,O);};var I=YAHOO.lang,M=YAHOO.util.CustomEvent,G=YAHOO.widget.Module,N=YAHOO.util.Event,F=YAHOO.util.Dom,D=YAHOO.util.Config,K=YAHOO.env.ua,B=YAHOO.widget.Overlay,H="subscribe",E="unsubscribe",C="contained",J,A={"BEFORE_MOVE":"beforeMove","MOVE":"move"},L={"X":{key:"x",validator:I.isNumber,suppressEvent:true,supercedes:["iframe"]},"Y":{key:"y",validator:I.isNumber,suppressEvent:true,supercedes:["iframe"]},"XY":{key:"xy",suppressEvent:true,supercedes:["iframe"]},"CONTEXT":{key:"context",suppressEvent:true,supercedes:["iframe"]},"FIXED_CENTER":{key:"fixedcenter",value:false,supercedes:["iframe","visible"]},"WIDTH":{key:"width",suppressEvent:true,supercedes:["context","fixedcenter","iframe"]},"HEIGHT":{key:"height",suppressEvent:true,supercedes:["context","fixedcenter","iframe"]},"AUTO_FILL_HEIGHT":{key:"autofillheight",supercedes:["height"],value:"body"},"ZINDEX":{key:"zindex",value:null},"CONSTRAIN_TO_VIEWPORT":{key:"constraintoviewport",value:false,validator:I.isBoolean,supercedes:["iframe","x","y","xy"]},"IFRAME":{key:"iframe",value:(K.ie==6?true:false),validator:I.isBoolean,supercedes:["zindex"]},"PREVENT_CONTEXT_OVERLAP":{key:"preventcontextoverlap",value:false,validator:I.isBoolean,supercedes:["constraintoviewport"]}};B.IFRAME_SRC="javascript:false;";B.IFRAME_OFFSET=3;B.VIEWPORT_OFFSET=10;B.TOP_LEFT="tl";B.TOP_RIGHT="tr";B.BOTTOM_LEFT="bl";B.BOTTOM_RIGHT="br";B.CSS_OVERLAY="yui-overlay";B.STD_MOD_RE=/^\s*?(body|footer|header)\s*?$/i;B.windowScrollEvent=new M("windowScroll");B.windowResizeEvent=new M("windowResize");B.windowScrollHandler=function(P){var O=N.getTarget(P);if(!O||O===window||O===window.document){if(K.ie){if(!window.scrollEnd){window.scrollEnd=-1;}clearTimeout(window.scrollEnd);window.scrollEnd=setTimeout(function(){B.windowScrollEvent.fire();},1);}else{B.windowScrollEvent.fire();}}};B.windowResizeHandler=function(O){if(K.ie){if(!window.resizeEnd){window.resizeEnd=-1;}clearTimeout(window.resizeEnd);window.resizeEnd=setTimeout(function(){B.windowResizeEvent.fire();},100);}else{B.windowResizeEvent.fire();}};B._initialized=null;if(B._initialized===null){N.on(window,"scroll",B.windowScrollHandler);N.on(window,"resize",B.windowResizeHandler);B._initialized=true;}B._TRIGGER_MAP={"windowScroll":B.windowScrollEvent,"windowResize":B.windowResizeEvent,"textResize":G.textResizeEvent};YAHOO.extend(B,G,{CONTEXT_TRIGGERS:[],init:function(P,O){B.superclass.init.call(this,P);this.beforeInitEvent.fire(B);F.addClass(this.element,B.CSS_OVERLAY);if(O){this.cfg.applyConfig(O,true);}if(this.platform=="mac"&&K.gecko){if(!D.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)){this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);}if(!D.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)){this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);}}this.initEvent.fire(B);},initEvents:function(){B.superclass.initEvents.call(this);var O=M.LIST;this.beforeMoveEvent=this.createEvent(A.BEFORE_MOVE);this.beforeMoveEvent.signature=O;this.moveEvent=this.createEvent(A.MOVE);this.moveEvent.signature=O;},initDefaultConfig:function(){B.superclass.initDefaultConfig.call(this);var O=this.cfg;O.addProperty(L.X.key,{handler:this.configX,validator:L.X.validator,suppressEvent:L.X.suppressEvent,supercedes:L.X.supercedes});O.addProperty(L.Y.key,{handler:this.configY,validator:L.Y.validator,suppressEvent:L.Y.suppressEvent,supercedes:L.Y.supercedes});O.addProperty(L.XY.key,{handler:this.configXY,suppressEvent:L.XY.suppressEvent,supercedes:L.XY.supercedes});O.addProperty(L.CONTEXT.key,{handler:this.configContext,suppressEvent:L.CONTEXT.suppressEvent,supercedes:L.CONTEXT.supercedes});O.addProperty(L.FIXED_CENTER.key,{handler:this.configFixedCenter,value:L.FIXED_CENTER.value,validator:L.FIXED_CENTER.validator,supercedes:L.FIXED_CENTER.supercedes});O.addProperty(L.WIDTH.key,{handler:this.configWidth,suppressEvent:L.WIDTH.suppressEvent,supercedes:L.WIDTH.supercedes});O.addProperty(L.HEIGHT.key,{handler:this.configHeight,suppressEvent:L.HEIGHT.suppressEvent,supercedes:L.HEIGHT.supercedes});O.addProperty(L.AUTO_FILL_HEIGHT.key,{handler:this.configAutoFillHeight,value:L.AUTO_FILL_HEIGHT.value,validator:this._validateAutoFill,supercedes:L.AUTO_FILL_HEIGHT.supercedes});O.addProperty(L.ZINDEX.key,{handler:this.configzIndex,value:L.ZINDEX.value});O.addProperty(L.CONSTRAIN_TO_VIEWPORT.key,{handler:this.configConstrainToViewport,value:L.CONSTRAIN_TO_VIEWPORT.value,validator:L.CONSTRAIN_TO_VIEWPORT.validator,supercedes:L.CONSTRAIN_TO_VIEWPORT.supercedes});
O.addProperty(L.IFRAME.key,{handler:this.configIframe,value:L.IFRAME.value,validator:L.IFRAME.validator,supercedes:L.IFRAME.supercedes});O.addProperty(L.PREVENT_CONTEXT_OVERLAP.key,{value:L.PREVENT_CONTEXT_OVERLAP.value,validator:L.PREVENT_CONTEXT_OVERLAP.validator,supercedes:L.PREVENT_CONTEXT_OVERLAP.supercedes});},moveTo:function(O,P){this.cfg.setProperty("xy",[O,P]);},hideMacGeckoScrollbars:function(){F.replaceClass(this.element,"show-scrollbars","hide-scrollbars");},showMacGeckoScrollbars:function(){F.replaceClass(this.element,"hide-scrollbars","show-scrollbars");},_setDomVisibility:function(O){F.setStyle(this.element,"visibility",(O)?"visible":"hidden");if(O){F.removeClass(this.element,"yui-overlay-hidden");}else{F.addClass(this.element,"yui-overlay-hidden");}},configVisible:function(R,O,X){var Q=O[0],S=F.getStyle(this.element,"visibility"),Y=this.cfg.getProperty("effect"),V=[],U=(this.platform=="mac"&&K.gecko),g=D.alreadySubscribed,W,P,f,c,b,a,d,Z,T;if(S=="inherit"){f=this.element.parentNode;while(f.nodeType!=9&&f.nodeType!=11){S=F.getStyle(f,"visibility");if(S!="inherit"){break;}f=f.parentNode;}if(S=="inherit"){S="visible";}}if(Y){if(Y instanceof Array){Z=Y.length;for(c=0;c<Z;c++){W=Y[c];V[V.length]=W.effect(this,W.duration);}}else{V[V.length]=Y.effect(this,Y.duration);}}if(Q){if(U){this.showMacGeckoScrollbars();}if(Y){if(Q){if(S!="visible"||S===""){this.beforeShowEvent.fire();T=V.length;for(b=0;b<T;b++){P=V[b];if(b===0&&!g(P.animateInCompleteEvent,this.showEvent.fire,this.showEvent)){P.animateInCompleteEvent.subscribe(this.showEvent.fire,this.showEvent,true);}P.animateIn();}}}}else{if(S!="visible"||S===""){this.beforeShowEvent.fire();this._setDomVisibility(true);this.cfg.refireEvent("iframe");this.showEvent.fire();}else{this._setDomVisibility(true);}}}else{if(U){this.hideMacGeckoScrollbars();}if(Y){if(S=="visible"){this.beforeHideEvent.fire();T=V.length;for(a=0;a<T;a++){d=V[a];if(a===0&&!g(d.animateOutCompleteEvent,this.hideEvent.fire,this.hideEvent)){d.animateOutCompleteEvent.subscribe(this.hideEvent.fire,this.hideEvent,true);}d.animateOut();}}else{if(S===""){this._setDomVisibility(false);}}}else{if(S=="visible"||S===""){this.beforeHideEvent.fire();this._setDomVisibility(false);this.hideEvent.fire();}else{this._setDomVisibility(false);}}}},doCenterOnDOMEvent:function(){var O=this.cfg,P=O.getProperty("fixedcenter");if(O.getProperty("visible")){if(P&&(P!==C||this.fitsInViewport())){this.center();}}},fitsInViewport:function(){var S=B.VIEWPORT_OFFSET,Q=this.element,T=Q.offsetWidth,R=Q.offsetHeight,O=F.getViewportWidth(),P=F.getViewportHeight();return((T+S<O)&&(R+S<P));},configFixedCenter:function(S,Q,T){var U=Q[0],P=D.alreadySubscribed,R=B.windowResizeEvent,O=B.windowScrollEvent;if(U){this.center();if(!P(this.beforeShowEvent,this.center)){this.beforeShowEvent.subscribe(this.center);}if(!P(R,this.doCenterOnDOMEvent,this)){R.subscribe(this.doCenterOnDOMEvent,this,true);}if(!P(O,this.doCenterOnDOMEvent,this)){O.subscribe(this.doCenterOnDOMEvent,this,true);}}else{this.beforeShowEvent.unsubscribe(this.center);R.unsubscribe(this.doCenterOnDOMEvent,this);O.unsubscribe(this.doCenterOnDOMEvent,this);}},configHeight:function(R,P,S){var O=P[0],Q=this.element;F.setStyle(Q,"height",O);this.cfg.refireEvent("iframe");},configAutoFillHeight:function(T,S,P){var V=S[0],Q=this.cfg,U="autofillheight",W="height",R=Q.getProperty(U),O=this._autoFillOnHeightChange;Q.unsubscribeFromConfigEvent(W,O);G.textResizeEvent.unsubscribe(O);this.changeContentEvent.unsubscribe(O);if(R&&V!==R&&this[R]){F.setStyle(this[R],W,"");}if(V){V=I.trim(V.toLowerCase());Q.subscribeToConfigEvent(W,O,this[V],this);G.textResizeEvent.subscribe(O,this[V],this);this.changeContentEvent.subscribe(O,this[V],this);Q.setProperty(U,V,true);}},configWidth:function(R,O,S){var Q=O[0],P=this.element;F.setStyle(P,"width",Q);this.cfg.refireEvent("iframe");},configzIndex:function(Q,O,R){var S=O[0],P=this.element;if(!S){S=F.getStyle(P,"zIndex");if(!S||isNaN(S)){S=0;}}if(this.iframe||this.cfg.getProperty("iframe")===true){if(S<=0){S=1;}}F.setStyle(P,"zIndex",S);this.cfg.setProperty("zIndex",S,true);if(this.iframe){this.stackIframe();}},configXY:function(Q,P,R){var T=P[0],O=T[0],S=T[1];this.cfg.setProperty("x",O);this.cfg.setProperty("y",S);this.beforeMoveEvent.fire([O,S]);O=this.cfg.getProperty("x");S=this.cfg.getProperty("y");this.cfg.refireEvent("iframe");this.moveEvent.fire([O,S]);},configX:function(Q,P,R){var O=P[0],S=this.cfg.getProperty("y");this.cfg.setProperty("x",O,true);this.cfg.setProperty("y",S,true);this.beforeMoveEvent.fire([O,S]);O=this.cfg.getProperty("x");S=this.cfg.getProperty("y");F.setX(this.element,O,true);this.cfg.setProperty("xy",[O,S],true);this.cfg.refireEvent("iframe");this.moveEvent.fire([O,S]);},configY:function(Q,P,R){var O=this.cfg.getProperty("x"),S=P[0];this.cfg.setProperty("x",O,true);this.cfg.setProperty("y",S,true);this.beforeMoveEvent.fire([O,S]);O=this.cfg.getProperty("x");S=this.cfg.getProperty("y");F.setY(this.element,S,true);this.cfg.setProperty("xy",[O,S],true);this.cfg.refireEvent("iframe");this.moveEvent.fire([O,S]);},showIframe:function(){var P=this.iframe,O;if(P){O=this.element.parentNode;if(O!=P.parentNode){this._addToParent(O,P);}P.style.display="block";}},hideIframe:function(){if(this.iframe){this.iframe.style.display="none";}},syncIframe:function(){var O=this.iframe,Q=this.element,S=B.IFRAME_OFFSET,P=(S*2),R;if(O){O.style.width=(Q.offsetWidth+P+"px");O.style.height=(Q.offsetHeight+P+"px");R=this.cfg.getProperty("xy");if(!I.isArray(R)||(isNaN(R[0])||isNaN(R[1]))){this.syncPosition();R=this.cfg.getProperty("xy");}F.setXY(O,[(R[0]-S),(R[1]-S)]);}},stackIframe:function(){if(this.iframe){var O=F.getStyle(this.element,"zIndex");if(!YAHOO.lang.isUndefined(O)&&!isNaN(O)){F.setStyle(this.iframe,"zIndex",(O-1));}}},configIframe:function(R,Q,S){var O=Q[0];function T(){var V=this.iframe,W=this.element,X;if(!V){if(!J){J=document.createElement("iframe");if(this.isSecure){J.src=B.IFRAME_SRC;}if(K.ie){J.style.filter="alpha(opacity=0)";
J.frameBorder=0;}else{J.style.opacity="0";}J.style.position="absolute";J.style.border="none";J.style.margin="0";J.style.padding="0";J.style.display="none";J.tabIndex=-1;}V=J.cloneNode(false);X=W.parentNode;var U=X||document.body;this._addToParent(U,V);this.iframe=V;}this.showIframe();this.syncIframe();this.stackIframe();if(!this._hasIframeEventListeners){this.showEvent.subscribe(this.showIframe);this.hideEvent.subscribe(this.hideIframe);this.changeContentEvent.subscribe(this.syncIframe);this._hasIframeEventListeners=true;}}function P(){T.call(this);this.beforeShowEvent.unsubscribe(P);this._iframeDeferred=false;}if(O){if(this.cfg.getProperty("visible")){T.call(this);}else{if(!this._iframeDeferred){this.beforeShowEvent.subscribe(P);this._iframeDeferred=true;}}}else{this.hideIframe();if(this._hasIframeEventListeners){this.showEvent.unsubscribe(this.showIframe);this.hideEvent.unsubscribe(this.hideIframe);this.changeContentEvent.unsubscribe(this.syncIframe);this._hasIframeEventListeners=false;}}},_primeXYFromDOM:function(){if(YAHOO.lang.isUndefined(this.cfg.getProperty("xy"))){this.syncPosition();this.cfg.refireEvent("xy");this.beforeShowEvent.unsubscribe(this._primeXYFromDOM);}},configConstrainToViewport:function(P,O,Q){var R=O[0];if(R){if(!D.alreadySubscribed(this.beforeMoveEvent,this.enforceConstraints,this)){this.beforeMoveEvent.subscribe(this.enforceConstraints,this,true);}if(!D.alreadySubscribed(this.beforeShowEvent,this._primeXYFromDOM)){this.beforeShowEvent.subscribe(this._primeXYFromDOM);}}else{this.beforeShowEvent.unsubscribe(this._primeXYFromDOM);this.beforeMoveEvent.unsubscribe(this.enforceConstraints,this);}},configContext:function(T,S,P){var W=S[0],Q,O,U,R,V=this.CONTEXT_TRIGGERS;if(W){Q=W[0];O=W[1];U=W[2];R=W[3];if(V&&V.length>0){R=(R||[]).concat(V);}if(Q){if(typeof Q=="string"){this.cfg.setProperty("context",[document.getElementById(Q),O,U,R],true);}if(O&&U){this.align(O,U);}if(this._contextTriggers){this._processTriggers(this._contextTriggers,E,this._alignOnTrigger);}if(R){this._processTriggers(R,H,this._alignOnTrigger);this._contextTriggers=R;}}}},_alignOnTrigger:function(P,O){this.align();},_findTriggerCE:function(O){var P=null;if(O instanceof M){P=O;}else{if(B._TRIGGER_MAP[O]){P=B._TRIGGER_MAP[O];}}return P;},_processTriggers:function(S,U,R){var Q,T;for(var P=0,O=S.length;P<O;++P){Q=S[P];T=this._findTriggerCE(Q);if(T){T[U](R,this,true);}else{this[U](Q,R);}}},align:function(P,O){var U=this.cfg.getProperty("context"),T=this,S,R,V;function Q(W,X){switch(P){case B.TOP_LEFT:T.moveTo(X,W);break;case B.TOP_RIGHT:T.moveTo((X-R.offsetWidth),W);break;case B.BOTTOM_LEFT:T.moveTo(X,(W-R.offsetHeight));break;case B.BOTTOM_RIGHT:T.moveTo((X-R.offsetWidth),(W-R.offsetHeight));break;}}if(U){S=U[0];R=this.element;T=this;if(!P){P=U[1];}if(!O){O=U[2];}if(R&&S){V=F.getRegion(S);switch(O){case B.TOP_LEFT:Q(V.top,V.left);break;case B.TOP_RIGHT:Q(V.top,V.right);break;case B.BOTTOM_LEFT:Q(V.bottom,V.left);break;case B.BOTTOM_RIGHT:Q(V.bottom,V.right);break;}}}},enforceConstraints:function(P,O,Q){var S=O[0];var R=this.getConstrainedXY(S[0],S[1]);this.cfg.setProperty("x",R[0],true);this.cfg.setProperty("y",R[1],true);this.cfg.setProperty("xy",R,true);},getConstrainedX:function(V){var S=this,O=S.element,e=O.offsetWidth,c=B.VIEWPORT_OFFSET,h=F.getViewportWidth(),d=F.getDocumentScrollLeft(),Y=(e+c<h),b=this.cfg.getProperty("context"),Q,X,j,T=false,f,W,g=d+c,P=d+h-e-c,i=V,U={"tltr":true,"blbr":true,"brbl":true,"trtl":true};var Z=function(){var k;if((S.cfg.getProperty("x")-d)>X){k=(X-e);}else{k=(X+j);}S.cfg.setProperty("x",(k+d),true);return k;};var R=function(){if((S.cfg.getProperty("x")-d)>X){return(W-c);}else{return(f-c);}};var a=function(){var k=R(),l;if(e>k){if(T){Z();}else{Z();T=true;l=a();}}return l;};if(V<g||V>P){if(Y){if(this.cfg.getProperty("preventcontextoverlap")&&b&&U[(b[1]+b[2])]){Q=b[0];X=F.getX(Q)-d;j=Q.offsetWidth;f=X;W=(h-(X+j));a();i=this.cfg.getProperty("x");}else{if(V<g){i=g;}else{if(V>P){i=P;}}}}else{i=c+d;}}return i;},getConstrainedY:function(Z){var W=this,P=W.element,i=P.offsetHeight,h=B.VIEWPORT_OFFSET,d=F.getViewportHeight(),g=F.getDocumentScrollTop(),e=(i+h<d),f=this.cfg.getProperty("context"),U,a,b,X=false,V,Q,c=g+h,S=g+d-i-h,O=Z,Y={"trbr":true,"tlbl":true,"bltl":true,"brtr":true};var T=function(){var k;if((W.cfg.getProperty("y")-g)>a){k=(a-i);}else{k=(a+b);}W.cfg.setProperty("y",(k+g),true);return k;};var R=function(){if((W.cfg.getProperty("y")-g)>a){return(Q-h);}else{return(V-h);}};var j=function(){var l=R(),k;if(i>l){if(X){T();}else{T();X=true;k=j();}}return k;};if(Z<c||Z>S){if(e){if(this.cfg.getProperty("preventcontextoverlap")&&f&&Y[(f[1]+f[2])]){U=f[0];b=U.offsetHeight;a=(F.getY(U)-g);V=a;Q=(d-(a+b));j();O=W.cfg.getProperty("y");}else{if(Z<c){O=c;}else{if(Z>S){O=S;}}}}else{O=h+g;}}return O;},getConstrainedXY:function(O,P){return[this.getConstrainedX(O),this.getConstrainedY(P)];},center:function(){var R=B.VIEWPORT_OFFSET,S=this.element.offsetWidth,Q=this.element.offsetHeight,P=F.getViewportWidth(),T=F.getViewportHeight(),O,U;if(S<P){O=(P/2)-(S/2)+F.getDocumentScrollLeft();}else{O=R+F.getDocumentScrollLeft();}if(Q<T){U=(T/2)-(Q/2)+F.getDocumentScrollTop();}else{U=R+F.getDocumentScrollTop();}this.cfg.setProperty("xy",[parseInt(O,10),parseInt(U,10)]);this.cfg.refireEvent("iframe");if(K.webkit){this.forceContainerRedraw();}},syncPosition:function(){var O=F.getXY(this.element);this.cfg.setProperty("x",O[0],true);this.cfg.setProperty("y",O[1],true);this.cfg.setProperty("xy",O,true);},onDomResize:function(Q,P){var O=this;B.superclass.onDomResize.call(this,Q,P);setTimeout(function(){O.syncPosition();O.cfg.refireEvent("iframe");O.cfg.refireEvent("context");},0);},_getComputedHeight:(function(){if(document.defaultView&&document.defaultView.getComputedStyle){return function(P){var O=null;if(P.ownerDocument&&P.ownerDocument.defaultView){var Q=P.ownerDocument.defaultView.getComputedStyle(P,"");if(Q){O=parseInt(Q.height,10);}}return(I.isNumber(O))?O:null;};}else{return function(P){var O=null;
if(P.style.pixelHeight){O=P.style.pixelHeight;}return(I.isNumber(O))?O:null;};}})(),_validateAutoFillHeight:function(O){return(!O)||(I.isString(O)&&B.STD_MOD_RE.test(O));},_autoFillOnHeightChange:function(R,P,Q){var O=this.cfg.getProperty("height");if((O&&O!=="auto")||(O===0)){this.fillHeight(Q);}},_getPreciseHeight:function(P){var O=P.offsetHeight;if(P.getBoundingClientRect){var Q=P.getBoundingClientRect();O=Q.bottom-Q.top;}return O;},fillHeight:function(R){if(R){var P=this.innerElement||this.element,O=[this.header,this.body,this.footer],V,W=0,X=0,T=0,Q=false;for(var U=0,S=O.length;U<S;U++){V=O[U];if(V){if(R!==V){X+=this._getPreciseHeight(V);}else{Q=true;}}}if(Q){if(K.ie||K.opera){F.setStyle(R,"height",0+"px");}W=this._getComputedHeight(P);if(W===null){F.addClass(P,"yui-override-padding");W=P.clientHeight;F.removeClass(P,"yui-override-padding");}T=Math.max(W-X,0);F.setStyle(R,"height",T+"px");if(R.offsetHeight!=T){T=Math.max(T-(R.offsetHeight-T),0);}F.setStyle(R,"height",T+"px");}}},bringToTop:function(){var S=[],R=this.element;function V(Z,Y){var b=F.getStyle(Z,"zIndex"),a=F.getStyle(Y,"zIndex"),X=(!b||isNaN(b))?0:parseInt(b,10),W=(!a||isNaN(a))?0:parseInt(a,10);if(X>W){return -1;}else{if(X<W){return 1;}else{return 0;}}}function Q(Y){var X=F.hasClass(Y,B.CSS_OVERLAY),W=YAHOO.widget.Panel;if(X&&!F.isAncestor(R,Y)){if(W&&F.hasClass(Y,W.CSS_PANEL)){S[S.length]=Y.parentNode;}else{S[S.length]=Y;}}}F.getElementsBy(Q,"DIV",document.body);S.sort(V);var O=S[0],U;if(O){U=F.getStyle(O,"zIndex");if(!isNaN(U)){var T=false;if(O!=R){T=true;}else{if(S.length>1){var P=F.getStyle(S[1],"zIndex");if(!isNaN(P)&&(U==P)){T=true;}}}if(T){this.cfg.setProperty("zindex",(parseInt(U,10)+2));}}}},destroy:function(){if(this.iframe){this.iframe.parentNode.removeChild(this.iframe);}this.iframe=null;B.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent,this);B.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent,this);G.textResizeEvent.unsubscribe(this._autoFillOnHeightChange);B.superclass.destroy.call(this);},forceContainerRedraw:function(){var O=this;F.addClass(O.element,"yui-force-redraw");setTimeout(function(){F.removeClass(O.element,"yui-force-redraw");},0);},toString:function(){return"Overlay "+this.id;}});}());(function(){YAHOO.widget.OverlayManager=function(G){this.init(G);};var D=YAHOO.widget.Overlay,C=YAHOO.util.Event,E=YAHOO.util.Dom,B=YAHOO.util.Config,F=YAHOO.util.CustomEvent,A=YAHOO.widget.OverlayManager;A.CSS_FOCUSED="focused";A.prototype={constructor:A,overlays:null,initDefaultConfig:function(){this.cfg.addProperty("overlays",{suppressEvent:true});this.cfg.addProperty("focusevent",{value:"mousedown"});},init:function(I){this.cfg=new B(this);this.initDefaultConfig();if(I){this.cfg.applyConfig(I,true);}this.cfg.fireQueue();var H=null;this.getActive=function(){return H;};this.focus=function(J){var K=this.find(J);if(K){K.focus();}};this.remove=function(K){var M=this.find(K),J;if(M){if(H==M){H=null;}var L=(M.element===null&&M.cfg===null)?true:false;if(!L){J=E.getStyle(M.element,"zIndex");M.cfg.setProperty("zIndex",-1000,true);}this.overlays.sort(this.compareZIndexDesc);this.overlays=this.overlays.slice(0,(this.overlays.length-1));M.hideEvent.unsubscribe(M.blur);M.destroyEvent.unsubscribe(this._onOverlayDestroy,M);M.focusEvent.unsubscribe(this._onOverlayFocusHandler,M);M.blurEvent.unsubscribe(this._onOverlayBlurHandler,M);if(!L){C.removeListener(M.element,this.cfg.getProperty("focusevent"),this._onOverlayElementFocus);M.cfg.setProperty("zIndex",J,true);M.cfg.setProperty("manager",null);}if(M.focusEvent._managed){M.focusEvent=null;}if(M.blurEvent._managed){M.blurEvent=null;}if(M.focus._managed){M.focus=null;}if(M.blur._managed){M.blur=null;}}};this.blurAll=function(){var K=this.overlays.length,J;if(K>0){J=K-1;do{this.overlays[J].blur();}while(J--);}};this._manageBlur=function(J){var K=false;if(H==J){E.removeClass(H.element,A.CSS_FOCUSED);H=null;K=true;}return K;};this._manageFocus=function(J){var K=false;if(H!=J){if(H){H.blur();}H=J;this.bringToTop(H);E.addClass(H.element,A.CSS_FOCUSED);K=true;}return K;};var G=this.cfg.getProperty("overlays");if(!this.overlays){this.overlays=[];}if(G){this.register(G);this.overlays.sort(this.compareZIndexDesc);}},_onOverlayElementFocus:function(I){var G=C.getTarget(I),H=this.close;if(H&&(G==H||E.isAncestor(H,G))){this.blur();}else{this.focus();}},_onOverlayDestroy:function(H,G,I){this.remove(I);},_onOverlayFocusHandler:function(H,G,I){this._manageFocus(I);},_onOverlayBlurHandler:function(H,G,I){this._manageBlur(I);},_bindFocus:function(G){var H=this;if(!G.focusEvent){G.focusEvent=G.createEvent("focus");G.focusEvent.signature=F.LIST;G.focusEvent._managed=true;}else{G.focusEvent.subscribe(H._onOverlayFocusHandler,G,H);}if(!G.focus){C.on(G.element,H.cfg.getProperty("focusevent"),H._onOverlayElementFocus,null,G);G.focus=function(){if(H._manageFocus(this)){if(this.cfg.getProperty("visible")&&this.focusFirst){this.focusFirst();}this.focusEvent.fire();}};G.focus._managed=true;}},_bindBlur:function(G){var H=this;if(!G.blurEvent){G.blurEvent=G.createEvent("blur");G.blurEvent.signature=F.LIST;G.focusEvent._managed=true;}else{G.blurEvent.subscribe(H._onOverlayBlurHandler,G,H);}if(!G.blur){G.blur=function(){if(H._manageBlur(this)){this.blurEvent.fire();}};G.blur._managed=true;}G.hideEvent.subscribe(G.blur);},_bindDestroy:function(G){var H=this;G.destroyEvent.subscribe(H._onOverlayDestroy,G,H);},_syncZIndex:function(G){var H=E.getStyle(G.element,"zIndex");if(!isNaN(H)){G.cfg.setProperty("zIndex",parseInt(H,10));}else{G.cfg.setProperty("zIndex",0);}},register:function(G){var J=false,H,I;if(G instanceof D){G.cfg.addProperty("manager",{value:this});this._bindFocus(G);this._bindBlur(G);this._bindDestroy(G);this._syncZIndex(G);this.overlays.push(G);this.bringToTop(G);J=true;}else{if(G instanceof Array){for(H=0,I=G.length;H<I;H++){J=this.register(G[H])||J;}}}return J;},bringToTop:function(M){var I=this.find(M),L,G,J;if(I){J=this.overlays;J.sort(this.compareZIndexDesc);G=J[0];if(G){L=E.getStyle(G.element,"zIndex");
if(!isNaN(L)){var K=false;if(G!==I){K=true;}else{if(J.length>1){var H=E.getStyle(J[1].element,"zIndex");if(!isNaN(H)&&(L==H)){K=true;}}}if(K){I.cfg.setProperty("zindex",(parseInt(L,10)+2));}}J.sort(this.compareZIndexDesc);}}},find:function(G){var K=G instanceof D,I=this.overlays,M=I.length,J=null,L,H;if(K||typeof G=="string"){for(H=M-1;H>=0;H--){L=I[H];if((K&&(L===G))||(L.id==G)){J=L;break;}}}return J;},compareZIndexDesc:function(J,I){var H=(J.cfg)?J.cfg.getProperty("zIndex"):null,G=(I.cfg)?I.cfg.getProperty("zIndex"):null;if(H===null&&G===null){return 0;}else{if(H===null){return 1;}else{if(G===null){return -1;}else{if(H>G){return -1;}else{if(H<G){return 1;}else{return 0;}}}}}},showAll:function(){var H=this.overlays,I=H.length,G;for(G=I-1;G>=0;G--){H[G].show();}},hideAll:function(){var H=this.overlays,I=H.length,G;for(G=I-1;G>=0;G--){H[G].hide();}},toString:function(){return"OverlayManager";}};}());(function(){YAHOO.widget.Tooltip=function(P,O){YAHOO.widget.Tooltip.superclass.constructor.call(this,P,O);};var E=YAHOO.lang,N=YAHOO.util.Event,M=YAHOO.util.CustomEvent,C=YAHOO.util.Dom,J=YAHOO.widget.Tooltip,H=YAHOO.env.ua,G=(H.ie&&(H.ie<=6||document.compatMode=="BackCompat")),F,I={"PREVENT_OVERLAP":{key:"preventoverlap",value:true,validator:E.isBoolean,supercedes:["x","y","xy"]},"SHOW_DELAY":{key:"showdelay",value:200,validator:E.isNumber},"AUTO_DISMISS_DELAY":{key:"autodismissdelay",value:5000,validator:E.isNumber},"HIDE_DELAY":{key:"hidedelay",value:250,validator:E.isNumber},"TEXT":{key:"text",suppressEvent:true},"CONTAINER":{key:"container"},"DISABLED":{key:"disabled",value:false,suppressEvent:true}},A={"CONTEXT_MOUSE_OVER":"contextMouseOver","CONTEXT_MOUSE_OUT":"contextMouseOut","CONTEXT_TRIGGER":"contextTrigger"};J.CSS_TOOLTIP="yui-tt";function K(Q,O){var P=this.cfg,R=P.getProperty("width");if(R==O){P.setProperty("width",Q);}}function D(P,O){if("_originalWidth" in this){K.call(this,this._originalWidth,this._forcedWidth);}var Q=document.body,U=this.cfg,T=U.getProperty("width"),R,S;if((!T||T=="auto")&&(U.getProperty("container")!=Q||U.getProperty("x")>=C.getViewportWidth()||U.getProperty("y")>=C.getViewportHeight())){S=this.element.cloneNode(true);S.style.visibility="hidden";S.style.top="0px";S.style.left="0px";Q.appendChild(S);R=(S.offsetWidth+"px");Q.removeChild(S);S=null;U.setProperty("width",R);U.refireEvent("xy");this._originalWidth=T||"";this._forcedWidth=R;}}function B(P,O,Q){this.render(Q);}function L(){N.onDOMReady(B,this.cfg.getProperty("container"),this);}YAHOO.extend(J,YAHOO.widget.Overlay,{init:function(P,O){J.superclass.init.call(this,P);this.beforeInitEvent.fire(J);C.addClass(this.element,J.CSS_TOOLTIP);if(O){this.cfg.applyConfig(O,true);}this.cfg.queueProperty("visible",false);this.cfg.queueProperty("constraintoviewport",true);this.setBody("");this.subscribe("changeContent",D);this.subscribe("init",L);this.subscribe("render",this.onRender);this.initEvent.fire(J);},initEvents:function(){J.superclass.initEvents.call(this);var O=M.LIST;this.contextMouseOverEvent=this.createEvent(A.CONTEXT_MOUSE_OVER);this.contextMouseOverEvent.signature=O;this.contextMouseOutEvent=this.createEvent(A.CONTEXT_MOUSE_OUT);this.contextMouseOutEvent.signature=O;this.contextTriggerEvent=this.createEvent(A.CONTEXT_TRIGGER);this.contextTriggerEvent.signature=O;},initDefaultConfig:function(){J.superclass.initDefaultConfig.call(this);this.cfg.addProperty(I.PREVENT_OVERLAP.key,{value:I.PREVENT_OVERLAP.value,validator:I.PREVENT_OVERLAP.validator,supercedes:I.PREVENT_OVERLAP.supercedes});this.cfg.addProperty(I.SHOW_DELAY.key,{handler:this.configShowDelay,value:200,validator:I.SHOW_DELAY.validator});this.cfg.addProperty(I.AUTO_DISMISS_DELAY.key,{handler:this.configAutoDismissDelay,value:I.AUTO_DISMISS_DELAY.value,validator:I.AUTO_DISMISS_DELAY.validator});this.cfg.addProperty(I.HIDE_DELAY.key,{handler:this.configHideDelay,value:I.HIDE_DELAY.value,validator:I.HIDE_DELAY.validator});this.cfg.addProperty(I.TEXT.key,{handler:this.configText,suppressEvent:I.TEXT.suppressEvent});this.cfg.addProperty(I.CONTAINER.key,{handler:this.configContainer,value:document.body});this.cfg.addProperty(I.DISABLED.key,{handler:this.configContainer,value:I.DISABLED.value,supressEvent:I.DISABLED.suppressEvent});},configText:function(P,O,Q){var R=O[0];if(R){this.setBody(R);}},configContainer:function(Q,P,R){var O=P[0];if(typeof O=="string"){this.cfg.setProperty("container",document.getElementById(O),true);}},_removeEventListeners:function(){var R=this._context,O,Q,P;if(R){O=R.length;if(O>0){P=O-1;do{Q=R[P];N.removeListener(Q,"mouseover",this.onContextMouseOver);N.removeListener(Q,"mousemove",this.onContextMouseMove);N.removeListener(Q,"mouseout",this.onContextMouseOut);}while(P--);}}},configContext:function(T,P,U){var S=P[0],V,O,R,Q;if(S){if(!(S instanceof Array)){if(typeof S=="string"){this.cfg.setProperty("context",[document.getElementById(S)],true);}else{this.cfg.setProperty("context",[S],true);}S=this.cfg.getProperty("context");}this._removeEventListeners();this._context=S;V=this._context;if(V){O=V.length;if(O>0){Q=O-1;do{R=V[Q];N.on(R,"mouseover",this.onContextMouseOver,this);N.on(R,"mousemove",this.onContextMouseMove,this);N.on(R,"mouseout",this.onContextMouseOut,this);}while(Q--);}}}},onContextMouseMove:function(P,O){O.pageX=N.getPageX(P);O.pageY=N.getPageY(P);},onContextMouseOver:function(Q,P){var O=this;if(O.title){P._tempTitle=O.title;O.title="";}if(P.fireEvent("contextMouseOver",O,Q)!==false&&!P.cfg.getProperty("disabled")){if(P.hideProcId){clearTimeout(P.hideProcId);P.hideProcId=null;}N.on(O,"mousemove",P.onContextMouseMove,P);P.showProcId=P.doShow(Q,O);}},onContextMouseOut:function(Q,P){var O=this;if(P._tempTitle){O.title=P._tempTitle;P._tempTitle=null;}if(P.showProcId){clearTimeout(P.showProcId);P.showProcId=null;}if(P.hideProcId){clearTimeout(P.hideProcId);P.hideProcId=null;}P.fireEvent("contextMouseOut",O,Q);P.hideProcId=setTimeout(function(){P.hide();},P.cfg.getProperty("hidedelay"));},doShow:function(Q,O){var R=25,P=this;
if(H.opera&&O.tagName&&O.tagName.toUpperCase()=="A"){R+=12;}return setTimeout(function(){var S=P.cfg.getProperty("text");if(P._tempTitle&&(S===""||YAHOO.lang.isUndefined(S)||YAHOO.lang.isNull(S))){P.setBody(P._tempTitle);}else{P.cfg.refireEvent("text");}P.moveTo(P.pageX,P.pageY+R);if(P.cfg.getProperty("preventoverlap")){P.preventOverlap(P.pageX,P.pageY);}N.removeListener(O,"mousemove",P.onContextMouseMove);P.contextTriggerEvent.fire(O);P.show();P.hideProcId=P.doHide();},this.cfg.getProperty("showdelay"));},doHide:function(){var O=this;return setTimeout(function(){O.hide();},this.cfg.getProperty("autodismissdelay"));},preventOverlap:function(S,R){var O=this.element.offsetHeight,Q=new YAHOO.util.Point(S,R),P=C.getRegion(this.element);P.top-=5;P.left-=5;P.right+=5;P.bottom+=5;if(P.contains(Q)){this.cfg.setProperty("y",(R-O-5));}},onRender:function(S,R){function T(){var W=this.element,V=this.underlay;if(V){V.style.width=(W.offsetWidth+6)+"px";V.style.height=(W.offsetHeight+1)+"px";}}function P(){C.addClass(this.underlay,"yui-tt-shadow-visible");if(H.ie){this.forceUnderlayRedraw();}}function O(){C.removeClass(this.underlay,"yui-tt-shadow-visible");}function U(){var X=this.underlay,W,V,Z,Y;if(!X){W=this.element;V=YAHOO.widget.Module;Z=H.ie;Y=this;if(!F){F=document.createElement("div");F.className="yui-tt-shadow";}X=F.cloneNode(false);W.appendChild(X);this.underlay=X;this._shadow=this.underlay;P.call(this);this.subscribe("beforeShow",P);this.subscribe("hide",O);if(G){window.setTimeout(function(){T.call(Y);},0);this.cfg.subscribeToConfigEvent("width",T);this.cfg.subscribeToConfigEvent("height",T);this.subscribe("changeContent",T);V.textResizeEvent.subscribe(T,this,true);this.subscribe("destroy",function(){V.textResizeEvent.unsubscribe(T,this);});}}}function Q(){U.call(this);this.unsubscribe("beforeShow",Q);}if(this.cfg.getProperty("visible")){U.call(this);}else{this.subscribe("beforeShow",Q);}},forceUnderlayRedraw:function(){var O=this;C.addClass(O.underlay,"yui-force-redraw");setTimeout(function(){C.removeClass(O.underlay,"yui-force-redraw");},0);},destroy:function(){this._removeEventListeners();J.superclass.destroy.call(this);},toString:function(){return"Tooltip "+this.id;}});}());(function(){YAHOO.widget.Panel=function(V,U){YAHOO.widget.Panel.superclass.constructor.call(this,V,U);};var S=null;var E=YAHOO.lang,F=YAHOO.util,A=F.Dom,T=F.Event,M=F.CustomEvent,K=YAHOO.util.KeyListener,I=F.Config,H=YAHOO.widget.Overlay,O=YAHOO.widget.Panel,L=YAHOO.env.ua,P=(L.ie&&(L.ie<=6||document.compatMode=="BackCompat")),G,Q,C,D={"SHOW_MASK":"showMask","HIDE_MASK":"hideMask","DRAG":"drag"},N={"CLOSE":{key:"close",value:true,validator:E.isBoolean,supercedes:["visible"]},"DRAGGABLE":{key:"draggable",value:(F.DD?true:false),validator:E.isBoolean,supercedes:["visible"]},"DRAG_ONLY":{key:"dragonly",value:false,validator:E.isBoolean,supercedes:["draggable"]},"UNDERLAY":{key:"underlay",value:"shadow",supercedes:["visible"]},"MODAL":{key:"modal",value:false,validator:E.isBoolean,supercedes:["visible","zindex"]},"KEY_LISTENERS":{key:"keylisteners",suppressEvent:true,supercedes:["visible"]},"STRINGS":{key:"strings",supercedes:["close"],validator:E.isObject,value:{close:"Close"}}};O.CSS_PANEL="yui-panel";O.CSS_PANEL_CONTAINER="yui-panel-container";O.FOCUSABLE=["a","button","select","textarea","input","iframe"];function J(V,U){if(!this.header&&this.cfg.getProperty("draggable")){this.setHeader("&#160;");}}function R(V,U,W){var Z=W[0],X=W[1],Y=this.cfg,a=Y.getProperty("width");if(a==X){Y.setProperty("width",Z);}this.unsubscribe("hide",R,W);}function B(V,U){var Y,X,W;if(P){Y=this.cfg;X=Y.getProperty("width");if(!X||X=="auto"){W=(this.element.offsetWidth+"px");Y.setProperty("width",W);this.subscribe("hide",R,[(X||""),W]);}}}YAHOO.extend(O,H,{init:function(V,U){O.superclass.init.call(this,V);this.beforeInitEvent.fire(O);A.addClass(this.element,O.CSS_PANEL);this.buildWrapper();if(U){this.cfg.applyConfig(U,true);}this.subscribe("showMask",this._addFocusHandlers);this.subscribe("hideMask",this._removeFocusHandlers);this.subscribe("beforeRender",J);this.subscribe("render",function(){this.setFirstLastFocusable();this.subscribe("changeContent",this.setFirstLastFocusable);});this.subscribe("show",this.focusFirst);this.initEvent.fire(O);},_onElementFocus:function(Z){if(S===this){var Y=T.getTarget(Z),X=document.documentElement,V=(Y!==X&&Y!==window);if(V&&Y!==this.element&&Y!==this.mask&&!A.isAncestor(this.element,Y)){try{if(this.firstElement){this.firstElement.focus();}else{if(this._modalFocus){this._modalFocus.focus();}else{this.innerElement.focus();}}}catch(W){try{if(V&&Y!==document.body){Y.blur();}}catch(U){}}}}},_addFocusHandlers:function(V,U){if(!this.firstElement){if(L.webkit||L.opera){if(!this._modalFocus){this._createHiddenFocusElement();}}else{this.innerElement.tabIndex=0;}}this.setTabLoop(this.firstElement,this.lastElement);T.onFocus(document.documentElement,this._onElementFocus,this,true);S=this;},_createHiddenFocusElement:function(){var U=document.createElement("button");U.style.height="1px";U.style.width="1px";U.style.position="absolute";U.style.left="-10000em";U.style.opacity=0;U.tabIndex=-1;this.innerElement.appendChild(U);this._modalFocus=U;},_removeFocusHandlers:function(V,U){T.removeFocusListener(document.documentElement,this._onElementFocus,this);if(S==this){S=null;}},focusFirst:function(W,U,Y){var V=this.firstElement;if(U&&U[1]){T.stopEvent(U[1]);}if(V){try{V.focus();}catch(X){}}},focusLast:function(W,U,Y){var V=this.lastElement;if(U&&U[1]){T.stopEvent(U[1]);}if(V){try{V.focus();}catch(X){}}},setTabLoop:function(X,Z){var V=this.preventBackTab,W=this.preventTabOut,U=this.showEvent,Y=this.hideEvent;if(V){V.disable();U.unsubscribe(V.enable,V);Y.unsubscribe(V.disable,V);V=this.preventBackTab=null;}if(W){W.disable();U.unsubscribe(W.enable,W);Y.unsubscribe(W.disable,W);W=this.preventTabOut=null;}if(X){this.preventBackTab=new K(X,{shift:true,keys:9},{fn:this.focusLast,scope:this,correctScope:true});V=this.preventBackTab;U.subscribe(V.enable,V,true);
Y.subscribe(V.disable,V,true);}if(Z){this.preventTabOut=new K(Z,{shift:false,keys:9},{fn:this.focusFirst,scope:this,correctScope:true});W=this.preventTabOut;U.subscribe(W.enable,W,true);Y.subscribe(W.disable,W,true);}},getFocusableElements:function(U){U=U||this.innerElement;var X={};for(var W=0;W<O.FOCUSABLE.length;W++){X[O.FOCUSABLE[W]]=true;}function V(Y){if(Y.focus&&Y.type!=="hidden"&&!Y.disabled&&X[Y.tagName.toLowerCase()]){return true;}return false;}return A.getElementsBy(V,null,U);},setFirstLastFocusable:function(){this.firstElement=null;this.lastElement=null;var U=this.getFocusableElements();this.focusableElements=U;if(U.length>0){this.firstElement=U[0];this.lastElement=U[U.length-1];}if(this.cfg.getProperty("modal")){this.setTabLoop(this.firstElement,this.lastElement);}},initEvents:function(){O.superclass.initEvents.call(this);var U=M.LIST;this.showMaskEvent=this.createEvent(D.SHOW_MASK);this.showMaskEvent.signature=U;this.hideMaskEvent=this.createEvent(D.HIDE_MASK);this.hideMaskEvent.signature=U;this.dragEvent=this.createEvent(D.DRAG);this.dragEvent.signature=U;},initDefaultConfig:function(){O.superclass.initDefaultConfig.call(this);this.cfg.addProperty(N.CLOSE.key,{handler:this.configClose,value:N.CLOSE.value,validator:N.CLOSE.validator,supercedes:N.CLOSE.supercedes});this.cfg.addProperty(N.DRAGGABLE.key,{handler:this.configDraggable,value:(F.DD)?true:false,validator:N.DRAGGABLE.validator,supercedes:N.DRAGGABLE.supercedes});this.cfg.addProperty(N.DRAG_ONLY.key,{value:N.DRAG_ONLY.value,validator:N.DRAG_ONLY.validator,supercedes:N.DRAG_ONLY.supercedes});this.cfg.addProperty(N.UNDERLAY.key,{handler:this.configUnderlay,value:N.UNDERLAY.value,supercedes:N.UNDERLAY.supercedes});this.cfg.addProperty(N.MODAL.key,{handler:this.configModal,value:N.MODAL.value,validator:N.MODAL.validator,supercedes:N.MODAL.supercedes});this.cfg.addProperty(N.KEY_LISTENERS.key,{handler:this.configKeyListeners,suppressEvent:N.KEY_LISTENERS.suppressEvent,supercedes:N.KEY_LISTENERS.supercedes});this.cfg.addProperty(N.STRINGS.key,{value:N.STRINGS.value,handler:this.configStrings,validator:N.STRINGS.validator,supercedes:N.STRINGS.supercedes});},configClose:function(X,V,Y){var Z=V[0],W=this.close,U=this.cfg.getProperty("strings");if(Z){if(!W){if(!C){C=document.createElement("a");C.className="container-close";C.href="#";}W=C.cloneNode(true);this.innerElement.appendChild(W);W.innerHTML=(U&&U.close)?U.close:"&#160;";T.on(W,"click",this._doClose,this,true);this.close=W;}else{W.style.display="block";}}else{if(W){W.style.display="none";}}},_doClose:function(U){T.preventDefault(U);this.hide();},configDraggable:function(V,U,W){var X=U[0];if(X){if(!F.DD){this.cfg.setProperty("draggable",false);return;}if(this.header){A.setStyle(this.header,"cursor","move");this.registerDragDrop();}this.subscribe("beforeShow",B);}else{if(this.dd){this.dd.unreg();}if(this.header){A.setStyle(this.header,"cursor","auto");}this.unsubscribe("beforeShow",B);}},configUnderlay:function(d,c,Z){var b=(this.platform=="mac"&&L.gecko),e=c[0].toLowerCase(),V=this.underlay,W=this.element;function X(){var f=false;if(!V){if(!Q){Q=document.createElement("div");Q.className="underlay";}V=Q.cloneNode(false);this.element.appendChild(V);this.underlay=V;if(P){this.sizeUnderlay();this.cfg.subscribeToConfigEvent("width",this.sizeUnderlay);this.cfg.subscribeToConfigEvent("height",this.sizeUnderlay);this.changeContentEvent.subscribe(this.sizeUnderlay);YAHOO.widget.Module.textResizeEvent.subscribe(this.sizeUnderlay,this,true);}if(L.webkit&&L.webkit<420){this.changeContentEvent.subscribe(this.forceUnderlayRedraw);}f=true;}}function a(){var f=X.call(this);if(!f&&P){this.sizeUnderlay();}this._underlayDeferred=false;this.beforeShowEvent.unsubscribe(a);}function Y(){if(this._underlayDeferred){this.beforeShowEvent.unsubscribe(a);this._underlayDeferred=false;}if(V){this.cfg.unsubscribeFromConfigEvent("width",this.sizeUnderlay);this.cfg.unsubscribeFromConfigEvent("height",this.sizeUnderlay);this.changeContentEvent.unsubscribe(this.sizeUnderlay);this.changeContentEvent.unsubscribe(this.forceUnderlayRedraw);YAHOO.widget.Module.textResizeEvent.unsubscribe(this.sizeUnderlay,this,true);this.element.removeChild(V);this.underlay=null;}}switch(e){case"shadow":A.removeClass(W,"matte");A.addClass(W,"shadow");break;case"matte":if(!b){Y.call(this);}A.removeClass(W,"shadow");A.addClass(W,"matte");break;default:if(!b){Y.call(this);}A.removeClass(W,"shadow");A.removeClass(W,"matte");break;}if((e=="shadow")||(b&&!V)){if(this.cfg.getProperty("visible")){var U=X.call(this);if(!U&&P){this.sizeUnderlay();}}else{if(!this._underlayDeferred){this.beforeShowEvent.subscribe(a);this._underlayDeferred=true;}}}},configModal:function(V,U,X){var W=U[0];if(W){if(!this._hasModalityEventListeners){this.subscribe("beforeShow",this.buildMask);this.subscribe("beforeShow",this.bringToTop);this.subscribe("beforeShow",this.showMask);this.subscribe("hide",this.hideMask);H.windowResizeEvent.subscribe(this.sizeMask,this,true);this._hasModalityEventListeners=true;}}else{if(this._hasModalityEventListeners){if(this.cfg.getProperty("visible")){this.hideMask();this.removeMask();}this.unsubscribe("beforeShow",this.buildMask);this.unsubscribe("beforeShow",this.bringToTop);this.unsubscribe("beforeShow",this.showMask);this.unsubscribe("hide",this.hideMask);H.windowResizeEvent.unsubscribe(this.sizeMask,this);this._hasModalityEventListeners=false;}}},removeMask:function(){var V=this.mask,U;if(V){this.hideMask();U=V.parentNode;if(U){U.removeChild(V);}this.mask=null;}},configKeyListeners:function(X,U,a){var W=U[0],Z,Y,V;if(W){if(W instanceof Array){Y=W.length;for(V=0;V<Y;V++){Z=W[V];if(!I.alreadySubscribed(this.showEvent,Z.enable,Z)){this.showEvent.subscribe(Z.enable,Z,true);}if(!I.alreadySubscribed(this.hideEvent,Z.disable,Z)){this.hideEvent.subscribe(Z.disable,Z,true);this.destroyEvent.subscribe(Z.disable,Z,true);}}}else{if(!I.alreadySubscribed(this.showEvent,W.enable,W)){this.showEvent.subscribe(W.enable,W,true);}if(!I.alreadySubscribed(this.hideEvent,W.disable,W)){this.hideEvent.subscribe(W.disable,W,true);
this.destroyEvent.subscribe(W.disable,W,true);}}}},configStrings:function(V,U,W){var X=E.merge(N.STRINGS.value,U[0]);this.cfg.setProperty(N.STRINGS.key,X,true);},configHeight:function(X,V,Y){var U=V[0],W=this.innerElement;A.setStyle(W,"height",U);this.cfg.refireEvent("iframe");},_autoFillOnHeightChange:function(X,V,W){O.superclass._autoFillOnHeightChange.apply(this,arguments);if(P){var U=this;setTimeout(function(){U.sizeUnderlay();},0);}},configWidth:function(X,U,Y){var W=U[0],V=this.innerElement;A.setStyle(V,"width",W);this.cfg.refireEvent("iframe");},configzIndex:function(V,U,X){O.superclass.configzIndex.call(this,V,U,X);if(this.mask||this.cfg.getProperty("modal")===true){var W=A.getStyle(this.element,"zIndex");if(!W||isNaN(W)){W=0;}if(W===0){this.cfg.setProperty("zIndex",1);}else{this.stackMask();}}},buildWrapper:function(){var W=this.element.parentNode,U=this.element,V=document.createElement("div");V.className=O.CSS_PANEL_CONTAINER;V.id=U.id+"_c";if(W){W.insertBefore(V,U);}V.appendChild(U);this.element=V;this.innerElement=U;A.setStyle(this.innerElement,"visibility","inherit");},sizeUnderlay:function(){var V=this.underlay,U;if(V){U=this.element;V.style.width=U.offsetWidth+"px";V.style.height=U.offsetHeight+"px";}},registerDragDrop:function(){var V=this;if(this.header){if(!F.DD){return;}var U=(this.cfg.getProperty("dragonly")===true);this.dd=new F.DD(this.element.id,this.id,{dragOnly:U});if(!this.header.id){this.header.id=this.id+"_h";}this.dd.startDrag=function(){var X,Z,W,c,b,a;if(YAHOO.env.ua.ie==6){A.addClass(V.element,"drag");}if(V.cfg.getProperty("constraintoviewport")){var Y=H.VIEWPORT_OFFSET;X=V.element.offsetHeight;Z=V.element.offsetWidth;W=A.getViewportWidth();c=A.getViewportHeight();b=A.getDocumentScrollLeft();a=A.getDocumentScrollTop();if(X+Y<c){this.minY=a+Y;this.maxY=a+c-X-Y;}else{this.minY=a+Y;this.maxY=a+Y;}if(Z+Y<W){this.minX=b+Y;this.maxX=b+W-Z-Y;}else{this.minX=b+Y;this.maxX=b+Y;}this.constrainX=true;this.constrainY=true;}else{this.constrainX=false;this.constrainY=false;}V.dragEvent.fire("startDrag",arguments);};this.dd.onDrag=function(){V.syncPosition();V.cfg.refireEvent("iframe");if(this.platform=="mac"&&YAHOO.env.ua.gecko){this.showMacGeckoScrollbars();}V.dragEvent.fire("onDrag",arguments);};this.dd.endDrag=function(){if(YAHOO.env.ua.ie==6){A.removeClass(V.element,"drag");}V.dragEvent.fire("endDrag",arguments);V.moveEvent.fire(V.cfg.getProperty("xy"));};this.dd.setHandleElId(this.header.id);this.dd.addInvalidHandleType("INPUT");this.dd.addInvalidHandleType("SELECT");this.dd.addInvalidHandleType("TEXTAREA");}},buildMask:function(){var U=this.mask;if(!U){if(!G){G=document.createElement("div");G.className="mask";G.innerHTML="&#160;";}U=G.cloneNode(true);U.id=this.id+"_mask";document.body.insertBefore(U,document.body.firstChild);this.mask=U;if(YAHOO.env.ua.gecko&&this.platform=="mac"){A.addClass(this.mask,"block-scrollbars");}this.stackMask();}},hideMask:function(){if(this.cfg.getProperty("modal")&&this.mask){this.mask.style.display="none";A.removeClass(document.body,"masked");this.hideMaskEvent.fire();}},showMask:function(){if(this.cfg.getProperty("modal")&&this.mask){A.addClass(document.body,"masked");this.sizeMask();this.mask.style.display="block";this.showMaskEvent.fire();}},sizeMask:function(){if(this.mask){var V=this.mask,W=A.getViewportWidth(),U=A.getViewportHeight();if(V.offsetHeight>U){V.style.height=U+"px";}if(V.offsetWidth>W){V.style.width=W+"px";}V.style.height=A.getDocumentHeight()+"px";V.style.width=A.getDocumentWidth()+"px";}},stackMask:function(){if(this.mask){var U=A.getStyle(this.element,"zIndex");if(!YAHOO.lang.isUndefined(U)&&!isNaN(U)){A.setStyle(this.mask,"zIndex",U-1);}}},render:function(U){return O.superclass.render.call(this,U,this.innerElement);},destroy:function(){H.windowResizeEvent.unsubscribe(this.sizeMask,this);this.removeMask();if(this.close){T.purgeElement(this.close);}O.superclass.destroy.call(this);},forceUnderlayRedraw:function(){var U=this.underlay;A.addClass(U,"yui-force-redraw");setTimeout(function(){A.removeClass(U,"yui-force-redraw");},0);},toString:function(){return"Panel "+this.id;}});}());(function(){YAHOO.widget.Dialog=function(J,I){YAHOO.widget.Dialog.superclass.constructor.call(this,J,I);};var B=YAHOO.util.Event,G=YAHOO.util.CustomEvent,E=YAHOO.util.Dom,A=YAHOO.widget.Dialog,F=YAHOO.lang,H={"BEFORE_SUBMIT":"beforeSubmit","SUBMIT":"submit","MANUAL_SUBMIT":"manualSubmit","ASYNC_SUBMIT":"asyncSubmit","FORM_SUBMIT":"formSubmit","CANCEL":"cancel"},C={"POST_METHOD":{key:"postmethod",value:"async"},"POST_DATA":{key:"postdata",value:null},"BUTTONS":{key:"buttons",value:"none",supercedes:["visible"]},"HIDEAFTERSUBMIT":{key:"hideaftersubmit",value:true}};A.CSS_DIALOG="yui-dialog";function D(){var L=this._aButtons,J,K,I;if(F.isArray(L)){J=L.length;if(J>0){I=J-1;do{K=L[I];if(YAHOO.widget.Button&&K instanceof YAHOO.widget.Button){K.destroy();}else{if(K.tagName.toUpperCase()=="BUTTON"){B.purgeElement(K);B.purgeElement(K,false);}}}while(I--);}}}YAHOO.extend(A,YAHOO.widget.Panel,{form:null,initDefaultConfig:function(){A.superclass.initDefaultConfig.call(this);this.callback={success:null,failure:null,argument:null};this.cfg.addProperty(C.POST_METHOD.key,{handler:this.configPostMethod,value:C.POST_METHOD.value,validator:function(I){if(I!="form"&&I!="async"&&I!="none"&&I!="manual"){return false;}else{return true;}}});this.cfg.addProperty(C.POST_DATA.key,{value:C.POST_DATA.value});this.cfg.addProperty(C.HIDEAFTERSUBMIT.key,{value:C.HIDEAFTERSUBMIT.value});this.cfg.addProperty(C.BUTTONS.key,{handler:this.configButtons,value:C.BUTTONS.value,supercedes:C.BUTTONS.supercedes});},initEvents:function(){A.superclass.initEvents.call(this);var I=G.LIST;this.beforeSubmitEvent=this.createEvent(H.BEFORE_SUBMIT);this.beforeSubmitEvent.signature=I;this.submitEvent=this.createEvent(H.SUBMIT);this.submitEvent.signature=I;this.manualSubmitEvent=this.createEvent(H.MANUAL_SUBMIT);this.manualSubmitEvent.signature=I;this.asyncSubmitEvent=this.createEvent(H.ASYNC_SUBMIT);
this.asyncSubmitEvent.signature=I;this.formSubmitEvent=this.createEvent(H.FORM_SUBMIT);this.formSubmitEvent.signature=I;this.cancelEvent=this.createEvent(H.CANCEL);this.cancelEvent.signature=I;},init:function(J,I){A.superclass.init.call(this,J);this.beforeInitEvent.fire(A);E.addClass(this.element,A.CSS_DIALOG);this.cfg.setProperty("visible",false);if(I){this.cfg.applyConfig(I,true);}this.showEvent.subscribe(this.focusFirst,this,true);this.beforeHideEvent.subscribe(this.blurButtons,this,true);this.subscribe("changeBody",this.registerForm);this.initEvent.fire(A);},doSubmit:function(){var P=YAHOO.util.Connect,Q=this.form,K=false,N=false,R,M,L,I;switch(this.cfg.getProperty("postmethod")){case"async":R=Q.elements;M=R.length;if(M>0){L=M-1;do{if(R[L].type=="file"){K=true;break;}}while(L--);}if(K&&YAHOO.env.ua.ie&&this.isSecure){N=true;}I=this._getFormAttributes(Q);P.setForm(Q,K,N);var J=this.cfg.getProperty("postdata");var O=P.asyncRequest(I.method,I.action,this.callback,J);this.asyncSubmitEvent.fire(O);break;case"form":Q.submit();this.formSubmitEvent.fire();break;case"none":case"manual":this.manualSubmitEvent.fire();break;}},_getFormAttributes:function(K){var I={method:null,action:null};if(K){if(K.getAttributeNode){var J=K.getAttributeNode("action");var L=K.getAttributeNode("method");if(J){I.action=J.value;}if(L){I.method=L.value;}}else{I.action=K.getAttribute("action");I.method=K.getAttribute("method");}}I.method=(F.isString(I.method)?I.method:"POST").toUpperCase();I.action=F.isString(I.action)?I.action:"";return I;},registerForm:function(){var I=this.element.getElementsByTagName("form")[0];if(this.form){if(this.form==I&&E.isAncestor(this.element,this.form)){return;}else{B.purgeElement(this.form);this.form=null;}}if(!I){I=document.createElement("form");I.name="frm_"+this.id;this.body.appendChild(I);}if(I){this.form=I;B.on(I,"submit",this._submitHandler,this,true);}},_submitHandler:function(I){B.stopEvent(I);this.submit();this.form.blur();},setTabLoop:function(I,J){I=I||this.firstButton;J=this.lastButton||J;A.superclass.setTabLoop.call(this,I,J);},setFirstLastFocusable:function(){A.superclass.setFirstLastFocusable.call(this);var J,I,K,L=this.focusableElements;this.firstFormElement=null;this.lastFormElement=null;if(this.form&&L&&L.length>0){I=L.length;for(J=0;J<I;++J){K=L[J];if(this.form===K.form){this.firstFormElement=K;break;}}for(J=I-1;J>=0;--J){K=L[J];if(this.form===K.form){this.lastFormElement=K;break;}}}},configClose:function(J,I,K){A.superclass.configClose.apply(this,arguments);},_doClose:function(I){B.preventDefault(I);this.cancel();},configButtons:function(S,R,M){var N=YAHOO.widget.Button,U=R[0],K=this.innerElement,T,P,J,Q,O,I,L;D.call(this);this._aButtons=null;if(F.isArray(U)){O=document.createElement("span");O.className="button-group";Q=U.length;this._aButtons=[];this.defaultHtmlButton=null;for(L=0;L<Q;L++){T=U[L];if(N){J=new N({label:T.text});J.appendTo(O);P=J.get("element");if(T.isDefault){J.addClass("default");this.defaultHtmlButton=P;}if(F.isFunction(T.handler)){J.set("onclick",{fn:T.handler,obj:this,scope:this});}else{if(F.isObject(T.handler)&&F.isFunction(T.handler.fn)){J.set("onclick",{fn:T.handler.fn,obj:((!F.isUndefined(T.handler.obj))?T.handler.obj:this),scope:(T.handler.scope||this)});}}this._aButtons[this._aButtons.length]=J;}else{P=document.createElement("button");P.setAttribute("type","button");if(T.isDefault){P.className="default";this.defaultHtmlButton=P;}P.innerHTML=T.text;if(F.isFunction(T.handler)){B.on(P,"click",T.handler,this,true);}else{if(F.isObject(T.handler)&&F.isFunction(T.handler.fn)){B.on(P,"click",T.handler.fn,((!F.isUndefined(T.handler.obj))?T.handler.obj:this),(T.handler.scope||this));}}O.appendChild(P);this._aButtons[this._aButtons.length]=P;}T.htmlButton=P;if(L===0){this.firstButton=P;}if(L==(Q-1)){this.lastButton=P;}}this.setFooter(O);I=this.footer;if(E.inDocument(this.element)&&!E.isAncestor(K,I)){K.appendChild(I);}this.buttonSpan=O;}else{O=this.buttonSpan;I=this.footer;if(O&&I){I.removeChild(O);this.buttonSpan=null;this.firstButton=null;this.lastButton=null;this.defaultHtmlButton=null;}}this.changeContentEvent.fire();},getButtons:function(){return this._aButtons||null;},focusFirst:function(K,I,M){var J=this.firstFormElement;if(I&&I[1]){B.stopEvent(I[1]);}if(J){try{J.focus();}catch(L){}}else{if(this.defaultHtmlButton){this.focusDefaultButton();}else{this.focusFirstButton();}}},focusLast:function(K,I,M){var N=this.cfg.getProperty("buttons"),J=this.lastFormElement;if(I&&I[1]){B.stopEvent(I[1]);}if(N&&F.isArray(N)){this.focusLastButton();}else{if(J){try{J.focus();}catch(L){}}}},_getButton:function(J){var I=YAHOO.widget.Button;if(I&&J&&J.nodeName&&J.id){J=I.getButton(J.id)||J;}return J;},focusDefaultButton:function(){var I=this._getButton(this.defaultHtmlButton);if(I){try{I.focus();}catch(J){}}},blurButtons:function(){var N=this.cfg.getProperty("buttons"),K,M,J,I;if(N&&F.isArray(N)){K=N.length;if(K>0){I=(K-1);do{M=N[I];if(M){J=this._getButton(M.htmlButton);if(J){try{J.blur();}catch(L){}}}}while(I--);}}},focusFirstButton:function(){var L=this.cfg.getProperty("buttons"),K,I;if(L&&F.isArray(L)){K=L[0];if(K){I=this._getButton(K.htmlButton);if(I){try{I.focus();}catch(J){}}}}},focusLastButton:function(){var M=this.cfg.getProperty("buttons"),J,L,I;if(M&&F.isArray(M)){J=M.length;if(J>0){L=M[(J-1)];if(L){I=this._getButton(L.htmlButton);if(I){try{I.focus();}catch(K){}}}}}},configPostMethod:function(J,I,K){this.registerForm();},validate:function(){return true;},submit:function(){if(this.validate()){this.beforeSubmitEvent.fire();this.doSubmit();this.submitEvent.fire();if(this.cfg.getProperty("hideaftersubmit")){this.hide();}return true;}else{return false;}},cancel:function(){this.cancelEvent.fire();this.hide();},getData:function(){var Y=this.form,K,R,U,M,S,P,O,J,V,L,W,Z,I,N,a,X,T;function Q(c){var b=c.tagName.toUpperCase();return((b=="INPUT"||b=="TEXTAREA"||b=="SELECT")&&c.name==M);}if(Y){K=Y.elements;R=K.length;U={};for(X=0;X<R;X++){M=K[X].name;S=E.getElementsBy(Q,"*",Y);
P=S.length;if(P>0){if(P==1){S=S[0];O=S.type;J=S.tagName.toUpperCase();switch(J){case"INPUT":if(O=="checkbox"){U[M]=S.checked;}else{if(O!="radio"){U[M]=S.value;}}break;case"TEXTAREA":U[M]=S.value;break;case"SELECT":V=S.options;L=V.length;W=[];for(T=0;T<L;T++){Z=V[T];if(Z.selected){I=Z.value;if(!I||I===""){I=Z.text;}W[W.length]=I;}}U[M]=W;break;}}else{O=S[0].type;switch(O){case"radio":for(T=0;T<P;T++){N=S[T];if(N.checked){U[M]=N.value;break;}}break;case"checkbox":W=[];for(T=0;T<P;T++){a=S[T];if(a.checked){W[W.length]=a.value;}}U[M]=W;break;}}}}}return U;},destroy:function(){D.call(this);this._aButtons=null;var I=this.element.getElementsByTagName("form"),J;if(I.length>0){J=I[0];if(J){B.purgeElement(J);if(J.parentNode){J.parentNode.removeChild(J);}this.form=null;}}A.superclass.destroy.call(this);},toString:function(){return"Dialog "+this.id;}});}());(function(){YAHOO.widget.SimpleDialog=function(E,D){YAHOO.widget.SimpleDialog.superclass.constructor.call(this,E,D);};var C=YAHOO.util.Dom,B=YAHOO.widget.SimpleDialog,A={"ICON":{key:"icon",value:"none",suppressEvent:true},"TEXT":{key:"text",value:"",suppressEvent:true,supercedes:["icon"]}};B.ICON_BLOCK="blckicon";B.ICON_ALARM="alrticon";B.ICON_HELP="hlpicon";B.ICON_INFO="infoicon";B.ICON_WARN="warnicon";B.ICON_TIP="tipicon";B.ICON_CSS_CLASSNAME="yui-icon";B.CSS_SIMPLEDIALOG="yui-simple-dialog";YAHOO.extend(B,YAHOO.widget.Dialog,{initDefaultConfig:function(){B.superclass.initDefaultConfig.call(this);this.cfg.addProperty(A.ICON.key,{handler:this.configIcon,value:A.ICON.value,suppressEvent:A.ICON.suppressEvent});this.cfg.addProperty(A.TEXT.key,{handler:this.configText,value:A.TEXT.value,suppressEvent:A.TEXT.suppressEvent,supercedes:A.TEXT.supercedes});},init:function(E,D){B.superclass.init.call(this,E);this.beforeInitEvent.fire(B);C.addClass(this.element,B.CSS_SIMPLEDIALOG);this.cfg.queueProperty("postmethod","manual");if(D){this.cfg.applyConfig(D,true);}this.beforeRenderEvent.subscribe(function(){if(!this.body){this.setBody("");}},this,true);this.initEvent.fire(B);},registerForm:function(){B.superclass.registerForm.call(this);this.form.innerHTML+='<input type="hidden" name="'+this.id+'" value=""/>';},configIcon:function(F,E,J){var K=E[0],D=this.body,I=B.ICON_CSS_CLASSNAME,H,G;if(K&&K!="none"){H=C.getElementsByClassName(I,"*",D);if(H){G=H.parentNode;if(G){G.removeChild(H);H=null;}}if(K.indexOf(".")==-1){H=document.createElement("span");H.className=(I+" "+K);H.innerHTML="&#160;";}else{H=document.createElement("img");H.src=(this.imageRoot+K);H.className=I;}if(H){D.insertBefore(H,D.firstChild);}}},configText:function(E,D,F){var G=D[0];if(G){this.setBody(G);this.cfg.refireEvent("icon");}},toString:function(){return"SimpleDialog "+this.id;}});}());(function(){YAHOO.widget.ContainerEffect=function(E,H,G,D,F){if(!F){F=YAHOO.util.Anim;}this.overlay=E;this.attrIn=H;this.attrOut=G;this.targetElement=D||E.element;this.animClass=F;};var B=YAHOO.util.Dom,C=YAHOO.util.CustomEvent,A=YAHOO.widget.ContainerEffect;A.FADE=function(D,F){var G=YAHOO.util.Easing,I={attributes:{opacity:{from:0,to:1}},duration:F,method:G.easeIn},E={attributes:{opacity:{to:0}},duration:F,method:G.easeOut},H=new A(D,I,E,D.element);H.handleUnderlayStart=function(){var K=this.overlay.underlay;if(K&&YAHOO.env.ua.ie){var J=(K.filters&&K.filters.length>0);if(J){B.addClass(D.element,"yui-effect-fade");}}};H.handleUnderlayComplete=function(){var J=this.overlay.underlay;if(J&&YAHOO.env.ua.ie){B.removeClass(D.element,"yui-effect-fade");}};H.handleStartAnimateIn=function(K,J,L){B.addClass(L.overlay.element,"hide-select");if(!L.overlay.underlay){L.overlay.cfg.refireEvent("underlay");}L.handleUnderlayStart();L.overlay._setDomVisibility(true);B.setStyle(L.overlay.element,"opacity",0);};H.handleCompleteAnimateIn=function(K,J,L){B.removeClass(L.overlay.element,"hide-select");if(L.overlay.element.style.filter){L.overlay.element.style.filter=null;}L.handleUnderlayComplete();L.overlay.cfg.refireEvent("iframe");L.animateInCompleteEvent.fire();};H.handleStartAnimateOut=function(K,J,L){B.addClass(L.overlay.element,"hide-select");L.handleUnderlayStart();};H.handleCompleteAnimateOut=function(K,J,L){B.removeClass(L.overlay.element,"hide-select");if(L.overlay.element.style.filter){L.overlay.element.style.filter=null;}L.overlay._setDomVisibility(false);B.setStyle(L.overlay.element,"opacity",1);L.handleUnderlayComplete();L.overlay.cfg.refireEvent("iframe");L.animateOutCompleteEvent.fire();};H.init();return H;};A.SLIDE=function(F,D){var I=YAHOO.util.Easing,L=F.cfg.getProperty("x")||B.getX(F.element),K=F.cfg.getProperty("y")||B.getY(F.element),M=B.getClientWidth(),H=F.element.offsetWidth,J={attributes:{points:{to:[L,K]}},duration:D,method:I.easeIn},E={attributes:{points:{to:[(M+25),K]}},duration:D,method:I.easeOut},G=new A(F,J,E,F.element,YAHOO.util.Motion);G.handleStartAnimateIn=function(O,N,P){P.overlay.element.style.left=((-25)-H)+"px";P.overlay.element.style.top=K+"px";};G.handleTweenAnimateIn=function(Q,P,R){var S=B.getXY(R.overlay.element),O=S[0],N=S[1];if(B.getStyle(R.overlay.element,"visibility")=="hidden"&&O<L){R.overlay._setDomVisibility(true);}R.overlay.cfg.setProperty("xy",[O,N],true);R.overlay.cfg.refireEvent("iframe");};G.handleCompleteAnimateIn=function(O,N,P){P.overlay.cfg.setProperty("xy",[L,K],true);P.startX=L;P.startY=K;P.overlay.cfg.refireEvent("iframe");P.animateInCompleteEvent.fire();};G.handleStartAnimateOut=function(O,N,R){var P=B.getViewportWidth(),S=B.getXY(R.overlay.element),Q=S[1];R.animOut.attributes.points.to=[(P+25),Q];};G.handleTweenAnimateOut=function(P,O,Q){var S=B.getXY(Q.overlay.element),N=S[0],R=S[1];Q.overlay.cfg.setProperty("xy",[N,R],true);Q.overlay.cfg.refireEvent("iframe");};G.handleCompleteAnimateOut=function(O,N,P){P.overlay._setDomVisibility(false);P.overlay.cfg.setProperty("xy",[L,K]);P.animateOutCompleteEvent.fire();};G.init();return G;};A.prototype={init:function(){this.beforeAnimateInEvent=this.createEvent("beforeAnimateIn");this.beforeAnimateInEvent.signature=C.LIST;this.beforeAnimateOutEvent=this.createEvent("beforeAnimateOut");
this.beforeAnimateOutEvent.signature=C.LIST;this.animateInCompleteEvent=this.createEvent("animateInComplete");this.animateInCompleteEvent.signature=C.LIST;this.animateOutCompleteEvent=this.createEvent("animateOutComplete");this.animateOutCompleteEvent.signature=C.LIST;this.animIn=new this.animClass(this.targetElement,this.attrIn.attributes,this.attrIn.duration,this.attrIn.method);this.animIn.onStart.subscribe(this.handleStartAnimateIn,this);this.animIn.onTween.subscribe(this.handleTweenAnimateIn,this);this.animIn.onComplete.subscribe(this.handleCompleteAnimateIn,this);this.animOut=new this.animClass(this.targetElement,this.attrOut.attributes,this.attrOut.duration,this.attrOut.method);this.animOut.onStart.subscribe(this.handleStartAnimateOut,this);this.animOut.onTween.subscribe(this.handleTweenAnimateOut,this);this.animOut.onComplete.subscribe(this.handleCompleteAnimateOut,this);},animateIn:function(){this.beforeAnimateInEvent.fire();this.animIn.animate();},animateOut:function(){this.beforeAnimateOutEvent.fire();this.animOut.animate();},handleStartAnimateIn:function(E,D,F){},handleTweenAnimateIn:function(E,D,F){},handleCompleteAnimateIn:function(E,D,F){},handleStartAnimateOut:function(E,D,F){},handleTweenAnimateOut:function(E,D,F){},handleCompleteAnimateOut:function(E,D,F){},toString:function(){var D="ContainerEffect";if(this.overlay){D+=" ["+this.overlay.toString()+"]";}return D;}};YAHOO.lang.augmentProto(A,YAHOO.util.EventProvider);})();YAHOO.register("container",YAHOO.widget.Module,{version:"2.7.0",build:"1799"});
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.7.0
*/
(function(){var B=YAHOO.util;var A=function(D,C,E,F){if(!D){}this.init(D,C,E,F);};A.NAME="Anim";A.prototype={toString:function(){var C=this.getEl()||{};var D=C.id||C.tagName;return(this.constructor.NAME+": "+D);},patterns:{noNegatives:/width|height|opacity|padding/i,offsetAttribute:/^((width|height)|(top|left))$/,defaultUnit:/width|height|top$|bottom$|left$|right$/i,offsetUnit:/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i},doMethod:function(C,E,D){return this.method(this.currentFrame,E,D-E,this.totalFrames);},setAttribute:function(C,F,E){var D=this.getEl();if(this.patterns.noNegatives.test(C)){F=(F>0)?F:0;}if("style" in D){B.Dom.setStyle(D,C,F+E);}else{if(C in D){D[C]=F;}}},getAttribute:function(C){var E=this.getEl();var G=B.Dom.getStyle(E,C);if(G!=="auto"&&!this.patterns.offsetUnit.test(G)){return parseFloat(G);}var D=this.patterns.offsetAttribute.exec(C)||[];var H=!!(D[3]);var F=!!(D[2]);if("style" in E){if(F||(B.Dom.getStyle(E,"position")=="absolute"&&H)){G=E["offset"+D[0].charAt(0).toUpperCase()+D[0].substr(1)];}else{G=0;}}else{if(C in E){G=E[C];}}return G;},getDefaultUnit:function(C){if(this.patterns.defaultUnit.test(C)){return"px";}return"";},setRuntimeAttribute:function(D){var I;var E;var F=this.attributes;this.runtimeAttributes[D]={};var H=function(J){return(typeof J!=="undefined");};if(!H(F[D]["to"])&&!H(F[D]["by"])){return false;}I=(H(F[D]["from"]))?F[D]["from"]:this.getAttribute(D);if(H(F[D]["to"])){E=F[D]["to"];}else{if(H(F[D]["by"])){if(I.constructor==Array){E=[];for(var G=0,C=I.length;G<C;++G){E[G]=I[G]+F[D]["by"][G]*1;}}else{E=I+F[D]["by"]*1;}}}this.runtimeAttributes[D].start=I;this.runtimeAttributes[D].end=E;this.runtimeAttributes[D].unit=(H(F[D].unit))?F[D]["unit"]:this.getDefaultUnit(D);return true;},init:function(E,J,I,C){var D=false;var F=null;var H=0;E=B.Dom.get(E);this.attributes=J||{};this.duration=!YAHOO.lang.isUndefined(I)?I:1;this.method=C||B.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=B.AnimMgr.fps;this.setEl=function(M){E=B.Dom.get(M);};this.getEl=function(){return E;};this.isAnimated=function(){return D;};this.getStartTime=function(){return F;};this.runtimeAttributes={};this.animate=function(){if(this.isAnimated()){return false;}this.currentFrame=0;this.totalFrames=(this.useSeconds)?Math.ceil(B.AnimMgr.fps*this.duration):this.duration;if(this.duration===0&&this.useSeconds){this.totalFrames=1;}B.AnimMgr.registerElement(this);return true;};this.stop=function(M){if(!this.isAnimated()){return false;}if(M){this.currentFrame=this.totalFrames;this._onTween.fire();}B.AnimMgr.stop(this);};var L=function(){this.onStart.fire();this.runtimeAttributes={};for(var M in this.attributes){this.setRuntimeAttribute(M);}D=true;H=0;F=new Date();};var K=function(){var O={duration:new Date()-this.getStartTime(),currentFrame:this.currentFrame};O.toString=function(){return("duration: "+O.duration+", currentFrame: "+O.currentFrame);};this.onTween.fire(O);var N=this.runtimeAttributes;for(var M in N){this.setAttribute(M,this.doMethod(M,N[M].start,N[M].end),N[M].unit);}H+=1;};var G=function(){var M=(new Date()-F)/1000;var N={duration:M,frames:H,fps:H/M};N.toString=function(){return("duration: "+N.duration+", frames: "+N.frames+", fps: "+N.fps);};D=false;H=0;this.onComplete.fire(N);};this._onStart=new B.CustomEvent("_start",this,true);this.onStart=new B.CustomEvent("start",this);this.onTween=new B.CustomEvent("tween",this);this._onTween=new B.CustomEvent("_tween",this,true);this.onComplete=new B.CustomEvent("complete",this);this._onComplete=new B.CustomEvent("_complete",this,true);this._onStart.subscribe(L);this._onTween.subscribe(K);this._onComplete.subscribe(G);}};B.Anim=A;})();YAHOO.util.AnimMgr=new function(){var C=null;var B=[];var A=0;this.fps=1000;this.delay=1;this.registerElement=function(F){B[B.length]=F;A+=1;F._onStart.fire();this.start();};this.unRegister=function(G,F){F=F||E(G);if(!G.isAnimated()||F==-1){return false;}G._onComplete.fire();B.splice(F,1);A-=1;if(A<=0){this.stop();}return true;};this.start=function(){if(C===null){C=setInterval(this.run,this.delay);}};this.stop=function(H){if(!H){clearInterval(C);for(var G=0,F=B.length;G<F;++G){this.unRegister(B[0],0);}B=[];C=null;A=0;}else{this.unRegister(H);}};this.run=function(){for(var H=0,F=B.length;H<F;++H){var G=B[H];if(!G||!G.isAnimated()){continue;}if(G.currentFrame<G.totalFrames||G.totalFrames===null){G.currentFrame+=1;if(G.useSeconds){D(G);}G._onTween.fire();}else{YAHOO.util.AnimMgr.stop(G,H);}}};var E=function(H){for(var G=0,F=B.length;G<F;++G){if(B[G]==H){return G;}}return -1;};var D=function(G){var J=G.totalFrames;var I=G.currentFrame;var H=(G.currentFrame*G.duration*1000/G.totalFrames);var F=(new Date()-G.getStartTime());var K=0;if(F<G.duration*1000){K=Math.round((F/H-1)*G.currentFrame);}else{K=J-(I+1);}if(K>0&&isFinite(K)){if(G.currentFrame+K>=J){K=J-(I+1);}G.currentFrame+=K;}};};YAHOO.util.Bezier=new function(){this.getPosition=function(E,D){var F=E.length;var C=[];for(var B=0;B<F;++B){C[B]=[E[B][0],E[B][1]];}for(var A=1;A<F;++A){for(B=0;B<F-A;++B){C[B][0]=(1-D)*C[B][0]+D*C[parseInt(B+1,10)][0];C[B][1]=(1-D)*C[B][1]+D*C[parseInt(B+1,10)][1];}}return[C[0][0],C[0][1]];};};(function(){var A=function(F,E,G,H){A.superclass.constructor.call(this,F,E,G,H);};A.NAME="ColorAnim";A.DEFAULT_BGCOLOR="#fff";var C=YAHOO.util;YAHOO.extend(A,C.Anim);var D=A.superclass;var B=A.prototype;B.patterns.color=/color$/i;B.patterns.rgb=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;B.patterns.hex=/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;B.patterns.hex3=/^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;B.patterns.transparent=/^transparent|rgba\(0, 0, 0, 0\)$/;B.parseColor=function(E){if(E.length==3){return E;}var F=this.patterns.hex.exec(E);if(F&&F.length==4){return[parseInt(F[1],16),parseInt(F[2],16),parseInt(F[3],16)];}F=this.patterns.rgb.exec(E);if(F&&F.length==4){return[parseInt(F[1],10),parseInt(F[2],10),parseInt(F[3],10)];}F=this.patterns.hex3.exec(E);if(F&&F.length==4){return[parseInt(F[1]+F[1],16),parseInt(F[2]+F[2],16),parseInt(F[3]+F[3],16)];
}return null;};B.getAttribute=function(E){var G=this.getEl();if(this.patterns.color.test(E)){var I=YAHOO.util.Dom.getStyle(G,E);var H=this;if(this.patterns.transparent.test(I)){var F=YAHOO.util.Dom.getAncestorBy(G,function(J){return !H.patterns.transparent.test(I);});if(F){I=C.Dom.getStyle(F,E);}else{I=A.DEFAULT_BGCOLOR;}}}else{I=D.getAttribute.call(this,E);}return I;};B.doMethod=function(F,J,G){var I;if(this.patterns.color.test(F)){I=[];for(var H=0,E=J.length;H<E;++H){I[H]=D.doMethod.call(this,F,J[H],G[H]);}I="rgb("+Math.floor(I[0])+","+Math.floor(I[1])+","+Math.floor(I[2])+")";}else{I=D.doMethod.call(this,F,J,G);}return I;};B.setRuntimeAttribute=function(F){D.setRuntimeAttribute.call(this,F);if(this.patterns.color.test(F)){var H=this.attributes;var J=this.parseColor(this.runtimeAttributes[F].start);var G=this.parseColor(this.runtimeAttributes[F].end);if(typeof H[F]["to"]==="undefined"&&typeof H[F]["by"]!=="undefined"){G=this.parseColor(H[F].by);for(var I=0,E=J.length;I<E;++I){G[I]=J[I]+G[I];}}this.runtimeAttributes[F].start=J;this.runtimeAttributes[F].end=G;}};C.ColorAnim=A;})();
/*
TERMS OF USE - EASING EQUATIONS
Open source under the BSD License.
Copyright 2001 Robert Penner All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

 * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
 * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
YAHOO.util.Easing={easeNone:function(B,A,D,C){return D*B/C+A;},easeIn:function(B,A,D,C){return D*(B/=C)*B+A;},easeOut:function(B,A,D,C){return -D*(B/=C)*(B-2)+A;},easeBoth:function(B,A,D,C){if((B/=C/2)<1){return D/2*B*B+A;}return -D/2*((--B)*(B-2)-1)+A;},easeInStrong:function(B,A,D,C){return D*(B/=C)*B*B*B+A;},easeOutStrong:function(B,A,D,C){return -D*((B=B/C-1)*B*B*B-1)+A;},easeBothStrong:function(B,A,D,C){if((B/=C/2)<1){return D/2*B*B*B*B+A;}return -D/2*((B-=2)*B*B*B-2)+A;},elasticIn:function(C,A,G,F,B,E){if(C==0){return A;}if((C/=F)==1){return A+G;}if(!E){E=F*0.3;}if(!B||B<Math.abs(G)){B=G;var D=E/4;}else{var D=E/(2*Math.PI)*Math.asin(G/B);}return -(B*Math.pow(2,10*(C-=1))*Math.sin((C*F-D)*(2*Math.PI)/E))+A;},elasticOut:function(C,A,G,F,B,E){if(C==0){return A;}if((C/=F)==1){return A+G;}if(!E){E=F*0.3;}if(!B||B<Math.abs(G)){B=G;var D=E/4;}else{var D=E/(2*Math.PI)*Math.asin(G/B);}return B*Math.pow(2,-10*C)*Math.sin((C*F-D)*(2*Math.PI)/E)+G+A;},elasticBoth:function(C,A,G,F,B,E){if(C==0){return A;}if((C/=F/2)==2){return A+G;}if(!E){E=F*(0.3*1.5);}if(!B||B<Math.abs(G)){B=G;var D=E/4;}else{var D=E/(2*Math.PI)*Math.asin(G/B);}if(C<1){return -0.5*(B*Math.pow(2,10*(C-=1))*Math.sin((C*F-D)*(2*Math.PI)/E))+A;}return B*Math.pow(2,-10*(C-=1))*Math.sin((C*F-D)*(2*Math.PI)/E)*0.5+G+A;},backIn:function(B,A,E,D,C){if(typeof C=="undefined"){C=1.70158;}return E*(B/=D)*B*((C+1)*B-C)+A;},backOut:function(B,A,E,D,C){if(typeof C=="undefined"){C=1.70158;}return E*((B=B/D-1)*B*((C+1)*B+C)+1)+A;},backBoth:function(B,A,E,D,C){if(typeof C=="undefined"){C=1.70158;}if((B/=D/2)<1){return E/2*(B*B*(((C*=(1.525))+1)*B-C))+A;}return E/2*((B-=2)*B*(((C*=(1.525))+1)*B+C)+2)+A;},bounceIn:function(B,A,D,C){return D-YAHOO.util.Easing.bounceOut(C-B,0,D,C)+A;},bounceOut:function(B,A,D,C){if((B/=C)<(1/2.75)){return D*(7.5625*B*B)+A;}else{if(B<(2/2.75)){return D*(7.5625*(B-=(1.5/2.75))*B+0.75)+A;}else{if(B<(2.5/2.75)){return D*(7.5625*(B-=(2.25/2.75))*B+0.9375)+A;}}}return D*(7.5625*(B-=(2.625/2.75))*B+0.984375)+A;},bounceBoth:function(B,A,D,C){if(B<C/2){return YAHOO.util.Easing.bounceIn(B*2,0,D,C)*0.5+A;}return YAHOO.util.Easing.bounceOut(B*2-C,0,D,C)*0.5+D*0.5+A;}};(function(){var A=function(H,G,I,J){if(H){A.superclass.constructor.call(this,H,G,I,J);}};A.NAME="Motion";var E=YAHOO.util;YAHOO.extend(A,E.ColorAnim);var F=A.superclass;var C=A.prototype;C.patterns.points=/^points$/i;C.setAttribute=function(G,I,H){if(this.patterns.points.test(G)){H=H||"px";F.setAttribute.call(this,"left",I[0],H);F.setAttribute.call(this,"top",I[1],H);}else{F.setAttribute.call(this,G,I,H);}};C.getAttribute=function(G){if(this.patterns.points.test(G)){var H=[F.getAttribute.call(this,"left"),F.getAttribute.call(this,"top")];}else{H=F.getAttribute.call(this,G);}return H;};C.doMethod=function(G,K,H){var J=null;if(this.patterns.points.test(G)){var I=this.method(this.currentFrame,0,100,this.totalFrames)/100;J=E.Bezier.getPosition(this.runtimeAttributes[G],I);}else{J=F.doMethod.call(this,G,K,H);}return J;};C.setRuntimeAttribute=function(P){if(this.patterns.points.test(P)){var H=this.getEl();var J=this.attributes;var G;var L=J["points"]["control"]||[];var I;var M,O;if(L.length>0&&!(L[0] instanceof Array)){L=[L];}else{var K=[];for(M=0,O=L.length;M<O;++M){K[M]=L[M];}L=K;}if(E.Dom.getStyle(H,"position")=="static"){E.Dom.setStyle(H,"position","relative");}if(D(J["points"]["from"])){E.Dom.setXY(H,J["points"]["from"]);
}else{E.Dom.setXY(H,E.Dom.getXY(H));}G=this.getAttribute("points");if(D(J["points"]["to"])){I=B.call(this,J["points"]["to"],G);var N=E.Dom.getXY(this.getEl());for(M=0,O=L.length;M<O;++M){L[M]=B.call(this,L[M],G);}}else{if(D(J["points"]["by"])){I=[G[0]+J["points"]["by"][0],G[1]+J["points"]["by"][1]];for(M=0,O=L.length;M<O;++M){L[M]=[G[0]+L[M][0],G[1]+L[M][1]];}}}this.runtimeAttributes[P]=[G];if(L.length>0){this.runtimeAttributes[P]=this.runtimeAttributes[P].concat(L);}this.runtimeAttributes[P][this.runtimeAttributes[P].length]=I;}else{F.setRuntimeAttribute.call(this,P);}};var B=function(G,I){var H=E.Dom.getXY(this.getEl());G=[G[0]-H[0]+I[0],G[1]-H[1]+I[1]];return G;};var D=function(G){return(typeof G!=="undefined");};E.Motion=A;})();(function(){var D=function(F,E,G,H){if(F){D.superclass.constructor.call(this,F,E,G,H);}};D.NAME="Scroll";var B=YAHOO.util;YAHOO.extend(D,B.ColorAnim);var C=D.superclass;var A=D.prototype;A.doMethod=function(E,H,F){var G=null;if(E=="scroll"){G=[this.method(this.currentFrame,H[0],F[0]-H[0],this.totalFrames),this.method(this.currentFrame,H[1],F[1]-H[1],this.totalFrames)];}else{G=C.doMethod.call(this,E,H,F);}return G;};A.getAttribute=function(E){var G=null;var F=this.getEl();if(E=="scroll"){G=[F.scrollLeft,F.scrollTop];}else{G=C.getAttribute.call(this,E);}return G;};A.setAttribute=function(E,H,G){var F=this.getEl();if(E=="scroll"){F.scrollLeft=H[0];F.scrollTop=H[1];}else{C.setAttribute.call(this,E,H,G);}};B.Scroll=D;})();YAHOO.register("animation",YAHOO.util.Anim,{version:"2.7.0",build:"1799"});
/*
* 2010-01-18 : Migration Version 1
*/
try {
	if(!isPreview){}
} catch(err) {
	if (top.location != location) {
		top.location.href = document.location.href ;
	}
}
/*
* 2010-01-18 : Migration Version 1
*/

function loadPageFromSelect(el) {
	document.location = YAHOO.util.Dom.get(el).value;
}
/*
* 2010-01-18 : Migration Version 1
*/

var agt=navigator.userAgent.toLowerCase();
var appVer = navigator.appVersion.toLowerCase();

var is_minor = parseFloat(appVer);
var is_major = parseInt(is_minor);


var is_opera = (agt.indexOf("opera") != -1);

var is_mac = (agt.indexOf("mac")!=-1);
var iePos  = appVer.indexOf('msie');
if (iePos !=-1) {
	if(is_mac) {
		var iePos = agt.indexOf('msie');
		is_minor = parseFloat(agt.substring(iePos+5,agt.indexOf(';',iePos)));
	}
	else is_minor = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)));
	is_major = parseInt(is_minor);
}

var is_konq = false;
var kqPos   = agt.indexOf('konqueror');
if (kqPos !=-1) {
	is_konq  = true;
	is_minor = parseFloat(agt.substring(kqPos+10,agt.indexOf(';',kqPos)));
	is_major = parseInt(is_minor);
}

var is_getElementById   = (document.getElementById) ? "true" : "false"; // 001121-abk
var is_getElementsByTagName = (document.getElementsByTagName) ? "true" : "false"; // 001127-abk
var is_documentElement = (document.documentElement) ? "true" : "false"; // 001121-abk

var is_safari = ((agt.indexOf('safari')!=-1))?true:false;
//var is_safari = ((agt.indexOf('safari')!=-1)&&(agt.indexOf('win')!=-1))?true:false;
var is_khtml  = (is_safari || is_konq);

var is_ie   = ((iePos!=-1) && (!is_opera) && (!is_khtml));

var is_ie6   = (is_ie && is_major == 6);
var is_ie6up = (is_ie && is_minor >= 6);

var is_ie7   = (is_ie && is_major == 7);
var is_ie7up = (is_ie && is_minor >= 7);

var is_ie8   = (is_ie && is_major == 8);
var is_ie8up = (is_ie && is_minor >= 8);

var is_chrome = (agt.indexOf('chrome') != -1);

// TODO: replace browser detection by YAHOO version (YAHOO.env.ua)
/*
* 2010-01-18 : Migration Version 1
*/

window.onLeftMenuReady = new YAHOO.util.CustomEvent("LeftMenuReady");

// Wrapper method to reduce code when checking if a variable is uninitialized.
//
// object: The object instance (can be any kind of object) which to check
//
function IsNull(object){
	return (object == 'undefined' || object == null);
}
var ASCENDING = 1;      // Used for sorting (i.e. in generic sort method and timetable.js)
var DESCENDING = -1;    // Used for sorting (i.e. in generic sort method and timetable.js)
function sort(a, b, direction)
{
    // The default direction is ASCENDING when none has been provided 
    direction = IsNull(direction) ? ASCENDING : direction;
    
    // a should precede b
    if (a < b)
        return (direction == ASCENDING ? -1 : 1);
    
    // a equals b no sort nescessary, order between the two remains unchanged
    else if (a == b)
        return 0;

    // b should precede a
    else
        return (direction == ASCENDING ? 1 : -1);
}
//
// This method can be used to left pad strings to a given length with a given character.
// It is added to the String objects prototype and can therefore be called on any valid
// string instance.
//
// char             : String representing the character with which to pad this string
// maxPaddingLength : Integer, maxPaddingLength - string length == the amount of padding characters
//
String.prototype.pad = function(char, maxPaddingLength) {
	var ret = this;
	var paddingCount = maxPaddingLength - this.length;
	for (var i=0; i<paddingCount; i++)
	ret = "0" + this;
	return ret;
}
// --------------------------------------------------------------------------------------------
//
// HTMLNode component
//
// --------------------------------------------------------------------------------------------
function HTMLNode(target, type, attributes, innerHtml, className, hrefText) {
	var newNode = target.createElement(type);
	for (var prop in attributes) {
		newNode.setAttribute(prop, attributes[prop]);
	}
	if (type = 'a' && hrefText) newNode.href = hrefText;
	if (className) newNode.className = className;
	if (innerHtml) newNode.innerHTML = innerHtml;
	return newNode;
}
/**
* KLM footer siteloader
*/
function loadOtherKLMSites(sel) {
	window.open(sel.value.split('|')[0]);
}
function initTopMenu() {
	YAHOO.util.Dom.addClass("topnav_" + mainStructureGroupID, "selected");
}
function initLeftMenu() {
	var c = YAHOO.util.Dom.get('leftnav_' + navigationID);

	var setOuterMenu = function(el) {
		if (el) {
			if (el.tagName == 'DIV') {
				el.style.display = 'block';
			} else if (el.tagName == 'LI') {
				var ul = el.getElementsByTagName('ul');
				if (ul.length > 0) {
					YAHOO.util.Dom.addClass(el, 'opened');
				} else {
					YAHOO.util.Dom.addClass(el, 'selected');
				}
//				YAHOO.util.Dom.addClass(el, 'opened');
				setOuterMenu(el.parentNode);
			} else {
				setOuterMenu(el.parentNode);
			}
		}
	}

	setOuterMenu(c);
	window.onLeftMenuReady.fire();
}
YAHOO.namespace('klm');

var initDashboardForm = function(button, form){
	var btn;
	var frm;
	if(YAHOO.lang.isObject(button)){
		btn = button;
	}else{
		btn = YAHOO.util.Dom.get(button);
	}
	if(YAHOO.lang.isObject(frm)){
		frm = form;
	}else{
		frm = YAHOO.util.Dom.get(form);
	}
	if(btn && frm){
		frm.action = btn.href;
		YAHOO.util.Event.addListener(btn, "click", submitDashboardForm, frm); 
	}
}

var submitDashboardForm = function(e, obj){
	YAHOO.util.Event.preventDefault(e);
	obj.submit();
}

function getParameter ( queryString, parameterName ) {
	var parameterName = parameterName + "=";
	if ( queryString.length > 0 ) {
		begin = queryString.indexOf ( parameterName );
		if ( begin != -1 ) {
			begin += parameterName.length;
			end = queryString.indexOf ( "&" , begin );
			if ( end == -1 ) {
				end = queryString.length
			}
			return unescape ( queryString.substring ( begin, end ) );
		}
	return null;
	}
}
var viewportWidth = 0;
function IE6ScrollBarBGone() {
	if(viewportWidth != YAHOO.util.Dom.getViewportWidth()){
		viewportWidth = YAHOO.util.Dom.getViewportWidth();
		var htmlTag = document.getElementsByTagName('html')[0];
		if(viewportWidth >= YAHOO.util.Dom.get('klm-doc').clientWidth){
			document.body.style.overflowX = 'hidden';
			htmlTag.style.overflowX = 'hidden';
		}else{
			document.body.style.overflowX = 'auto';
			htmlTag.style.overflowX = 'auto';
		}
	}
}
/*
* 2010-01-18 : Migration Version 1
*/

var FlashDetect = new function(){
    var self = this;
    self.installed = false;
    self.raw = "";
    self.major = -1;
    self.minor = -1;
    self.revision = -1;
    self.revisionStr = "";
    var activeXDetectRules = [
        {
            "name":"ShockwaveFlash.ShockwaveFlash.7",
            "version":function(obj){
                return getActiveXVersion(obj);
            }
        },
        {
            "name":"ShockwaveFlash.ShockwaveFlash.6",
            "version":function(obj){
                var version = "6,0,21";
                try{
                    obj.AllowScriptAccess = "always";
                    version = getActiveXVersion(obj);
                }catch(err){}
                return version;
            }
        },
        {
            "name":"ShockwaveFlash.ShockwaveFlash",
            "version":function(obj){
                return getActiveXVersion(obj);
            }
        }
    ];
    /**
     * Extract the ActiveX version of the plugin.
     * 
     * @param {Object} The flash ActiveX object.
     * @type String
     */
    var getActiveXVersion = function(activeXObj){
        var version = -1;
        try{
            version = activeXObj.GetVariable("$version");
        }catch(err){}
        return version;
    };
    /**
     * Try and retrieve an ActiveX object having a specified name.
     * 
     * @param {String} name The ActiveX object name lookup.
     * @return One of ActiveX object or a simple object having an attribute of activeXError with a value of true.
     * @type Object
     */
    var getActiveXObject = function(name){
        var obj = -1;
        try{
            obj = new ActiveXObject(name);
        }catch(err){
            obj = {activeXError:true};
        }
        return obj;
    };
    /**
     * Parse an ActiveX $version string into an object.
     * 
     * @param {String} str The ActiveX Object GetVariable($version) return value. 
     * @return An object having raw, major, minor, revision and revisionStr attributes.
     * @type Object
     */
    var parseActiveXVersion = function(str){
        var versionArray = str.split(",");//replace with regex
        return {
            "raw":str,
            "major":parseInt(versionArray[0].split(" ")[1], 10),
            "minor":parseInt(versionArray[1], 10),
            "revision":parseInt(versionArray[2], 10),
            "revisionStr":versionArray[2]
        };
    };
    /**
     * Parse a standard enabledPlugin.description into an object.
     * 
     * @param {String} str The enabledPlugin.description value.
     * @return An object having raw, major, minor, revision and revisionStr attributes.
     * @type Object
     */
    var parseStandardVersion = function(str){
        var descParts = str.split(/ +/);
        var majorMinor = descParts[2].split(/\./);
        var revisionStr = descParts[3];
        return {
            "raw":str,
            "major":parseInt(majorMinor[0], 10),
            "minor":parseInt(majorMinor[1], 10), 
            "revisionStr":revisionStr,
            "revision":parseRevisionStrToInt(revisionStr)
        };
    };
    /**
     * Parse the plugin revision string into an integer.
     * 
     * @param {String} The revision in string format.
     * @type Number
     */
    var parseRevisionStrToInt = function(str){
        return parseInt(str.replace(/[a-zA-Z]/g, ""), 10) || self.revision;
    };
    /**
     * Is the major version greater than or equal to a specified version.
     * 
     * @param {Number} version The minimum required major version.
     * @type Boolean
     */
    self.majorAtLeast = function(version){
        return self.major >= version;
    };
    /**
     * Is the minor version greater than or equal to a specified version.
     * 
     * @param {Number} version The minimum required minor version.
     * @type Boolean
     */
    self.minorAtLeast = function(version){
        return self.minor >= version;
    };
    /**
     * Is the revision version greater than or equal to a specified version.
     * 
     * @param {Number} version The minimum required revision version.
     * @type Boolean
     */
    self.revisionAtLeast = function(version){
        return self.revision >= version;
    };
    /**
     * Is the version greater than or equal to a specified major, minor and revision.
     * 
     * @param {Number} major The minimum required major version.
     * @param {Number} (Optional) minor The minimum required minor version.
     * @param {Number} (Optional) revision The minimum required revision version.
     * @type Boolean
     */
    self.versionAtLeast = function(major){
        var properties = [self.major, self.minor, self.revision];
        var len = Math.min(properties.length, arguments.length);
        for(i=0; i<len; i++){
            if(properties[i]>=arguments[i]){
                if(i+1<len && properties[i]==arguments[i]){
                    continue;
                }else{
                    return true;
                }
            }else{
                return false;
            }
        }
    };
    /**
     * Constructor, sets raw, major, minor, revisionStr, revision and installed public properties.
     */
    self.FlashDetect = function(){
        if(navigator.plugins && navigator.plugins.length>0){
            var type = 'application/x-shockwave-flash';
            var mimeTypes = navigator.mimeTypes;
            if(mimeTypes && mimeTypes[type] && mimeTypes[type].enabledPlugin && mimeTypes[type].enabledPlugin.description){
                var version = mimeTypes[type].enabledPlugin.description;
                var versionObj = parseStandardVersion(version);
                self.raw = versionObj.raw;
                self.major = versionObj.major;
                self.minor = versionObj.minor; 
                self.revisionStr = versionObj.revisionStr;
                self.revision = versionObj.revision;
                self.installed = true;
            }
        }else if(navigator.appVersion.indexOf("Mac")==-1 && window.execScript){
            var version = -1;
            for(var i=0; i<activeXDetectRules.length && version==-1; i++){
                var obj = getActiveXObject(activeXDetectRules[i].name);
                if(!obj.activeXError){
                    self.installed = true;
                    version = activeXDetectRules[i].version(obj);
                    if(version!=-1){
                        var versionObj = parseActiveXVersion(version);
                        self.raw = versionObj.raw;
                        self.major = versionObj.major;
                        self.minor = versionObj.minor; 
                        self.revision = versionObj.revision;
                        self.revisionStr = versionObj.revisionStr;
                    }
                }
            }
        }
    }();
};
FlashDetect.JS_RELEASE = "1.0.4";
/*
* 2010-01-18 Migration Version 1
* 2010-01-29 Heiko, country language selector, always link to http:, 2B removed after all sites are rebranded!
*/

function CountryLanguageSelector() {
	var Dom = YAHOO.util.Dom, Event = YAHOO.util.Event;
	this.cl = countryLanguages;
	this.setTop = false;
	this.currentCountryLanguage = document.location.toString().replace(document.location.protocol + '//', '').split('/')[2];
	var junction = document.location.toString().replace(document.location.protocol + '//', '').split('/')[1];
	this.currentCountryCode = this.currentCountryLanguage.split('_')[0];
	this.currentLanguageCode = this.currentCountryLanguage.split('_')[1];

	this.buildCountrySelector = function() {
		if (this.cl.length > 0) {
			var ul = document.createElement('ul');
			for (var i = 0; i < this.cl.length; i++) {
				// Create list element
				var li = document.createElement('li');
				// var a = document.createElement('a');
				li.id = i;
				Event.addListener(li, 'mouseover', function(e) {
					Dom.addClass(this, 'hover');
				});
				Event.addListener(li, 'mouseout', function(e) {
					Dom.removeClass(this, 'hover');
				});
				// a.href = 'javascript:;';
				li.innerHTML = this.cl[i].country;
				if (this.cl[i].abbreviation == countryCode) {
					li.className = 'selected';
					this.selectedCountry = li;
					this.currentCountry = li;
				}
				ul.appendChild(li);
			}
			this.clSelect.appendChild(ul);
			Event.addListener(this.clSelect, 'click', this.selectCountry, this, true);
		} else {
			alert("no country and language info found");
		}
	}
	this.buildLanguageSelector = function(cl) {
		var ul = Dom.get('lang-list');
		ul.innerHTML = '';
		for (var i = 0; i < cl.languages.length; i++) {
			var li = document.createElement('li');
			var a = document.createElement('a');
			a.innerHTML = cl.languages[i].lang;
			a.href = 'javascript:;';
			if (cl.abbreviation == countryCode && cl.languages[i].code == languageCode) a.style.fontWeight = 'bold';
			if (cl.url) {
				if (cl.url.indexOf('http')>0) {
					a.href = cl.url;
				} else {
					a.href = document.location.protocol + '//' + document.domain + cl.url;
				}
			}
			else {
						// ROLE IT BACK WHEN ALL SITES ARE REBRANDED!
						//if (cl.abbreviation == countryCode) {
						//	a.href = document.location.toString().replace(countryCode + '_' + languageCode, cl.abbreviation + '_' + cl.languages[i].code);
						//} else {
							a.href = 'http://' + document.domain + '/' + junction + '/' + cl.abbreviation + '_' + cl.languages[i].code + homepageLocation;
						//}
			}
			a.id = cl.abbreviation + '_' + cl.languages[i].code;
			Event.addListener(a, 'click', this.saveAndRedirect, this, true);
			li.appendChild(a);
			ul.appendChild(li);
		}
		if (this.setTop == false) {
			this.clSelect.scrollTop = this.selectedCountry.offsetTop - 60;
			this.setTop = true;
		}
	}
	this.saveAndRedirect = function(e) {
		Event.preventDefault(e);
		t = Event.getTarget(e);
		if (Dom.get('remember-language').checked) {
			Cookie.set('countrylanguage', t.id);
			document.location = t.href;
		} else {
			document.location = t.href
		}
	}
	this.selectCountry = function(e) {
		var target = Event.getTarget(e);
//		target.blur();
		Dom.removeClass(this.selectedCountry, 'selected');
		Dom.addClass(target, 'selected');
		this.selectedCountry = target;
		var cl = this.cl[target.id];
		if (cl.partner) {
			Dom.setStyle(this.clRightpartner, 'display', 'block');
			Dom.setStyle(this.clRightNormal, 'display', 'none');
			var html = "<div>";
			html += '<a target="_blank" href="' + cl.url + '"><img src="' + cl.logo +'" /></a>';
			html += "</div>";
			html += cl.text + '<br /><br/>';
			html += '<a target="_blank" href="' + cl.url + '">' + cl.linktext + '</a><span class="external-popup">&nbsp;</span>';
			this.clRightpartner.innerHTML = html;
			return;
		} else {
			Dom.setStyle(this.clRightpartner, 'display', 'none');
			Dom.setStyle(this.clRightNormal, 'display', 'block');
			this.buildLanguageSelector(cl);
			return;
		}
	}
	this.open = function() {
		Dom.addClass(this.main, 'open');
//		alert(this.clSelect.getElementsByTagName('ul')[0].offsetHeight)
		this.btn.blur();
		Event.removeListener(this.btn, 'click', this.open, this, true);
		Event.addListener(this.btn, 'click', this.close, this, true);
		Event.addListener(document, 'mousedown', this.documentClose, this, true);
		if (this.frame) Dom.setXY(this.frame, [Dom.getX(this.clBody), Dom.getY(this.clBody) - 2]);
		this.buildLanguageSelector(this.cl[this.selectedCountry.id]);
	}
	this.close = function() {
		Dom.removeClass(this.main, 'open');
		this.btn.blur();
		Event.removeListener(this.btn, 'click', this.close, this, true);
		Event.removeListener(document, 'mousedown', this.documentClose, this, true);
		Event.addListener(this.btn, 'click', this.open, this, true);
		Dom.removeClass(this.selectedCountry, 'selected');
		this.selectedCountry = this.currentCountry;
		Dom.addClass(this.selectedCountry, 'selected');
		this.setTop = false;
	}
	this.documentClose = function(e) {
		var t = Event.getTarget(e);
		if (Dom.isAncestor('country-language-body', t) || Dom.isAncestor('btn-country-language', t)) {
			return false;
		} else {
			this.close();
		}
	}
	
	// Get main container
	this.main = Dom.get('klm-language-selector');
	// Get body
	this.clBody = Dom.get('country-language-body');
	// Get country selector
	this.clSelect = Dom.get('cl-select');
	// Get right containers
	this.clRightNormal = Dom.get('cl-right-normal');
	this.clRightpartner = Dom.get('cl-right-partner');
	// Get seperator to hide on open
	this.btn = Dom.get('btn-country-language');
	Event.addListener(this.btn, 'click', this.open, this, true);
	
	// Build selector
	this.buildCountrySelector(); 
	if (document.all) {
		this.frame = document.createElement('iframe');
		this.frame.src = '/travel/generic/static/empty.html';
		this.frame.frameBorder = 2; 
		this.frame.style.zIndex = -1;
		//Dom.setStyle(this.frame, 'opacity', 0);
//		Dom.setXY(this.frame, Dom.getXY(this.main));
		this.main.appendChild(this.frame);
	}
}
/*
* 2010-01-18 : Migration Version 1
*/

function chooseFlashOrImage(where) {
	var w = YAHOO.util.Dom.get(where);
	var imageFlashPicker = YAHOO.util.Dom.getElementsByClassName("flash_image_chooser","div", w.parentNode);
	var containers = null;
	if (imageFlashPicker.length > 0){
		if(FlashDetect.installed) {
			for (var i=0 ; i< imageFlashPicker.length; i++) {
				containers = imageFlashPicker[i].getElementsByTagName("div");
				if (containers.length > 1) {
					containers[0].style.display = 'none';
					containers[1].style.display = 'block';
				}
			}
		}
		else {
			for (var i=0 ; i< imageFlashPicker.length; i++) {
				containers = imageFlashPicker[i].getElementsByTagName("div");
				try {
					containers[0].style.display = 'block';
					containers[1].style.display = 'none';
				} catch (e) {}
			}
		}
	}
}

function getPrefix() {
	prefixUrl = new String(window.location.href);
	if (prefixUrl.indexOf("https") >= 0){
		var prefix = ("https");
	}
	else{
		var prefix = ("http");
	}
	return prefix;
}
var countryLanguages = [ 
	{ country: 'Aruba', abbreviation: 'aw', languages: [
		{ lang: 'Nederlands', code: 'nl' },		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Australia', abbreviation: 'au', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Austria', abbreviation: 'at', languages: [
		{ lang: 'Deutsch', code: 'de' },		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Bahrain', abbreviation: 'bh', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Belgium', abbreviation: 'be', languages: [
		{ lang: 'English', code: 'en' },		{ lang: 'Français', code: 'fr' },		{ lang: 'Nederlands', code: 'nl' }]
	},
	{ country: 'Brazil', abbreviation: 'br', languages: [
		{ lang: 'Português', code: 'br' },		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Burundi', abbreviation: 'bi', url: '/travel/ke_en/index_default.html'
, languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Canada', abbreviation: 'ca', languages: [
		{ lang: 'English', code: 'en' },		{ lang: 'Français', code: 'fr' }]
	},
	{ country: 'China', abbreviation: 'cn', languages: [
		{ lang: 'English', code: 'en' },		{ lang: '简体中文', code: 'cn' }]
	},
	{ country: 'Cyprus', abbreviation: 'cy', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Czech Republic', abbreviation: 'cz', languages: [
		{ lang: 'English / Cesky', code: 'en' }]
	},
	{ country: 'Denmark', abbreviation: 'dk', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Ecuador', abbreviation: 'ec', languages: [
		{ lang: 'Español', code: 'es' },		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Egypt', abbreviation: 'eg', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Estonia', abbreviation: 'ee', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Ethiopia', abbreviation: 'et', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Finland', abbreviation: 'fi', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'France', abbreviation: 'fr', languages: [
		{ lang: 'Français', code: 'fr' },		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Germany', abbreviation: 'de', languages: [
		{ lang: 'Deutsch', code: 'de' },		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Ghana', abbreviation: 'gh', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Greece', abbreviation: 'gr', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Hong Kong', abbreviation: 'hk', languages: [
		{ lang: 'English', code: 'en' },		{ lang: '繁體中文', code: 'hk' }]
	},
	{ country: 'Hungary', abbreviation: 'hu', languages: [
		{ lang: 'English / Magyar', code: 'en' }]
	},
	{ country: 'India', abbreviation: 'in', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Indonesia', abbreviation: 'id', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Iran', abbreviation: 'ir', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Ireland', abbreviation: 'ie', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Israel', abbreviation: 'il', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Italy', abbreviation: 'it', languages: [
		{ lang: 'Italiano', code: 'it' },		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Japan', abbreviation: 'jp', languages: [
		{ lang: 'English', code: 'en' },		{ lang: '日本語', code: 'ja' }]
	},
	{ country: 'Kazakhstan', abbreviation: 'kz', languages: [
		{ lang: 'English', code: 'en' },		{ lang: 'Русский', code: 'ru' }]
	},
	{ country: 'Kenya', abbreviation: 'ke', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Korea', abbreviation: 'kr', languages: [
		{ lang: 'English', code: 'en' },		{ lang: '한국어', code: 'ko' }]
	},
	{ country: 'Kuwait', abbreviation: 'kw', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Latvia', abbreviation: 'lv', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Libya', abbreviation: 'ly', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Lithuania', abbreviation: 'lt', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Luxembourg', abbreviation: 'lu', languages: [
		{ lang: 'English', code: 'en' },		{ lang: 'Français', code: 'fr' }]
	},
	{ country: 'Malawi', abbreviation: 'mw', url: '/travel/ke_en/index_default.html'
, languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Malaysia', abbreviation: 'my', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Mexico', abbreviation: 'mx', languages: [
		{ lang: 'Español', code: 'es' },		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Netherlands', abbreviation: 'nl', languages: [
		{ lang: 'English', code: 'en' },		{ lang: 'Nederlands', code: 'nl' }]
	},
	{ country: 'Netherlands Antilles', abbreviation: 'an', languages: [
		{ lang: 'English', code: 'en' },		{ lang: 'Nederlands', code: 'nl' }]
	},
	{ country: 'New Caledonia', abbreviation: 'nc', languages: [
		{ lang: 'English', code: 'en' },		{ lang: 'Français', code: 'fr' }]
	},
	{ country: 'New Zealand', abbreviation: 'nz', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Nigeria', abbreviation: 'ng', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Norway', abbreviation: 'no', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Oman', abbreviation: 'om', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Pakistan', abbreviation: 'pk', url: '/travel/ae_en/index.htm'
, languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Panama', abbreviation: 'pa', languages: [
		{ lang: 'Español', code: 'es' },		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Peru', abbreviation: 'pe', languages: [
		{ lang: 'Español', code: 'es' },		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Philippines', abbreviation: 'ph', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Poland', abbreviation: 'pl', languages: [
		{ lang: 'English / Polski', code: 'en' }]
	},
	{ country: 'Portugal', abbreviation: 'pt', languages: [
		{ lang: 'English / Portuguese', code: 'en' }]
	},
	{ country: 'Qatar', abbreviation: 'qa', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Romania', abbreviation: 'ro', languages: [
		{ lang: 'English / Romaneste', code: 'en' }]
	},
	{ country: 'Russia', abbreviation: 'ru', languages: [
		{ lang: 'English', code: 'en' },		{ lang: 'Русский', code: 'ru' }]
	},
	{ country: 'Rwanda', abbreviation: 'rw', url: '/travel/ke_en/index_default.html'
, languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Saudi Arabia', abbreviation: 'sa', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Singapore', abbreviation: 'sg', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Slovakia', abbreviation: 'sk', languages: [
		{ lang: 'English / Slovenčine', code: 'en' }]
	},
	{ country: 'South Africa', abbreviation: 'za', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Spain', abbreviation: 'es', languages: [
		{ lang: 'Español', code: 'es' },		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Sudan', abbreviation: 'sd', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Suriname', abbreviation: 'sr', languages: [
		{ lang: 'Nederlands', code: 'nl' },		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Sweden', abbreviation: 'se', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Switzerland', abbreviation: 'ch', languages: [
		{ lang: 'Deutsch', code: 'de' },		{ lang: 'English', code: 'en' },		{ lang: 'Français', code: 'fr' },		{ lang: 'Italiano', code: 'it' }]
	},
	{ country: 'Taiwan', abbreviation: 'tw', languages: [
		{ lang: 'English', code: 'en' },		{ lang: '繁體中文', code: 'tw' }]
	},
	{ country: 'Tanzania', abbreviation: 'tz', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Thailand', abbreviation: 'th', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Turkey', abbreviation: 'tr', languages: [
		{ lang: 'English / Turkish', code: 'en' }]
	},
	{ country: 'Uganda', abbreviation: 'ug', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Ukraine', abbreviation: 'ua', languages: [
		{ lang: 'English / Українська', code: 'en' },		{ lang: 'Русский', code: 'ru' }]
	},
	{ country: 'United Arab Emirates', abbreviation: 'ae', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'United Kingdom', abbreviation: 'gb', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'United States', abbreviation: 'us', languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Zambia', abbreviation: 'zm', url: '/travel/ke_en/index_default.html'
, languages: [
		{ lang: 'English', code: 'en' }]
	},
	{ country: 'Other countries', abbreviation: 'travel', languages: [
		{ lang: 'Deutsch', code: 'de' },		{ lang: 'English', code: 'en' },		{ lang: 'Nederlands', code: 'nl' },		{ lang: 'Italiano', code: 'it' },		{ lang: 'Español', code: 'es' },		{ lang: 'Français', code: 'fr' }]
	}
];

/*
* 2010-01-18 : Migration Version 1
*/

function Overlay(container, properties){
  if(container){
    if(typeof(container) == 'object')
      this.container = container;
    else if(typeof(container) == 'string')
      this.container = YAHOO.util.Dom.get(container);
    else
      this.container = document.getElementsByTagName('body')[0];
  }else{
    this.container = document.getElementsByTagName('body')[0];
  }
  
  this.properties = properties;

  this.properties['id'] = (this.properties['id'] ? this.properties['id'] : 'overlay');
  this.properties['iframe-id'] = (this.properties['iframe-id'] ? this.properties['iframe-id'] : this.properties['id'] + '-iframe');
  this.properties['className'] = (this.properties['className'] ? this.properties['className'] : 'overlay');
  
  if(this.properties['animate']){
    this.properties['opacity'] = this.properties['opacity'] ? this.properties['opacity'] : .5
    this.properties['speed'] = this.properties['speed'] ? this.properties['speed'] : .5
  }
  
  this.children = new Array();
}

Overlay.prototype.addOnClickHandler = function(child, sOnClickFunction){
  if(sOnClickFunction == null || sOnClickFunction == "")
    sOnClickFunction = "close";
  this.children.push({"child" : child, "func" : sOnClickFunction});
}

Overlay.prototype.show = function(){
  var self = this;
  var overlayExists = true;
  var overlayIFrameExists = true;
  var overlay = YAHOO.util.Dom.get(this.properties['id']);
  if(!overlay){
    overlay = document.createElement('div');
    overlay.id = this.properties['id'];
    overlayExists = false;
  }else{
      this.overlayAlreadyThere = true;
  }
  
  if(this.children.length > 0){
    overlay.onclick = function(){
      for(i = 0; i < self.children.length; i++){
        var child = self.children[i].child;
        var sFunction = self.children[i].func;
        eval("child." + sFunction + "();");
      }
    }
  }
  
  YAHOO.util.Dom.addClass(this.container, 'overlay-container');

  if(this.properties['className'] != null)
    overlay.className = this.properties['className'];

  if(document.all){ //IE6
    var iframe = YAHOO.util.Dom.get(this.properties['iframe-id']);
    if(!iframe){
      iframe = document.createElement('iframe');
      iframe.id = this.properties['iframe-id'];
      overlayIFrameExists = false;
    }else{
        this.iframeAlreadyThere = true;
    }
    iframe.frameBorder = 0;
    iframe.scrolling = 'no';
    iframe.src = "/travel/generic/static/empty.html";
    iframe.style.height = YAHOO.util.Dom.getDocumentHeight() + "px";
    if(!overlayIFrameExists)
      this.container.appendChild(iframe);
    iframe = null;
    overlay.style.height = YAHOO.util.Dom.getDocumentHeight() + "px";
  }

  if(!overlayExists)
    this.container.appendChild(overlay);

  overlay.style.display = 'block';

  var attributes = {
    opacity : { to: this.properties['opacity'] }
  }

  if(this.properties['animate']){
    anim = new YAHOO.util.Motion(overlay, attributes, this.properties['speed'], YAHOO.util.Easing.easeOut);
    //anim.onComplete.subscribe(this.onShowComplete);
    anim.animate();
  }

  overlay = null;
}

Overlay.prototype.onShowComplete = function(){

}

Overlay.prototype.hide = function(){
  var overlay = YAHOO.util.Dom.get(this.properties['id']);
  if(this.properties['animate']){
    var attributes = {
      opacity : { to: 0 }
    }
    anim = new YAHOO.util.Motion(overlay, attributes, this.properties['speed'], YAHOO.util.Easing.easeOut);
    anim.controller = this;
    anim.onComplete.subscribe(this.onHideComplete);
    anim.animate();
  }else{
    YAHOO.util.Dom.removeClass(this.container, 'overlay-container');
    this.container.removeChild(overlay);
    var iframe = YAHOO.util.Dom.get(this.properties['iframe-id']);
    if(iframe)
      this.container.removeChild(iframe);
  }
  
}

Overlay.prototype.onHideComplete = function(){
  var overlay = YAHOO.util.Dom.get(this.controller.properties['id']);
  var iframe = YAHOO.util.Dom.get(this.controller.properties['iframe-id']);

  if(!this.controller.overlayAlreadyThere)
    this.controller.container.removeChild(overlay);

  if(iframe && !this.controller.iframeAlreadyThere)
    this.controller.container.removeChild(iframe);

  YAHOO.util.Dom.removeClass(this.controller.container, 'overlay-container');
}
/*
* 2010-01-18 : Migration Version 1
*/

var SelfAssist = function(country, lang){
  //General
  var self = this;
  this.base_url = "/commercial/selfassist/faq-web";
  this.loading_url = 'loading.htm';
  this.popup = 0;
  this.ref = 'KLMWEB';
  
  //Language Settings
  this.country = 'nl';
  this.lang = 'en';
  
  /*if(country == null && lang == null && YAHOO.util.Cookie.get("countryLanguage") != null){
    var sLanguageSetting = YAHOO.util.Cookie.get("countryLanguage");
    this.country = sLanguageSetting.split('_')[0];
    this.lang = sLanguageSetting.split('_')[1];
  }else{*/
    if(country != null){
      this.country = country;
    }
    if(lang != null){
      this.lang = lang;
    }
  //}

  if(YAHOO.util.Cookie && YAHOO.util.Cookie.get("popup") != null){
    this.popup = YAHOO.util.Cookie.get("popup");
  }else if(this.getCookie("popup") != null){
    this.popup = this.getCookie("popup");
  }
  //Self Assist controls
  //Container
  this.container = YAHOO.util.Dom.get("sa-container");
  this.container.style.display = 'block';

  var parentContainer = this.container.parentNode;
  this.layOver = new Overlay(parentContainer, {speed: .9, opacity: .8, animate: true, id:'sa-overlay'});
  this.layOver.addOnClickHandler(this);
  
  //Form
  this.defaultInput = YAHOO.util.Dom.get("mySearch");
  this.defaultButton = YAHOO.util.Dom.get("supportZoekLink");

  this.addForm(this.defaultInput, this.defaultButton);

  //Tabs
  this.searchTab = YAHOO.util.Dom.get("zoektab");
  this.catTab = YAHOO.util.Dom.get("tabcat");
  YAHOO.util.Event.addListener(this.catTab.getElementsByTagName('a')[0], 'click', this.onTabClickHandler, this.catTab)
  this.faqTab = YAHOO.util.Dom.get("tabfaq");
  YAHOO.util.Event.addListener(this.faqTab.getElementsByTagName('a')[0], 'click', this.onTabClickHandler, this.faqTab)
  this.closeTab = YAHOO.util.Dom.get("tabclose");
  YAHOO.util.Event.addListener(this.closeTab.getElementsByTagName('a')[0], 'click', this.onTabClickHandler, this.closeTab)
	
  //Iframe
  this.iframe = YAHOO.util.Dom.get("sa-iframe");
  this.iframe.style.visibility = "hidden";
  YAHOO.util.Event.addListener(this.iframe, 'load', this.resetTabs, this);
  
  //Default SearchTerm
  this.searchTerm = "";
  this.defaultSearchTerm = this.defaultInput.value;

  //Load QueryString Listener
  if (location.host.match("klm.com")) {
    this.loadFromQueryString(window.location.search.substring(1));
  }
}

/** getQSVar
* Get a variable value from the querystring
* @param varname
**/
SelfAssist.prototype.getQSVar = function(varname) {
  hu = window.location.search.substring(1);
  gy = hu.split("&");
  returnValue = null;
  for (i=0;i<gy.length;i++) {
    ft = gy[i].split("=");
    if (ft[0] == varname) {
      returnValue = ft[1];
    }
  }
  return returnValue;
}


SelfAssist.prototype.getCookie = function(c_name){
  if (document.cookie.length>0){
    c_start=document.cookie.indexOf(c_name + "=");
    if (c_start!=-1){
      c_start=c_start + c_name.length+1;
      c_end=document.cookie.indexOf(";",c_start);
      if (c_end==-1) c_end=document.cookie.length;
        return unescape(document.cookie.substring(c_start,c_end));
    }
  }
  return null;
}

/** loadFromQueryString
* Checks for variables used in the querystring that loads the SelfAssist Popup
* @param queryString
**/
SelfAssist.prototype.loadFromQueryString = function(queryString){
  if(this.getQSVar("sa_url") != null)  //By URL
    this.loadUri(Url.decode(this.getQSVar("sa_url")));
  else if(this.getQSVar('q') != null) //By Question
    this.ask(this.getQSVar('q'));
  else if(this.getQSVar('q_cat') != null) //By Category
    this.cat(this.getQSVar('q_cat'));
  else if(this.getQSVar('q_faq') != null){ //By FAQ Category (If category is '1', general top 10 will be opened)
    if(this.getQSVar('q_faq') != 1){
      this.faq(this.getQSVar('q_faq'));
    }else{
      this.faq();
    }
  }
}

/** addForm
* Add a form to listen to. When the button is clicked SelfAssist will handle the click event.
* @param oInput
* @param oButton
**/
SelfAssist.prototype.addForm = function(oInput, oButton){
  YAHOO.util.Event.purgeElement(oInput, true);
  YAHOO.util.Event.purgeElement(oButton, true);
  var self = this;
  var oInputFld = oInput;
  YAHOO.util.Event.addListener(oButton, "click", this.onSubmitHandler, oInput, true);
  YAHOO.util.Event.addListener(oInput, "keyup", this.onSubmitHandler, oInput, true);
  YAHOO.util.Event.addListener(oInput, "focus", this.inputFocus, oInput, true);
  YAHOO.util.Event.addListener(oInput, "blur", this.inputBlur, oInput, true);
}

/** ask
* Loads a searchresult for selfassist.
* @param query
**/
SelfAssist.prototype.ask = function(query){
  if(query != this.defaultSearchTerm){
    this.searchTerm = query;
  }
  if(query != this.defaultSearchTerm && query != ''){
    this.loadUri('ask.htm', '&query=' + encodeURIComponent(query));
  }else
    this.loadUri('start.htm');
  this.defaultInput.value = '';
  this.defaultButton.focus();
  this.inputBlur(null, this.defaultInput);
}

/** cat
* Loads a categoryoverview by default. 
* When a category id is supplied the top 10 for that category is loaded.
* @param category_id (optional)
**/
SelfAssist.prototype.cat = function(){
  if (arguments.length > 0){
    this.loadUri('categoryQuestions.htm', '&cid=' + arguments[0]);
  }else{
    this.loadUri('categories.htm');
  }
}

/** faq
* Loads a faq10 for general category by default. 
* When a category id is supplied the top 10 for that category is loaded.
* @param category_id (optional)
**/
SelfAssist.prototype.faq = function(){
  if (arguments.length > 0){
    this.loadUri('categoryQuestions.htm', '&cid=' + arguments[0]);
  }else{
    this.loadUri('topx.htm');
  }
}

/** loadUri
* Loads an url into the iframe.
* @param url
**/
SelfAssist.prototype.loadUri = function(url){
  var params = '';
  var uri = "";
  if(url.indexOf('?') < 0){
    params = '?locale=' + this.country + '_' + this.lang + '&popup=' + this.popup;
    if(arguments.length > 1){
      params = params + arguments[1];
    }
  }

  if (this.ref){
    params = params + "&ref=" + this.ref ;
  }

  //Only relative urls are allowed.
  if (url.indexOf(':') >= 0 && url.indexOf(':') <= 10) {
    var idx = url.lastIndexOf('/');
    url = idx < 15 ? '404.htm' : url.substr(idx + 1);
  }

  uri = this.base_url + '/' + url + params;

  //if layover is hidden, open it.
  if(this.container.className != "open"){
    this.layOver.show();
    this.open(uri);
  }else{
    this.iframe.src = uri;
  }

}

/** resetTabs
* Selects the current tab and deselects the others.
* @param oTab
**/
SelfAssist.prototype.resetTabs = function(e, obj){
  var oActiveTab = null;
  var uri = "";
  try{
	uri = obj.iframe.contentWindow.document.location.href;
  }catch(e){}
  if(uri.match("categories.htm") || uri.match("allCategoryQuestions.htm") || uri.match("categoryQuestions.htm")){
    oActiveTab = obj.catTab;
  } else if(uri.match("topx.htm")){
    oActiveTab = obj.faqTab;
  }else{
    oActiveTab = obj.searchTab;
  }
  //reset css classes
  YAHOO.util.Dom.removeClass(obj.searchTab.id, 'actief');
  YAHOO.util.Dom.removeClass(obj.catTab.id, 'actief');
  YAHOO.util.Dom.removeClass(obj.faqTab.id, 'actief');
  YAHOO.util.Dom.removeClass(obj.closeTab.id, 'actief');

  YAHOO.util.Dom.addClass(oActiveTab, 'actief');
}

/** finishOpen 
* Callback function for open event. Shows the iframe.
**/
SelfAssist.prototype.finishOpen = function(type, args, uri) {
  this.sa.iframe.src = uri;
  this.sa.iframe.style.visibility = "visible";

}

/** finishClose
* Callback function for close event. Hides the iframe.
**/
SelfAssist.prototype.finishClose = function() {
  this.sa.container.className = "closed";
  this.sa.inputBlur();
}

/** open 
* Opens the layover in an animation.
**/
SelfAssist.prototype.open = function(uri) {
    var attributes = {
      width: { to: 907 }, 
      height: { to: 460 }
    }
    anim = new YAHOO.util.Anim(this.container, attributes, .9, YAHOO.util.Easing.easeOut);
    anim.sa = this;
    anim.onComplete.subscribe(function(){window.sa.iframe.src = uri; window.sa.iframe.style.visibility = "visible"; window.sa.defaultButton.blur();});
    if(document.all){
      setTimeout("anim.animate();", 10);
    }else{
      anim.animate();
    }
    this.container.className = "open";
}

/*EVENTHANDLERS*/


/** close
* Closes the layover in an animation.
**/
SelfAssist.prototype.close = function(e, args) {
  this.defaultInput.value = this.defaultSearchTerm;
  YAHOO.util.Dom.removeClass(document.getElementsByTagName('body')[0], 'show-layover')
  //Load url into iFrame
  this.loadUri(this.loading_url);
  this.layOver.hide();
  this.iframe.style.visibility = "hidden";
  var attributes = {
    width: { to: 268 },
    height: { to: 45 }
  }
  anim = new YAHOO.util.Motion(this.container, attributes, .9, YAHOO.util.Easing.easeOut);
  anim.sa = this;
  anim.onComplete.subscribe(this.finishClose);
  anim.animate();
}

/** onSubmitHandler 
* Handles the submitentries of the Selfassist forms.
**/
SelfAssist.prototype.onSubmitHandler = function(e, obj){
  if (obj.disabled != "")
  	return;
  YAHOO.util.Event.preventDefault(e);
  if((e.type == 'keyup' && e.keyCode == 13) || (e.type == 'click')){
    window.sa.ask(obj.value);
  }
}

/** onTabClickHandler
* Handles tab clicks.
**/
SelfAssist.prototype.onTabClickHandler = function(e, obj){
  switch(obj.id){
    case window.sa.searchTab.id:
      window.sa.ask(window.sa.defaultInput.value);
      break;
    case window.sa.catTab.id:
      window.sa.cat();
      break;
    case window.sa.faqTab.id:
      window.sa.faq();
      break;
    case window.sa.closeTab.id:
      window.sa.close();
      break;
    default:
      break;
  }
}

/** inputFocus
* When a form input element is focussed, this function will be called.
* Sets style and value for the input field.
**/
SelfAssist.prototype.inputFocus = function(e , oInput) {
  if (oInput.title == "" || oInput.title == oInput.value) {
    oInput.title = oInput.value;
    oInput.value = "";
  }
  oInput.style.color = "#003145";
}

/** inputBlur
* When a form input element is blurred, this function will be called.
* Resets style and value for the input field.
**/
SelfAssist.prototype.inputBlur = function(e, oInput) {
  if (oInput.value == "" || oInput.title == oInput.value) {
    oInput.value = oInput.title;
    oInput.style.color = "";
  }
}


/*URL UTF-8 Encoder/Decoder Class*/

var Url = {

    // public method for url encoding
    encode : function (string) {
        return escape(this._utf8_encode(string));
    },

    // public method for url decoding
    decode : function (string) {
        return this._utf8_decode(unescape(string));
    },

    // private method for UTF-8 encoding
    _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;
    },

    // private method for UTF-8 decoding
    _utf8_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;
    }
};
/*
*	2009-12-22 Seeta Ti and URL has been modified
*/

var initMeasures = function(country, lang, url, isHomepage){
    _metron.measureVariable("z_application", "Tridion");
    _metron.measureVariable("z_country", country);
    _metron.measureVariable("z_language", lang);
    var ti = "";

    if(isHomepage){
      ti = "homepage";
      _metron.measureVariable("cg_n", "homepage");
      
      //EBT
      
      var queryStr = unescape(window.location.search);
      var args;
      var tabToSelect = null;
      if (queryStr != ""){
        queryStr = queryStr.substr(1, queryStr.length);
        var pairs = queryStr.split("&"); //Separate name value pairs
        for (var i = 0; i < pairs.length; i++){
          args = pairs[i].split("=");
          if (args[0] == 'db') 
            tabToSelect = args[1]
        }
      }else{
        tabToSelect = 'db_ebt';
      }
      if (tabToSelect == "db_ebt"){
        if (document.getElementById("klm-ebt") != null){ // ebt7
          _metron.measureVariable("si_n" , "RETURN EBT7 Funnel;EBT7 Funnel")
        }else{ // ebt6
          _metron.measureVariable("si_n" , "RT EBT Funnel;EBT Funnel")
        }
        _metron.measureVariable("si_x" , "1;1")
      }

    }else{
      //Get TI var from url
      var searchString = "/" + country + "_" + lang + "/";
      var dir_pos = url.indexOf(searchString);
      var start = (dir_pos + searchString.length) ;
      var dir = url.substr(start, url.length - start);
      
	  //Get measurePath from url
      arrDirs = dir.split('/');
	  switch (arrDirs.length)
	  {
  		  case 0: ti = "Generic";
		  case 1: ti = "Homepage";
		  default: ti = arrDirs[arrDirs.length - 2];
	  }

      for(var i = 0; i < arrDirs.length; i++){
        var current_dir = arrDirs[i];
        var varname = "cg_s" + (i - 1);
        if(i == 0)
          varname = "cg_n";
        else if(i == 1)
          varname = "cg_s";

        if (current_dir == "index.htm")
                current_dir = "";
        else if (current_dir.lastIndexOf(".") > 0) 
                if (i == 3)
                        current_dir = current_dir.substr(0,current_dir.lastIndexOf("."));
                else 
                        current_dir = "";

        if (current_dir != "") 
                _metron.measureVariable(varname, current_dir);
      }
    }
    
    _metron.measureVariable("ti", ti);

    //Commit measurevars
    _metron.measuresCommit();
}

var onClickMeasures = function(inputArray){ 
	var ti = "";
	var map = new Map();
	map.put("z_application","Tridion");
	map.put("z_country",countryCode);
	map.put("z_language",languageCode);
	map.put("z_tridion_event","Clicked");
	map.put("z_tridion_eventplace",document.title);

	url = location.pathname; 
	var searchString = "/" + countryCode + "_" + languageCode + "/";
	var dir_pos = url.indexOf(searchString);
	var start = (dir_pos + searchString.length) ;
	var dir = url.substr(start, url.length - start);

	//Get measurePath from url
	arrDirs = dir.split('/');
	switch (arrDirs.length)
	{
	  case 0: ti = "Generic"; break;
	  case 1: ti = "Homepage"; map.put("cg_n","homepage"); break;
	  default: 
		var temp = arrDirs[arrDirs.length - 1];
		if (temp == "index.htm") { 
			ti = arrDirs[arrDirs.length - 2];
		}
		else if (temp.lastIndexOf(".") > 0) {
			ti = temp.substr(0,temp.lastIndexOf("."));
		}
		  
	}
	map.put("ti", ti);
	var _inputArray = new Array();
	_inputArray = inputArray;

	for (var prop in _inputArray) {
		if (typeof(prop) != "undefined")
		{
			map.put(prop, _inputArray[prop]);
		}
	}
	_metron.measureVariablesAndCommit(map.showMe());
}
/*
* 2010-01-18 : Migration Version 1
* 2010-02-04 : Seeta : modified to call from page loader
*/

function metrixlab_onready(el, func){
	this.args = new Array(el, func);
	this.doTry = function(){
		try{
			var el = eval(this.args[0]);
			el.onloading = this.args[1];
			el.onloading();
			clearInterval(this.args[2]);
		}
		catch(e){}
	}
	this.doTry.bind = function(object){
		var method = this;
		return function(){
			method.apply(object);
		}
	}
	this.args[2] = setInterval(this.doTry.bind(this), 250);
	return this;
}

function metrixEnabler() {
       if (isMetrixScriptEnabled == "True") {
		new metrixlab_onready("document.body", function(){
			var metrixlab_body = top.document.getElementsByTagName('body').item(0);
			var metrixlab_script = top.document.createElement('script');
			metrixlab_script.setAttribute('defer','defer');
			metrixlab_script.src=getPrefix()+ '://invitation.opinionbar.com/popups/P06801_'+countryCode+'_'+languageCode+'/overlay_dyn.js';
			metrixlab_script.type='text/javascript';
			metrixlab_body.insertBefore(metrixlab_script, metrixlab_body.childNodes[0]);
		});
       }
}
/*
*   2009-12-24 Seeta, copied from nl_nl live site
*   2009-01-14 Seeta, moved findKey function from Array to Metron object
*/

function Metron(id) {

	if (typeof(id) == "undefined") { // no id > use default id
		this.webtrends = new WebTrends();
		
	} else { // use caller specific id
		this.webtrends = new WebTrends(id);
	}
	if (navigator.cookieEnabled)
	{
	this.webtrends.dcsGetId(); // do initialisation of WebTrends, see doc for usage
	}

}
Metron.prototype.ClearWT = function () {
	for(var item in this.webtrends.WT)
	{
			var dont_do_this = (item == "z_application") 
				|| (item == "z_language")
				|| (item == "z_country");
			
			if(!dont_do_this ){
				delete this.webtrends.WT[item];
			}
	}
}

/*
	example HTML:
	var _metron=new Metron();
	_metron.measureVariable("z_Countrycode", "au");
	_metron.measureVariable("z_Languagecode", "en");

	var newPageTitle = document.URL;
	newPageTitle = newPageTitle.substring(newPageTitle.lastIndexOf("/")+1, newPageTitle.length); 
	newPageTitle = newPageTitle.substring(0, newPageTitle.lastIndexOf("."));
	_metron.measureVariable("ti", newPageTitle);
	_metron.measuresCommit();		
	_metron.debug();
*/

Metron.prototype.measureVariable = function (key, value) {
	value = scriptEncoding(value);
	// 2008-12-16 Changed by Anish not to overwrite the existing variables
	if (this.webtrends.WT[key]) {
		this.webtrends.WT[key] += ";" + value;
	} else {
		this.webtrends.WT[key] = value;
	}
}

Metron.prototype.measureAndOverwriteVariable = function (key, value) {
	this.webtrends.WT[key] = value;
}

Metron.prototype.measuresCommit = function () {
	this.webtrends.dcsCollect();
                this.ClearWT();
}

Metron.prototype.debug = function () {
	this.webtrends.dcsDebug();
}

/*
	return URL
	e.g.
	http://www.ite1.klm.com/travel/nl_nl/index_default.html?db=db_tt2#
	
	return:
	travel/nl_nl/index_default.html
*/
Metron.prototype.getURL = function () {
	var returnUrl;
	if(document.URL.indexOf("?") == -1)
	{
		returnUrl = document.URL.substring( document.URL.indexOf("/", 8));
	}
	else
	{
		returnUrl = document.URL.substring( document.URL.indexOf("/", 8), document.URL.indexOf("?") );
	}
	return returnUrl;
}


Metron.prototype.convertAndGetArray = function (inputArray) {

	var _inputArray = new Array();
	
	if(typeof(inputArray[0]) != "undefined")
	{	
		for (var i in inputArray) 
		{
			var key = inputArray[i].key;
			var value = scriptEncoding(inputArray[i].value);
			_inputArray[key] = value;
		}	
	}
	else
	{
		_inputArray = inputArray;
	}
	for (var prop in _inputArray) {
		_inputArray[prop] = scriptEncoding(_inputArray[prop]);
	}
	return _inputArray;
}

scriptEncoding = function (value) {
	var sReturn = "";
	switch (value)
	{
		case "document.title": sReturn = document.title; break;
		case "location.pathname": sReturn = location.pathname; break;
		case "location.href": sReturn = location.href; break;
		default: sReturn = value;
	}
	return sReturn;
}
// user-defined functions
/*
	Usage:
		_metron.measureVariablesAndCommit(
			{ 	"z_ebt_eventtype"  : "autocomplete_no_selection_from_list", 
				"z_ebt_eventplace" : "homepage",
				"z_ebt_event"        : "1" 
			} );
*/
Metron.prototype.measureVariablesAndCommit = function (inputArray) {
	var newURL = this.getURL(); 
	var newTitle = newURL; 
	var _inputArray = new Array();

	_inputArray = this.convertAndGetArray(inputArray);
	
	this.webtrends.dcsMultiTrackKLM2(/* DCS.dcsuri */ newTitle, /* WT.ti */ newTitle, _inputArray);	
	this.ClearWT();
}

/*
	example HTML (hidden INPUT fields with application specific names):
	<input type="hidden" name="M_pnr" value="32FRUI" disabled="disabled"/>
	<input type="hidden" name="M_eo" value="Change Booking" disabled="disabled"/>
	<input type="hidden" name="M_es" value="Offered" disabled="disabled"/>
	<input type="hidden" name="M_eo" value="Cancel Booking" disabled="disabled"/>
	<input type="hidden" name="M_es" value="Offered" disabled="disabled"/>
	
	example JS (specify the Webtrends tagname (without WT.), the HTML Element-type and the HTML Element-name):
	<script type="text/javascript">
	//<![CDATA[
		var _metron = new Metron();
		_metron.measureHTMLElementAndCommit("z_pnr", "input", "M__pnr");
		_metron.measureHTMLElementAndCommit("z_event", "input", "M_eo");
		_metron.measureHTMLElementAndCommit("z_event_status", "input", "M_es");
	//]]>>
	</script>		
*/
Metron.prototype.measureHTMLElementAndCommit = function (wtKey, htmlElement, htmlName) {
	var newURL = this.getURL(); // e.g. http://www.ite1.klm.com/travel/it_it/index_default.htm
	var newTitle = newURL; // e.g. /travel/it_it/index_default.htm

	var inputArray = this.getInputValuesByName(htmlElement, htmlName);
	/*
	inputArray format: [ { "wtKey" : "myKey", "value" : "myValue" }, { } ]
	*/
	
	// 20081119 WvdH: changed to instant processing
	// for (var i = 0; i < inputArray.length; i++) {
	// 	this.webtrends.dcsMultiTrack("DCS.dcsuri", newTitle, "WT.ti", newTitle, "WT." + wtKey, inputArray[i]);
	// }
	this.webtrends.dcsMultiTrackKLM(/* DCS.dcsuri */ newTitle, /* WT.ti */ newTitle, inputArray);
}

/*
<input type="hidden" name="M_ABC" value="32FRUITS" disabled="disabled"/>
<input type="hidden" name="M_KLM" value="Koffered" disabled="disabled"/>
<input type="hidden" name="M_ABC" value="64APPEL" disabled="disabled"/>
<input type="hidden" name="M_ABC" value="16CITRON" disabled="disabled"/>

<script type="text/javascript">
	//<![CDATA[
		var _metron=new Metron();
		_metron.measureHTMLElement("z_abc", "input", "M_ABC");
		_metron.measureHTMLElement("z_def", "input", "M_DEF");
		_metron.measureHTMLElement("z_klm", "input", "M_KLM");
		_metron.measuresCommit();
		_metron.debug();
	//]]>>
</script>
*/
Metron.prototype.measureHTMLElement = function (wtKey, htmlElement, htmlName) {
	var newURL = this.getURL(); // e.g. http://www.ite1.klm.com/travel/it_it/index_default.htm
	var newTitle = newURL; // e.g. /travel/it_it/index_default.htm

	var inputArray = this.getInputValuesByName(htmlElement, htmlName);

	// 2008-12-16 Changed by Anish not to overwrite the existing variables
	if (this.webtrends.WT[wtKey]) {
		this.webtrends.WT[wtKey] += ";" + inputArray[0];
	} else {
		this.webtrends.WT[wtKey] = inputArray[0];
	}
	
	for (var i = 1; i < inputArray.length; i++) {
		this.webtrends.WT[wtKey] += ";" + inputArray[i];
	}
}

// Same but for the DCS array of data
Metron.prototype.measureHTMLElement2 = function (wtKey, htmlElement, htmlName) {
	var newURL = this.getURL(); // e.g. http://www.ite1.klm.com/travel/it_it/index_default.htm
	var newTitle = newURL; // e.g. /travel/it_it/index_default.htm

	var inputArray = this.getInputValuesByName(htmlElement, htmlName);

	this.webtrends.DCS[wtKey] = inputArray[0];
	
	for (var i = 1; i < inputArray.length; i++) {
		this.webtrends.DCS[wtKey] += ";" + inputArray[i];
	}
}

/*
	Example HTML:
	<input type="hidden" name="M_ABC" value="32FRUITS" />
	<input type="hidden" name="M_KLM" value="Koffered" />
	<input type="hidden" name="M_ABC" value="64APPEL" />
	<input type="hidden" name="M_DEF" value="" />
	<input type="hidden" name="M_XYZ" />

	<script type="text/javascript">
	//<![CDATA[
		var _metron=new Metron();
	//]]>>
	</script>
	<script type="text/javascript">
	//<![CDATA[
	function something(object) {
		for (var i=0; i < object.valueList.length; i++) {
			object.valueList[i].value = object.valueList[i].value + " *2= " + object.valueList[i].value;
		}	
	}

	var valueItem1 = new valueItem("input", "M_ABC", "walter");
	var valueItem2 = new valueItem("input", "M_KLM", "willem");
	var valueItem3 = new valueItem("input", "M_DEF", "willem");
	var valueItem4 = new valueItem("input", "M_DEG", "");
	var valueItem5 = new valueItem("input", "M_DEH");
	var valueItem6 = new valueItem("input", "M_XYZ", "");
	
	var testObject = new analyticsInfo(null, 
		[ valueItem1, valueItem2, valueItem3, valueItem4, valueItem5, valueItem6 ], 
		"ti");
	_metron.measureHTMLElementAndCommitObject(testObject);	
	_metron.debug();		

	//]]>>
	</script>
*/
function analyticsInfo(operation, valueList, wtKey) {
	this.operation = operation;
	this.valueList = valueList;
	this.wtKey = wtKey;
}

function valueItem(htmlElement, htmlName, value) {
	this.htmlElement = htmlElement;
	this.htmlName = htmlName;
	this.value = value;
}

/*
	2008-12-16:
	The following method clears just the WT data parameters. The DCS parameters will still remain.
	Added by Anish - exe43
*/
Metron.prototype.clearWAParameters = function() {
	this.webtrends.WT = {};
}

/*
	2008-12-16:
	The following method Process the analyticsInfo object and retains the data without committing.
	Added by Anish - exe43
*/
Metron.prototype.measureAnalyticsObject = function (object) {
	var inputArray = object.valueList;
	
	for (var i = 0; i < inputArray.length; i++) {
		var tmp = inputArray[i].value;
		// test if it is (not) necessary to overwrite the value
		if (typeof(tmp) == "undefined") { // the override value is not defined, so use the supplied data
			tmp = this.getInputValuesByName(inputArray[i].htmlElement, inputArray[i].htmlName);
		} // else the override value is defined, so use that one
		object.valueList[i].value = tmp;
//alert("html-elem="+inputArray[i].htmlElement+"\nhtml-name="+inputArray[i].htmlName+"\nhtml-value="+this.getInputValuesByName(inputArray[i].htmlElement, inputArray[i].htmlName)+"\noverride="+inputArray[i].value+"\nobject.value="+object.valueList[i].value);
	}

	if (object.operation != null) { // post-processing function is defined, so call it
		object.operation(object);
		//  since the object or valueList can be changed we do not sent it to WebTrends
		// it is the responsibility of the application to call this function again, but without the operation
		return;
		
	} else {
		
		this.webtrends.WT[object.wtKey] = inputArray[0].value;
		
		for (var i = 1; i < inputArray.length; i++) {
			this.webtrends.WT[wtKey] += ";" + inputArray[i].value;
		}
			
	}
}

Metron.prototype.measureHTMLElementAndCommitObject = function (object) {
	var inputArray = object.valueList;
	
	for (var i = 0; i < inputArray.length; i++) {
		var tmp = inputArray[i].value;
		// test if it is (not) necessary to overwrite the value
		if (typeof(tmp) == "undefined") { // the override value is not defined, so use the supplied data
			tmp = this.getInputValuesByName(inputArray[i].htmlElement, inputArray[i].htmlName);
		} // else the override value is defined, so use that one
		object.valueList[i].value = tmp;
//alert("html-elem="+inputArray[i].htmlElement+"\nhtml-name="+inputArray[i].htmlName+"\nhtml-value="+this.getInputValuesByName(inputArray[i].htmlElement, inputArray[i].htmlName)+"\noverride="+inputArray[i].overrideValue+"\nobject.value="+object.valueList[i].value);
	}

	if (object.operation != null) { // post-processing function is defined, so call it
		object.operation(object);
		//  since the object or valueList can be changed we do not sent it to WebTrends
		// it is the responsibility of the application to call this function again, but without the operation
		return;
		
	} else {
		var newURL = this.getURL(); 
		var newTitle = newURL; 
		// pass the array with values to a modified dcsMultiTrack function
		this.webtrends.dcsMultiTrackKLM(/* DCS.dcsuri */ newTitle, /* WT.ti */ newTitle, inputArray);
	}
}

Metron.prototype.getInputValuesByName = function (tagName, inputName){
	var inputValues = new Array();
	var inputFields = document.getElementsByTagName(tagName);
	for (var i = 0; i < inputFields.length; i++) {
		if (inputFields[i].name == inputName) {
			inputValues[inputValues.length] = inputFields[i].value;
		}
	}
	return inputValues;
}


/*
 * Functions for currency conversions
 */

function IncludeFile(file) {  /* This function includes the given file*/
		var url = document.URL.substring( 0, document.URL.indexOf("/",10) ) + file;
		var headID = document.getElementsByTagName("head")[0];         
		var newScript = document.createElement('script');
		newScript.type = 'text/javascript';
		newScript.src = url;
		headID.appendChild(newScript);
}

 

Metron.prototype.findKey = function(searchStr) {

/* This function finds the index of the search value in the array*/ 

       var returnIndex = -1;                                                   

       for (i=0; i<this.length; i++) {                                                                                        

                          if (this[i].key.toUpperCase()==searchStr.toUpperCase()) {                                      

                                    return i;

        }

      }

      return returnIndex;

    }

 

Metron.prototype.getExchangeRate = function (curr) {

/* This function gets a currency parameter and returns the value of that currency*/ 

                        

            var returnVal=0;

            var keyIndex=-1;

            if (typeof(CURRENCIES) != "undefined") { //successfull include of JS

                        keyIndex=this.findKey(curr);    //find the currency                      

                        if(keyIndex>=0){

                                    returnVal=CURRENCIES[keyIndex].value;

                                    if(isNaN(returnVal)){                                            //currency is not numeric

                                                returnVal=0;                                                      

                                    }

                                    if (returnVal != 0){

                                                returnVal = 1 / returnVal;

                                    }                                   

                        } 

            }

 

            

            return returnVal;

}

 

Metron.prototype.convertCurrencyToEuro = function (curr, val) {

/* This function gets a currency parameter and a local value and returns the EUR value of that currency*/ 

            var returnVal=0;

            var keyIndex=-1;

            if (typeof(CURRENCIES) != "undefined")  {            //successfull include of JS                                              

                        keyIndex=this.findKey(curr);      //find the currency

                        if(keyIndex>=0){

                                    returnVal=CURRENCIES[keyIndex].value;

                                    if(isNaN(returnVal)){                                            //currency is not numeric

                                                returnVal=0;                                                                                          

                                    }

                                    if (returnVal != 0){

                                                returnVal = 1 / returnVal;

                                    }                                   

                        } 

            }

               return returnVal*val;

}
// Do not use any or call any methods below because that are not guaranteed to work
// Do not copy new WebTrends code and overwrite the code below because it contains customizations

// WebTrends SmartSource Data Collector Tag
// Version: 8.5.0     
// Tag Builder Version: 2.0.0
// Created: 9/22/2008 10:56:37 AM

function WebTrends(newID){
	var that=this;
	// begin: user modifiable
	if (typeof(newID) == "undefined") { // no id > use default id
		// this.dcsid = "dcskhhdbl1000043tf721gdjr_4d5b"; // ite
		this.dcsid = "dcs8i7h6p00000om5mqog2xmv_9h5e"; // le
	} else { // use caller specific id
		this.dcsid = newID;
	}
	this.domain="statse.webtrendslive.com";
	this.timezone=1;
	this.fpcdom=".klm.com";
	this.onsitedoms=".klm.com";
	this.downloadtypes="xls,doc,pdf,txt,csv,zip";
	this.trackevents=true;
	this.enabled=true;
	this.i18n=false;
	this.fpc="WT_FPC";
	// end: user modifiable
	this.DCS={};
	this.WT={};
	this.DCSext={};
	this.images=[];
	this.index=0;
	this.exre=(function(){return(window.RegExp?new RegExp("dcs(uri)|(ref)|(aut)|(met)|(sta)|(sip)|(pro)|(byt)|(dat)|(p3p)|(cfg)|(redirect)|(cip)","i"):"");})();
	this.re=(function(){return(window.RegExp?(that.i18n?{"%25":/\%/g}:{"%09":/\t/g,"%20":/ /g,"%23":/\#/g,"%26":/\&/g,"%2B":/\+/g,"%3F":/\?/g,"%5C":/\\/g,"%22":/\"/g,"%7F":/\x7F/g,"%A0":/\xA0/g}):"");})();
}
WebTrends.prototype.dcsGetId=function(){
	if (this.enabled&&(document.cookie.indexOf(this.fpc+"=")==-1)&&(document.cookie.indexOf("WTLOPTOUT=")==-1)){
		document.write("<scr"+"ipt type='text/javascript' src='"+"http"+(window.location.protocol.indexOf('https:')==0?'s':'')+"://"+this.domain+"/"+this.dcsid+"/wtid.js"+"'><\/scr"+"ipt>");
	}
}
WebTrends.prototype.dcsGetCookie=function(name){
	var cookies=document.cookie.split("; ");
	var cmatch=[];
	var idx=0;
	var i=0;
	var namelen=name.length;
	var clen=cookies.length;
	for (i=0;i<clen;i++){
		var c=cookies[i];
		if ((c.substring(0,namelen+1))==(name+"=")){
			cmatch[idx++]=c;
		}
	}
	var cmatchCount=cmatch.length;
	if (cmatchCount>0){
		idx=0;
		if ((cmatchCount>1)&&(name==this.fpc)){
			var dLatest=new Date(0);
			for (i=0;i<cmatchCount;i++){
				var lv=parseInt(this.dcsGetCrumb(cmatch[i],"lv"));
				var dLst=new Date(lv);
				if (dLst>dLatest){
					dLatest.setTime(dLst.getTime());
					idx=i;
				}
			}
		}
		return unescape(cmatch[idx].substring(namelen+1));
	}
	else{
		return null;
	}
}
WebTrends.prototype.dcsGetCrumb=function(cval,crumb,sep){
	var aCookie=cval.split(sep||":");
	for (var i=0;i<aCookie.length;i++){
		var aCrumb=aCookie[i].split("=");
		if (crumb==aCrumb[0]){
			return aCrumb[1];
		}
	}
	return null;
}
WebTrends.prototype.dcsGetIdCrumb=function(cval,crumb){
	var id=cval.substring(0,cval.indexOf(":lv="));
	var aCrumb=id.split("=");
	for (var i=0;i<aCrumb.length;i++){
		if (crumb==aCrumb[0]){
			return aCrumb[1];
		}
	}
	return null;
}
WebTrends.prototype.dcsIsFpcSet=function(name,id,lv,ss){
	var c=this.dcsGetCookie(name);
	if (c){
		return ((id==this.dcsGetIdCrumb(c,"id"))&&(lv==this.dcsGetCrumb(c,"lv"))&&(ss==this.dcsGetCrumb(c,"ss")))?0:3;
	}
	return 2;
}
WebTrends.prototype.dcsFPC=function(){
	if (document.cookie.indexOf("WTLOPTOUT=")!=-1){
		return;
	}
	var WT=this.WT;
	var name=this.fpc;
	var dCur=new Date();
	var adj=(dCur.getTimezoneOffset()*60000)+(this.timezone*3600000);
	dCur.setTime(dCur.getTime()+adj);
	var dExp=new Date(dCur.getTime()+315360000000);
	var dSes=new Date(dCur.getTime());
	WT.co_f=WT.vt_sid=WT.vt_f=WT.vt_f_a=WT.vt_f_s=WT.vt_f_d=WT.vt_f_tlh=WT.vt_f_tlv="";
	if (document.cookie.indexOf(name+"=")==-1){
		if ((typeof(gWtId)!="undefined")&&(gWtId!="")){
			WT.co_f=gWtId;
		}
		else if ((typeof(gTempWtId)!="undefined")&&(gTempWtId!="")){
			WT.co_f=gTempWtId;
			WT.vt_f="1";
		}
		else{
			WT.co_f="2";
			var curt=dCur.getTime().toString();
			for (var i=2;i<=(32-curt.length);i++){
				WT.co_f+=Math.floor(Math.random()*16.0).toString(16);
			}
			WT.co_f+=curt;
			WT.vt_f="1";
		}
		if (typeof(gWtAccountRollup)=="undefined"){
			WT.vt_f_a="1";
		}
		WT.vt_f_s=WT.vt_f_d="1";
		WT.vt_f_tlh=WT.vt_f_tlv="0";
	}
	else{
		var c=this.dcsGetCookie(name);
		var id=this.dcsGetIdCrumb(c,"id");
		var lv=parseInt(this.dcsGetCrumb(c,"lv"));
		var ss=parseInt(this.dcsGetCrumb(c,"ss"));
		if ((id==null)||(id=="null")||isNaN(lv)||isNaN(ss)){
			return;
		}
		WT.co_f=id;
		var dLst=new Date(lv);
		WT.vt_f_tlh=Math.floor((dLst.getTime()-adj)/1000);
		dSes.setTime(ss);
		if ((dCur.getTime()>(dLst.getTime()+1800000))||(dCur.getTime()>(dSes.getTime()+28800000))){
			WT.vt_f_tlv=Math.floor((dSes.getTime()-adj)/1000);
			dSes.setTime(dCur.getTime());
			WT.vt_f_s="1";
		}
		if ((dCur.getDay()!=dLst.getDay())||(dCur.getMonth()!=dLst.getMonth())||(dCur.getYear()!=dLst.getYear())){
			WT.vt_f_d="1";
		}
	}
	WT.co_f=escape(WT.co_f);
	WT.vt_sid=WT.co_f+"."+(dSes.getTime()-adj);
	var expiry="; expires="+dExp.toGMTString();
	var cur=dCur.getTime().toString();
	var ses=dSes.getTime().toString();
	document.cookie=name+"="+"id="+WT.co_f+":lv="+cur+":ss="+ses+expiry+"; path=/"+(((this.fpcdom!=""))?("; domain="+this.fpcdom):(""));
	var rc=this.dcsIsFpcSet(name,WT.co_f,cur,ses);
	if (rc!=0){
		WT.co_f=WT.vt_sid=WT.vt_f_s=WT.vt_f_d=WT.vt_f_tlh=WT.vt_f_tlv="";
		WT.vt_f=WT.vt_f_a=rc;
    }
}
WebTrends.prototype.dcsIsOnsite=function(host){
	if (host.length>0){
	    host=host.toLowerCase();
	    if (host==window.location.hostname.toLowerCase()){
		    return true;
	    }
	    if (typeof(this.onsitedoms.test)=="function"){
		    return this.onsitedoms.test(host);
	    }
	    else if (this.onsitedoms.length>0){
		    var doms=this.dcsSplit(this.onsitedoms);
		    var len=doms.length;
		    for (var i=0;i<len;i++){
			    if (host==doms[i]){
			        return true;
			    }
		    }
	    }
	}
	return false;
}
WebTrends.prototype.dcsTypeMatch=function(pth, typelist){
	var type=pth.substring(pth.lastIndexOf(".")+1,pth.length);
	var types=this.dcsSplit(typelist);
	var tlen=types.length;	
	for (var i=0;i<tlen;i++){
		if (type==types[i]){
			return true;
		}
	}
	return false;
}
WebTrends.prototype.dcsEvt=function(evt,tag){
	var e=evt.target||evt.srcElement;
	while (e.tagName&&(e.tagName!=tag)){
		e=e.parentElement||e.parentNode;
	}
	return e;
}
WebTrends.prototype.dcsNavigation=function(evt){
	return "";
}
WebTrends.prototype.dcsBind=function(event,func){
	if ((typeof(func)=="function")&&document.body){
		if (document.body.addEventListener){
			document.body.addEventListener(event, func.wtbind(this), true);
		}
		else if(document.body.attachEvent){
			document.body.attachEvent("on"+event, func.wtbind(this));
		}
	}
}
WebTrends.prototype.dcsET=function(){
	var e=(navigator.appVersion.indexOf("MSIE")!=-1)?"click":"mousedown";
	this.dcsBind(e,this.dcsDownload);
	this.dcsBind(e,this.dcsFormButton);
	this.dcsBind(e,this.dcsOffsite);
	this.dcsBind(e,this.dcsAnchor);
}
/*
	Calling: this.webtrends.dcsMultiTrackKLM("DCS.dcsuri", newTitle, "WT.ti", newTitle,  array);
*/
/*
 * inputArray = [ { "wtKey" : "myKey", "value" : "myValue" }, { "wtKey" : "myKey2", "value" : "myValue2" },  ]
*/
WebTrends.prototype.dcsMultiTrackKLM = function( dcsUri, wtTi, inputArray ) {
	var bTi = false;
	var bDCSuri = false;

	for (var i = 0; i < inputArray.length;i ++) {
		this.WT[ inputArray[i].wtKey ] = "" + inputArray[i].value;
		if(inputArray[i].wtKey == "ti")
		{
			bTi = true;
		}
		if(inputArray[i].wtKey == "dcsuri")
		{
			bDCSuri = true;
		}
	}
	if(!bDCSuri){
		this.DCS["dcsuri"] = dcsUri;
	}
	if(!bTi){
		this.WT["ti"] = wtTi;
	}	
	var dCurrent=new Date();
	this.DCS.dcsdat=dCurrent.getTime();
	this.dcsFunc(this.dcsFPC());
	//this.dcsTag();
	this.dcsCollect();

	// clear data so next call doesn't contain the old values
	//this.WT = {};
}
/*
	Original WebTrends function that works with multiple function arguments
	Calling: this.webtrends.dcsMultiTrackKLM("DCS.dcsuri", newTitle, "WT.ti", newTitle, "WT." + inputArray[i].wtKey, inputArray[i].value);

*/

/*
 * inputArray = { "prop" : "value", "prop2" : "value2" }
*/
WebTrends.prototype.dcsMultiTrackKLM2 = function( dcsUri, wtTi, inputArray ) {
	
	var bTi = false;
	var bDCSuri = false;
	
	for (var prop in inputArray) {
		this.WT[ prop ] = "" + inputArray[prop];
		if(prop == "ti")
		{
			bTi = true;
		}
		if(prop == "dcsuri")
		{
			bDCSuri = true;
		}
		if (prop.indexOf('WT.')==0){
			this.WT[prop.substring(3)]=inputArray[prop];
		}
		else if (prop.indexOf('DCS.')==0){
			this.DCS[prop.substring(4)]=inputArray[prop];
		}
		else if (prop.indexOf('DCSext.')==0){
			this.DCSext[prop.substring(7)]=inputArray[prop];
		}	
	}
	if(!bDCSuri){
		this.DCS["dcsuri"] = dcsUri;
	}
	if(!bTi){
		this.WT["ti"] = wtTi;
	}	
		
	var dCurrent=new Date();
	this.DCS.dcsdat=dCurrent.getTime();
	this.dcsFunc(this.dcsFPC());
	//this.dcsTag();
	this.dcsCollect();

	// clear data so next call doesn't contain the old values
	//this.WT = {};
}

WebTrends.prototype.dcsMultiTrack=function(){
	var args=dcsMultiTrack.arguments?dcsMultiTrack.arguments:arguments;
	if (args.length%2==0){
		for (var i=0;i<args.length;i+=2){
			if (args[i].indexOf('WT.')==0){
				this.WT[args[i].substring(3)]=args[i+1];
			}
			else if (args[i].indexOf('DCS.')==0){
				this.DCS[args[i].substring(4)]=args[i+1];
			}
			else if (args[i].indexOf('DCSext.')==0){
				this.DCSext[args[i].substring(7)]=args[i+1];
			}
		}
		var dCurrent=new Date();
		this.DCS.dcsdat=dCurrent.getTime();
		this.dcsFunc(this.dcsFPC());
		this.dcsTag();
	}
}
WebTrends.prototype.dcsSplit=function(list){
	var items=list.toLowerCase().split(",");
	var len=items.length;
	for (var i=0;i<len;i++){
		items[i]=items[i].replace(/^\s*/,"").replace(/\s*$/,"");
	}
	return items;
}
// Code section for Track clicks to download links.
WebTrends.prototype.dcsDownload=function(evt){
	evt=evt||(window.event||"");
	if (evt&&((typeof(evt.which)!="number")||(evt.which==1))){
		var e=this.dcsEvt(evt,"A");
		if (e.href){
		    var hn=e.hostname?(e.hostname.split(":")[0]):"";
		    if (this.dcsIsOnsite(hn)&&this.dcsTypeMatch(e.pathname,this.downloadtypes)){
		        var qry=e.search?e.search.substring(e.search.indexOf("?")+1,e.search.length):"";
		        var pth=e.pathname?((e.pathname.indexOf("/")!=0)?"/"+e.pathname:e.pathname):"/";
		        var ttl="";
		        var text=document.all?e.innerText:e.text;
		        var img=this.dcsEvt(evt,"IMG");
		        if (img.alt){
			        ttl=img.alt;
		        }
		        else if (text){
			        ttl=text;
		        }
		        else if (e.innerHTML){
			        ttl=e.innerHTML;
		        }
		        this.dcsMultiTrack("DCS.dcssip",hn,"DCS.dcsuri",pth,"DCS.dcsqry",e.search||"","WT.ti","Download:"+ttl,"WT.dl","20","WT.nv",this.dcsNavigation(evt));
		        this.DCS.dcssip=this.DCS.dcsuri=this.DCS.dcsqry=this.WT.ti=this.WT.dl=this.WT.nv="";
		    }
		}
	}
}
// Code section for Track form button clicks.
WebTrends.prototype.dcsFormButton=function(evt){
	evt=evt||(window.event||"");
	if (evt&&((typeof(evt.which)!="number")||(evt.which==1))){
		var tags=["INPUT","BUTTON"];
		for (var j=0;j<tags.length;j++){
			var e=this.dcsEvt(evt,tags[j]);
			var type=e.type||"";
			if (type&&((type=="submit")||(type=="image")||(type=="button")||(type=="reset"))||((type=="text")&&((evt.which||evt.keyCode)==13))){
				var uri="";
				var ttl="";
				var qry="";
				var id=0;
				if (e.form){
					// begin: field capture
					// end: field capture
					uri=e.form.action||window.location.pathname;
					ttl=e.form.id||e.form.name||e.form.className||"Unknown";
					id=(e.form.method&&(e.form.method.toLowerCase()=="post"))?"27":"26";
				}
				else{
					uri=window.location.pathname;
					ttl=e.name||e.id||"Unknown";
					id=(tags[j].toLowerCase()=="input")?"28":"29";
				}
				if (uri&&ttl&&(evt.keyCode!=9)){
					this.dcsMultiTrack("DCS.dcsuri",uri,"DCS.dcsqry",qry,"WT.ti","FormButton:"+ttl,"WT.dl",id,"WT.nv",this.dcsNavigation(evt));
				}
				this.DCS.dcsuri=this.DCS.dcsqry=this.WT.ti=this.WT.dl=this.WT.nv="";
				break;
			}
		}
	}
}
// Code section for Track clicks to links leading offsite.
WebTrends.prototype.dcsOffsite=function(evt){
	evt=evt||(window.event||"");
	if (evt&&((typeof(evt.which)!="number")||(evt.which==1))){
		var e=this.dcsEvt(evt,"A");
		if (e.href){
		    var hn=e.hostname?(e.hostname.split(":")[0]):"";
		    var pr=e.protocol||"";
		    if ((hn.length>0)&&(pr.indexOf("http")==0)&&!this.dcsIsOnsite(hn)){
			    var qry=e.search?e.search.substring(e.search.indexOf("?")+1,e.search.length):"";
			    var pth=e.pathname?((e.pathname.indexOf("/")!=0)?"/"+e.pathname:e.pathname):"/";
			    var trim=true;
			    this.dcsMultiTrack("DCS.dcssip",hn,"DCS.dcsuri",pth,"DCS.dcsqry",trim?"":qry,"WT.ti","Offsite:"+hn+pth+qry,"WT.dl","24","WT.nv",this.dcsNavigation(evt));
			    this.DCS.dcssip=this.DCS.dcsuri=this.DCS.dcsqry=this.WT.ti=this.WT.dl=this.WT.nv="";
		    }
		}
	}
}

// Code section for Track clicks to links that contain anchors.
WebTrends.prototype.dcsAnchor=function(evt){
	evt=evt||(window.event||"");
	if (evt&&((typeof(evt.which)!="number")||(evt.which==1))){
		var e=this.dcsEvt(evt,"A");
		if (e.href){
		    var hn=e.hostname?(e.hostname.split(":")[0]):"";
		    if (this.dcsIsOnsite(hn)&&e.hash&&(e.hash!="")&&(e.hash!="#")){
		        var qry=e.search?e.search.substring(e.search.indexOf("?")+1,e.search.length):"";
			    var pth=e.pathname?((e.pathname.indexOf("/")!=0)?"/"+e.pathname:e.pathname):"/";
			    this.dcsMultiTrack("DCS.dcssip",hn,"DCS.dcsuri",pth+e.hash,"WT.ti","Anchor:"+e.hash,"WT.dl","21","WT.nv",this.dcsNavigation(evt));
			    this.DCS.dcssip=this.DCS.dcsuri=this.WT.ti=this.WT.dl=this.WT.nv="";
		    }
		}
	}
}
WebTrends.prototype.dcsAdv=function(){
	if (this.trackevents&&(typeof(this.dcsET)=="function")){
		if (window.addEventListener){
			window.addEventListener("load",this.dcsET.wtbind(this),false);
		}
		else if (window.attachEvent){
			window.attachEvent("onload",this.dcsET.wtbind(this));
		}
	}
	this.dcsFunc(this.dcsFPC());
}
WebTrends.prototype.dcsVar=function(){
	var dCurrent=new Date();
	var WT=this.WT;
	var DCS=this.DCS;
	WT.tz=parseInt(dCurrent.getTimezoneOffset()/60*-1)||"0";
	WT.bh=dCurrent.getHours()||"0";
	WT.ul=navigator.appName=="Netscape"?navigator.language:navigator.userLanguage;
	if (typeof(screen)=="object"){
		WT.cd=navigator.appName=="Netscape"?screen.pixelDepth:screen.colorDepth;
		WT.sr=screen.width+"x"+screen.height;
	}
	if (typeof(navigator.javaEnabled())=="boolean"){
		WT.jo=navigator.javaEnabled()?"Yes":"No";
	}
	if (document.title){
		// 2008-10-01 WvdH: Bugfix! WebTrends doesn't accept overwriting the WT.ti tag (now it does!)
		if (WT.ti == "") { // WT.ti tag not set by our JavaScript, so WebTrends may do it
			if (window.RegExp) {
				var tire=new RegExp("^"+window.location.protocol+"//"+window.location.hostname+"\\s-\\s");
				WT.ti=document.title.replace(tire,"");
			} else {
				WT.ti=document.title;
			}
		} // else WT.ti tag is set by our JavaScript, e.g. structure-group title used for the WT.ti tag
	}
	WT.js="Yes";
	WT.jv=(function(){
		var agt=navigator.userAgent.toLowerCase();
		var major=parseInt(navigator.appVersion);
		var mac=(agt.indexOf("mac")!=-1);
		var ff=(agt.indexOf("firefox")!=-1);
		var ff0=(agt.indexOf("firefox/0.")!=-1);
		var ff10=(agt.indexOf("firefox/1.0")!=-1);
		var ff15=(agt.indexOf("firefox/1.5")!=-1);
		var ff20=(agt.indexOf("firefox/2.0")!=-1);
		var ff3up=(ff&&!ff0&&!ff10&!ff15&!ff20);
		var nn=(!ff&&(agt.indexOf("mozilla")!=-1)&&(agt.indexOf("compatible")==-1));
		var nn4=(nn&&(major==4));
		var nn6up=(nn&&(major>=5));
		var ie=((agt.indexOf("msie")!=-1)&&(agt.indexOf("opera")==-1));
		var ie4=(ie&&(major==4)&&(agt.indexOf("msie 4")!=-1));
		var ie5up=(ie&&!ie4);
		var op=(agt.indexOf("opera")!=-1);
		var op5=(agt.indexOf("opera 5")!=-1||agt.indexOf("opera/5")!=-1);
		var op6=(agt.indexOf("opera 6")!=-1||agt.indexOf("opera/6")!=-1);
		var op7up=(op&&!op5&&!op6);
		var jv="1.1";
		if (ff3up){
			jv="1.8";
		}
		else if (ff20){
			jv="1.7";
		}
		else if (ff15){
			jv="1.6";
		}
		else if (ff0||ff10||nn6up||op7up){
			jv="1.5";
		}
		else if ((mac&&ie5up)||op6){
			jv="1.4";
		}
		else if (ie5up||nn4||op5){
			jv="1.3";
		}
		else if (ie4){
			jv="1.2";
		}
		return jv;
	})();
	WT.ct="unknown";
	if (document.body&&document.body.addBehavior){
		try{
			document.body.addBehavior("#default#clientCaps");
			WT.ct=document.body.connectionType||"unknown";
			document.body.addBehavior("#default#homePage");
			WT.hp=document.body.isHomePage(location.href)?"1":"0";
		}
		catch(e){
		}
	}
	if (document.all){
		WT.bs=document.body?document.body.offsetWidth+"x"+document.body.offsetHeight:"unknown";
	}
	else{
		WT.bs=window.innerWidth+"x"+window.innerHeight;
	}
	WT.fv=(function(){
		var i,flash;
		if (window.ActiveXObject){
			for(i=10;i>0;i--){
				try{
					flash=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
					return i+".0";
				}
				catch(e){
				}
			}
		}
		else if (navigator.plugins&&navigator.plugins.length){
			for (i=0;i<navigator.plugins.length;i++){
				if (navigator.plugins[i].name.indexOf('Shockwave Flash')!=-1){
					return navigator.plugins[i].description.split(" ")[2];
				}
			}
		}
		return "Not enabled";
	})();
	WT.slv=(function(){
		var slv="Not enabled";
		try{     
			if (navigator.userAgent.indexOf('MSIE')!=-1){
				var sli = new ActiveXObject('AgControl.AgControl');
				if (sli){
					slv="Unknown";
				}
			}
			else if (navigator.plugins["Silverlight Plug-In"]){
				slv="Unknown";
			}
		}
		catch(e){
		}
		if (slv!="Not enabled"){
			var i,j,v;
			if ((typeof(Silverlight)=="object")&&(typeof(Silverlight.isInstalled)=="function")){
				for (j=9;j>=0;j--){
					for(i=3;i>0;i--){
						v=i+"."+j;
						if (Silverlight.isInstalled(v)){
							slv=v;
							break;
						}
					}
					if (slv==v){
						break;
					}
				}
			}
		}
		return slv;
	})();
	if (this.i18n){
		if (typeof(document.defaultCharset)=="string"){
			WT.le=document.defaultCharset;
		} 
		else if (typeof(document.characterSet)=="string"){
			WT.le=document.characterSet;
		}
		else{
			WT.le="unknown";
		}
	}
	WT.tv="8.5.0";
//	WT.sp="@@SPLITVALUE@@";
	WT.dl="0";
	WT.ssl=(window.location.protocol.indexOf('https:')==0)?"1":"0";
	DCS.dcsdat=dCurrent.getTime();
	DCS.dcssip=window.location.hostname;

	// 2008-10-31 WvdH: Bugfix! WebTrends doesn't accept overwriting the DCS.dcsuri tag (now it does!)
	if (typeof(DCS.dcsuri) == "undefined") { // DCS.dcsuri tag not set by our JavaScript, so WebTrends may do it
		DCS.dcsuri = window.location.pathname;
	} // else DCS.dcsuri tag is set by our JavaScript, e.g. application specific URL used for the DCS.dcsuri tag

	WT.es=DCS.dcssip+DCS.dcsuri;
	if (window.location.search){
		DCS.dcsqry=window.location.search;
	}
	if ((window.document.referrer!="")&&(window.document.referrer!="-")){
		if (!(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)<4)){
			DCS.dcsref=window.document.referrer;
		}
	}
}
WebTrends.prototype.dcsEscape=function(S, REL){
	if (REL!=""){
		S=S.toString();
		for (var R in REL){
 			if (REL[R] instanceof RegExp){
				S=S.replace(REL[R],R);
 			}
		}
		return S;
	}
	else{
		return escape(S);
	}
}
WebTrends.prototype.dcsA=function(N,V){
	if (this.i18n&&(this.exre!="")&&!this.exre.test(N)){
		if (N=="dcsqry"){
			var newV="";
			var params=V.substring(1).split("&");
			for (var i=0;i<params.length;i++){
				var pair=params[i];
				var pos=pair.indexOf("=");
				if (pos!=-1){
					var key=pair.substring(0,pos);
					var val=pair.substring(pos+1);
					if (i!=0){
						newV+="&";
					}
					newV+=key+"="+this.dcsEncode(val);
				}
			}
			V=V.substring(0,1)+newV;
		}
		else{
			V=this.dcsEncode(V);
		}
	}
	return "&"+N+"="+this.dcsEscape(V, this.re);
}
WebTrends.prototype.dcsEncode=function(S){
	return (typeof(encodeURIComponent)=="function")?encodeURIComponent(S):escape(S);
}
WebTrends.prototype.dcsCreateImage=function(dcsSrc){
	if (document.images){
		this.images[this.index]=new Image();
		this.images[this.index].src=dcsSrc;
		this.index++;
	}
	else{
		document.write('<IMG ALT="" BORDER="0" NAME="DCSIMG" WIDTH="1" HEIGHT="1" SRC="'+dcsSrc+'">');
	}
}
WebTrends.prototype.dcsMeta=function(){
	var elems;
	if (document.all){
		elems=document.all.tags("meta");
	}
	else if (document.documentElement){
		elems=document.getElementsByTagName("meta");
	}
	if (typeof(elems)!="undefined"){
		var length=elems.length;
		for (var i=0;i<length;i++){
			var name=elems.item(i).name;
			var content=elems.item(i).content;
			var equiv=elems.item(i).httpEquiv;
			if (name.length>0){
				if (name.indexOf("WT.")==0){
					this.WT[name.substring(3)]=content;
				}
				else if (name.indexOf("DCSext.")==0){
					this.DCSext[name.substring(7)]=content;
				}
				else if (name.indexOf("DCS.")==0){
					this.DCS[name.substring(4)]=content;
				}
			}
		}
	}
}
WebTrends.prototype.getQryOnlyWT = function(qryVal) {
	var newV="";
	var bFirst = true;
	var params=qryVal.substring(1).split("&");
	for (var i=0;i<params.length;i++){
		var pair=params[i];
		var pos=pair.indexOf("=");
		if (pos!=-1){
			var key=pair.substring(0,pos);
			var val=pair.substring(pos+1);
			if ( ( key.indexOf("WT") == 0 ) || ( key.indexOf("DCS") == 0 ) ) {
				if (! bFirst){
					newV+="&";
				}
				newV += key+"="+this.dcsEncode(val);
				bFirst = false;
			}
		}
	}
	return newV;
}
WebTrends.prototype.dcsTag=function(){
	if (document.cookie.indexOf("WTLOPTOUT=")!=-1){
		return;
	}
	var WT=this.WT;
	var DCS=this.DCS;
	var DCSext=this.DCSext;
	var i18n=this.i18n;

	var P = "";
	var strBase="http"+(window.location.protocol.indexOf('https:')==0?'s':'')+"://"+this.domain+(this.dcsid==""?'':'/'+this.dcsid)+"/dcs.gif?";
	var strDCSqryTotal = "";
	var strDCSqryOnlyWT = "";
	var strDCSqryNone = this.dcsA("dcsqry", "NONE" );
	var strDCSRefTotal = "";
	var strDCSRefStatic = "";
	var strDCSRefNone = this.dcsA("dcsref", "NONE" );

	if (i18n){
		WT.dep="";
	}
	for (var N in DCS){
 		if (DCS[N]&&(typeof DCS[N]!="function")){
			if ( N == 'dcsqry' ) {
				strDCSqryTotal = this.dcsA(N,DCS[N]);
			}
			else if ( N == 'dcsref' ) {
				strDCSRefTotal = this.dcsA(N,DCS[N]);
			}
			else {
				strBase+=this.dcsA(N,DCS[N]);
			}
		}
	}
	var keys=["co_f","vt_sid","vt_f_tlv"];
	for (var i=0;i<keys.length;i++){
		var key=keys[i];
		if (WT[key]){
			strBase+=this.dcsA("WT."+key,WT[key]);
			delete WT[key];
		}
	}
	for (N in WT){
		if (WT[N]&&(typeof WT[N]!="function")){
			strBase+=this.dcsA("WT."+N,WT[N]);
		}
	}
	for (N in DCSext){
		if (DCSext[N]&&(typeof DCSext[N]!="function")){
			if (i18n){
				WT.dep=(WT.dep.length==0)?N:(WT.dep+";"+N);
			}
			strBase+=this.dcsA(N,DCSext[N]);
		}
	}
	if (i18n&&(WT.dep.length>0)){
		strBase+=this.dcsA("WT.dep",WT.dep);
	}

	P = strBase + strDCSqryTotal + strDCSRefTotal;

	var iMaxLength = 2048;
	if ( (P.length > iMaxLength) && (navigator.userAgent.indexOf('MSIE') >=0 ) )
	{
		// 1. Check 'dcsqry' and remove all non-Webtrends prefixes
		strDCSqryOnlyWT = this.dcsA("dcsqry", this.getQryOnlyWT(DCS['dcsqry']) );
		P = strBase + strDCSqryOnlyWT + strDCSRefTotal + "&truncated=1";
		if ( P.length > iMaxLength )
		{
			// 2. Check 'dcsref' and leave only the static part
			if ( DCS.dcsref )
			{
				var iPos = DCS.dcsref.indexOf("?");
				if ( iPos > -1 )
				{
					strDCSRefStatic = this.dcsA("dcsref", DCS.dcsref.substr(0,iPos) );
				}
				else
				{
					strDCSRefStatic = strDCSRefTotal;
				}
				P = strBase + strDCSqryOnlyWT + strDCSRefStatic + "&truncated=2";
			}
			if ( P.length > iMaxLength )
			{
				// 3. Check 'dcsref' and remove the total value and set to 'NONE'
				P = strBase + strDCSqryOnlyWT + strDCSRefNone + "&truncated=3";
				if ( P.length > iMaxLength )
				{
					// 4. Check 'dcsqry' and remove the total value and set to 'NONE'
					P = strBase + strDCSqryNone + strDCSRefNone + "&truncated=4";
					if ( P.length > iMaxLength )
					{
						// 5. Set truncated value to 5
						P=P.substring(0,iMaxLength - 13) + "&truncated=5";
					}
				}
			}
		}
	}
	/* Current solution:
	if (P.length>2048&&navigator.userAgent.indexOf('MSIE')>=0){
		// P=P.substring(0,2040)+"&WT.tu=1";
		// 2009-07-01 WvdH: fix long URL's
		P=P.substring(0,2035)+"&truncated=1";
	}
	*/
	this.dcsCreateImage(P);
	this.WT.ad="";
}
WebTrends.prototype.dcsFunc=function(func){
	if (typeof(func)=="function"){
		func();
	}
}
WebTrends.prototype.dcsDebug=function(){
	var t=this;
	var i=t.images[0].src;
	var q=i.indexOf("?");
	var r=i.substring(0,q).split("/");
	var m="<b>Protocol</b><br><code>"+r[0]+"<br></code>";
	m+="<b>Domain</b><br><code>"+r[2]+"<br></code>";
	m+="<b>Path</b><br><code>/"+r[3]+"/"+r[4]+"<br></code>";
	m+="<b>Query Params</b><code>"+i.substring(q+1).replace(/\&/g,"<br>")+"</code>";
	m+="<br><b>Cookies</b><br><code>"+document.cookie.replace(/\;/g,"<br>")+"</code>";
	if (t.w&&!t.w.closed){
		t.w.close();
	}
	t.w=window.open("","dcsDebug","width=500,height=650,scrollbars=yes,resizable=yes");
	t.w.document.write(m);
	t.w.focus();
}
WebTrends.prototype.dcsCollect=function(){
    if (this.enabled){
        this.dcsVar();
        this.dcsMeta();
        this.dcsFunc(this.dcsAdv());
        this.dcsTag();
    }
}

function dcsMultiTrack(){
	if (typeof(_tag)!="undefined"){
		return(_tag.dcsMultiTrack());
	}
}

Function.prototype.wtbind = function(obj){
	var method=this;
	var temp=function(){
		return method.apply(obj,arguments);
	};
	return temp;
}
if (top.location != document.location){
 
        document.domain = 'klm.com';
 
}
 
try {
 
        var _metron2 = new Metron();
 
} catch (e) {}

var CURRENCIES = [
{key:"AED", value:      5.242150},
{key:"AFN", value:     70.646400},
{key:"ALL", value:    131.534000},
{key:"ANG", value:      2.554690},
{key:"AOA", value:    111.407000},
{key:"ARS", value:      5.488090},
{key:"AUD", value:      1.712860},
{key:"AWG", value:      2.554690},
{key:"AZN", value:      1.148610},
{key:"BAM", value:      1.955830},
{key:"BBD", value:      2.854400},
{key:"BDT", value:     98.120800},
{key:"BGN", value:      1.955830},
{key:"BHD", value:      0.536770},
{key:"BIF", value:   1761.460000},
{key:"BMD", value:      1.427200},
{key:"BND", value:      2.061010},
{key:"BOB", value:     10.018900},
{key:"BRL", value:      2.624940},
{key:"BSD", value:      1.427200},
{key:"BWP", value:      9.781520},
{key:"BZD", value:      2.854400},
{key:"CAD", value:      1.553300},
{key:"CDF", value:   1157.470000},
{key:"CHF", value:      1.516780},
{key:"CLP", value:    785.381000},
{key:"CNY", value:      9.750840},
{key:"COP", value:   2875.210000},
{key:"CRC", value:    833.086000},
{key:"CUP", value:      1.427200},
{key:"CVE", value:    110.265000},
{key:"CYP", value:      0.585270},
{key:"CZK", value:     25.520900},
{key:"DJF", value:    250.687000},
{key:"DKK", value:      7.443590},
{key:"DOP", value:     51.283600},
{key:"DZD", value:    104.008000},
{key:"EEK", value:     15.646600},
{key:"EGP", value:      7.909840},
{key:"ETB", value:     17.917100},
{key:"EUR", value:      1.000000},
{key:"FJD", value:      2.847320},
{key:"FRF", value:      6.559570},
{key:"GBP", value:      0.866310},
{key:"GEL", value:      2.395420},
{key:"GHS", value:      2.090760},
{key:"GIP", value:      0.866310},
{key:"GMD", value:     38.427400},
{key:"GNF", value:   6922.490000},
{key:"GTQ", value:     11.755100},
{key:"GYD", value:    293.010000},
{key:"HKD", value:     11.062000},
{key:"HNL", value:     26.964100},
{key:"HRK", value:      7.317930},
{key:"HTG", value:     56.731200},
{key:"HUF", value:    270.008000},
{key:"IDR", value:  14304.600000},
{key:"ILS", value:      5.438720},
{key:"INR", value:     69.431500},
{key:"IQD", value:   1645.620000},
{key:"IRR", value:  14178.000000},
{key:"ISK", value:    183.415000},
{key:"JMD", value:    126.272000},
{key:"JOD", value:      1.012020},
{key:"JPY", value:    134.322000},
{key:"KES", value:    108.873000},
{key:"KGS", value:     62.318700},
{key:"KMF", value:    491.968000},
{key:"KPW", value:    197.111000},
{key:"KRW", value:   1780.850000},
{key:"KWD", value:      0.409700},
{key:"KYD", value:      1.170300},
{key:"KZT", value:    215.191000},
{key:"LAK", value:  12150.000000},
{key:"LBP", value:   2151.500000},
{key:"LKR", value:    163.826000},
{key:"LRD", value:      1.427200},
{key:"LSL", value:     11.255400},
{key:"LTL", value:      3.452800},
{key:"LVL", value:      0.702800},
{key:"LYD", value:      1.766850},
{key:"MAD", value:     11.313000},
{key:"MDL", value:     16.013500},
{key:"MGA", value:   2760.210000},
{key:"MKD", value:     61.771100},
{key:"MMK", value:      9.184030},
{key:"MOP", value:     11.393900},
{key:"MRO", value:    372.137000},
{key:"MUR", value:     45.512100},
{key:"MVR", value:     18.268200},
{key:"MWK", value:    201.234000},
{key:"MXN", value:     18.364800},
{key:"MYR", value:      5.030220},
{key:"MZN", value:     38.645200},
{key:"NAD", value:     11.255400},
{key:"NGN", value:    217.648000},
{key:"NIO", value:     28.438400},
{key:"NLG", value:      2.203710},
{key:"NOK", value:      8.608750},
{key:"NPR", value:    111.090000},
{key:"NZD", value:      2.098730},
{key:"OMR", value:      0.548760},
{key:"PAB", value:      1.427200},
{key:"PEN", value:      4.225790},
{key:"PGK", value:      3.755810},
{key:"PHP", value:     68.997400},
{key:"PKR", value:    118.330000},
{key:"PLN", value:      4.127350},
{key:"PYG", value:   7070.340000},
{key:"QAR", value:      5.195010},
{key:"RON", value:      4.226480},
{key:"RSD", value:     93.236700},
{key:"RUB", value:     45.143800},
{key:"RWF", value:    810.745000},
{key:"SAR", value:      5.352340},
{key:"SBD", value:     11.379500},
{key:"SCR", value:     18.779100},
{key:"SDD", value:    288.313000},
{key:"SDG", value:      3.196930},
{key:"SEK", value:     10.158000},
{key:"SGD", value:      2.061010},
{key:"SKK", value:     30.126000},
{key:"SLL", value:   4947.450000},
{key:"SOS", value:   2036.040000},
{key:"SRD", value:      3.953340},
{key:"STD", value:  22047.200000},
{key:"SVC", value:     12.488000},
{key:"SYP", value:     67.763500},
{key:"SZL", value:     11.255400},
{key:"THB", value:     48.571700},
{key:"TND", value:      1.886450},
{key:"TOP", value:      2.815670},
{key:"TRY", value:      2.128600},
{key:"TTD", value:      8.962820},
{key:"TWD", value:     46.967400},
{key:"TZS", value:   1874.920000},
{key:"UAH", value:     11.975300},
{key:"UGX", value:   2948.920000},
{key:"USD", value:      1.427200},
{key:"UYU", value:     33.025500},
{key:"UZS", value:   2130.910000},
{key:"VEB", value:   3090.950000},
{key:"VEF", value:      3.064630},
{key:"VND", value:  25425.900000},
{key:"VUV", value:    145.372000},
{key:"WST", value:      3.775160},
{key:"XAF", value:    655.957000},
{key:"XCD", value:      3.853440},
{key:"XDR", value:      0.914820},
{key:"XEU", value:      1.000000},
{key:"XOF", value:    655.957000},
{key:"XPF", value:    119.332000},
{key:"YER", value:    284.013000},
{key:"YUM", value:     71.274200},
{key:"ZAR", value:     11.255400},
{key:"ZMK", value:   6887.570000},
{key:"ZWR", value:     95.473300}];
function Map()
{
    // members
    this.keyArray = new Array(); // Keys
    this.valArray = new Array(); // Values
        
    // methods
    this.put = put;
    this.get = get;
    this.size = size;  
    this.clear = clear;
    this.keySet = keySet;
    this.valSet = valSet;
    this.showMe = showMe;   // returns a string with all keys and values in map.
    this.findIt = findIt;
    this.remove = remove;
}

function put( key, val )
{

	switch (val)
	{
		case "document.title" : val = document.title; break;
		case "location.pathname" : val = location.pathname; break;
	}
    var elementIndex = this.findIt( key );
    
    if( elementIndex == (-1) )
    {
        this.keyArray.push( key );
        this.valArray.push( val );
    }
    else
    {
        this.valArray[ elementIndex ] = val;
    }
}

function get( key )
{
    var result = null;
    var elementIndex = this.findIt( key );

    if( elementIndex != (-1) )
    {   
        result = this.valArray[ elementIndex ];
    }  
    
    return result;
}

function remove( key )
{
    var result = null;
    var elementIndex = this.findIt( key );

    if( elementIndex != (-1) )
    {
        this.keyArray = this.keyArray.removeAt(elementIndex);
        this.valArray = this.valArray.removeAt(elementIndex);
    }  
    
    return ;
}

function size()
{
    return (this.keyArray.length);  
}

function clear()
{
    for( var i = 0; i < this.keyArray.length; i++ )
    {
        this.keyArray.pop(); this.valArray.pop();   
    }
}

function keySet()
{
    return (this.keyArray);
}

function valSet()
{
    return (this.valArray);   
}

function showMe()
{

    var result = new Array();
    for( var i = 0; i < this.keyArray.length; i++ )
    {
		result[this.keyArray[ i ]] = this.valArray[ i ]
		//result += "'" + this.keyArray[ i ] + "':'" + this.valArray[ i ] + "'"
        //if (i != this.keyArray.length - 1 )
		//{
		//	result += "," ; 
		//}
    } 
    return result;
}

function findIt( key )
{
    var result = (-1);

    for( var i = 0; i < this.keyArray.length; i++ )
    {
        if( this.keyArray[ i ] == key )
        {
            result = i;
            break;
        }
    }
    return result;
}

function removeAt( index )
{
  var part1 = this.slice( 0, index);
  var part2 = this.slice( index+1 );

  return( part1.concat( part2 ) );
}
// Array.prototype.removeAt = removeAt;
/*
* 2010-01-18 : Migration Version 1
*/

/**
 * This function sets up various components needed for initial display.
 */
function pageLoader() {
	if(window.isSifr == "True") {
		sifrInit(); // Init flash Noa replacement for titles
	}
	initTriggers();
	initFlightOffers();
	initSpecialOffers();
	newsOverview();
	initLeftMenu();
	if (YAHOO.env.ua.ie > 0 && YAHOO.env.ua.ie <= 6){
		setInterval('IE6ScrollBarBGone();', 100);
	}
	initWebSensor();
	
	try {
		if(YAHOO.util.Dom.get('dashboard-tabs')){
			// Only proceed if the dashboard has been detected
			window.db = (window.db) ? window.db : new Dashboard();
			if(window.isSifr == "True") {
				YAHOO.util.Event.onAvailable("db_ott_content", sifrInit);
				YAHOO.util.Event.onAvailable("db_ici_content", sifrInit);
				YAHOO.util.Event.onAvailable("db_anc_content", sifrInit);
				YAHOO.util.Event.onAvailable("db_mmb_content", sifrInit);
			}
			try {
				// Load EBT7 object only if the EBT tab is selected
				if (YAHOO.util.Dom.hasClass('db_ebt7', 'selected')) {
					var ebtPage = (ebtPage) ? ebtPage : new EBTPage('db_ebt7_content');
					ebtPage.pos = countryCode.toUpperCase(); // determine POS.
					var fs = (fs) ? fs : new DBFlightSearch(
						'db_ebt7_content', 
						'/passage/ebtui/inputsearchcriteria.ajax?posCode=' + countryCode.toUpperCase() + '&languageCode=' + languageCode.toLowerCase(), 
						ebtPage, 
						'/passage/ebtui/cabinclass.ajax?posCode=' + countryCode.toUpperCase() + '&languageCode=' + languageCode.toLowerCase()
					);
				}
			} catch (e) {
				// EBT not working
			}	
		}
	} catch (e) {
		// Dashboard failed to load.
	}

	YAHOO.klm.clSelector = new CountryLanguageSelector();
}
/*
* 2010-01-18 : Migration Version 1
*/
function initWebSensor() {
	var cook=document.cookie;
	var i=cook.indexOf('KLMCOM_SESSIONCOOKIE');
	var sRes=window.screen.width+"x"+window.screen.height;
	if(i<0)
	{
		var id1=parseInt(Math.random()*2147418112);
		document.cookie='KLMCOM_SESSIONCOOKIE='+id1+new Date().getTime()+'--'+sRes+';path=/;domain=.klm.com'
	}	

	strCDom=document.location.host.substring(document.location.host.lastIndexOf('.',document.location.host.lastIndexOf('.') - 1));
	keepdays=180;

	cook=document.cookie;
	i=cook.indexOf('MfTrack_js');
	if(i<0){
		// the cookie was not yet present, create a new cookie
		id1=parseInt(Math.random()*2147418112);
		strCVal=id1+'.'+new Date().getTime()+'--'+sRes;
		document.cookie='MfTrack_js='+strCVal+'; path=/; domain='+strCDom;
	}
	strPVal='';
	i=cook.indexOf('MfPers_js=');
	if(i<0){
		// the cookie was not yet present, create a new cookie
		id1=parseInt(Math.random()*2147418112);
		strPVal=id1+'.'+new Date().getTime()+'--'+sRes;
	}
 	else {
		// change expire date of persistent cookie, with same value
		j=cook.indexOf(";",i+10);
		if (j<0){
			strPVal=cook.substring(i+10);
		}else{
			strPVal=cook.substring(i+10, j);
		}
		// Temperaly check if cookie is oke, keep test till 1-1-2009
		re = /^\d+\.\d+(\-){2}\d+x\d+$/;
		// cookie not oke, create new value
		if (!re.test(strPVal))
		{
			id1=parseInt(Math.random()*2147418112);
			strPVal=id1+'.'+new Date().getTime()+'--'+sRes;
		}	
	}
	expires=new Date();
	expires.setTime(expires.getTime()+(keepdays*24*60*60*1000));
	document.cookie='MfPers_js='+strPVal+'; path=/; domain='+strCDom+'; expires='+expires.toGMTString();
	
	var qs = window.location.search
	var adcamp = getParameter(qs, "adcamp")
	if (adcamp)
	{
		expires=new Date();
		expires.setTime(expires.getTime()+(30*24*60*60*1000));
		var content = "&adcamp=" + adcamp + "&adchan=" + getParameter(qs, "adchan") + "&adtype=" +
			getParameter(qs, "adtype") + "&adctry=" + getParameter(qs, "adctry") + "&adlang=" +
			getParameter(qs, "adlang") + "&http_referrer=" + document.referrer;
		document.cookie="SADCAMP=" + content + "; path=/; domain=" + strCDom;
		document.cookie="PADCAMP=" + content + "; path=/; domain=" + strCDom + "; expires="+expires.toGMTString();
	}
}
/*
* 2010-01-18 : Migration Version 1
*/

// Beta version
Cookie = {
	
	/**
	* Returns the cookie value for the given name
	* @param (String) name The name of the cookie to get
	* @return (String) returns the value of the cookie
	**/
	get : function(name) {
		
		var cookie = document.cookie;
		
		if (name === "") {
			alert ("Cookie.get(): Cookie name must be a non-empty string.");
			return false;
		}
		
		var start = cookie.indexOf( name + "=" );
		var len = start + name.length + 1;
		
		if (start == -1) {
			return null;
		}
		
		var end = cookie.indexOf( ";", len );
		
		if ( end == -1 ) end = cookie.length;
		
		return unescape( cookie.substring( len, end ) );
		
	},
	
	set : function(name, value, options) {
		
		var expireDate = new Date();
		expireDate.setTime(expireDate.getTime() + (86400000 * 100));
		var gmtExpireDate = expireDate.toGMTString();

		var cookieString = name + "=" + value + ";expires=" + gmtExpireDate + ";path=/" ;
		document.cookie = cookieString;
	},
	
	remove : function(name) {
		if (name === "") {
			alert("Cookie.remove(): Cookie name must be a non-empty string.");
			return false;
		}
		
		document.cookie = name + "=; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}
/*
* 2010-01-18 : Migration Version 1
*/

function initTriggers() {
	//form triggers
	var fields = YAHOO.util.Selector.query('div.trigger input');

	for(i = 0; i < fields.length; i++){
		var field = fields[i];
		field.title = field.value;
		YAHOO.util.Event.addListener(fields[i], "focus", function(e) {
			var field = YAHOO.util.Event.getTarget(e);
			if((field.type == 'text' || field.type == 'password') && field.value == field.title){
				field.value = "";
				field.style.color = "#000000";
			}
		});
		YAHOO.util.Event.addListener(fields[i], "blur", function(e) {
			var field = YAHOO.util.Event.getTarget(e);
			if((field.type == 'text' || field.type == 'password') && (field.value == "" || field.value == field.title)){
				field.value = field.title;
				field.style.color = "#003145";
			}
		});
	}

	// Promo triggers
	var promoTriggers = YAHOO.util.Dom.getElementsByClassName("promo-trigger");
	if (promoTriggers.length > 0) {
		YAHOO.util.Event.addListener(promoTriggers, "mouseover", function() {
			YAHOO.util.Dom.addClass(this, "hover");
		});
		YAHOO.util.Event.addListener(promoTriggers, "mouseout", function() {
			YAHOO.util.Dom.removeClass(this, "hover");
		});
	}
	//Application triggers
	var appTriggers = YAHOO.util.Dom.getElementsByClassName("application-trigger");
	if (appTriggers.length > 0) {
		YAHOO.util.Event.addListener(appTriggers, "mouseover", function() {
			YAHOO.util.Dom.addClass(this, "hover");
		});
		YAHOO.util.Event.addListener(appTriggers, "mouseout", function() {
			YAHOO.util.Dom.removeClass(this, "hover");
		});
		YAHOO.util.Event.addListener(appTriggers, "click", function() {
			window.location = this.getElementsByTagName("a")[0].href;
		});
	}
}

/*********************************
*	Added for Flight Offers page
**********************************/
function initFlightOffers() {
	var fo = document.getElementsByTagName("tr");
	YAHOO.util.Event.addListener(fo, "mouseover", function() {
		YAHOO.util.Dom.addClass(this, "hover");
	});
	YAHOO.util.Event.addListener(fo, "mouseout", function() {
		YAHOO.util.Dom.removeClass(this, "hover");
	});
}

/*********************************
*	Added for Special Offers page
**********************************/
function initSpecialOffers() {	
	var splOfferHome = YAHOO.util.Dom.getElementsByClassName("sploffer-home");
	if (splOfferHome.length > 0) {
		YAHOO.util.Event.addListener(splOfferHome, "mouseover", function() {
			YAHOO.util.Dom.addClass(this, "hover");
		});
		YAHOO.util.Event.addListener(splOfferHome, "mouseout", function() {
			YAHOO.util.Dom.removeClass(this, "hover");
		});
	}
}

/************************************
*	Added for the News Overview page
*************************************/
function newsOverview() {
	var newsSmall = YAHOO.util.Dom.getElementsByClassName('news-small');
	var newsLarge = YAHOO.util.Dom.getElementsByClassName('news-large');
	var allNews = [newsSmall, newsLarge];
	
	YAHOO.util.Event.addListener(allNews, "mouseover", function(){
		//alert(this.innerHTML);
		var newsText = this.getElementsByTagName("p")[0];
		if(newsText != null) {
			newsText.style.textDecoration = 'underline';
		}
	});
	
	YAHOO.util.Event.addListener(allNews, "mouseout", function(){
		//alert(this.innerHTML);
		var newsTextOut = this.getElementsByTagName("p")[0];
		if(newsTextOut != null) {
			newsTextOut.style.textDecoration = 'none';
		}
	});
}
/*
* 2010-01-18 : Migration Version 1
*/

// use for new ebt7 dashboard
//if (this.canScriptDomain) this.lightBox = new LayOver(document.body, "lightbox", .4, .5);

/**
 * LayOver triggeres a layover box using an animation
 * 
 * Usage: this.lightBox = new LayOver(document.body, "lightbox", 0.4)
 * 
 * @param {HTMLElem} container : The elem to attach the layOver to
 * @param {String} className : The classname to add to the layOver div
 * @param {int} animationSpeed : The time the animation should last
 * @param {int} maxOpacity : Not used ????
 * @param {String} useReplacementBoxes : Not used ???
 */
function LayOver(container, className, animationSpeed, maxOpacity, useReplacementBoxes) {
	this.speed = animationSpeed;
	this.opacity = maxOpacity;
	this.container = container;
	// Get parentregion
	var parentRegion = YAHOO.util.Dom.getRegion(this.container);
	// make sure you fill out the whole page
	var height = YAHOO.util.Dom.getViewportHeight() > document.body.offsetHeight ? YAHOO.util.Dom.getViewportHeight() : document.body.offsetHeight;
	// Create the layover
	this.layOver = document.createElement("div");
	this.layOver.className = className;
	YAHOO.util.Dom.setStyle(this.layOver, "opacity", 0);

	// Settings for the layover
	// The layover is put in the parentobject of the application that uses the layover
	// Because else ie has problems with z-index
	this.layOver.style.height = height + "px";
	this.layOver.style.width = YAHOO.util.Dom.getViewportWidth() + "px";
	// Set negative margin to align the layover with the screen
	this.layOver.style.marginLeft = - parentRegion.left + "px";
	this.layOver.style.marginTop = - parentRegion.top + "px";

	if (is_ie6) {
		//		this.selectBoxes = document.getElementsByTagName("select");
		//		if (useReplacementBoxes) this.replacements = createReplacementSelectBoxes(this.selectBoxes);
		//		if (!useReplacementBoxes) this.replacements = createReplacementSelectBoxes2(this.selectBoxes);
		this.replacements = new SelectBoxReplacement();
		//		alert(this.replacements.length)
	}

	// Custom events
	//	this.onComplete = new YAHOO.util.CustomEvent("onComplete", this, true);
}
LayOver.prototype.hide = function() {
	var attributes = {
		opacity : { to: 0 }
	}
	anim = new YAHOO.util.Motion(this.layOver, attributes, this.speed, YAHOO.util.Easing.easeOut);
	anim.lo = this;
	anim.onComplete.subscribe(this.finishHide);
	anim.animate();
}
LayOver.prototype.finishHide = function() {
	//	if (this.lo.selectBoxes) this.lo.showSelectBoxes();
	if (this.lo.replacements) this.lo.replacements.showBoxes();
	this.lo.layOver.style.display = "none";
	this.lo.container.removeChild(this.lo.layOver);
	//	this.onComplete.fire();
}
LayOver.prototype.show = function(toShow, el, obj, func) {
	this.container.appendChild(this.layOver);
	if (this.selectBoxes) this.hideSelectBoxes();
	if (this.replacements) this.replacements.hideBoxes();
	this.layOver.style.display = "block";
	var attributes = {
		opacity : { to: this.opacity }
	}
	anim = new YAHOO.util.Motion(this.layOver, attributes, this.speed, YAHOO.util.Easing.easeOut);
	anim.lo = this;
	anim.toShow = toShow;
	anim.onComplete.subscribe(this.finishShow);
	anim.animate();
	this.obj = obj;
	this.closeFunc = func;
	this.el = el;
	this.listener = YAHOO.util.Event.addListener(document, 'mousedown', this.docClick, this, true);
}
LayOver.prototype.docClick = function(e) {
	var t = YAHOO.util.Event.getTarget(e);
	if (YAHOO.util.Dom.isAncestor(this.el, t)
	|| this.el == t) {
		return;
	} else {
		var obj = this.obj;
		if(obj != null)
		{
			eval("obj." + this.closeFunc + "()");
		}
	}
	if(this.listener)
		YAHOO.util.Event.removeListener(document, 'mousedown');
}
LayOver.prototype.finishShow = function() {
	Dom.get(this.toShow).style.display = 'block';
	//	this.lo.onComplete.fire();
}
LayOver.prototype.hideSelectBoxes = function() {
	for (var i = 0; i < this.selectBoxes.length; i++) {
		this.selectBoxes[i].style.visibility = "hidden";
		if (this.replacements) {
			if (this.replacements[i]) {
				var txt = this.replacements[i].getElementsByTagName("span")[0];
				txt.innerHTML = this.selectBoxes[i].options[this.selectBoxes[i].selectedIndex].innerHTML;
				this.replacements[i].style.visibility = "visible";

			}
		}
	}
}
LayOver.prototype.showSelectBoxes = function() {
	for (var i = 0; i < this.selectBoxes.length; i++) {
		this.selectBoxes[i].style.visibility = "visible";
		if (this.replacements && this.replacements[i]) this.replacements[i].style.visibility = "hidden";
	}
}

function createReplacementSelectBoxes2(selectBoxes) {
	var replacements = new Array();
	for (var i = 0; i < selectBoxes.length; i++) {
		if (!YAHOO.util.Dom.hasClass(selectBoxes[i], "noreplace")) {
			// Get location and size of selectbox
			var region = YAHOO.util.Dom.getRegion(selectBoxes[i]);
			// Get location and size of parentNode for position purposes
			var pRegion = YAHOO.util.Dom.getRegion(selectBoxes[i].parentNode);
			var width = region.right - region.left;
			var height = region.bottom - region.top;

			// Create div to serve as placeholder
			var div = document.createElement("div");
			div.style.border = "solid 1px #7f9db9";
			div.style.width = (width > 0 ? (width - 2) : width) + "px";
			div.style.height = (height > 0 ? (height - 2) : height) + "px";
			div.style.position = "absolute";
			div.style.top = (region.top - 2) + "px";
			div.style.left = (region.left - 2) + "px";
			div.style.textAlign = "left";

			// Create text input to serve as replacement
			var textBox = document.createElement("input");
			textBox.type = "text";
			//		div.appendChild(textBox);

			txt = document.createElement("span");
			txt.style.display = "block";
			txt.style.marginLeft = 4 + "px";
			txt.style.color = YAHOO.util.Dom.getStyle(selectBoxes[i], "color");
			txt.style.marginTop = 1 + "px";

			div.appendChild(txt);

			var img = document.createElement("img");
			img.src="/travel/generic/images/ie6-selectbox-arrow_tcm169-187466.gif";
			img.style.position = "absolute";
			img.style.margin = 0;
			img.style.right = 0 + "px";
			img.style.top = 1 + "px";
			//div.appendChild(img);

			document.body.appendChild(div);

			replacements[i] = div;
		}
	}
	return replacements;
}
function createReplacementSelectBoxes(selectBoxes) {
	var replacements = new Array();
	for (var i = 0; i < selectBoxes.length; i++) {

		var div = document.createElement("div");
		div.style.position = "absolute";
		div.style.visibility = "hidden";

		var input = document.createElement("input");
		input.type = "text";
		//		input.value = selectBoxes[i].value;
		input.style.width = (selectBoxes[i].offsetWidth - 4) + "px";
		input.style.height = (selectBoxes[i].offsetHeight - 4) + "px";

		// Get the location of the selectbox on the screen
		var region = YAHOO.util.Dom.getRegion(selectBoxes[i]);
		div.style.left = (region.left - 2) + "px";
		div.style.top = (region.top - 3) + "px";
		div.appendChild(input);

		var img = document.createElement("img");
		img.src="/travel/generic/images/ie6-selectbox-arrow_tcm169-187466.gif";
		img.className = "replacement-image";
		img.style.position = "absolute";
		img.style.right = 1 + "px";
		img.style.top = 3 + "px";
		div.appendChild(img);

		//		selectBoxes[i].parentNode.appendChild(div);
		document.body.appendChild(div);

		replacements[i] = div;
	}
	return replacements;
}
function SelectBoxReplacement() {
	var tempBoxes = document.getElementsByTagName("select");
	this.selectBoxes = new Array();
	this.replaceBoxes = new Array();
	for (var i = 0; i < tempBoxes.length; i++) {
		if (tempBoxes[i].className.indexOf("noreplace") == -1) {
			this.selectBoxes[this.selectBoxes.length] = tempBoxes[i];
		}
	}
	this.createReplacements();
}
SelectBoxReplacement.prototype.createReplacements = function() {
	for (var i = 0; i < this.selectBoxes.length; i++) {
		var sBox = this.selectBoxes[i];
		var region = YAHOO.util.Dom.getRegion(sBox);
		if (sBox && region) {
			var pRegion = YAHOO.util.Dom.getRegion(sBox.parentNode);
			var width = region.right - region.left;
			var height = region.bottom - region.top;
			
			var newWidth = width - 2;
			var newHeight = height - 2;
			if ( newWidth < 0 )
				newWidth = 0;
			if ( newHeight < 0 )
				newHeight = 0;
			var rBox = document.createElement("div");
			rBox.style.border = "solid 1px #7f9db9";
			rBox.style.width = newWidth + "px";
			rBox.style.height = newHeight + "px";
			rBox.style.textAlign = "left";
			rBox.style.position = "absolute";
			rBox.style.left = (region.left - 2) + "px";
			rBox.style.top = (region.top - 2) + "px";
			
			newWidth = width - 6;
			if ( newWidth < 0 )
				newWidth = 0;
			var span = document.createElement("input");
			span.type = "text";
			span.style.border = "none";
			span.style.width = newWidth + "px";
			span.style.color = YAHOO.util.Dom.getStyle(sBox, "color");
			span.style.paddingLeft = 4 + "px";
			span.style.marginTop = 1 + "px";
			rBox.appendChild(span);
			
			var img = document.createElement("img");
			img.src="/travel/generic/images/ie6-selectbox-arrow_tcm169-187466.gif";
			img.style.position = "absolute";
			img.style.margin = 0;
			img.style.right = 0 + "px";
			img.style.top = 1 + "px";
			rBox.appendChild(img);
			
			YAHOO.util.Dom.setStyle(rBox, "visibility", "hidden");
			//document.body.appendChild(rBox);
			var klmdoc = YAHOO.util.Dom.get('klm-doc');
			klmdoc.appendChild(rBox);
			
			this.replaceBoxes[this.replaceBoxes.length] = {
				box: rBox,
				oriBox: sBox,
				txt: span
			};
		}
	}
	//	this.replaceBoxes[2].txt.innerHTML = this.replaceBoxes[2].oriBox.options[this.replaceBoxes[2].oriBox.selectedIndex].innerHTML;
}
SelectBoxReplacement.prototype.hideBoxes = function() {
	for (var i = 0; i < this.replaceBoxes.length; i++) {
		this.replaceBoxes[i].oriBox.style.visibility = "hidden";
		this.replaceBoxes[i].box.style.visibility = "visible";
		var region = YAHOO.util.Dom.getRegion(this.replaceBoxes[i].oriBox);

		YAHOO.util.Dom.setX(this.replaceBoxes[i].box, region.left);
		this.replaceBoxes[i].txt.value = this.replaceBoxes[i].oriBox.options[this.replaceBoxes[i].oriBox.selectedIndex].innerHTML;
	}
}
SelectBoxReplacement.prototype.showBoxes = function() {
	for (var i = 0; i < this.replaceBoxes.length; i++) {
		this.replaceBoxes[i].oriBox.style.visibility = "visible";
		this.replaceBoxes[i].box.style.visibility = "hidden";
	}
}
function openImageBox(image, title, width, height) {

	if (!Dom.hasClass(document.body, 'yui-skin-sam')) Dom.addClass(document.body, 'yui-skin-sam');
	var panel = new YAHOO.widget.Panel('image-box', {
		fixedcenter: true,
		close: false,
		draggable: false,
		zindex: 8,
		modal: true,
		visible: true,
		shadow: false,
		width: width + 'px',
		height: (height + 40) + 'px'
	});

	panel.setHeader(' <h3>' + title + '</h3><a class="print" href="javascript: printImage()">' + dict.print + '</a><a id="close-panel" class="close-overlay" href="javascript: YAHOO.klm.imagePanel.hide();">' + dict.close + '</a>');
	panel.setBody('<img s' + 'rc="' + image + '" />');
	panel.render(document.body);
	panel.subscribe('hide', function(e){
		document.body.removeChild(YAHOO.util.Dom.get('image-box_c'));
		document.body.removeChild(YAHOO.util.Dom.get('image-box_mask'));
	});
	YAHOO.klm.imagePanel = panel;
	var docClose = function(e) {
		var t = YAHOO.util.Event.getTarget(e);
		if (YAHOO.util.Dom.isAncestor('image-box-c', YAHOO.util.Event.getTarget(e))
		|| Dom.get('image-box-c') == YAHOO.util.Event.getTarget(e)) {
			return;
		} else {
			YAHOO.klm.imagePanel.hide();
		}
	}

	YAHOO.util.Event.addListener(document, 'mousedown',  docClose, this, true);
}
/*
* 2010-01-18 : Migration Version 1
*/

var ErrorHandler = function(configuration){
	
	this.conf = {
		container : configuration.container,
		mode: 'top',
		from: configuration.from,
		id: configuration.id
	}
	
	if(configuration.mode){
		this.conf.mode = configuration.mode;
	}
	
	this.container = this.getContainer();
	this.list = YAHOO.util.Dom.get(this.conf.id + '-list');
	
	this.header = this.container.getElementsByTagName('p')[0];
	
	if(this.header && formLongErrorMsgs){
		this.header.innerHTML = formLongErrorMsgs.errorBoxHeader
	}
}

ErrorHandler.prototype.addMessage = function(message){
	this.container.style.display = 'block';
	var messageContainer = document.createElement('li');
	messageContainer.innerHTML = message;
	this.list.appendChild(messageContainer);
}

ErrorHandler.prototype.getContainer = function(){
	var container = YAHOO.util.Dom.get(this.conf.id);
	var list = YAHOO.util.Dom.get(this.conf.id + '-list');
	if(!container){
		container = document.createElement('div');
		container.id = this.conf.id;
		this.getList(container);
		if(this.conf.mode.toLowerCase() == 'top') {
			YAHOO.util.Dom.insertBefore(container, YAHOO.util.Dom.getFirstChild(this.conf.container));
		} else {
			this.conf.container.appendChild(container);
		}
	}else if(!list){
		list = container.getElementsByTagName('ul')[0];
		if(list){
			list.id = this.conf.id + '-list';
		}else{
			this.getList(container);
		}
	}
	return container;
}


ErrorHandler.prototype.getList = function(container){
		list = document.createElement('ul');
		list.id = this.conf.id + '-list';
		container.appendChild(list);
}
/*
* 2010-01-18 : Migration Version 1
*/

/*
 * Copyright 2005 Joe Walker
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * Declare an object to which we can add real functions.
 */
if (dwr == null) var dwr = {};
if (dwr.util == null) dwr.util = {};
if (DWRUtil == null) var DWRUtil = dwr.util;

/** @private The flag we use to decide if we should escape html */
dwr.util._escapeHtml = true;

/**
 * Set the global escapeHtml flag
 */
dwr.util.setEscapeHtml = function(escapeHtml) {
  dwr.util._escapeHtml = escapeHtml;
}

/** @private Work out from an options list and global settings if we should be esccaping */
dwr.util._shouldEscapeHtml = function(options) {
  if (options && options.escapeHtml != null) {
    return options.escapeHtml;
  }
  return dwr.util._escapeHtml;
}

/**
 * Return a string with &, <, >, ' and " replaced with their entities
 * @see TODO
 */
dwr.util.escapeHtml = function(original) {
  var div = document.createElement('div');
  var text = document.createTextNode(original);
  div.appendChild(text);
  return div.innerHTML;
}

/**
 * Replace common XML entities with characters (see dwr.util.escapeHtml())
 * @see TODO
 */
dwr.util.unescapeHtml = function(original) {
  var div = document.createElement('div');
  div.innerHTML = original.replace(/<\/?[^>]+>/gi, '');
  return div.childNodes[0] ? div.childNodes[0].nodeValue : '';
}

/**
 * Replace characters dangerous for XSS reasons with visually similar characters
 * @see TODO
 */
dwr.util.replaceXmlCharacters = function(original) {
  original = original.replace("&", "+");
  original = original.replace("<", "\u2039");
  original = original.replace(">", "\u203A");
  original = original.replace("\'", "\u2018");
  original = original.replace("\"", "\u201C");
  return original;
}

/**
 * Return true iff the input string contains any XSS dangerous characters
 * @see TODO
 */
dwr.util.containsXssRiskyCharacters = function(original) {
  return (original.indexOf('&') != -1
    || original.indexOf('<') != -1
    || original.indexOf('>') != -1
    || original.indexOf('\'') != -1
    || original.indexOf('\"') != -1);
}

/**
 * Enables you to react to return being pressed in an input
 * @see http://getahead.org/dwr/browser/util/selectrange
 */
dwr.util.onReturn = function(event, action) {
  if (!event) event = window.event;
  if (event && event.keyCode && event.keyCode == 13) action();
};

/**
 * Select a specific range in a text box. Useful for 'google suggest' type functions.
 * @see http://getahead.org/dwr/browser/util/selectrange
 */
dwr.util.selectRange = function(ele, start, end) {
  ele = dwr.util._getElementById(ele, "selectRange()");
  if (ele == null) return;
  if (ele.setSelectionRange) {
    ele.setSelectionRange(start, end);
  }
  else if (ele.createTextRange) {
    var range = ele.createTextRange();
    range.moveStart("character", start);
    range.moveEnd("character", end - ele.value.length);
    range.select();
  }
  ele.focus();
};

/**
 * Find the element in the current HTML document with the given id or ids
 * @see http://getahead.org/dwr/browser/util/$
 */
if (document.getElementById) {
  dwr.util.byId = function() {
    var elements = new Array();
    for (var i = 0; i < arguments.length; i++) {
      var element = arguments[i];
      if (typeof element == 'string') {
        element = document.getElementById(element);
      }
      if (arguments.length == 1) {
        return element;
      }
      elements.push(element);
    }
    return elements;
  };
}
else if (document.all) {
  dwr.util.byId = function() {
    var elements = new Array();
    for (var i = 0; i < arguments.length; i++) {
      var element = arguments[i];
      if (typeof element == 'string') {
        element = document.all[element];
      }
      if (arguments.length == 1) {
        return element;
      }
      elements.push(element);
    }
    return elements;
  };
}

/**
 * Alias $ to dwr.util.byId
 * @see http://getahead.org/dwr/browser/util/$
 */
var $;
if (!$) {
  $ = dwr.util.byId;
}

/**
 * This function pretty-prints simple data or whole object graphs, f ex as an aid in debugging.
 * @see http://getahead.org/dwr/browser/util/todescriptivestring
 */
dwr.util.toDescriptiveString = function(data, showLevels, options) {
  if (showLevels === undefined) showLevels = 1;
  var opt = {};
  if (dwr.util._isObject(options)) opt = options;
  var defaultoptions = {
    escapeHtml:false,
    baseIndent: "",
    childIndent: "\u00A0\u00A0",
    lineTerminator: "\n",
    oneLineMaxItems: 5,
    shortStringMaxLength: 13,
    propertyNameMaxLength: 30 
  };
  for (var p in defaultoptions) if (!(p in opt)) opt[p] = defaultoptions[p];
  if (typeof options == "number") {
    var baseDepth = options;
    opt.baseIndent = dwr.util._indent2(baseDepth, opt);
  }

  var skipDomProperties = {
    document:true, ownerDocument:true,
    all:true,
    parentElement:true, parentNode:true, offsetParent:true,
    children:true, firstChild:true, lastChild:true,
    previousSibling:true, nextSibling:true,
    innerHTML:true, outerHTML:true,
    innerText:true, outerText:true, textContent:true,
    attributes:true,
    style:true, currentStyle:true, runtimeStyle:true,
    parentTextEdit:true
  };
  
  function recursive(data, showLevels, indentDepth, options) {
    var reply = "";
    try {
      // string
      if (typeof data == "string") {
        var str = data;
        if (showLevels == 0 && str.length > options.shortStringMaxLength)
          str = str.substring(0, options.shortStringMaxLength-3) + "...";
        if (options.escapeHtml) {
          // Do the escape separately for every line as escapeHtml() on some 
          // browsers (IE) will strip line breaks and we want to preserve them
          var lines = str.split("\n");
          for (var i = 0; i < lines.length; i++) lines[i] = dwr.util.escapeHtml(lines[i]);
          str = lines.join("\n");
        }
        if (showLevels == 0) { // Short format
          str = str.replace(/\n|\r|\t/g, function(ch) {
            switch (ch) {
              case "\n": return "\\n";
              case "\r": return "";
              case "\t": return "\\t";
            }
          });
        }
        else { // Long format
          str = str.replace(/\n|\r|\t/g, function(ch) {
            switch (ch) {
              case "\n": return options.lineTerminator + indent(indentDepth+1, options);
              case "\r": return "";
              case "\t": return "\\t";
            }
          });
        }
        reply = '"' + str + '"';
      }
      
      // function
      else if (typeof data == "function") {
        reply = "function";
      }
    
      // Array
      else if (dwr.util._isArray(data)) {
        if (showLevels == 0) { // Short format (don't show items)
          if (data.length > 0)
            reply = "[...]";
          else
            reply = "[]";
        }
        else { // Long format (show items)
          var strarr = [];
          strarr.push("[");
          var count = 0;
          for (var i = 0; i < data.length; i++) {
            if (! (i in data)) continue;
            var itemvalue = data[i];
            if (count > 0) strarr.push(", ");
            if (showLevels == 1) { // One-line format
              if (count == options.oneLineMaxItems) {
                strarr.push("...");
                break;
              }
            }
            else { // Multi-line format
              strarr.push(options.lineTerminator + indent(indentDepth+1, options));
            }
            if (i != count) {
              strarr.push(i);
              strarr.push(":");
            }
            strarr.push(recursive(itemvalue, showLevels-1, indentDepth+1, options));
            count++;
          }
          if (showLevels > 1) strarr.push(options.lineTerminator + indent(indentDepth, options));
          strarr.push("]");
          reply = strarr.join("");
        }
      }
      
      // Objects except Date
      else if (dwr.util._isObject(data) && !dwr.util._isDate(data)) {
        if (showLevels == 0) { // Short format (don't show properties)
          reply = dwr.util._detailedTypeOf(data);
        }
        else { // Long format (show properties)
          var strarr = [];
          if (dwr.util._detailedTypeOf(data) != "Object") {
            strarr.push(dwr.util._detailedTypeOf(data));
            if (typeof data.valueOf() != "object") {
              strarr.push(":");
              strarr.push(recursive(data.valueOf(), 1, indentDepth, options));
            }
            strarr.push(" ");
          }
          strarr.push("{");
          var isDomObject = dwr.util._isHTMLElement(data); 
          var count = 0;
          for (var prop in data) {
            var propvalue = data[prop];
            if (isDomObject) {
              if (!propvalue) continue;
              if (typeof propvalue == "function") continue;
              if (skipDomProperties[prop]) continue;
              if (prop.toUpperCase() == prop) continue;
            }
            if (count > 0) strarr.push(", ");
            if (showLevels == 1) { // One-line format
              if (count == options.oneLineMaxItems) {
                strarr.push("...");
                break;
              }
            }
            else { // Multi-line format
              strarr.push(options.lineTerminator + indent(indentDepth+1, options));
            }
            strarr.push(prop.length > options.propertyNameMaxLength ? prop.substring(0, options.propertyNameMaxLength-3) + "..." : prop);
            strarr.push(":");
            strarr.push(recursive(propvalue, showLevels-1, indentDepth+1, options));
            count++;
          }
          if (showLevels > 1 && count > 0) strarr.push(options.lineTerminator + indent(indentDepth, options));
          strarr.push("}");
          reply = strarr.join("");
        }
      }
  
      // undefined, null, number, boolean, Date
      else {
        reply = "" + data;
      }
  
      return reply;
    }
    catch(err) {
      return (err.message ? err.message : ""+err);
    }
  }

  function indent(count, options) {
    var strarr = [];
    strarr.push(options.baseIndent);
    for (var i=0; i<count; i++) {
      strarr.push(options.childIndent);
    }
    return strarr.join("");
  };
  
  return recursive(data, showLevels, 0, opt);
}

/**
 * Setup a GMail style loading message.
 * @see http://getahead.org/dwr/browser/util/useloadingmessage
 */
dwr.util.useLoadingMessage = function(message) {
  var loadingMessage;
  if (message) loadingMessage = message;
  else loadingMessage = "Loading";
  dwr.engine.setPreHook(function() {
    var disabledZone = dwr.util.byId('disabledZone');
    if (!disabledZone) {
      disabledZone = document.createElement('div');
      disabledZone.setAttribute('id', 'disabledZone');
      disabledZone.style.position = "absolute";
      disabledZone.style.zIndex = "1000";
      disabledZone.style.left = "0px";
      disabledZone.style.top = "0px";
      disabledZone.style.width = "100%";
      disabledZone.style.height = "100%";
      document.body.appendChild(disabledZone);
      var messageZone = document.createElement('div');
      messageZone.setAttribute('id', 'messageZone');
      messageZone.style.position = "absolute";
      messageZone.style.top = "0px";
      messageZone.style.right = "0px";
      messageZone.style.background = "red";
      messageZone.style.color = "white";
      messageZone.style.fontFamily = "Arial,Helvetica,sans-serif";
      messageZone.style.padding = "4px";
      disabledZone.appendChild(messageZone);
      var text = document.createTextNode(loadingMessage);
      messageZone.appendChild(text);
      dwr.util._disabledZoneUseCount = 1;
    }
    else {
      dwr.util.byId('messageZone').innerHTML = loadingMessage;
      disabledZone.style.visibility = 'visible';
      dwr.util._disabledZoneUseCount++;
    }
  });
  dwr.engine.setPostHook(function() {
    dwr.util._disabledZoneUseCount--;
    if (dwr.util._disabledZoneUseCount == 0) {
      dwr.util.byId('disabledZone').style.visibility = 'hidden';
    }
  });
};

/**
 * Set a global highlight handler
 */
dwr.util.setHighlightHandler = function(handler) {
  dwr.util._highlightHandler = handler;
};

/**
 * An example highlight handler
 */
dwr.util.yellowFadeHighlightHandler = function(ele) {
  dwr.util._yellowFadeProcess(ele, 0);
};
dwr.util._yellowFadeSteps = [ "d0", "b0", "a0", "90", "98", "a0", "a8", "b0", "b8", "c0", "c8", "d0", "d8", "e0", "e8", "f0", "f8" ];
dwr.util._yellowFadeProcess = function(ele, colorIndex) {
  ele = dwr.util.byId(ele);
  if (colorIndex < dwr.util._yellowFadeSteps.length) {
    ele.style.backgroundColor = "#ffff" + dwr.util._yellowFadeSteps[colorIndex];
    setTimeout("dwr.util._yellowFadeProcess('" + ele.id + "'," + (colorIndex + 1) + ")", 200);
  }
  else {
    ele.style.backgroundColor = "transparent";
  }
};

/**
 * An example highlight handler
 */
dwr.util.borderFadeHighlightHandler = function(ele) {
  ele.style.borderWidth = "2px";
  ele.style.borderStyle = "solid";
  dwr.util._borderFadeProcess(ele, 0);
};
dwr.util._borderFadeSteps = [ "d0", "b0", "a0", "90", "98", "a0", "a8", "b0", "b8", "c0", "c8", "d0", "d8", "e0", "e8", "f0", "f8" ];
dwr.util._borderFadeProcess = function(ele, colorIndex) {
  ele = dwr.util.byId(ele);
  if (colorIndex < dwr.util._borderFadeSteps.length) {
    ele.style.borderColor = "#ff" + dwr.util._borderFadeSteps[colorIndex] + dwr.util._borderFadeSteps[colorIndex];
    setTimeout("dwr.util._borderFadeProcess('" + ele.id + "'," + (colorIndex + 1) + ")", 200);
  }
  else {
    ele.style.backgroundColor = "transparent";
  }
};

/**
 * A focus highlight handler
 */
dwr.util.focusHighlightHandler = function(ele) {
  try {
    ele.focus();
  }
  catch (ex) { /* ignore */ }
};

/** @private the current global highlight style */
dwr.util._highlightHandler = null;

/**
 * Highlight that an element has changed
 */
dwr.util.highlight = function(ele, options) {
  if (options && options.highlightHandler) {
    options.highlightHandler(dwr.util.byId(ele));
  }
  else if (dwr.util._highlightHandler != null) {
    dwr.util._highlightHandler(dwr.util.byId(ele));
  }
};

/**
 * Set the value an HTML element to the specified value.
 * @see http://getahead.org/dwr/browser/util/setvalue
 */
dwr.util.setValue = function(ele, val, options) {
  if (val == null) val = "";
  if (options == null) options = {};
  if (dwr.util._shouldEscapeHtml(options) && typeof(val) == "string") {
    val = dwr.util.escapeHtml(val);
  }

  var orig = ele;
  if (typeof ele == "string") {
    ele = dwr.util.byId(ele);
    // We can work with names and need to sometimes for radio buttons, and IE has
    // an annoying bug where getElementById() returns an element based on name if
    // it doesn't find it by id. Here we don't want to do that, so:
    if (ele && ele.id != orig) ele = null;
  }
  var nodes = null;
  if (ele == null) {
    // Now it is time to look by name
    nodes = document.getElementsByName(orig);
    if (nodes.length >= 1) ele = nodes.item(0);
  }

  if (ele == null) {
    dwr.util._debug("setValue() can't find an element with id/name: " + orig + ".");
    return;
  }

  // All paths now lead to some update so we highlight a change
  dwr.util.highlight(ele, options);

  if (dwr.util._isHTMLElement(ele, "select")) {
    if (ele.type == "select-multiple" && dwr.util._isArray(val)) dwr.util._selectListItems(ele, val);
    else dwr.util._selectListItem(ele, val);
    return;
  }

  if (dwr.util._isHTMLElement(ele, "input")) {
    if (ele.type == "radio" || ele.type == "checkbox") {
      if (nodes && nodes.length >= 1) {
        for (var i = 0; i < nodes.length; i++) {
          var node = nodes.item(i);
          if (node.type != ele.type) continue;
          if (dwr.util._isArray(val)) {
            node.checked = false;
            for (var j = 0; j < val.length; j++)
              if (val[i] == node.value) node.checked = true;
          }
          else {
            node.checked = (node.value == val);
          }
        }
      }
      else ele.checked = (val == true);
    }
    else ele.value = val;

    return;
  }

  if (dwr.util._isHTMLElement(ele, "textarea")) {
    ele.value = val;
    return;
  }

  // If the value to be set is a DOM object then we try importing the node
  // rather than serializing it out
  if (val.nodeType) {
    if (val.nodeType == 9 /*Node.DOCUMENT_NODE*/) val = val.documentElement;
    val = dwr.util._importNode(ele.ownerDocument, val, true);
    ele.appendChild(val);
    return;
  }

  // Fall back to innerHTML
  ele.innerHTML = val;
};

/**
 * @private Find multiple items in a select list and select them. Used by setValue()
 * @param ele The select list item
 * @param val The array of values to select
 */
dwr.util._selectListItems = function(ele, val) {
  // We deal with select list elements by selecting the matching option
  // Begin by searching through the values
  var found  = false;
  var i;
  var j;
  for (i = 0; i < ele.options.length; i++) {
    ele.options[i].selected = false;
    for (j = 0; j < val.length; j++) {
      if (ele.options[i].value == val[j]) {
        ele.options[i].selected = true;
      }
    }
  }
  // If that fails then try searching through the visible text
  if (found) return;

  for (i = 0; i < ele.options.length; i++) {
    for (j = 0; j < val.length; j++) {
      if (ele.options[i].text == val[j]) {
        ele.options[i].selected = true;
      }
    }
  }
};

/**
 * @private Find an item in a select list and select it. Used by setValue()
 * @param ele The select list item
 * @param val The value to select
 */
dwr.util._selectListItem = function(ele, val) {
  // We deal with select list elements by selecting the matching option
  // Begin by searching through the values
  var found = false;
  var i;
  for (i = 0; i < ele.options.length; i++) {
    if (ele.options[i].value == val) {
      ele.options[i].selected = true;
      found = true;
    }
    else {
      ele.options[i].selected = false;
    }
  }

  // If that fails then try searching through the visible text
  if (found) return;

  for (i = 0; i < ele.options.length; i++) {
    if (ele.options[i].text == val) {
      ele.options[i].selected = true;
    }
    else {
      ele.options[i].selected = false;
    }
  }
};

/**
 * Read the current value for a given HTML element.
 * @see http://getahead.org/dwr/browser/util/getvalue
 */
dwr.util.getValue = function(ele, options) {
  if (options == null) options = {};
  var orig = ele;
  if (typeof ele == "string") {
    ele = dwr.util.byId(ele);
    // We can work with names and need to sometimes for radio buttons, and IE has
    // an annoying bug where getElementById() returns an element based on name if
    // it doesn't find it by id. Here we don't want to do that, so:
    if (ele && ele.id != orig) ele = null;
  }
  var nodes = null;
  if (ele == null) {
    // Now it is time to look by name
    nodes = document.getElementsByName(orig);
    if (nodes.length >= 1) ele = nodes.item(0);
  }
  if (ele == null) {
    dwr.util._debug("getValue() can't find an element with id/name: " + orig + ".");
    return "";
  }

  if (dwr.util._isHTMLElement(ele, "select")) {
    // Using "type" property instead of "multiple" as "type" is an official 
    // client-side property since JS 1.1
    if (ele.type == "select-multiple") {
      var reply = new Array();
      for (var i = 0; i < ele.options.length; i++) {
        var item = ele.options[i];
        if (item.selected) {
          var valueAttr = item.getAttributeNode("value");
          if (valueAttr && valueAttr.specified) {
            reply.push(item.value);
          }
          else {
            reply.push(item.text);
          }
        }
      }
      return reply;
    }
    else {
      var sel = ele.selectedIndex;
      if (sel != -1) {
        var item = ele.options[sel];
        var valueAttr = item.getAttributeNode("value");
        if (valueAttr && valueAttr.specified) {
          return item.value;
        }
        return item.text;
      }
      else {
        return "";
      }
    }
  }

  if (dwr.util._isHTMLElement(ele, "input")) {
    if (ele.type == "radio") {
      if (nodes && nodes.length >= 1) {
        for (var i = 0; i < nodes.length; i++) {
          var node = nodes.item(i);
          if (node.type == ele.type) {
            if (node.checked) return node.value;
          }
        }
      }
      return ele.checked;
    }
    if (ele.type == "checkbox") {
      if (nodes && nodes.length >= 1) {
        var reply = [];
        for (var i = 0; i < nodes.length; i++) {
          var node = nodes.item(i);
          if (node.type == ele.type) {
            if (node.checked) reply.push(node.value);
          }
        }
        return reply;
      }
      return ele.checked;
    }
    return ele.value;
  }

  if (dwr.util._isHTMLElement(ele, "textarea")) {
    return ele.value;
  }

  if (dwr.util._shouldEscapeHtml(options)) {
    if (ele.textContent) return ele.textContent;
    else if (ele.innerText) return ele.innerText;
  }
  return ele.innerHTML;
};

/**
 * getText() is like getValue() except that it reads the text (and not the value) from select elements
 * @see http://getahead.org/dwr/browser/util/gettext
 */
dwr.util.getText = function(ele) {
  ele = dwr.util._getElementById(ele, "getText()");
  if (ele == null) return null;
  if (!dwr.util._isHTMLElement(ele, "select")) {
    dwr.util._debug("getText() can only be used with select elements. Attempt to use: " + dwr.util._detailedTypeOf(ele) + " from  id: " + orig + ".");
    return "";
  }

  // This is a bit of a scam because it assumes single select
  // but I'm not sure how we should treat multi-select.
  var sel = ele.selectedIndex;
  if (sel != -1) {
    return ele.options[sel].text;
  }
  else {
    return "";
  }
};

/**
 * Given a map, or a recursive structure consisting of arrays and maps, call 
 * setValue() for all leaf entries and use intermediate levels to form nested
 * element ids.
 * @see http://getahead.org/dwr/browser/util/setvalues
 */
dwr.util.setValues = function(data, options) {
  var prefix = "";
  if (options && options.prefix) prefix = options.prefix;
  if (options && options.idPrefix) prefix = options.idPrefix;
  dwr.util._setValuesRecursive(data, prefix);
};

/**
 * @private Recursive helper for setValues()
 */
dwr.util._setValuesRecursive = function(data, idpath) {
  // Array containing objects -> add "[n]" to prefix and make recursive call
  // for each item object
  if (dwr.util._isArray(data) && data.length > 0 && dwr.util._isObject(data[0])) {
    for (var i = 0; i < data.length; i++) {
      dwr.util._setValuesRecursive(data[i], idpath+"["+i+"]");
    }
  }
  // Object (not array) -> handle nested object properties
  else if (dwr.util._isObject(data) && !dwr.util._isArray(data)) {
    for (var prop in data) {
      var subidpath = idpath ? idpath+"."+prop : prop;
      // Object (not array), or array containing objects -> call ourselves recursively
      if (dwr.util._isObject(data[prop]) && !dwr.util._isArray(data[prop]) 
          || dwr.util._isArray(data[prop]) && data[prop].length > 0 && dwr.util._isObject(data[prop][0])) {
        dwr.util._setValuesRecursive(data[prop], subidpath);
      }
      // Functions -> skip
      else if (typeof data[prop] == "function") {
        // NOP
      }
      // Only simple values left (or array of simple values, or empty array)
      // -> call setValue()
      else {
        // Are there any elements with that id or name
        if (dwr.util.byId(subidpath) != null || document.getElementsByName(subidpath).length >= 1) {
          dwr.util.setValue(subidpath, data[prop]);
        }
      }
    }
  }
};

/**
 * Given a map, or a recursive structure consisting of arrays and maps, call 
 * getValue() for all leaf entries and use intermediate levels to form nested
 * element ids.
 * Given a string or element that refers to a form, create an object from the 
 * elements of the form.
 * @see http://getahead.org/dwr/browser/util/getvalues
 */
dwr.util.getValues = function(data, options) {
  if (typeof data == "string" || dwr.util._isHTMLElement(data)) {
    return dwr.util.getFormValues(data);
  }
  else {
    var prefix = "";
    if (options != null && options.prefix) prefix = options.prefix;
    if (options != null && options.idPrefix) prefix = options.idPrefix;
    dwr.util._getValuesRecursive(data, prefix);
    return data;
  }
};

/**
 * Given a string or element that refers to a form, create an object from the 
 * elements of the form.
 * @see http://getahead.org/dwr/browser/util/getvalues
 */
dwr.util.getFormValues = function(eleOrNameOrId) {
  var ele = null;
  if (typeof eleOrNameOrId == "string") {
    ele = document.forms[eleOrNameOrId];
    if (ele == null) ele = dwr.util.byId(eleOrNameOrId);
  }
  else if (dwr.util._isHTMLElement(eleOrNameOrId)) {
    ele = eleOrNameOrId;
  }
  if (ele != null) {
    if (ele.elements == null) {
      alert("getFormValues() requires an object or reference to a form element.");
      return null;
    }
    var reply = {};
    var name;
    var value;
    for (var i = 0; i < ele.elements.length; i++) {
      if (ele[i].type in {button:0,submit:0,reset:0,image:0,file:0}) continue;
      if (ele[i].name) {
        name = ele[i].name;
        value = dwr.util.getValue(name);
      }
      else {
        if (ele[i].id) name = ele[i].id;
        else name = "element" + i;
        value = dwr.util.getValue(ele[i]);
      }
      reply[name] = value;
    }
    return reply;
  }
};

/**
 * @private Recursive helper for getValues().
 */
dwr.util._getValuesRecursive = function(data, idpath) {
  // Array containing objects -> add "[n]" to idpath and make recursive call
  // for each item object
  if (dwr.util._isArray(data) && data.length > 0 && dwr.util._isObject(data[0])) {
    for (var i = 0; i < data.length; i++) {
      dwr.util._getValuesRecursive(data[i], idpath+"["+i+"]");
    }
  }
  // Object (not array) -> handle nested object properties
  else if (dwr.util._isObject(data) && !dwr.util._isArray(data)) {
    for (var prop in data) {
      var subidpath = idpath ? idpath+"."+prop : prop;
      // Object, or array containing objects -> call ourselves recursively
      if (dwr.util._isObject(data[prop]) && !dwr.util._isArray(data[prop])
          || dwr.util._isArray(data[prop]) && data[prop].length > 0 && dwr.util._isObject(data[prop][0])) {
        dwr.util._getValuesRecursive(data[prop], subidpath);
      }
      // Functions -> skip
      else if (typeof data[prop] == "function") {
        // NOP
      }
      // Only simple values left (or array of simple values, or empty array)
      // -> call getValue()
      else {
        // Are there any elements with that id or name
        if (dwr.util.byId(subidpath) != null || document.getElementsByName(subidpath).length >= 1) {
          data[prop] = dwr.util.getValue(subidpath);
        }
      }
    }
  }
};

/**
 * Add options to a list from an array or map.
 * @see http://getahead.org/dwr/browser/lists
 */
dwr.util.addOptions = function(ele, data/*, options*/) {
  ele = dwr.util._getElementById(ele, "addOptions()");
  if (ele == null) return;
  var useOptions = dwr.util._isHTMLElement(ele, "select");
  var useLi = dwr.util._isHTMLElement(ele, ["ul", "ol"]);
  if (!useOptions && !useLi) {
    dwr.util._debug("addOptions() can only be used with select/ul/ol elements. Attempt to use: " + dwr.util._detailedTypeOf(ele));
    return;
  }
  if (data == null) return;
  
  var argcount = arguments.length;
  var options = {};
  var lastarg = arguments[argcount - 1]; 
  if (argcount > 2 && dwr.util._isObject(lastarg)) {
    options = lastarg;
    argcount--;
  }
  var arg3 = null; if (argcount >= 3) arg3 = arguments[2];
  var arg4 = null; if (argcount >= 4) arg4 = arguments[3];
  if (!options.optionCreator && useOptions) options.optionCreator = dwr.util._defaultOptionCreator;
  if (!options.optionCreator && useLi) options.optionCreator = dwr.util._defaultListItemCreator;

  var text, value, li;
  if (dwr.util._isArray(data)) {
    // Loop through the data that we do have
    for (var i = 0; i < data.length; i++) {
      options.data = data[i];
      options.text = null;
      options.value = null;
      if (useOptions) {
        if (arg3 != null) {
          if (arg4 != null) {
            options.text = dwr.util._getValueFrom(data[i], arg4);
            options.value = dwr.util._getValueFrom(data[i], arg3);
          }
          else options.text = options.value = dwr.util._getValueFrom(data[i], arg3);
        }
        else options.text = options.value = dwr.util._getValueFrom(data[i]);

        if (options.text != null || options.value) {
          var opt = options.optionCreator(options);
          opt.text = options.text;
          opt.value = options.value;
          ele.options[ele.options.length] = opt;
        }
      }
      else {
        options.value = dwr.util._getValueFrom(data[i], arg3);
        if (options.value != null) {
          li = options.optionCreator(options);
          if (dwr.util._shouldEscapeHtml(options)) {
            options.value = dwr.util.escapeHtml(options.value);
          }
          li.innerHTML = options.value;
          ele.appendChild(li);
        }
      }
    }
  }
  else if (arg4 != null) {
    if (!useOptions) {
      alert("dwr.util.addOptions can only create select lists from objects.");
      return;
    }
    for (var prop in data) {
      options.data = data[prop];
      options.value = dwr.util._getValueFrom(data[prop], arg3);
      options.text = dwr.util._getValueFrom(data[prop], arg4);

      if (options.text != null || options.value) {
        var opt = options.optionCreator(options);
        opt.text = options.text;
        opt.value = options.value;
        ele.options[ele.options.length] = opt;
      }
    }
  }
  else {
    if (!useOptions) {
      dwr.util._debug("dwr.util.addOptions can only create select lists from objects.");
      return;
    }
    for (var prop in data) {
      options.data = data[prop];
      if (!arg3) {
        options.value = prop;
        options.text = data[prop];
      }
      else {
        options.value = data[prop];
        options.text = prop;
      }
      if (options.text != null || options.value) {
        var opt = options.optionCreator(options);
        opt.text = options.text;
        opt.value = options.value;
        ele.options[ele.options.length] = opt;
      }
    }
  }

  // All error routes through this function result in a return, so highlight now
  dwr.util.highlight(ele, options); 
};

/**
 * @private Get the data from an array function for dwr.util.addOptions
 */
dwr.util._getValueFrom = function(data, method) {
  if (method == null) return data;
  else if (typeof method == 'function') return method(data);
  else return data[method];
};

/**
 * @private Default option creation function
 */
dwr.util._defaultOptionCreator = function(options) {
  return new Option();
};

/**
 * @private Default list item creation function
 */
dwr.util._defaultListItemCreator = function(options) {
  return document.createElement("li");
};

/**
 * Remove all the options from a select list (specified by id)
 * @see http://getahead.org/dwr/browser/lists
 */
dwr.util.removeAllOptions = function(ele) {
  ele = dwr.util._getElementById(ele, "removeAllOptions()");
  if (ele == null) return;
  var useOptions = dwr.util._isHTMLElement(ele, "select");
  var useLi = dwr.util._isHTMLElement(ele, ["ul", "ol"]);
  if (!useOptions && !useLi) {
    dwr.util._debug("removeAllOptions() can only be used with select, ol and ul elements. Attempt to use: " + dwr.util._detailedTypeOf(ele));
    return;
  }
  if (useOptions) {
    ele.options.length = 0;
  }
  else {
    while (ele.childNodes.length > 0) {
      ele.removeChild(ele.firstChild);
    }
  }
};

/**
 * Create rows inside a the table, tbody, thead or tfoot element (given by id).
 * @see http://getahead.org/dwr/browser/tables
 */
dwr.util.addRows = function(ele, data, cellFuncs, options) {
  ele = dwr.util._getElementById(ele, "addRows()");
  if (ele == null) return;
  if (!dwr.util._isHTMLElement(ele, ["table", "tbody", "thead", "tfoot"])) {
    dwr.util._debug("addRows() can only be used with table, tbody, thead and tfoot elements. Attempt to use: " + dwr.util._detailedTypeOf(ele));
    return;
  }
  if (!options) options = {};
  if (!options.rowCreator) options.rowCreator = dwr.util._defaultRowCreator;
  if (!options.cellCreator) options.cellCreator = dwr.util._defaultCellCreator;
  var tr, rowNum;
  if (dwr.util._isArray(data)) {
    for (rowNum = 0; rowNum < data.length; rowNum++) {
      options.rowData = data[rowNum];
      options.rowIndex = rowNum;
      options.rowNum = rowNum;
      options.data = null;
      options.cellNum = -1;
      tr = dwr.util._addRowInner(cellFuncs, options);
      if (tr != null) ele.appendChild(tr);
    }
  }
  else if (typeof data == "object") {
    rowNum = 0;
    for (var rowIndex in data) {
      options.rowData = data[rowIndex];
      options.rowIndex = rowIndex;
      options.rowNum = rowNum;
      options.data = null;
      options.cellNum = -1;
      tr = dwr.util._addRowInner(cellFuncs, options);
      if (tr != null) ele.appendChild(tr);
      rowNum++;
    }
  }

  dwr.util.highlight(ele, options);
};

/**
 * @private Internal function to draw a single row of a table.
 */
dwr.util._addRowInner = function(cellFuncs, options) {
  var tr = options.rowCreator(options);
  if (tr == null) return null;
  for (var cellNum = 0; cellNum < cellFuncs.length; cellNum++) {
    var func = cellFuncs[cellNum];
    if (typeof func == 'function') options.data = func(options.rowData, options);
    else options.data = func || "";
    options.cellNum = cellNum;
    var td = options.cellCreator(options);
    if (td != null) {
      if (options.data != null) {
        if (dwr.util._isHTMLElement(options.data)) td.appendChild(options.data);
        else {
          if (dwr.util._shouldEscapeHtml(options) && typeof(options.data) == "string") {
            td.innerHTML = dwr.util.escapeHtml(options.data);
          }
          else {
            td.innerHTML = options.data;
          }
        }
      }
      tr.appendChild(td);
    }
  }
  return tr;
};

/**
 * @private Default row creation function
 */
dwr.util._defaultRowCreator = function(options) {
  return document.createElement("tr");
};

/**
 * @private Default cell creation function
 */
dwr.util._defaultCellCreator = function(options) {
  return document.createElement("td");
};

/**
 * Remove all the children of a given node.
 * @see http://getahead.org/dwr/browser/tables
 */
dwr.util.removeAllRows = function(ele, options) {
  ele = dwr.util._getElementById(ele, "removeAllRows()");
  if (ele == null) return;
  if (!options) options = {};
  if (!options.filter) options.filter = function() { return true; };
  if (!dwr.util._isHTMLElement(ele, ["table", "tbody", "thead", "tfoot"])) {
    dwr.util._debug("removeAllRows() can only be used with table, tbody, thead and tfoot elements. Attempt to use: " + dwr.util._detailedTypeOf(ele));
    return;
  }
  var child = ele.firstChild;
  var next;
  while (child != null) {
    next = child.nextSibling;
    if (options.filter(child)) {
      ele.removeChild(child);
    }
    child = next;
  }
};

/**
 * dwr.util.byId(ele).className = "X", that we can call from Java easily.
 */
dwr.util.setClassName = function(ele, className) {
  ele = dwr.util._getElementById(ele, "setClassName()");
  if (ele == null) return;
  ele.className = className;
};

/**
 * dwr.util.byId(ele).className += "X", that we can call from Java easily.
 */
dwr.util.addClassName = function(ele, className) {
  ele = dwr.util._getElementById(ele, "addClassName()");
  if (ele == null) return;
  ele.className += " " + className;
};

/**
 * dwr.util.byId(ele).className -= "X", that we can call from Java easily
 * From code originally by Gavin Kistner
 */
dwr.util.removeClassName = function(ele, className) {
  ele = dwr.util._getElementById(ele, "removeClassName()");
  if (ele == null) return;
  var regex = new RegExp("(^|\\s)" + className + "(\\s|$)", 'g');
  ele.className = ele.className.replace(regex, '');
};

/**
 * dwr.util.byId(ele).className |= "X", that we can call from Java easily.
 */
dwr.util.toggleClassName = function(ele, className) {
  ele = dwr.util._getElementById(ele, "toggleClassName()");
  if (ele == null) return;
  var regex = new RegExp("(^|\\s)" + className + "(\\s|$)");
  if (regex.test(ele.className)) {
    ele.className = ele.className.replace(regex, '');
  }
  else {
    ele.className += " " + className;
  }
};

/**
 * Clone a node and insert it into the document just above the 'template' node
 * @see http://getahead.org/dwr/???
 */
dwr.util.cloneNode = function(ele, options) {
  ele = dwr.util._getElementById(ele, "cloneNode()");
  if (ele == null) return null;
  if (options == null) options = {};
  var clone = ele.cloneNode(true);
  if (options.idPrefix || options.idSuffix) {
    dwr.util._updateIds(clone, options);
  }
  else {
    dwr.util._removeIds(clone);
  }
  ele.parentNode.insertBefore(clone, ele);
  return clone;
};

/**
 * @private Update all of the ids in an element tree
 */
dwr.util._updateIds = function(ele, options) {
  if (options == null) options = {};
  if (ele.id) {
    ele.setAttribute("id", (options.idPrefix || "") + ele.id + (options.idSuffix || ""));
  }
  var children = ele.childNodes;
  for (var i = 0; i < children.length; i++) {
    var child = children.item(i);
    if (child.nodeType == 1 /*Node.ELEMENT_NODE*/) {
      dwr.util._updateIds(child, options);
    }
  }
};

/**
 * @private Remove all the Ids from an element
 */
dwr.util._removeIds = function(ele) {
  if (ele.id) ele.removeAttribute("id");
  var children = ele.childNodes;
  for (var i = 0; i < children.length; i++) {
    var child = children.item(i);
    if (child.nodeType == 1 /*Node.ELEMENT_NODE*/) {
      dwr.util._removeIds(child);
    }
  }
};

/**
 * Clone a template node and its embedded template child nodes according to
 * cardinalities (of arrays) in supplied data.  
 */
dwr.util.cloneNodeForValues = function(templateEle, data, options) {
  templateEle = dwr.util._getElementById(templateEle, "cloneNodeForValues()");
  if (templateEle == null) return null;
  if (options == null) options = {};
  var idpath;
  if (options.idPrefix != null)
    idpath = options.idPrefix;
  else
    idpath = templateEle.id || ""; 
  return dwr.util._cloneNodeForValuesRecursive(templateEle, data, idpath, options);
};

/**
 * @private Recursive helper for cloneNodeForValues(). 
 */
dwr.util._cloneNodeForValuesRecursive = function(templateEle, data, idpath, options) {
  // Incoming array -> make an id for each item and call clone of the template 
  // for each of them
  if (dwr.util._isArray(data)) {
    var clones = [];
    for (var i = 0; i < data.length; i++) {
      var item = data[i];
      var clone = dwr.util._cloneNodeForValuesRecursive(templateEle, item, idpath + "[" + i + "]", options);
      clones.push(clone);
    }
    return clones;
  }
  else
  // Incoming object (not array) -> clone the template, add id prefixes, add 
  // clone to DOM, and then recurse into any array properties if they contain 
  // objects and there is a suitable template
  if (dwr.util._isObject(data) && !dwr.util._isArray(data)) {
    var clone = templateEle.cloneNode(true);
    if (options.updateCloneStyle && clone.style) {
      for (var propname in options.updateCloneStyle) {
        clone.style[propname] = options.updateCloneStyle[propname];
      }
    }
    dwr.util._replaceIds(clone, templateEle.id, idpath);
    templateEle.parentNode.insertBefore(clone, templateEle);
    dwr.util._cloneSubArrays(data, idpath, options);
    return clone;
  }

  // It is an error to end up here so we return nothing
  return null;
};

/**
 * @private Substitute a leading idpath fragment with another idpath for all 
 * element ids tree, and remove ids that don't match the idpath. 
 */
dwr.util._replaceIds = function(ele, oldidpath, newidpath) {
  if (ele.id) {
    var newId = null;
    if (ele.id == oldidpath) {
      newId = newidpath;
    }
    else if (ele.id.length > oldidpath.length) {
      if (ele.id.substr(0, oldidpath.length) == oldidpath) {
        var trailingChar = ele.id.charAt(oldidpath.length);
        if (trailingChar == "." || trailingChar == "[") {
          newId = newidpath + ele.id.substr(oldidpath.length);
        }
      }
    }
    if (newId) {
      ele.setAttribute("id", newId);
    }
    else {
      ele.removeAttribute("id");
    }
  }
  var children = ele.childNodes;
  for (var i = 0; i < children.length; i++) {
    var child = children.item(i);
    if (child.nodeType == 1 /*Node.ELEMENT_NODE*/) {
      dwr.util._replaceIds(child, oldidpath, newidpath);
    }
  }
};

/**
 * @private Finds arrays in supplied data and uses any corresponding template 
 * node to make a clone for each item in the array. 
 */
dwr.util._cloneSubArrays = function(data, idpath, options) {
  for (prop in data) {
    var value = data[prop];
    // Look for potential recursive cloning in all array properties
    if (dwr.util._isArray(value)) {
      // Only arrays with objects are interesting for cloning
      if (value.length > 0 && dwr.util._isObject(value[0])) {
        var subTemplateId = idpath + "." + prop;
        var subTemplateEle = dwr.util.byId(subTemplateId);
        if (subTemplateEle != null) {
          dwr.util._cloneNodeForValuesRecursive(subTemplateEle, value, subTemplateId, options);
        }
      }
    }
    // Continue looking for arrays in object properties
    else if (dwr.util._isObject(value)) {
      dwr.util._cloneSubArrays(value, idpath + "." + prop, options);
    }
  }
}

/**
 * @private Helper to turn a string into an element with an error message
 */
dwr.util._getElementById = function(ele, source) {
  var orig = ele;
  ele = dwr.util.byId(ele);
  if (ele == null) {
    dwr.util._debug(source + " can't find an element with id: " + orig + ".");
  }
  return ele;
};

/**
 * @private Is the given node an HTML element (optionally of a given type)?
 * @param ele The element to test
 * @param nodeName eg "input", "textarea" - check for node name (optional)
 *         if nodeName is an array then check all for a match.
 */
dwr.util._isHTMLElement = function(ele, nodeName) {
  if (ele == null || typeof ele != "object" || ele.nodeName == null) {
    return false;
  }
  if (nodeName != null) {
    var test = ele.nodeName.toLowerCase();
    if (typeof nodeName == "string") {
      return test == nodeName.toLowerCase();
    }
    if (dwr.util._isArray(nodeName)) {
      var match = false;
      for (var i = 0; i < nodeName.length && !match; i++) {
        if (test == nodeName[i].toLowerCase()) {
          match =  true;
        }
      }
      return match;
    }
    dwr.util._debug("dwr.util._isHTMLElement was passed test node name that is neither a string or array of strings");
    return false;
  }
  return true;
};

/**
 * @private Like typeOf except that more information for an object is returned other than "object"
 */
dwr.util._detailedTypeOf = function(x) {
  var reply = typeof x;
  if (reply == "object") {
    reply = Object.prototype.toString.apply(x); // Returns "[object class]"
    reply = reply.substring(8, reply.length-1);  // Just get the class bit
  }
  return reply;
};

/**
 * @private Object detector. Excluding null from objects.
 */
dwr.util._isObject = function(data) {
  return (data && typeof data == "object");
};

/**
 * @private Array detector. Note: instanceof doesn't work with multiple frames.
 */
dwr.util._isArray = function(data) {
  return (data && data.join);
};

/**
 * @private Date detector. Note: instanceof doesn't work with multiple frames.
 */
dwr.util._isDate = function(data) {
  return (data && data.toUTCString) ? true : false;
};

/**
 * @private Used by setValue. Gets around the missing functionallity in IE.
 */
dwr.util._importNode = function(doc, importedNode, deep) {
  var newNode;

  if (importedNode.nodeType == 1 /*Node.ELEMENT_NODE*/) {
    newNode = doc.createElement(importedNode.nodeName);

    for (var i = 0; i < importedNode.attributes.length; i++) {
      var attr = importedNode.attributes[i];
      if (attr.nodeValue != null && attr.nodeValue != '') {
        newNode.setAttribute(attr.name, attr.nodeValue);
      }
    }

    if (typeof importedNode.style != "undefined") {
      newNode.style.cssText = importedNode.style.cssText;
    }
  }
  else if (importedNode.nodeType == 3 /*Node.TEXT_NODE*/) {
    newNode = doc.createTextNode(importedNode.nodeValue);
  }

  if (deep && importedNode.hasChildNodes()) {
    for (i = 0; i < importedNode.childNodes.length; i++) {
      newNode.appendChild(dwr.util._importNode(doc, importedNode.childNodes[i], true));
    }
  }

  return newNode;
};

/** @private Used internally when some message needs to get to the programmer */
dwr.util._debug = function(message, stacktrace) {
  var written = false;
  try {
    if (window.console) {
      if (stacktrace && window.console.trace) window.console.trace();
      window.console.log(message);
      written = true;
    }
    else if (window.opera && window.opera.postError) {
      window.opera.postError(message);
      written = true;
    }
  }
  catch (ex) { /* ignore */ }

  if (!written) {
    var debug = document.getElementById("dwr-debug");
    if (debug) {
      var contents = message + "<br/>" + debug.innerHTML;
      if (contents.length > 2048) contents = contents.substring(0, 2048);
      debug.innerHTML = contents;
    }
  }
};
/*
* 2010-01-18 : Migration Version 1
*/

// Provide a default path to dwr.engine
if (dwr == null) var dwr = {};
if (dwr.engine == null) dwr.engine = {};
if (DWREngine == null) var DWREngine = dwr.engine;

if (CountryRequest == null) var CountryRequest = {};
CountryRequest._path = '/commercial/ott/ott-dwr';
CountryRequest.getLanguage = function(callback) {
  dwr.engine._execute(CountryRequest._path, 'CountryRequest', 'getLanguage', callback);
}
CountryRequest.setLanguage = function(p0, callback) {
  dwr.engine._execute(CountryRequest._path, 'CountryRequest', 'setLanguage', p0, callback);
}
/*
* 2010-01-18 : Migration Version 1
*/

// Provide a default path to dwr.engine
if (dwr == null) var dwr = {};
if (dwr.engine == null) dwr.engine = {};
if (DWREngine == null) var DWREngine = dwr.engine;

if (CountryStationRequest == null) var CountryStationRequest = {};
CountryStationRequest._path = '/commercial/ott/ott-dwr';
CountryStationRequest.getSelectedCountry = function(callback) {
  dwr.engine._execute(CountryStationRequest._path, 'CountryStationRequest', 'getSelectedCountry', callback);
}
CountryStationRequest.setSelectedCountry = function(p0, callback) {
  dwr.engine._execute(CountryStationRequest._path, 'CountryStationRequest', 'setSelectedCountry', p0, callback);
}
CountryStationRequest.getLanguage = function(callback) {
  dwr.engine._execute(CountryStationRequest._path, 'CountryStationRequest', 'getLanguage', callback);
}
CountryStationRequest.setLanguage = function(p0, callback) {
  dwr.engine._execute(CountryStationRequest._path, 'CountryStationRequest', 'setLanguage', p0, callback);
}
/*
* 2010-01-18 : Migration Version 1
*/

/*
* Copyright 2005 Joe Walker
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* Declare an object to which we can add real functions.
*/
if (dwr == null) var dwr = {};
if (dwr.engine == null) dwr.engine = {};
if (DWREngine == null) var DWREngine = dwr.engine;

/**
* Set an alternative error handler from the default alert box.
* @see getahead.org/dwr/browser/engine/errors
*/
dwr.engine.setErrorHandler = function(handler) {
	dwr.engine._errorHandler = handler;
};

/**
* Set an alternative warning handler from the default alert box.
* @see getahead.org/dwr/browser/engine/errors
*/
dwr.engine.setWarningHandler = function(handler) {
	dwr.engine._warningHandler = handler;
};

/**
* Setter for the text/html handler - what happens if a DWR request gets an HTML
* reply rather than the expected Javascript. Often due to login timeout
*/
dwr.engine.setTextHtmlHandler = function(handler) {
	dwr.engine._textHtmlHandler = handler;
}

/**
* Set a default timeout value for all calls. 0 (the default) turns timeouts off.
* @see getahead.org/dwr/browser/engine/errors
*/
dwr.engine.setTimeout = function(timeout) {
	dwr.engine._timeout = timeout;
};

/**
* The Pre-Hook is called before any DWR remoting is done.
* @see getahead.org/dwr/browser/engine/hooks
*/
dwr.engine.setPreHook = function(handler) {
	dwr.engine._preHook = handler;
};

/**
* The Post-Hook is called after any DWR remoting is done.
* @see getahead.org/dwr/browser/engine/hooks
*/
dwr.engine.setPostHook = function(handler) {
	dwr.engine._postHook = handler;
};

/**
* Custom headers for all DWR calls
* @see getahead.org/dwr/????
*/
dwr.engine.setHeaders = function(headers) {
	dwr.engine._headers = headers;
};

/**
* Custom parameters for all DWR calls
* @see getahead.org/dwr/????
*/
dwr.engine.setParameters = function(parameters) {
	dwr.engine._parameters = parameters;
};

/** XHR remoting type constant. See dwr.engine.set[Rpc|Poll]Type() */
dwr.engine.XMLHttpRequest = 1;

/** XHR remoting type constant. See dwr.engine.set[Rpc|Poll]Type() */
dwr.engine.IFrame = 2;

/** XHR remoting type constant. See dwr.engine.setRpcType() */
dwr.engine.ScriptTag = 3;

/**
* Set the preferred remoting type.
* @param newType One of dwr.engine.XMLHttpRequest or dwr.engine.IFrame or dwr.engine.ScriptTag
* @see getahead.org/dwr/browser/engine/options
*/
dwr.engine.setRpcType = function(newType) {
	if (newType != dwr.engine.XMLHttpRequest && newType != dwr.engine.IFrame && newType != dwr.engine.ScriptTag) {
		dwr.engine._handleError(null, { name:"dwr.engine.invalidRpcType", message:"RpcType must be one of dwr.engine.XMLHttpRequest or dwr.engine.IFrame or dwr.engine.ScriptTag" });
		return;
	}
	dwr.engine._rpcType = newType;
};

/**
* Which HTTP method do we use to send results? Must be one of "GET" or "POST".
* @see getahead.org/dwr/browser/engine/options
*/
dwr.engine.setHttpMethod = function(httpMethod) {
	if (httpMethod != "GET" && httpMethod != "POST") {
		dwr.engine._handleError(null, { name:"dwr.engine.invalidHttpMethod", message:"Remoting method must be one of GET or POST" });
		return;
	}
	dwr.engine._httpMethod = httpMethod;
};

/**
* Ensure that remote calls happen in the order in which they were sent? (Default: false)
* @see getahead.org/dwr/browser/engine/ordering
*/
dwr.engine.setOrdered = function(ordered) {
	dwr.engine._ordered = ordered;
};

/**
* Do we ask the XHR object to be asynchronous? (Default: true)
* @see getahead.org/dwr/browser/engine/options
*/
dwr.engine.setAsync = function(async) {
	dwr.engine._async = async;
};

/**
* Does DWR poll the server for updates? (Default: false)
* @see getahead.org/dwr/browser/engine/options
*/
dwr.engine.setActiveReverseAjax = function(activeReverseAjax) {
	if (activeReverseAjax) {
		// Bail if we are already started
		if (dwr.engine._activeReverseAjax) return;
		dwr.engine._activeReverseAjax = true;
		dwr.engine._poll();
	}
	else {
		// Can we cancel an existing request?
		if (dwr.engine._activeReverseAjax && dwr.engine._pollReq) dwr.engine._pollReq.abort();
		dwr.engine._activeReverseAjax = false;
	}
	// TODO: in iframe mode, if we start, stop, start then the second start may
	// well kick off a second iframe while the first is still about to return
	// we should cope with this but we don't
};

/**
* Set the preferred polling type.
* @param newPollType One of dwr.engine.XMLHttpRequest or dwr.engine.IFrame
* @see getahead.org/dwr/browser/engine/options
*/
dwr.engine.setPollType = function(newPollType) {
	if (newPollType != dwr.engine.XMLHttpRequest && newPollType != dwr.engine.IFrame) {
		dwr.engine._handleError(null, { name:"dwr.engine.invalidPollType", message:"PollType must be one of dwr.engine.XMLHttpRequest or dwr.engine.IFrame"  });
		return;
	}
	dwr.engine._pollType = newPollType;
};

/**
* The default message handler.
* @see getahead.org/dwr/browser/engine/errors
*/
dwr.engine.defaultErrorHandler = function(message, ex) {
	dwr.engine._debug("Error: " + ex.name + ", " + ex.message, true);

	if (message == null || message == "") alert("A server error has occured. More information may be available in the console.");
	// Ignore NS_ERROR_NOT_AVAILABLE if Mozilla is being narky
	else if (message.indexOf("0x80040111") != -1) dwr.engine._debug(message);
	else alert(message);
};

/**
* The default warning handler.
* @see getahead.org/dwr/browser/engine/errors
*/
dwr.engine.defaultWarningHandler = function(message, ex) {
	dwr.engine._debug(message);
};

/**
* For reduced latency you can group several remote calls together using a batch.
* @see getahead.org/dwr/browser/engine/batch
*/
dwr.engine.beginBatch = function() {
	if (dwr.engine._batch) {
		dwr.engine._handleError(null, { name:"dwr.engine.batchBegun", message:"Batch already begun" });
		return;
	}
	dwr.engine._batch = dwr.engine._createBatch();
};

/**
* Finished grouping a set of remote calls together. Go and execute them all.
* @see getahead.org/dwr/browser/engine/batch
*/
dwr.engine.endBatch = function(options) {
	var batch = dwr.engine._batch;
	if (batch == null) {
		dwr.engine._handleError(null, { name:"dwr.engine.batchNotBegun", message:"No batch in progress" });
		return;
	}
	dwr.engine._batch = null;
	if (batch.map.callCount == 0) return;

	// The hooks need to be merged carefully to preserve ordering
	if (options) dwr.engine._mergeBatch(batch, options);

	// In ordered mode, we don't send unless the list of sent items is empty
	if (dwr.engine._ordered && dwr.engine._batchesLength != 0) {
		dwr.engine._batchQueue[dwr.engine._batchQueue.length] = batch;
	}
	else {
		dwr.engine._sendData(batch);
	}
};

/** @deprecated */
dwr.engine.setPollMethod = function(type) { dwr.engine.setPollType(type); };
dwr.engine.setMethod = function(type) { dwr.engine.setRpcType(type); };
dwr.engine.setVerb = function(verb) { dwr.engine.setHttpMethod(verb); };

//==============================================================================
// Only private stuff below here
//==============================================================================

/** The original page id sent from the server */
dwr.engine._origScriptSessionId = "477C92C532B33F3F2535AF7E110896AE";

/** The session cookie name */
dwr.engine._sessionCookieName = "JSESSIONID"; // JSESSIONID

/** Is GET enabled for the benefit of Safari? */
dwr.engine._allowGetForSafariButMakeForgeryEasier = "false";

/** The script prefix to strip in the case of scriptTagProtection. */
dwr.engine._scriptTagProtection = "throw 'allowScriptTagRemoting is false.';";

/** The default path to the DWR servlet */
dwr.engine._defaultPath = "/commercial/ott/ott-dwr";

/** The read page id that we calculate */
dwr.engine._scriptSessionId = null;

/** The function that we use to fetch/calculate a session id */
dwr.engine._getScriptSessionId = function() {
	if (dwr.engine._scriptSessionId == null) {
		dwr.engine._scriptSessionId = dwr.engine._origScriptSessionId + Math.floor(Math.random() * 1000);
	}
	return dwr.engine._scriptSessionId;
};

/** A function to call if something fails. */
dwr.engine._errorHandler = dwr.engine.defaultErrorHandler;

/** For debugging when something unexplained happens. */
dwr.engine._warningHandler = dwr.engine.defaultWarningHandler;

/** A function to be called before requests are marshalled. Can be null. */
dwr.engine._preHook = null;

/** A function to be called after replies are received. Can be null. */
dwr.engine._postHook = null;

/** An map of the batches that we have sent and are awaiting a reply on. */
dwr.engine._batches = {};

/** A count of the number of outstanding batches. Should be == to _batches.length unless prototype has messed things up */
dwr.engine._batchesLength = 0;

/** In ordered mode, the array of batches waiting to be sent */
dwr.engine._batchQueue = [];

/** What is the default rpc type */
dwr.engine._rpcType = dwr.engine.XMLHttpRequest;

/** What is the default remoting method (ie GET or POST) */
dwr.engine._httpMethod = "POST";

/** Do we attempt to ensure that calls happen in the order in which they were sent? */
dwr.engine._ordered = false;

/** Do we make the calls async? */
dwr.engine._async = true;

/** The current batch (if we are in batch mode) */
dwr.engine._batch = null;

/** The global timeout */
dwr.engine._timeout = 0;

/** ActiveX objects to use when we want to convert an xml string into a DOM object. */
dwr.engine._DOMDocument = ["Msxml2.DOMDocument.6.0", "Msxml2.DOMDocument.5.0", "Msxml2.DOMDocument.4.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"];

/** The ActiveX objects to use when we want to do an XMLHttpRequest call. */
dwr.engine._XMLHTTP = ["Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"];

/** Are we doing comet or polling? */
dwr.engine._activeReverseAjax = false;

/** What is the default polling type */
dwr.engine._pollType = dwr.engine.XMLHttpRequest;
//dwr.engine._pollType = dwr.engine.IFrame;

/** The iframe that we are using to poll */
dwr.engine._outstandingIFrames = [];

/** The xhr object that we are using to poll */
dwr.engine._pollReq = null;

/** How many milliseconds between internal comet polls */
dwr.engine._pollCometInterval = 200;

/** How many times have we re-tried to poll? */
dwr.engine._pollRetries = 0;
dwr.engine._maxPollRetries = 0;

/** Do we do a document.reload if we get a text/html reply? */
dwr.engine._textHtmlHandler = null;

/** If you wish to send custom headers with every request */
dwr.engine._headers = null;

/** If you wish to send extra custom request parameters with each request */
dwr.engine._parameters = null;

/** Undocumented interceptors - do not use */
dwr.engine._postSeperator = "\n";
dwr.engine._defaultInterceptor = function(data) {return data;}
dwr.engine._urlRewriteHandler = dwr.engine._defaultInterceptor;
dwr.engine._contentRewriteHandler = dwr.engine._defaultInterceptor;
dwr.engine._replyRewriteHandler = dwr.engine._defaultInterceptor;

/** Batch ids allow us to know which batch the server is answering */
dwr.engine._nextBatchId = 0;

/** A list of the properties that need merging from calls to a batch */
dwr.engine._propnames = [ "rpcType", "httpMethod", "async", "timeout", "errorHandler", "warningHandler", "textHtmlHandler" ];

/** Do we stream, or can be hacked to do so? */
dwr.engine._partialResponseNo = 0;
dwr.engine._partialResponseYes = 1;
dwr.engine._partialResponseFlush = 2;

/**
* @private Send a request. Called by the Javascript interface stub
* @param path part of URL after the host and before the exec bit without leading or trailing /s
* @param scriptName The class to execute
* @param methodName The method on said class to execute
* @param func The callback function to which any returned data should be passed
*       if this is null, any returned data will be ignored
* @param vararg_params The parameters to pass to the above class
*/
dwr.engine._execute = function(path, scriptName, methodName, vararg_params) {
	var singleShot = false;
	if (dwr.engine._batch == null) {
		dwr.engine.beginBatch();
		singleShot = true;
	}
	var batch = dwr.engine._batch;
	// To make them easy to manipulate we copy the arguments into an args array
	var args = [];
	for (var i = 0; i < arguments.length - 3; i++) {
		args[i] = arguments[i + 3];
	}
	// All the paths MUST be to the same servlet
	if (batch.path == null) {
		batch.path = path;
	}
	else {
		if (batch.path != path) {
			dwr.engine._handleError(batch, { name:"dwr.engine.multipleServlets", message:"Can't batch requests to multiple DWR Servlets." });
			return;
		}
	}
	// From the other params, work out which is the function (or object with
	// call meta-data) and which is the call parameters
	var callData;
	var lastArg = args[args.length - 1];
	if (typeof lastArg == "function" || lastArg == null) callData = { callback:args.pop() };
	else callData = args.pop();

	// Merge from the callData into the batch
	dwr.engine._mergeBatch(batch, callData);
	batch.handlers[batch.map.callCount] = {
		exceptionHandler:callData.exceptionHandler,
		callback:callData.callback
	};

	// Copy to the map the things that need serializing
	var prefix = "c" + batch.map.callCount + "-";
	batch.map[prefix + "scriptName"] = scriptName;
	batch.map[prefix + "methodName"] = methodName;
	batch.map[prefix + "id"] = batch.map.callCount;
	for (i = 0; i < args.length; i++) {
		dwr.engine._serializeAll(batch, [], args[i], prefix + "param" + i);
	}

	// Now we have finished remembering the call, we incr the call count
	
	batch.map.callCount++;
	if (singleShot) dwr.engine.endBatch();
};

/** @private Poll the server to see if there is any data waiting */
dwr.engine._poll = function(overridePath) {
	if (!dwr.engine._activeReverseAjax) return;

	var batch = dwr.engine._createBatch();
	batch.map.id = 0; // TODO: Do we need this??
	batch.map.callCount = 1;
	batch.isPoll = true;
	if (navigator.userAgent.indexOf("Gecko/") != -1) {
		batch.rpcType = dwr.engine._pollType;
		batch.map.partialResponse = dwr.engine._partialResponseYes;
	}
	else if (document.all) {
		batch.rpcType = dwr.engine.IFrame;
		batch.map.partialResponse = dwr.engine._partialResponseFlush;
	}
	else {
		batch.rpcType = dwr.engine._pollType;
		batch.map.partialResponse = dwr.engine._partialResponseNo;
	}
	batch.httpMethod = "POST";
	batch.async = true;
	batch.timeout = 0;
	batch.path = (overridePath) ? overridePath : dwr.engine._defaultPath;
	batch.preHooks = [];
	batch.postHooks = [];
	batch.errorHandler = dwr.engine._pollErrorHandler;
	batch.warningHandler = dwr.engine._pollErrorHandler;
	batch.handlers[0] = {
		callback:function(pause) {
			dwr.engine._pollRetries = 0;
			setTimeout("dwr.engine._poll()", pause);
		}
	};

	// Send the data
	dwr.engine._sendData(batch);
	if (batch.rpcType == dwr.engine.XMLHttpRequest) {
		// if (batch.map.partialResponse != dwr.engine._partialResponseNo) {
		dwr.engine._checkCometPoll();
	}
};

/** Try to recover from polling errors */
dwr.engine._pollErrorHandler = function(msg, ex) {
	// if anything goes wrong then just silently try again (up to 3x) after 10s
	dwr.engine._pollRetries++;
	dwr.engine._debug("Reverse Ajax poll failed (pollRetries=" + dwr.engine._pollRetries + "): " + ex.name + " : " + ex.message);
	if (dwr.engine._pollRetries < dwr.engine._maxPollRetries) {
		setTimeout("dwr.engine._poll()", 10000);
	}
	else {
		dwr.engine._debug("Giving up.");
	}
};

/** @private Generate a new standard batch */
dwr.engine._createBatch = function() {
	var batch = {
		map:{
			callCount:0,
			page:window.location.pathname + window.location.search,
			httpSessionId:dwr.engine._getJSessionId(),
			scriptSessionId:dwr.engine._getScriptSessionId()
		},
		charsProcessed:0, paramCount:0,
		headers:[], parameters:[],
		isPoll:false, headers:{}, handlers:{}, preHooks:[], postHooks:[],
		rpcType:dwr.engine._rpcType,
		httpMethod:dwr.engine._httpMethod,
		async:dwr.engine._async,
		timeout:dwr.engine._timeout,
		errorHandler:dwr.engine._errorHandler,
		warningHandler:dwr.engine._warningHandler,
		textHtmlHandler:dwr.engine._textHtmlHandler
	};
	if (dwr.engine._preHook) batch.preHooks.push(dwr.engine._preHook);
	if (dwr.engine._postHook) batch.postHooks.push(dwr.engine._postHook);
	var propname, data;
	if (dwr.engine._headers) {
		for (propname in dwr.engine._headers) {
			data = dwr.engine._headers[propname];
			if (typeof data != "function") batch.headers[propname] = data;
		}
	}
	if (dwr.engine._parameters) {
		for (propname in dwr.engine._parameters) {
			data = dwr.engine._parameters[propname];
			if (typeof data != "function") batch.parameters[propname] = data;
		}
	}
	return batch;
}

/** @private Take further options and merge them into */
dwr.engine._mergeBatch = function(batch, overrides) {
	var propname, data;
	for (var i = 0; i < dwr.engine._propnames.length; i++) {
		propname = dwr.engine._propnames[i];
		if (overrides[propname] != null) batch[propname] = overrides[propname];
	}
	if (overrides.preHook != null) batch.preHooks.unshift(overrides.preHook);
	if (overrides.postHook != null) batch.postHooks.push(overrides.postHook);
	if (overrides.headers) {
		for (propname in overrides.headers) {
			data = overrides.headers[propname];
			if (typeof data != "function") batch.headers[propname] = data;
		}
	}
	if (overrides.parameters) {
		for (propname in overrides.parameters) {
			data = overrides.parameters[propname];
			if (typeof data != "function") batch.map["p-" + propname] = "" + data;
		}
	}
};

/** @private What is our session id? */
dwr.engine._getJSessionId =  function() {
	var cookies = document.cookie.split(';');
	for (var i = 0; i < cookies.length; i++) {
		var cookie = cookies[i];
		while (cookie.charAt(0) == ' ') cookie = cookie.substring(1, cookie.length);
		if (cookie.indexOf(dwr.engine._sessionCookieName + "=") == 0) {
			return cookie.substring(11, cookie.length);
		}
	}
	return "";
}

/** @private Check for reverse Ajax activity */
dwr.engine._checkCometPoll = function() {
	for (var i = 0; i < dwr.engine._outstandingIFrames.length; i++) {
		var text = "";
		var iframe = dwr.engine._outstandingIFrames[i];
		try {
			text = dwr.engine._getTextFromCometIFrame(iframe);
		}
		catch (ex) {
			dwr.engine._handleWarning(iframe.batch, ex);
		}
		if (text != "") dwr.engine._processCometResponse(text, iframe.batch);
	}
	if (dwr.engine._pollReq) {
		var req = dwr.engine._pollReq;
		var text = req.responseText;
		dwr.engine._processCometResponse(text, req.batch);
	}

	// If the poll resources are still there, come back again
	if (dwr.engine._outstandingIFrames.length > 0 || dwr.engine._pollReq) {
		setTimeout("dwr.engine._checkCometPoll()", dwr.engine._pollCometInterval);
	}
};

/** @private Extract the whole (executed an all) text from the current iframe */
dwr.engine._getTextFromCometIFrame = function(frameEle) {
	var body = frameEle.contentWindow.document.body;
	if (body == null) return "";
	var text = body.innerHTML;
	// We need to prevent IE from stripping line feeds
	if (text.indexOf("<PRE>") == 0 || text.indexOf("<pre>") == 0) {
		text = text.substring(5, text.length - 7);
	}
	return text;
};

/** @private Some more text might have come in, test and execute the new stuff */
dwr.engine._processCometResponse = function(response, batch) {
	if (batch.charsProcessed == response.length) return;
	if (response.length == 0) {
		batch.charsProcessed = 0;
		return;
	}

	var firstStartTag = response.indexOf("//#DWR-START#", batch.charsProcessed);
	if (firstStartTag == -1) {
		// dwr.engine._debug("No start tag (search from " + batch.charsProcessed + "). skipping '" + response.substring(batch.charsProcessed) + "'");
		batch.charsProcessed = response.length;
		return;
	}
	// if (firstStartTag > 0) {
	//   dwr.engine._debug("Start tag not at start (search from " + batch.charsProcessed + "). skipping '" + response.substring(batch.charsProcessed, firstStartTag) + "'");
	// }

	var lastEndTag = response.lastIndexOf("//#DWR-END#");
	if (lastEndTag == -1) {
		// dwr.engine._debug("No end tag. unchanged charsProcessed=" + batch.charsProcessed);
		return;
	}

	// Skip the end tag too for next time, remembering CR and LF
	if (response.charCodeAt(lastEndTag + 11) == 13 && response.charCodeAt(lastEndTag + 12) == 10) {
		batch.charsProcessed = lastEndTag + 13;
	}
	else {
		batch.charsProcessed = lastEndTag + 11;
	}

	var exec = response.substring(firstStartTag + 13, lastEndTag);

	dwr.engine._receivedBatch = batch;
	dwr.engine._eval(exec);
	dwr.engine._receivedBatch = null;
};

/** @private Actually send the block of data in the batch object. */
dwr.engine._sendData = function(batch) {
	batch.map.batchId = dwr.engine._nextBatchId++;
	dwr.engine._batches[batch.map.batchId] = batch;
	dwr.engine._batchesLength++;
	batch.completed = false;

	for (var i = 0; i < batch.preHooks.length; i++) {
		batch.preHooks[i]();
	}
	batch.preHooks = null;
	// Set a timeout
	if (batch.timeout && batch.timeout != 0) {
		batch.interval = setInterval(function() { dwr.engine._abortRequest(batch); }, batch.timeout);
	}
	// Get setup for XMLHttpRequest if possible
	if (batch.rpcType == dwr.engine.XMLHttpRequest) {
		if (window.XMLHttpRequest) {
			batch.req = new XMLHttpRequest();
		}
		// IE5 for the mac claims to support window.ActiveXObject, but throws an error when it's used
		else if (window.ActiveXObject && !(navigator.userAgent.indexOf("Mac") >= 0 && navigator.userAgent.indexOf("MSIE") >= 0)) {
			batch.req = dwr.engine._newActiveXObject(dwr.engine._XMLHTTP);
		}
	}

	var prop, request;
	if (batch.req) {
		// Proceed using XMLHttpRequest
		if (batch.async) {
			batch.req.onreadystatechange = function() { dwr.engine._stateChange(batch); };
		}
		// If we're polling, record this for monitoring
		if (batch.isPoll) {
			dwr.engine._pollReq = batch.req;
			// In IE XHR is an ActiveX control so you can't augment it like this
			// however batch.isPoll uses IFrame on IE so were safe here
			batch.req.batch = batch;
		}
		// Workaround for Safari 1.x POST bug
		var indexSafari = navigator.userAgent.indexOf("Safari/");
		if (indexSafari >= 0) {
			var version = navigator.userAgent.substring(indexSafari + 7);
			if (parseInt(version, 10) < 400) {
				if (dwr.engine._allowGetForSafariButMakeForgeryEasier == "true") batch.httpMethod = "GET";
				else dwr.engine._handleWarning(batch, { name:"dwr.engine.oldSafari", message:"Safari GET support disabled. See getahead.org/dwr/server/servlet and allowGetForSafariButMakeForgeryEasier." });
			}
		}
		batch.mode = batch.isPoll ? dwr.engine._ModePlainPoll : dwr.engine._ModePlainCall;
		request = dwr.engine._constructRequest(batch);
		try {
			batch.req.open(batch.httpMethod, request.url, batch.async);
			try {
				for (prop in batch.headers) {
					var value = batch.headers[prop];
					if (typeof value == "string") batch.req.setRequestHeader(prop, value);
				}
				if (!batch.headers["Content-Type"]) batch.req.setRequestHeader("Content-Type", "text/plain");
			}
			catch (ex) {
				dwr.engine._handleWarning(batch, ex);
			}
			batch.req.send(request.body);
			if (!batch.async) dwr.engine._stateChange(batch);
		}
		catch (ex) {
			dwr.engine._handleError(batch, ex);
		}
	}
	else if (batch.rpcType != dwr.engine.ScriptTag) {
		// Proceed using iframe
		var idname = batch.isPoll ? "dwr-if-poll-" + batch.map.batchId : "dwr-if-" + batch.map["c0-id"];
		batch.div = document.createElement("div");
		batch.div.innerHTML = "<iframe src='javascript:void(0)' frameborder='0' style='width:0px;height:0px;border:0;' id='" + idname + "' name='" + idname + "'></iframe>";
		document.body.appendChild(batch.div);
		batch.iframe = document.getElementById(idname);
		batch.iframe.batch = batch;
		batch.mode = batch.isPoll ? dwr.engine._ModeHtmlPoll : dwr.engine._ModeHtmlCall;
		if (batch.isPoll) dwr.engine._outstandingIFrames.push(batch.iframe);
		request = dwr.engine._constructRequest(batch);
		if (batch.httpMethod == "GET") {
			batch.iframe.setAttribute("src", request.url);
			// document.body.appendChild(batch.iframe);
		}
		else {
			batch.form = document.createElement("form");
			batch.form.setAttribute("id", "dwr-form");
			batch.form.setAttribute("action", request.url);
			batch.form.setAttribute("target", idname);
			batch.form.target = idname;
			batch.form.setAttribute("method", batch.httpMethod);
			for (prop in batch.map) {
				var value = batch.map[prop];
				if (typeof value != "function") {
					var formInput = document.createElement("input");
					formInput.setAttribute("type", "hidden");
					formInput.setAttribute("name", prop);
					formInput.setAttribute("value", value);
					batch.form.appendChild(formInput);
				}
			}
			document.body.appendChild(batch.form);
			batch.form.submit();
		}
	}
	else {
		batch.httpMethod = "GET"; // There's no such thing as ScriptTag using POST
		batch.mode = batch.isPoll ? dwr.engine._ModePlainPoll : dwr.engine._ModePlainCall;
		request = dwr.engine._constructRequest(batch);
		batch.script = document.createElement("script");
		batch.script.id = "dwr-st-" + batch.map["c0-id"];
		batch.script.src = request.url;
		document.body.appendChild(batch.script);
	}
};

dwr.engine._ModePlainCall = "/call/plaincall/";
dwr.engine._ModeHtmlCall = "/call/htmlcall/";
dwr.engine._ModePlainPoll = "/call/plainpoll/";
dwr.engine._ModeHtmlPoll = "/call/htmlpoll/";

/** @private Work out what the URL should look like */
dwr.engine._constructRequest = function(batch) {
	// A quick string to help people that use web log analysers
	var request = { url:batch.path + batch.mode, body:null };
	if (batch.isPoll == true) {
		request.url += "ReverseAjax.dwr";
	}
	else if (batch.map.callCount == 1) {
		request.url += batch.map["c0-scriptName"] + "." + batch.map["c0-methodName"] + ".dwr";
	}
	else {
		request.url += "Multiple." + batch.map.callCount + ".dwr";
	}
	// Play nice with url re-writing
	var sessionMatch = location.href.match(/jsessionid=([^?]+)/);
	if (sessionMatch != null) {
		request.url += ";jsessionid=" + sessionMatch[1];
	}

	var prop;
	if (batch.httpMethod == "GET") {
		// Some browsers (Opera/Safari2) seem to fail to convert the callCount value
		// to a string in the loop below so we do it manually here.
		batch.map.callCount = "" + batch.map.callCount;
		request.url += "?";
		for (prop in batch.map) {
			if (typeof batch.map[prop] != "function") {
				request.url += encodeURIComponent(prop) + "=" + encodeURIComponent(batch.map[prop]) + "&";
			}
		}
		request.url = request.url.substring(0, request.url.length - 1);
	}
	else {
		// PERFORMANCE: for iframe mode this is thrown away.
		request.body = "";
		for (prop in batch.map) {
			if (typeof batch.map[prop] != "function") {
				request.body += prop + "=" + batch.map[prop] + dwr.engine._postSeperator;
			}
		}
		request.body = dwr.engine._contentRewriteHandler(request.body);
	}
	request.url = dwr.engine._urlRewriteHandler(request.url);
	return request;
};

/** @private Called by XMLHttpRequest to indicate that something has happened */
dwr.engine._stateChange = function(batch) {
	var toEval;

	if (batch.completed) {
		dwr.engine._debug("Error: _stateChange() with batch.completed");
		return;
	}

	var req = batch.req;
	try {
		if (req.readyState != 4) return;
	}
	catch (ex) {
		dwr.engine._handleWarning(batch, ex);
		// It's broken - clear up and forget this call
		dwr.engine._clearUp(batch);
		return;
	}

	try {
		var reply = req.responseText;
		reply = dwr.engine._replyRewriteHandler(reply);
		var status = req.status; // causes Mozilla to except on page moves

		if (reply == null || reply == "") {
			dwr.engine._handleWarning(batch, { name:"dwr.engine.missingData", message:"No data received from server" });
		}
		else if (status != 200) {
			dwr.engine._handleError(batch, { name:"dwr.engine.http." + status, message:req.statusText });
		}
		else {
			var contentType = req.getResponseHeader("Content-Type");
			if (!contentType.match(/^text\/plain/) && !contentType.match(/^text\/javascript/)) {
				if (contentType.match(/^text\/html/) && typeof batch.textHtmlHandler == "function") {
					batch.textHtmlHandler();
				}
				else {
					dwr.engine._handleWarning(batch, { name:"dwr.engine.invalidMimeType", message:"Invalid content type: '" + contentType + "'" });
				}
			}
			else {
				// Comet replies might have already partially executed
				if (batch.isPoll && batch.map.partialResponse == dwr.engine._partialResponseYes) {
					dwr.engine._processCometResponse(reply, batch);
				}
				else {
					if (reply.search("//#DWR") == -1) {
						dwr.engine._handleWarning(batch, { name:"dwr.engine.invalidReply", message:"Invalid reply from server" });
					}
					else {
						toEval = reply;
					}
				}
			}
		}
	}
	catch (ex) {
		dwr.engine._handleWarning(batch, ex);
	}

	dwr.engine._callPostHooks(batch);

	// Outside of the try/catch so errors propogate normally:
	dwr.engine._receivedBatch = batch;
	if (toEval != null) toEval = toEval.replace(dwr.engine._scriptTagProtection, "");
	dwr.engine._eval(toEval);
	dwr.engine._receivedBatch = null;

	dwr.engine._clearUp(batch);
};

/** @private Called by the server: Execute a callback */
dwr.engine._remoteHandleCallback = function(batchId, callId, reply) {
	var batch = dwr.engine._batches[batchId];
	if (batch == null) {
		dwr.engine._debug("Warning: batch == null in remoteHandleCallback for batchId=" + batchId, true);
		return;
	}
	// Error handlers inside here indicate an error that is nothing to do
	// with DWR so we handle them differently.
	try {
		var handlers = batch.handlers[callId];
		if (!handlers) {
			dwr.engine._debug("Warning: Missing handlers. callId=" + callId, true);
		}
		else if (typeof handlers.callback == "function") handlers.callback(reply);
	}
	catch (ex) {
		dwr.engine._handleError(batch, ex);
	}
};

/** @private Called by the server: Handle an exception for a call */
dwr.engine._remoteHandleException = function(batchId, callId, ex) {
	var batch = dwr.engine._batches[batchId];
	if (batch == null) { dwr.engine._debug("Warning: null batch in remoteHandleException", true); return; }
	var handlers = batch.handlers[callId];
	if (handlers == null) { dwr.engine._debug("Warning: null handlers in remoteHandleException", true); return; }
	if (ex.message == undefined) ex.message = "";
	if (typeof handlers.exceptionHandler == "function") handlers.exceptionHandler(ex.message, ex);
	else if (typeof batch.errorHandler == "function") batch.errorHandler(ex.message, ex);
};

/** @private Called by the server: The whole batch is broken */
dwr.engine._remoteHandleBatchException = function(ex, batchId) {
	var searchBatch = (dwr.engine._receivedBatch == null && batchId != null);
	if (searchBatch) {
		dwr.engine._receivedBatch = dwr.engine._batches[batchId];
	}
	if (ex.message == undefined) ex.message = "";
	dwr.engine._handleError(dwr.engine._receivedBatch, ex);
	if (searchBatch) {
		dwr.engine._receivedBatch = null;
		dwr.engine._clearUp(dwr.engine._batches[batchId]);
	}
};

/** @private Called by the server: Reverse ajax should not be used */
dwr.engine._remotePollCometDisabled = function(ex, batchId) {
	dwr.engine.setActiveReverseAjax(false);
	var searchBatch = (dwr.engine._receivedBatch == null && batchId != null);
	if (searchBatch) {
		dwr.engine._receivedBatch = dwr.engine._batches[batchId];
	}
	if (ex.message == undefined) ex.message = "";
	dwr.engine._handleError(dwr.engine._receivedBatch, ex);
	if (searchBatch) {
		dwr.engine._receivedBatch = null;
		dwr.engine._clearUp(dwr.engine._batches[batchId]);
	}
};

/** @private Called by the server: An IFrame reply is about to start */
dwr.engine._remoteBeginIFrameResponse = function(iframe, batchId) {
	if (iframe != null) dwr.engine._receivedBatch = iframe.batch;
	dwr.engine._callPostHooks(dwr.engine._receivedBatch);
};

/** @private Called by the server: An IFrame reply is just completing */
dwr.engine._remoteEndIFrameResponse = function(batchId) {
	dwr.engine._clearUp(dwr.engine._receivedBatch);
	dwr.engine._receivedBatch = null;
};

/** @private This is a hack to make the context be this window */
dwr.engine._eval = function(script) {
	if (script == null) return null;
	if (script == "") { dwr.engine._debug("Warning: blank script", true); return null; }
	// dwr.engine._debug("Exec: [" + script + "]", true);
	return eval(script);
};

/** @private Called as a result of a request timeout */
dwr.engine._abortRequest = function(batch) {
	if (batch && !batch.completed) {
		clearInterval(batch.interval);
		dwr.engine._clearUp(batch);
		if (batch.req) batch.req.abort();
		dwr.engine._handleError(batch, { name:"dwr.engine.timeout", message:"Timeout" });
	}
};

/** @private call all the post hooks for a batch */
dwr.engine._callPostHooks = function(batch) {
	if (batch.postHooks) {
		for (var i = 0; i < batch.postHooks.length; i++) {
			batch.postHooks[i]();
		}
		batch.postHooks = null;
	}
}

/** @private A call has finished by whatever means and we need to shut it all down. */
dwr.engine._clearUp = function(batch) {
	if (!batch) { dwr.engine._debug("Warning: null batch in dwr.engine._clearUp()", true); return; }
	if (batch.completed == "true") { dwr.engine._debug("Warning: Double complete", true); return; }

	// IFrame tidyup
	if (batch.div) batch.div.parentNode.removeChild(batch.div);
	if (batch.iframe) {
		// If this is a poll frame then stop comet polling
		for (var i = 0; i < dwr.engine._outstandingIFrames.length; i++) {
			if (dwr.engine._outstandingIFrames[i] == batch.iframe) {
				dwr.engine._outstandingIFrames.splice(i, 1);
			}
		}
		batch.iframe.parentNode.removeChild(batch.iframe);
	}
	if (batch.form) batch.form.parentNode.removeChild(batch.form);

	// XHR tidyup: avoid IE handles increase
	if (batch.req) {
		// If this is a poll frame then stop comet polling
		if (batch.req == dwr.engine._pollReq) dwr.engine._pollReq = null;
		delete batch.req;
	}

	if (batch.map && batch.map.batchId) {
		delete dwr.engine._batches[batch.map.batchId];
		dwr.engine._batchesLength--;
	}

	batch.completed = true;

	// If there is anything on the queue waiting to go out, then send it.
	// We don't need to check for ordered mode, here because when ordered mode
	// gets turned off, we still process *waiting* batches in an ordered way.
	if (dwr.engine._batchQueue.length != 0) {
		var sendbatch = dwr.engine._batchQueue.shift();
		dwr.engine._sendData(sendbatch);
	}
};

/** @private Generic error handling routing to save having null checks everywhere */
dwr.engine._handleError = function(batch, ex) {
	if (typeof ex == "string") ex = { name:"unknown", message:ex };
	if (ex.message == null) ex.message = "";
	if (ex.name == null) ex.name = "unknown";
	if (batch && typeof batch.errorHandler == "function") batch.errorHandler(ex.message, ex);
	else if (dwr.engine._errorHandler) dwr.engine._errorHandler(ex.message, ex);
	dwr.engine._clearUp(batch);
};

/** @private Generic error handling routing to save having null checks everywhere */
dwr.engine._handleWarning = function(batch, ex) {
	if (typeof ex == "string") ex = { name:"unknown", message:ex };
	if (ex.message == null) ex.message = "";
	if (ex.name == null) ex.name = "unknown";
	if (batch && typeof batch.warningHandler == "function") batch.warningHandler(ex.message, ex);
	else if (dwr.engine._warningHandler) dwr.engine._warningHandler(ex.message, ex);
	dwr.engine._clearUp(batch);
};

/**
* @private Marshall a data item
* @param batch A map of variables to how they have been marshalled
* @param referto An array of already marshalled variables to prevent recurrsion
* @param data The data to be marshalled
* @param name The name of the data being marshalled
*/
dwr.engine._serializeAll = function(batch, referto, data, name) {
	if (data == null) {
		batch.map[name] = "null:null";
		return;
	}

	switch (typeof data) {
		case "boolean":
		batch.map[name] = "boolean:" + data;
		break;
		case "number":
		batch.map[name] = "number:" + data;
		break;
		case "string":
		batch.map[name] = "string:" + encodeURIComponent(data);
		break;
		case "object":
		if (data instanceof String) batch.map[name] = "String:" + encodeURIComponent(data);
		else if (data instanceof Boolean) batch.map[name] = "Boolean:" + data;
		else if (data instanceof Number) batch.map[name] = "Number:" + data;
		else if (data instanceof Date) batch.map[name] = "Date:" + data.getTime();
		else if (data && data.join) batch.map[name] = dwr.engine._serializeArray(batch, referto, data, name);
		else batch.map[name] = dwr.engine._serializeObject(batch, referto, data, name);
		break;
		case "function":
		// We just ignore functions.
		break;
		default:
		dwr.engine._handleWarning(null, { name:"dwr.engine.unexpectedType", message:"Unexpected type: " + typeof data + ", attempting default converter." });
		batch.map[name] = "default:" + data;
		break;
	}
};

/** @private Have we already converted this object? */
dwr.engine._lookup = function(referto, data, name) {
	var lookup;
	// Can't use a map: getahead.org/ajax/javascript-gotchas
	for (var i = 0; i < referto.length; i++) {
		if (referto[i].data == data) {
			lookup = referto[i];
			break;
		}
	}
	if (lookup) return "reference:" + lookup.name;
	referto.push({ data:data, name:name });
	return null;
};

/** @private Marshall an object */
dwr.engine._serializeObject = function(batch, referto, data, name) {
	var ref = dwr.engine._lookup(referto, data, name);
	if (ref) return ref;

	// This check for an HTML is not complete, but is there a better way?
	// Maybe we should add: data.hasChildNodes typeof "function" == true
	if (data.nodeName && data.nodeType) {
		return dwr.engine._serializeXml(batch, referto, data, name);
	}

	// treat objects as an associative arrays
	var reply = "Object_" + dwr.engine._getObjectClassName(data) + ":{";
	var element;
	for (element in data) {
		if (typeof data[element] != "function") {
			batch.paramCount++;
			var childName = "c" + dwr.engine._batch.map.callCount + "-e" + batch.paramCount;
			dwr.engine._serializeAll(batch, referto, data[element], childName);

			reply += encodeURIComponent(element) + ":reference:" + childName + ", ";
		}
	}

	if (reply.substring(reply.length - 2) == ", ") {
		reply = reply.substring(0, reply.length - 2);
	}
	reply += "}";

	return reply;
};

/** @private Returns the classname of supplied argument obj */
dwr.engine._errorClasses = { "Error":Error, "EvalError":EvalError, "RangeError":RangeError, "ReferenceError":ReferenceError, "SyntaxError":SyntaxError, "TypeError":TypeError, "URIError":URIError };
dwr.engine._getObjectClassName = function(obj) {
	// Try to find the classname by stringifying the object's constructor
	// and extract <class> from "function <class>".
	if (obj && obj.constructor && obj.constructor.toString)
	{
		var str = obj.constructor.toString();
		var regexpmatch = str.match(/function\s+(\w+)/);
		if (regexpmatch && regexpmatch.length == 2) {
			return regexpmatch[1];
		}
	}

	// Now manually test against the core Error classes, as these in some
	// browsers successfully match to the wrong class in the
	// Object.toString() test we will do later
	if (obj && obj.constructor) {
		for (var errorname in dwr.engine._errorClasses) {
			if (obj.constructor == dwr.engine._errorClasses[errorname]) return errorname;
		}
	}

	// Try to find the classname by calling Object.toString() on the object
	// and extracting <class> from "[object <class>]"
	if (obj) {
		var str = Object.prototype.toString.call(obj);
		var regexpmatch = str.match(/\[object\s+(\w+)/);
		if (regexpmatch && regexpmatch.length==2) {
			return regexpmatch[1];
		}
	}

	// Supplied argument was probably not an object, but what is better?
	return "Object";
};

/** @private Marshall an object */
dwr.engine._serializeXml = function(batch, referto, data, name) {
	var ref = dwr.engine._lookup(referto, data, name);
	if (ref) return ref;

	var output;
	if (window.XMLSerializer) output = new XMLSerializer().serializeToString(data);
	else if (data.toXml) output = data.toXml;
	else output = data.innerHTML;

	return "XML:" + encodeURIComponent(output);
};

/** @private Marshall an array */
dwr.engine._serializeArray = function(batch, referto, data, name) {
	var ref = dwr.engine._lookup(referto, data, name);
	if (ref) return ref;

	var reply = "Array:[";
	for (var i = 0; i < data.length; i++) {
		if (i != 0) reply += ",";
		batch.paramCount++;
		var childName = "c" + dwr.engine._batch.map.callCount + "-e" + batch.paramCount;
		dwr.engine._serializeAll(batch, referto, data[i], childName);
		reply += "reference:";
		reply += childName;
	}
	reply += "]";

	return reply;
};

/** @private Convert an XML string into a DOM object. */
dwr.engine._unserializeDocument = function(xml) {
	var dom;
	if (window.DOMParser) {
		var parser = new DOMParser();
		dom = parser.parseFromString(xml, "text/xml");
		if (!dom.documentElement || dom.documentElement.tagName == "parsererror") {
			var message = dom.documentElement.firstChild.data;
			message += "\n" + dom.documentElement.firstChild.nextSibling.firstChild.data;
			throw message;
		}
		return dom;
	}
	else if (window.ActiveXObject) {
		dom = dwr.engine._newActiveXObject(dwr.engine._DOMDocument);
		dom.loadXML(xml); // What happens on parse fail with IE?
		return dom;
	}
	else {
		var div = document.createElement("div");
		div.innerHTML = xml;
		return div;
	}
};

/** @param axarray An array of strings to attempt to create ActiveX objects from */
dwr.engine._newActiveXObject = function(axarray) {
	var returnValue;
	for (var i = 0; i < axarray.length; i++) {
		try {
			returnValue = new ActiveXObject(axarray[i]);
			break;
		}
		catch (ex) { /* ignore */ }
	}
	return returnValue;
};

/** @private Used internally when some message needs to get to the programmer */
dwr.engine._debug = function(message, stacktrace) {
	var written = false;
	try {
		if (window.console) {
			if (stacktrace && window.console.trace) window.console.trace();
			window.console.log(message);
			written = true;
		}
		else if (window.opera && window.opera.postError) {
			window.opera.postError(message);
			written = true;
		}
	}
	catch (ex) { /* ignore */ }

	if (!written) {
		var debug = document.getElementById("dwr-debug");
		if (debug) {
			var contents = message + "<br/>" + debug.innerHTML;
			if (contents.length > 2048) contents = contents.substring(0, 2048);
			debug.innerHTML = contents;
		}
	}
};
/*
* 2010-01-18 : Migration Version 1
*/
 
var setInitialTab = 0;

var fnCallback = function openPopUp(e){
    YAHOO.util.Event.preventDefault(e);
    window.open(this.getAttribute('href'), "_blank", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=900, height=700");
    return false;
}

YAHOO.util.Event.addListener("pop-up-window", "click", fnCallback);

function Dashboard(){
    this.dbBody = YAHOO.util.Dom.get("dashboard-body");
    this.dbTabs = YAHOO.util.Dom.get("dashboard-tabs").getElementsByTagName("td");
    this.tabActive = null;
    
    // Add mouseover effect to tabs
    YAHOO.util.Event.addListener(this.dbTabs, "mouseover", function(ev){
        if (!YAHOO.util.Dom.hasClass(this, "selected")) {
            YAHOO.util.Dom.addClass(this, "hover");
        }
    });
    YAHOO.util.Event.addListener(this.dbTabs, "mouseout", function(ev){
        YAHOO.util.Dom.removeClass(this, "hover");
    });
    
    if (setInitialTab == 0) {
        this.setTabActive(this.dbTabs[0]);
        setInitialTab = 1;
    }
 
   // check for tab parameter and go straight to requested tab
    var qs = window.location.search
    var tab = getParameter(qs, "tab")
	
    if (tab)	{
	    for (i=0; i<this.dbTabs.length; i++) {
		if ((this.dbTabs[i].id.indexOf(tab))==0){
       			this.setTabActive(this.dbTabs[i]);
       			setInitialTab = i+1;
		}
	 }
   }	
     
    // Add click event listener to tabs
    YAHOO.util.Event.addListener(this.dbTabs, "click", this.loadDashboard, this, true);
}

Dashboard.prototype.loadDashboard = function(ev, args){
    // Only load if a different dashboard was clicked.
    YAHOO.util.Event.preventDefault(ev);
    var target = YAHOO.util.Event.getTarget(ev);
    // Get A tag
    var link = (target.tagName == "A" ? target : target.parentNode);
    // Get tab element for id reference
    if (target.tagName == "TD") {
        var tab = target;
    }
    else {
        var tab = (target.tagName == "A" ? target.parentNode : target.parentNode.parentNode);
    }
    // Blur a tag
    link.blur();
    
    if (this.tabActive) {
        // Hide last selected dashboard
        window.currentTab = this.tabActive.id + "_content";
        setTimeout("YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get(window.currentTab).getElementsByTagName('select'), 'display', 'none');", 500);
        YAHOO.util.Dom.setStyle(this.tabActive.id + "_content", "display", "none");
        callback = {
            success: this.handleSuccess,
            failure: this.handleFailure,
            argument: [this, tab]
        };
        // Check if selected dashboard is allready present
        if (YAHOO.util.Dom.get(tab.id + "_content")) {
            YAHOO.util.Dom.setStyle(tab.id + "_content", "display", "");
            YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get(tab.id + "_content").getElementsByTagName('select'), 'display', '');
        }
        else {
            if (YAHOO.util.Dom.hasClass(tab, 'widget')) {
                if(fb_customer){
                                $.get(tab.getElementsByTagName("A")[0].href, { FBSessionID: fb_customer.SessionID, FBCloneID: fb_customer.EngineID, BV_SessionID: fb_customer.SessionID, BV_EngineID: fb_customer.EngineID}, this.handleWidgetResponse, 'html'); //Using JQuery for widget response (Dynamic Javascript loading).
                }else{
                                $.get(tab.getElementsByTagName("A")[0].href, this.handleWidgetResponse, 'html'); //Using JQuery for widget response (Dynamic Javascript loading).

                }
                window.setTimeout(function(){
                    YAHOO.util.Get.script('/travel/generic/static/js/' + tab.id + '.js');
                }, 0);
            }
            else {
	if(tab.id === "db_ott"){
		YAHOO.util.Get.css("/travel/generic/static/css/timetable/rebreandTimetable_home.css");
	}
                var request = YAHOO.util.Connect.asyncRequest('GET', tab.getElementsByTagName("A")[0].href, callback);
            }
        }
        
        this.setTabActive(tab);
		// Commented out because the requirements changed... Again...
		//addFieldEvents(this);
    }
}

/**
* Add onFocus event to each input element in the dashboard. Adds field to selected fields array.
* Add onBlur event to each input element in the dashboard. Removes field from selected fields array.
*/
function addFieldEvents(dashBoardObj) {
    dashBoardObj.selectedFields = {};
    var dbBody = YAHOO.util.Dom.get("dashboard-body"), formChildren, tagName, field;
    if (dbBody) {
        formChildren = dbBody.getElementsByTagName('*');
        // Find first input field in DOM		
        for (i = 0; i < formChildren.length; i = i + 1) {
            field = formChildren[i];
            tagName = field.tagName.toLowerCase();
            if (tagName === 'input' || tagName === 'select' || tagName === 'textarea') {
				// Add key in object with value false (indicate not selected for now)
				var id = YAHOO.util.Dom.generateId(field);
                dashBoardObj.selectedFields[id] = false;;
					
                YAHOO.util.Event.addListener(field, "focus", function(){
                    // Sets focus to true in selectedFields object, this === field, db === dashboard instance
                    // if field has an ID, use that as a key, otherwise generate one.
					var key = YAHOO.util.Dom.generateId(this);
                    db.selectedFields[key] = true;
					
                });
                YAHOO.util.Event.addListener(field, "blur", function(){
                    // Sets focus to false in selectedFields object
                    // if field has an ID, use that as a key, otherwise generate one.
					var key = YAHOO.util.Dom.generateId(this);
                    db.selectedFields[key] = false;
                });

            }
        }
    }
}


Dashboard.prototype.handleWidgetResponse = function(response, textStatus){
    $(response).appendTo('div#dashboard-body');
}

Dashboard.prototype.handleSuccess = function(o){
    var tempDiv = document.createElement("div");
    var dashboard_container = YAHOO.util.Dom.get('dashboard-body');
    var container_name = o.argument[1].id + "_content";
    
    var start = o.responseText.indexOf("<body>");
    var end = o.responseText.indexOf("</body>");
    
    if (start >= 0) {
        tempDiv.innerHTML = o.responseText.substring(start + 6, end).substring();
    }
    else {
        tempDiv.innerHTML = o.responseText;
    }
    document.body.appendChild(tempDiv);
    var cont = YAHOO.util.Dom.get(container_name);
    if (cont) {
        dashboard_container.appendChild(cont);
        
        window.setTimeout(function(){
            YAHOO.util.Get.script('/travel/generic/static/js/' + o.argument[1].id + '.js');
        }, 0);
        
    }
    else {
        alert('Dashboard root element("' + container_name + '") not found');
    }
    document.body.removeChild(tempDiv);

}
Dashboard.prototype.handleFailure = function(o){
    var div = document.createElement('div');
    var div = document.createElement("div");
    div.className = "db_content_selected";
    div.id = o.argument[1].id + "_content";
    div.innerHTML = "Dashboard " + o.argument[1].id.replace(/db_/, "") + " could not be loaded.";
    o.argument[0].dbBody.appendChild(div);
}
Dashboard.prototype.setTabActive = function(tab){
    YAHOO.util.Dom.removeClass(this.dbTabs, "selected");
    YAHOO.util.Dom.addClass(tab, "selected");
    this.tabActive = tab;
}
/*
* 2010-01-18 : Migration Version 1
*/

function Calendar(button, dateReference, anchor, minDate, maxDate) {
	this.btnOpen = button;
	this.dateRef = dateReference;
	this.status = false;
	this.anchor = anchor;
	
	this.createContainer(this.anchor);
	
	this.cal = new YAHOO.widget.Calendar('myCal', this.tableContainer.id, { mindate: minDate, maxDate: maxDate });
	this.config();
	
	// IE 6 fix for selectboxes
	if (is_ie6) {
		this.frame = this.createIframe();
	}
	Event.addListener(button, 'click', this.show, this, true);
}
Calendar.prototype.createContainer = function(anchor) {
	// Create container
	this.container = this.container = new HTMLNode(document, 'div', null, '', 'ebt-calendar');
	document.body.appendChild(this.container);
	
	this.tableContainer = new HTMLNode(document, 'div', {id:'cal' + Math.random()});
	this.container.appendChild(this.tableContainer);
	this.btnClose = new HTMLNode(document, 'a', {href:'javascript:;'}, 'close', 'close-calendar calclose');
	this.container.appendChild(this.btnClose);

	Event.addListener(this.btnClose, 'click', this.hide, this, true);
}
Calendar.prototype.config = function() {
	this.cal.cfg.setProperty('START_WEEKDAY', 1);
	this.cal.cfg.setProperty('WEEKDAYS_SHORT', dayNamesShort);
	this.cal.cfg.setProperty('MONTHS_LONG', monthNamesLong);
}
Calendar.prototype.show = function() {
	this.pos = Dom.getRegion(this.anchor);
	if (this.btnOpen.className == 'disabled') {
		return false;
	}
	this.cal.cfg.setProperty('pagedate', (this.dateRef.getDate().getMonth() +1) + '/' + this.dateRef.getDate().getFullYear());
	this.cal.select((this.dateRef.getDate().getMonth() +1) + '/' + this.dateRef.getDate().getDate() + '/' + this.dateRef.getDate().getFullYear());
	this.cal.render();
	Dom.setStyle(this.container, 'display', 'block');
	Dom.setX(this.container, this.pos.left);
	Dom.setY(this.container, this.pos.bottom);
	if (this.frame) {
		Dom.setStyle(this.frame, 'width', this.container.offsetWidth);
		Dom.setStyle(this.frame, 'height', this.container.offsetHeight);
		Dom.setStyle(this.frame, 'top', this.container.offsetTop);
		Dom.setStyle(this.frame, 'left', this.container.offsetLeft);
		Dom.setStyle(this.frame, 'visibility', 'visible');
	}
	this.status = true;
//	Dom.setStyle(this.container, 'top', this.pos.bottom + 'px');
}
Calendar.prototype.hide = function() {
	Dom.setStyle(this.container, 'display', 'none');
	if (this.frame) {
		Dom.setStyle(this.frame, 'visibility', 'hidden');
	}
	this.status = false;
}
Calendar.prototype.createIframe = function() {
	var frame = document.createElement("IFRAME");
	frame.src = '/travel/generic/static/empty.html';
	frame.style.position = 'absolute';
	frame.style.zIndex = 1;
	Dom.setStyle(frame, 'visibility', 'hidden');
	document.body.appendChild(frame);
	return frame;
}
/*
* 2010-01-18 : Migration Version 1
*/

function ToolTip (container, link, deltaX, deltaY) {
	this.container = container.tagName ? container : YAHOO.util.Dom.get(container);
	this.link = link;
	this.deltaX = deltaX;
	this.deltaY = deltaY;
 	if (document.all) {
		this.iframe = document.createElement('iframe');
		this.iframe.className = 'tooltip-iframe';
		// src added to make sure there is no problem with secure/non-secure items
		this.iframe.src = '/travel/generic/static/empty.html';
		this.iframe.frameBorder = 0;
		this.container.appendChild(this.iframe);
	}
}
ToolTip.prototype.show = function () {
	if (!isNaN(this.deltaX) && !isNaN(this.deltaX)) {
		this.container.style.left = calculateLeft(this.link) + this.deltaX + "px";
		this.container.style.top = calculateTop(this.link) + this.deltaY + "px";
		this.container.style.bottom = "auto";
	}
	this.toShow = setTimeout(createContextFunction(this, "doShow"), 300);
}
ToolTip.prototype.showPos = function (e, args) {
	var ieFix = document.all ? 120 : 30; 
	var leftCorr =  YAHOO.util.Dom.hasClass(args[0].container, 'goleft') ? -300 : 0;
	args[0].container.style.left = (args[1].offsetLeft + ieFix + leftCorr) + "px";
	args[0].container.parentNode.style.zIndex = 200;
	args[0].toShow = setTimeout(createContextFunction(args[0], "doShow"), 300);
}
ToolTip.prototype.hide = function () {
	clearTimeout(this.toShow);
	this.toShow = -1;
	this.container.style.display = 'none';
}
ToolTip.prototype.doShow = function () {
	this.container.style.display = 'block';
	if (document.all) {
		this.iframe.style.width = (this.container.offsetWidth)+ 'px';
		this.iframe.style.height = (this.container.offsetHeight) + 'px';
	}
}
function createContextFunction(context, method, method2) {
	return (function(x){
		method = (method == "post") ? method2 : method;
		eval("context."+method+"(x)");
		return false;
	});
}
function calculateTop(object) {if (object) return object.offsetTop + calculateTop(object.offsetParent); else return 0;}
function calculateLeft(object) {if (object) return object.offsetLeft + calculateLeft(object.offsetParent); else return 0;}
function isChild(ancestor, candidate) {
	while (candidate && candidate != ancestor.parentNode) {
		if (candidate == ancestor) return true;
		candidate = candidate.parentNode;
	}
	return false;
}
/*
* 2010-01-18 : Migration Version 1
*/

function ChildrenBox(DOMDivElement, page) {
	this.cb = DOMDivElement;
	this.target = page;

	this.initEvents();
}
ChildrenBox.prototype.initEvents = function() {
	// Object settings
	this.totalChildren = 0
	this.maxChildren = 9;
	this.template = Dom.get("ebt-add-template");
	this.children = new Array();
	this.childrenAdmin = new Array();
	this.maxChildrenError = Dom.get("ebt-maxchildren-error");
	this.cbTooltipLink = Dom.get("ebt-children-tooltiplink");
	this.childrenList = YAHOO.util.Dom.get('ebt-children-listed');
	this.childrenFormdata = YAHOO.util.Dom.get('ebt-children-formdata');
	this.cbTooltipLinkText = YAHOO.util.Dom.get("ebt-children-tooltiplink-text").innerHTML;
	this.cbTooltipElement = new ToolTip("ebt-children-tooltip", "ebt-children-tooltiplink");
	// Get all age group names
	this.ageText = {
		infant: Dom.get("ebt-cb-infant-text").innerHTML,
		child: Dom.get("ebt-cb-child-text").innerHTML,
		youngadult: Dom.get("ebt-cb-youngadult-text").innerHTML,
		adult: Dom.get("ebt-cb-adult-text").innerHTML
	}
	
	// Initiate user controls
	this.btnCheckBox = Dom.get("ebt-btn-open-cb");
	this.btnClose = Dom.get("btn-ebt-children-close");
	this.moreInfo = Dom.get("ebt-more-info-link");
	this.btnAdd = Dom.get("ebt-cb-add");
	this.btnSaveAll = Dom.get("cb-save-but");
	
	YAHOO.util.Event.addListener(this.btnCheckBox, "click", this.open, [this, this.btnCheckBox], true);
	YAHOO.util.Event.addListener(this.btnClose, "click", this.cancelAndClose, this, true);
	YAHOO.util.Event.addListener(this.btnAdd, "click", this.clickAddChild, this, true);
	YAHOO.util.Event.addListener(this.btnSaveAll, "click", this.saveAndClose, this, true);
}
ChildrenBox.prototype.open = function(e, args) {
	var base = args[0];
	var btnCheckBox = args[1];

	if (btnCheckBox.checked && base.childrenAdmin) {
		while(base.totalChildren > 0) base.children[base.totalChildren - 1].remove();
		if (base.childrenAdmin.length == 0) {
			base.clickAddChild();
		} else {
			for (var i = 0; i < base.childrenAdmin.length; i++) {
				base.clickAddChild(base.childrenAdmin[i]);
			}
		}
		base.maxChildrenError.style.display = "none";
		if (base.target.layOver) base.target.layOver.show();
		base.animateOpen();
	}
}
ChildrenBox.prototype.animateOpen = function() {
	this.cb.style.display = "block";
	var attributes = {
		opacity: { to: 1 }
	}
	anim = new YAHOO.util.Motion(this.cb, attributes, .4, YAHOO.util.Easing.easeOut);
	anim.animate();
}
ChildrenBox.prototype.close = function() {
	var attributes = {
		opacity: { to: 0 }
	}
	anim = new YAHOO.util.Motion(this.cb, attributes, .4, YAHOO.util.Easing.easeOut);
	anim.cb = this;
	anim.onComplete.subscribe(this.finishClose);
	anim.animate();
	if (this.target.layOver) this.target.layOver.hide();
}
ChildrenBox.prototype.cancelAndClose = function() {
	this.maxChildrenError.style.display = "none";
	if(this.childrenAdmin.length == 0) {
			this.btnCheckBox.checked = false;
	}
	this.close();
}
ChildrenBox.prototype.finishClose = function() {
	YAHOO.util.Dom.get("ebt-children-box").style.display = "none";
}
ChildrenBox.prototype.clickAddChild = function() {
	if (this.totalChildren < this.maxChildren) {
		this.totalChildren++;
		this.children[this.totalChildren - 1] = new Child(this, this.totalChildren, null, this.template)
	} else {
		this.maxChildrenError.style.display = "block";
	}
}
ChildrenBox.prototype.updateChildOrder = function(num) {
	this.maxChildrenError.style.display = "none";
	for (var i = num; i < this.totalChildren; i++) {
		this.children[i - 1] = this.children[i];
		this.children[i - 1].updateOrderNr(i);
	}
	this.children[this.totalChildren - 1] = null;
	this.totalChildren--;
}
ChildrenBox.prototype.saveAndClose = function() {
	
	if (this.totalChildren > 0) {
		for (var i = 0; i < this.totalChildren; i++) {
			if (this.children[i].hasError) return;
		}
		this.cbTooltipLink.className = "ebt-children-tooltiplink";
		this.cbTooltipLink.innerHTML = this.totalChildren + "&nbsp;" + this.cbTooltipLinkText;
		this.cbTooltipLink.href = "javascript:;";
		while (this.childrenList.childNodes.length > 0) {
			this.childrenList.removeChild(this.childrenList.firstChild);
		}
		var newChild;
		this.childrenAdmin = new Array();
		for (var i = 0; i < this.totalChildren; i++) {
			newChild = document.createElement("li");
			this.children[i].checkDate();
			newChild.innerHTML = this.children[i].getNiceOutput();
			this.childrenList.appendChild(newChild);
			this.childrenAdmin[i] = [this.children[i].selectedDayIndex, this.children[i].selectedMonthIndex, this.children[i].selectedYearIndex];
		}
		YAHOO.util.Event.removeListener(this.cbTooltipLink, 'mouseover', this.cbTooltipElement.show);
		YAHOO.util.Event.addListener(this.cbTooltipLink, 'mouseover', this.cbTooltipElement.show, this.cbTooltipElement, true);
		YAHOO.util.Event.removeListener(this.cbTooltipLink, 'mouseout', this.cbTooltipElement.hide);
		YAHOO.util.Event.addListener(this.cbTooltipLink, 'mouseout', this.cbTooltipElement.hide, this.cbTooltipElement, true);
//		YAHOO.util.Event.removeListener(this.cbTooltipLink, 'click', this.open);
		YAHOO.util.Event.addListener(this.cbTooltipLink, 'click', this.open, [this, this.btnCheckBox], true);
	} else {
		while(this.nrOfChildren > 0) this.children[base.nrOfChildren-1].remove();
		this.childrenAdmin = [];
		this.cbTooltipLink.innerHTML = this.cbTooltipLinkText;
		this.cbTooltipLink.className = 'no-link';
		this.btnCheckBox.checked = "";
		YAHOO.util.Event.removeListener(this.cbTooltipLink, 'mouseover', this.cbTooltipElement.show);
	}
	this.returnFormElements();
	this.close();
}
ChildrenBox.prototype.returnFormElements = function () {
	while (this.childrenFormdata.childNodes.length > 0) this.childrenFormdata.removeChild(this.childrenFormdata.firstChild);
	if (this.childrenAdmin) {
		for (var i = 0; i < this.childrenAdmin.length; i++) {
			var inputEl = document.createElement('input');
			inputEl.type = 'hidden';
			inputEl.id = 'child[' + i + '].day';
			inputEl.name = 'child[' + i + '].day';
			inputEl.value = this.children[i].day;
			this.childrenFormdata.appendChild(inputEl);
			
			inputEl = document.createElement('input');
			inputEl.type = 'hidden';
			inputEl.id = 'child[' + i + '].month';
			inputEl.name = 'child[' + i + '].month';
			inputEl.value = this.children[i].month;
			this.childrenFormdata.appendChild(inputEl);
			
			inputEl = document.createElement('input');
			inputEl.type = 'hidden';
			inputEl.id = 'child[' + i + '].year';
			inputEl.name = 'child[' + i + '].year';
			inputEl.value = this.children[i].year;
			this.childrenFormdata.appendChild(inputEl);
			
			inputEl = document.createElement('input');
			inputEl.type = 'hidden';
			inputEl.id = 'child[' + i + '].isInfant';
			inputEl.name = 'child[' + i + '].infant';
			inputEl.value = this.children[i].isInfant;
			this.childrenFormdata.appendChild(inputEl);
			
			inputEl = document.createElement('input');
			inputEl.type = 'hidden';
			inputEl.id = 'child[' + i + '].isChild';
			inputEl.name = 'child[' + i + '].child';
			inputEl.value = this.children[i].isChild;
			this.childrenFormdata.appendChild(inputEl);
			
			inputEl = document.createElement('input');
			inputEl.type = 'hidden';
			inputEl.id = 'child[' + i + '].isYoungAdult';
			inputEl.name = 'child[' + i + '].youngAdult';
			inputEl.value = this.children[i].isYoungAdult;
			this.childrenFormdata.appendChild(inputEl);
		}
	}
}



function Child(cb, num, selectedValues, DOMFieldsetElement) {
	this.cb = cb;
	this.num = num;
	
	if (!DOMFieldsetElement) {
		alert("that's not good");
	} else  {
		this.template = DOMFieldsetElement.cloneNode(true);
		this.template.id = this.template.id + "-" + this.num;
		YAHOO.util.Dom.removeClass(this.template, "template");
		this.parent = DOMFieldsetElement.parentNode;
		this.parent.appendChild(this.template);
		
		// Get all the DOM Elements needed
		this.parse(this.template);
		
		this.saved = false
		YAHOO.util.Event.addListener(this.btnRemove, "click", this.remove, this, true);
		YAHOO.util.Event.addListener([this.daySelect, this.monthSelect, this.yearSelect], "change", this.checkDate, this, true);
	}
}
Child.prototype.parse = function(node) {
	
	if (!node) return;
	
	if (node.className) {
		
		switch (node.className) {
			case "ebt-nr":
				node.id = "ebt-nr-" + this.num;
				this.nr = node;
				this.nr.innerHTML = this.num;
				break;
			case "ebt-day":
				node.id = "ebt-day-" + this.num;
				this.daySelect = node;
				this.fillDayBox();
				break;
			case "ebt-month": 
				node.id = "ebt-month-" + this.num;
				this.monthSelect = node;
				this.fillMonthBox();
				break;
			case "ebt-year": 
				node.id = "ebt-year-" + this.num;
				this.yearSelect = node;
				this.fillYearSelect();
				break;
			case "ebt-agegroup":
				node.id = "ebt-ageGroup-" + this.num;
				this.ageGroup = node;
				break;
			case "ebt-remove":
				node.id = "ebt-remove-" + this.num;
				this.btnRemove = node;
			default:
				break;		 
		}
	}
	
	for (var i = 0; i < node.childNodes.length; i++) 
		this.parse(node.childNodes[i]);
}
Child.prototype.fillDayBox = function() {
	this.daySelect.options.length = 0;
	
	for (var i = 0; i <= 31; i++) {
		this.daySelect.options[i] = new Option(i+1, i+1);
	}
}
Child.prototype.fillMonthBox = function() {
	this.monthSelect.options.length = 0;
	
	for (var i = 0; i < monthNames.length; i++) {
		this.monthSelect.options[i] = new Option(monthNames[i][0], i+1);
	}
}
Child.prototype.fillYearSelect = function() {
	var today = new Date();
	var thisYear = today.getFullYear();
	var yearIndex = 0;
	for (var i = thisYear - 15; i <= thisYear; i++) {
		this.yearSelect.options[yearIndex] = new Option(i, i);
		yearIndex++;
	}
}
Child.prototype.remove = function(e) {
	this.parent.removeChild(this.template);
	this.cb.updateChildOrder(this.num);
}
Child.prototype.updateOrderNr = function(newNum) {
	this.num = newNum;
	this.template.id = "ebt-add-template-" + this.num;
	this.parse(this.template);
	this.checkDate();
}
Child.prototype.checkDate = function() {
	this.selectedDayIndex = this.daySelect.selectedIndex;
	this.selectedMonthIndex = this.monthSelect.selectedIndex
	this.selectedYearIndex = this.yearSelect.selectedIndex
	this.day = parseInt(this.daySelect.value, 10);
	this.month = parseInt(this.monthSelect.value, 10);
	this.year = parseInt(this.yearSelect.value, 10);
	var date = new Date(this.year, this.month - 1, this.day);
	var today = new Date();
	if ((date.getMonth() + 1) == this.month && date < today) {
		//this.errorP.style.display = "none";
		this.harError = false;
	} else {
		//this.errorP.style.display = "none";
		this.hasError = true;
		this.ageGroup.innerHTML = "";
		return;
	}
	var refDate = new Date();
	refDate.setFullYear(refDate.getFullYear() - 2);
	// Check if infant
	if (refDate < date) {
		this.ageGroup.innerHTML = this.ageGroupText = this.cb.ageText.infant;
		this.isInfant = true;
		return;
	}
	// Check for child
	refDate.setFullYear(refDate.getFullYear() - 10);
	if (refDate < date) {
		this.ageGroup.innerHTML = this.ageGroupText =  this.cb.ageText.child;
		this.isChild = true;
		return;
	}
	// Check if Young adult
	refDate.setFullYear(refDate.getFullYear() - 3);
	if (refDate < date) {
		this.ageGroup.innerHTML = this.ageGroupText =  this.cb.ageText.youngadult;
		this.isYoungAdult = true;
		return;
	}
	this.ageGroup.innerHTML = this.ageGroupText = this.cb.ageText.adult;
}
Child.prototype.getNiceOutput = function() {
	this.niceOutput = this.day + "-" + this.month + " " + this.year + " (" + this.ageGroupText + ")";
	return this.niceOutput;
}

var airportToData = new Array();
var airportFromData = new Array();
function AutoComplete (bookTool, xmlFile, inputField, airportCodeInputField, dataContainer, from) {
	this.bookingTool = bookTool;
	this.from = from;
	this.airportCodeInputField = YAHOO.util.Dom.get(airportCodeInputField);
	this.inputField = YAHOO.util.Dom.get(inputField);
	YAHOO.util.Event.addListener(this.inputField, "focus", function () {this.select();}); 
	YAHOO.util.Event.addListener(this.inputField, "keydown", function () {this.style.color = '#023167'}); 
	YAHOO.util.Event.addListener(this.inputField, "keyup", this.updateHiddenField, this, true); 
	if (this.airportCodeInputField.value != '') this.inputField.style.color = '#023167';
	this.getAirportData(xmlFile, from);
	this.from ? this.ACDS = new YAHOO.widget.DS_JSFunction(this.getFromMatches) : this.ACDS = new YAHOO.widget.DS_JSFunction(this.getToMatches);
	this.autoComplete = new YAHOO.widget.AutoComplete(inputField, dataContainer, this.ACDS);
	this.autoComplete.queryDelay = 0; 
	this.autoComplete.maxResultsDisplayed = 100;
	this.autoComplete.obj = this;
	if (this.bookingTool.browser == 'ie55' || this.bookingTool.browser == 'ie6') this.autoComplete.useIFrame = true;
	this.autoComplete.autoHighlight = false; 

//	this.autoComplete.itemSelectEvent.subscribe(this.selectAirport);
//	this.autoComplete.dataReturnEvent.subscribe(this.onDataReturn);
	// formats the autocomplete suggestions; highlight the searchquery by making it bold
	this.autoComplete.formatResult = function(oResultItem, sQuery) {
		var city = oResultItem[0];
		var state = oResultItem[1];
		var country = oResultItem[2];
		var airport = oResultItem[3];
		var airportCode = oResultItem[4];
		var cityGroup = oResultItem[5];
		var numberOf = oResultItem[6];
		
		sQuery = unescape(sQuery);		
		// highlight (<strong>) searchquery in resultlist
		var regExp = new RegExp("(.*)(" + sQuery + ")(.*)", "i");
		city = city.replace(regExp, '$1<strong>$2</strong>$3');
		if (state) state = state.replace(regExp, '$1<strong>$2</strong>$3');
		country = country.replace(regExp, '$1<strong>$2</strong>$3');
		airport = airport.replace(regExp, '$1<strong>$2</strong>$3');
		airportCode = airportCode.replace(regExp, '$1<strong>$2</strong>$3');
		if (cityGroup) {
			airportCode = numberOf;
		}
		// return markup for ac-suggestions
		var sMarkup = city;
		// add state if available
		sMarkup += state ? " (" + state + "), " : ", "; 
		sMarkup += country + ' - ' + airport + ' (' + airportCode + ')';
		// if airportgroup, make italic;
		if (cityGroup) sMarkup = '<i>' + sMarkup + '</i>';
		
		return (sMarkup);
	}

	// replace _sResultKey in autocomplete Object to display full text on selectEvent
	this.autoComplete.doBeforeExpandContainer = function (oTextbox, oContainer, sQuery, aResults) {
		var resultList = oContainer.getElementsByTagName('li');
		// delete <strong> tags
		var regExp = new RegExp("<strong>(.*?)</strong>", "ig");
		for (var i = 0; i < resultList.length; i++) {
			if (resultList[i].innerHTML != '') {
				resultList[i]._sResultKey = resultList[i].innerHTML.replace(regExp, '$1')
			} 
		}
		// delete <i> tags, if present
		regExp = new RegExp("<i>(.*?)</i>", "ig");
		for (var i = 0; i < resultList.length; i++) {
			if (resultList[i].innerHTML != '') {
				resultList[i]._sResultKey = resultList[i]._sResultKey.replace(regExp, '$1')
			} 
		}
		return true;
	}
}
AutoComplete.prototype.onDataReturn = function (e, args) {
	var autoComplete = args[0];
	var query = args[1];
	var results = args[2];

	if (results.length == 0 && query.length > 2) 
		YAHOO.util.Dom.addClass(autoComplete._oTextbox, 'error');
	else 
		YAHOO.util.Dom.removeClass(autoComplete._oTextbox, 'error');
}
AutoComplete.prototype.selectAirport = function (e, args) {
	var base = args[0];
	var airportCode = args[2][4];
	
	base.obj.airportCodeInputField.value = airportCode; //airportCode;
	base.obj.inputField.blur();
}
AutoComplete.prototype.updateHiddenField = function () {
	this.airportCodeInputField.value = this.inputField.value;
}
AutoComplete.prototype.getAirportData = function (xmlFile) {
	var callback = { 
		success: this.parseAirportData, 
		failure: this.handleFailure,
		scope: this
	};
	this.airportXMLData = YAHOO.util.Connect.asyncRequest('GET', xmlFile, callback, null);
}
AutoComplete.prototype.parseAirportData = function (o) {
	var airports = o.responseXML.getElementsByTagName('Airport');
	var airportRecord;

	for (var i = 0; i < airports.length; i++) {
		airportRecord = new Array();
		airportRecord[0] = airports[i].getAttribute("city"); // City
		airportRecord[1] = airports[i].getAttribute("state"); // State
		airportRecord[2] = airports[i].getAttribute("country"); // Country
		airportRecord[3] = airports[i].getAttribute("name"); // Airportname
		airportRecord[4] = airports[i].getAttribute("code"); // AirportCode
		airportRecord[5] = airports[i].getAttribute("group"); // grouping name
		if (airportRecord[5]) {
			airportRecord[6] = airports[i].getAttribute("numberof"); // Number of airports in this group
		}
		this.from ? airportFromData[i] = airportRecord : airportToData[i] = airportRecord;
		
	}
	if (this.from) 
		airportFromData.sort(initialSortFunc)
	else {
		airportToData.sort(initialSortFunc)
	}
}
AutoComplete.prototype.handleFailure = function () {
}
AutoComplete.prototype.getFromMatches = function (sQuery) {
	sQuery = unescape(sQuery);
	var aResults = [];
	if (sQuery.length < 3) return aResults;
	
	// priority array; defines order to show results: airportcode, airportname, city, state, country
	var priority = [4, 3, 0, 1, 2, 5];
	var regExp = new RegExp("(.*)(" + sQuery + ")(.*)", "i");
	
	for (var i = 0; i < airportFromData.length; i++) {
		for (var j = 0; j < airportFromData[i].length; j++) {
			if (regExp.test(airportFromData[i][priority[j]])) {
				aResults.push(airportFromData[i]);
				aResults[aResults.length - 1][6] = j;
				break;
			}
		}
	}
	aResults.sort(acSortFunc);
	return aResults;
}
AutoComplete.prototype.getToMatches = function (sQuery) {
	sQuery = unescape(sQuery);
	var aResults = [];
	if (sQuery.length < 3) return aResults;
	
	// priority array; defines order to show results: airportcode, airportname, city, state, country
	var priority = [4, 3, 0, 1, 2, 5];
	var regExp = new RegExp("(.*)(" + sQuery + ")(.*)", "i");
	
	for (var i = 0; i < airportToData.length; i++) {
		for (var j = 0; j < airportToData[i].length; j++) {
			if (regExp.test(airportToData[i][priority[j]])) {
				aResults.push(airportToData[i]);
				aResults[aResults.length - 1][7] = j;
				break;
			}
		}
	}
	
	aResults.sort(acSortFunc);
	return (sortSecLevelAlphabetic(aResults));
}
function sortSecLevelAlphabetic (results) {
	var arSorted = new Array();
	var arSub = new Array();
	if (results[0])	var group = results[0][7];

	for (var i = 0; i < results.length; i++) {
		if (results[i][7] == group) {
			arSub[arSub.length] = results[i]
		} else {
			arSub.sort(initialSortFunc);
			arSorted = arSorted.concat(arSub);
			arSub = new Array();
			arSub[arSub.length] = results[i]
			group = results[i][7];
		}
	}
	arSub.sort(initialSortFunc);
	arSorted = arSorted.concat(arSub);
	
	return arSorted;
}
function acSortFunc (a, b) {
	if (parseInt(a[7], 10) >= parseInt(b[7], 10)) return 1;
	if (parseInt(a[7], 10) < parseInt(b[7], 10)) return -1;
	return 0;
}
function initialSortFunc (a, b) {
	if (a[0] >= b[0]) return 1;
	return -1;
}
/*
* 2010-01-18 : Migration Version 1
*/

var type = '';
var days = ['[trans:Mo]', '[trans:Tu]', '[trans:We]', '[trans:Th]', '[trans:Fr]', '[trans:Sa]', '[trans:Su]'];

function showCalendar(depret, txt) {
	top.type = depret;
	var container = document.getElementById('calendarcontainer');
	var header = document.getElementById('calendartop');
	header.innerHTML = txt; 
	if (document.all) {
		var entries = document.getElementsByTagName('select');
		for (var i = 0; i < entries.length; i++) {
			if (entries[i].className == 'cal_hide') {
				entries[i].style.display = 'none';
			}
		}
	}
	var today = new Date();
	var index = document.getElementById(depret + '_month').options.selectedIndex;
	document.getElementById('calendarmonth').options.selectedIndex = index;
	updateMonth(today.getFullYear() + "" + (today.getMonth()+1+index), index);
	container.style.display = 'block';
                document.getElementById('calendarmonth').focus();
}

function showCalendar_other(depret, txt) {
	top.type = depret;
	var container = document.getElementById('calendarcontainer_other');
	var header = document.getElementById('calendartop_other');
	header.innerHTML = txt;
	if (document.all) {
		var entries = document.getElementsByTagName('select');
		for (var i = 0; i < entries.length; i++) {
			if (entries[i].className == 'cal_hide') {
				entries[i].style.display = 'none';
			}
		}
	}
	var today = new Date();
	var index = document.getElementById(depret + '_month_other').options.selectedIndex;
	document.getElementById('calendarmonth_other').options.selectedIndex = index;
	updateMonth_other(today.getFullYear() + "" + (today.getMonth()+1+index), index);
	container.style.display = 'block';
  document.getElementById('calendarmonth_other').focus();
}

function fill(type, day, month) {
	closeCalendar();
	document.getElementById(type + '_day').options.selectedIndex = day;
	document.getElementById(type + '_month').options.selectedIndex = month;
	syncDate(document.getElementById(type + '_month'));
	if (type=='dep'){document.getElementById('ret_day').focus();}
	if (type=='ret') {document.getElementById('on').focus();}
}

function fillother(type, day, month) {
	closeCalendar_other();
	document.getElementById(type + '_day_other').options.selectedIndex = day;
	document.getElementById(type + '_month_other').options.selectedIndex = month;
	syncDate_other(document.getElementById(type + '_month_other'));
	if (type=='dep'){document.getElementById('ret_day_other').focus();}
	if (type=='ret') {document.getElementById('default').focus();}	
}

function closeCalendar () {
	var container = document.getElementById('calendarcontainer');
	if (document.all) {
		var entries = document.getElementsByTagName('select');
		for (var i = 0; i < entries.length; i++) {
			if (entries[i].className == 'cal_hide') {
				entries[i].style.display = 'block';
			}
		}
	}
	container.style.display = 'none';
}

function closeCalendar_other () {
	var container = document.getElementById('calendarcontainer_other');
		
	if (document.all) {
		var entries = document.getElementsByTagName('select');
		for (var i = 0; i < entries.length; i++) {
			if (entries[i].className == 'cal_hide') {
				entries[i].style.display = 'block';
			}
		}
	}
	container.style.display = 'none';
}

function updateMonth(monthyear, selection) {
	var month = monthyear.substr(4,2);
	var year = monthyear.substr(0,4);
	var noOfDays = getNumberOfDays(month, year);
	var firstDay = getFirstDay(month, year);
	fillMonth(month, firstDay, noOfDays, selection);
}

function updateMonth_other(monthyear, selection) {
	var month = monthyear.substr(4,2);
	var year = monthyear.substr(0,4);
	var noOfDays = getNumberOfDays(month, year);
	var firstDay = getFirstDay(month, year);
	fillMonth_other(month, firstDay, noOfDays, selection);
}
function getNumberOfDays(m, y) {
	var days = 31;
	switch (parseInt(m, 10)) {
		case 4: case 6: case 9: case 11:
			days = 30;
			break;
		case 2:
		  if ((y % 4 == 0) ^ (y % 100 == 0) ^ (y % 400 == 0))
			days = 29;
		  else
			days = 28;
		  break;
	}
	return days;
}
function getFirstDay(m, y) {
	d = new Date(y, m-1, 1);
	d.setHours(12);
	return (d.getDay() - 1 >= 0 ? d.getDay() - 1 : d.getDay() + 6);
}
function fillMonth(month, firstDay, noOfDays, monthIndex) {
	var firstSet = false;
	var dayCounter = 1;
	var today = new Date();
	dateToday = today.getDate();
	monthToday = today.getMonth() + 1;
	var sHTML = '<table cellspacing="0"><tr class="head">'
	for (var i = 0; i < days.length; i ++) {
		sHTML += '<td>' + days[i] + '</td>\n';
	}
	sHTML += '</tr>';
	while (dayCounter <= noOfDays) {
		sHTML += '<tr>';
		for (i = 0; i < 7; i++) {
			if (!firstSet && i < firstDay) {
				sHTML += '<td>&nbsp;</td>\n';
			} else {
				firstSet = true;
				if (dayCounter <= noOfDays) {
					if ((monthToday == month) && (dayCounter < dateToday)) {
						sHTML += '<td>' + dayCounter + '</td>\n';
					} else {
						sHTML += '<td><a href="javascript:fill(top.type, ' + (dayCounter - 1) + ' , ' + monthIndex + ');">' + dayCounter + '</a></td>\n';
					}

				} else {
					sHTML += '<td>&nbsp;</td>\n';
				}
				dayCounter++;
			}
		}
		sHTML += '</tr>'
	}
	sHTML += '</table>';
	document.getElementById('monthtable').innerHTML = sHTML;
}

function fillMonth_other(month, firstDay, noOfDays, monthIndex) {
	var firstSet = false;
	var dayCounter = 1;
	var today = new Date();
	dateToday = today.getDate();
	monthToday = today.getMonth() + 1;
	var sHTML = '<table cellspacing="0"><tr class="head">'
	for (var i = 0; i < days.length; i ++) {
		sHTML += '<td>' + days[i] + '</td>\n';
	}
	sHTML += '</tr>';
	while (dayCounter <= noOfDays) {
		sHTML += '<tr>';
		for (i = 0; i < 7; i++) {
			if (!firstSet && i < firstDay) {
				sHTML += '<td>&nbsp;</td>\n';
			} else {
				firstSet = true;
				if (dayCounter <= noOfDays) {
					if ((monthToday == month) && (dayCounter < dateToday)) {
						sHTML += '<td>' + dayCounter + '</td>\n';
					} else {
						sHTML += '<td><a href="javascript:fillother(top.type, ' + (dayCounter - 1) + ' , ' + monthIndex + ');" tabindex=301>' + dayCounter + '</a></td>\n';
					}

				} else {
					sHTML += '<td>&nbsp;</td>\n';
				}
				dayCounter++;
			}
		}
		sHTML += '</tr>'
	}
	sHTML += '</table>';
	document.getElementById('monthtable_other').innerHTML = sHTML;
}

function RecalcCalendar(id,days) { //,matchdates) {
	this.calendar = document.getElementById(id);
	this.days = days||new Array("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday");
	/*this.minMatch = false;
	this.maxMatch = false;
	if (matchdates!=null) {
		if (matchdates.minMatch!=null) {
			this.minMatch = true;
			this.matchCalendar = document.getElementById(matchdates.minMatch);
		} else if(matchdates.maxMatch!=null) {
			this.maxMatch = true;
			this.matchCalendar = document.getElementById(matchdates.maxMatch);
		}
	}*/
	var self = this;
	addEventHandler(this.calendar, "click", function(e) {
		return self.clickHandler(e);
	});
}

RecalcCalendar.prototype = {
	aRE:/a/i,
	relRE:/date/i,
	divRE:/div/i,
	dateRE:/\b[0-9]{1,2}\b/,
	dayRE:/^[^ ]*/,
	clickHandler:function(e) {
		var e = e||event;
		var target = e.target||e.srcElement;
		var eventResult = true;

		while (target.nodeType>1)target = target.parentNode; //Safari targets textnodes.

		if (this.aRE.test(target.nodeName) && this.relRE.test(target.getAttribute("rel"))) {//It's a date link
			//de-select current date
			var selSpans = getElementsByClassName(this.calendar, "span", "sel");
			removeClass(selSpans[0], "sel");

			//select current date
			var span = target.parentNode;
			addClass(span, "sel");

			//change date-string
			var div = target;
			while (div.parentNode && !this.divRE.test(div.nodeName)) div = div.parentNode;
			if (this.divRE.test(div.nodeName)) {
				var strong = div.getElementsByTagName("strong").item(0);
				var sDate = strong.firstChild.nodeValue;
				sDate = sDate.replace(this.dateRE, target.firstChild.nodeValue);

				//count how many-eth day this is
				var td = target.parentNode.parentNode;
				var day = this.days[td.cellIndex];
				sDate = sDate.replace(this.dayRE, day);
				strong.replaceChild(document.createTextNode(sDate),strong.firstChild);
			} else alert("Could not find a div");

			//set variable on button-action
			var button = document.getElementById("recalcon"), buttonlink = button.getElementsByTagName("a").item(0), buttonhref = buttonlink.getAttribute("href"), href="";
			var re = new RegExp("([\\?&]" + this.calendar.id + "=)[^&]*");
			if (re.test(buttonhref)) {
				href = buttonhref.replace(re, "$1" + target.firstChild.nodeValue);
			} else {
				href = buttonhref + (buttonhref.indexOf("?")>0?"&":"?") + this.calendar.id + "=" + target.firstChild.nodeValue;
			}
			buttonlink.setAttribute("href",href);

			//enable recalcButton
			addClass(button, "enable");
			//cancel original event
			eventResult = cancelEvent(e);
		}
		return eventResult;
	}
}
/*
* 2010-01-18 : Migration Version 1
*/

//--------------------------------------------------------------------------------------------
// DBFlightSearch component
//--------------------------------------------------------------------------------------------
function DBFlightSearch (container, inputSearchCriteriaJSON, ebtPage, cabinClassURL, cityCode, closeText) {
	this.ebtPage = ebtPage;
	this.cabinClassURL = cabinClassURL;
	this.container = YAHOO.util.Dom.get(container);
	this.destFinder = new FindDestinationBox(this);
	this.closeText = closeText;
	this.getInputSearchCriteria(inputSearchCriteriaJSON);
	this.cityCode = cityCode;
}
DBFlightSearch.prototype.updateFlightSearch = function (inputSearchCriteriaJSON, cabinClassURL) {
	this.getInputSearchCriteriaUpdateOnly(inputSearchCriteriaJSON);
	this.cabinClassURL = cabinClassURL;
}

DBFlightSearch.prototype.getInputSearchCriteria = function (JSONData) {
	var callback = {
		success: this.parseInputSearchCriteria,
		failure: this.handleFailure,
		scope: this
	};
	YAHOO.util.Connect.asyncRequest('GET', JSONData, callback, null);
}
DBFlightSearch.prototype.getInputSearchCriteriaUpdateOnly = function (JSONData) {
	var callback = { 
		success: this.parseInputSearchCriteriaUpdateOnly, 
		failure: this.handleFailure,
		scope: this
	};
	YAHOO.util.Connect.asyncRequest('GET', JSONData, callback, null);
}

DBFlightSearch.prototype.parseInputSearchCriteria = function (o) {
	if (o.responseText == '')
	alert('A backend error occurred. Contact the system administrator.');
	else
	{
		this.inputSearchCriteria = eval('(' + o.responseText + ')');
		this.init();
		if (this.cityCode!=undefined)
		this.initCity();
		this.destFinder.parseData();
	}
}
DBFlightSearch.prototype.parseInputSearchCriteriaUpdateOnly = function (o) {
	if (o.responseText == '')
		alert('A backend error occurred. Contact the system administrator.');
	else
	{
		this.inputSearchCriteria = eval('(' + o.responseText + ')');
		this.initUpdate();
		if (this.cityCode!=undefined)
			this.initCity();
	}
}

DBFlightSearch.prototype.handleFailure = function (o) {
}

DBFlightSearch.prototype.initCity = function () {
	if (YAHOO.util.Dom.get('ebt-destination-place'))
	{

		var airports = this.inputSearchCriteria.allowedDestinations;

		for (var i = 0; i < airports.length; i++) {
			if (airports[i].code==this.cityCode)
			{
				YAHOO.util.Dom.get('ebt-destination-place').value = airports[i].content;
				YAHOO.util.Dom.get('ebt-airportcode').value = airports[i].code;
				YAHOO.util.Dom.get('ebt-outbound-destination-location-type').value = "city";
				//YAHOO.util.Dom.get('ebt-destination-container').value =
			}
		}
	}
}


DBFlightSearch.prototype.init = function () {
	this.initShoppingCartLink();
	this.waitingPageActive = false;
	this.ebtRoundTrip = YAHOO.util.Dom.get('ebt-round-trip');
	this.ebtFBEngineId = YAHOO.util.Dom.get('ebt-fb-engine-id');
	this.ebtFBSessionId = YAHOO.util.Dom.get('ebt-fb-session-id');
	if ( typeof fb_customer != "undefined" ) {
		if(fb_customer && this.ebtFBEngineId && this.ebtFBSessionId){
			this.ebtFBEngineId.value = fb_customer.EngineID;
			this.ebtFBSessionId.value = fb_customer.SessionID;
		}
	}
	YAHOO.util.Event.addListener(this.ebtRoundTrip, 'click', this.showReturnDates, this, true);
	this.ebtOneWay = YAHOO.util.Dom.get('ebt-one-way');
	YAHOO.util.Event.addListener(this.ebtOneWay, 'click', this.hideReturnDates, this, true);
	this.submitButton = YAHOO.util.Dom.get('ebt-flightsearch-submit');
	YAHOO.util.Event.addListener(this.submitButton, 'click', this.doSubmitData, this, true);
	this.openJawButton = YAHOO.util.Dom.get('ebt-open-jaw-opt-link');
	YAHOO.util.Event.addListener(this.openJawButton, 'click', this.doSubmitData2, this, true);
	this.initDefaultSearch(this.inputSearchCriteria.defaultSearchByPeriod);
	this.initAdults(this.inputSearchCriteria.minimumNumberOfAdults, this.inputSearchCriteria.maximumSeats);
	this.initBestPriceGuarantee(this.inputSearchCriteria.bestPriceGuarantee);
	this.initCabinClass(this.inputSearchCriteria.brandedCabinClasses);
	this.getInitialCabinClasses();
	this.initOrigins(this.inputSearchCriteria.allowedOrigins, this.inputSearchCriteria.defaultOrigin);
	this.flightDater = new FlightDater(this, this.inputSearchCriteria.dateFormat, 	this.inputSearchCriteria.defaultDaysDeparture, this.inputSearchCriteria.defaultDaysAfterDeparture, 	this.inputSearchCriteria.maximumAdvancePurchase, this.inputSearchCriteria.months, 	this.inputSearchCriteria.shortWeekDays, this.closeText);
	this.childrensBox = new ChildrensBox(this, this.inputSearchCriteria.shortMonths);
	// subscribe childrensBox to listen to dateChange event to update children's types
	this.flightDater.depDateChange.subscribe(this.childrensBox.updateChildrensData, this.childrensBox);

	if (YAHOO.util.Dom.get('ebt-destination-place') && YAHOO.util.Dom.get('ebt-destination-container'))
	this.autoCompleteTo = new EBTAutocomplete('ebt-destination-place', this.inputSearchCriteria.allowedDestinations, 'ebt-airportcode');
	// recent searches popup
	if (YAHOO.util.Dom.get('ebt-recent-search-link')) {
		this.recentSearches = new RecentSearch(this);
	}
	// tooltips for Hotels and Cars, Best-price and Local Shop

	/*v1.0*/
	/*if (YAHOO.util.Dom.get('ebt-local-shop-box')) {
	this.tooltipLocalshop = new ToolTip('ebt-local-shop-box');
	this.tooltipLocalshoplLink = YAHOO.util.Dom.get('ebt-local-shop');
	YAHOO.util.Event.addListener(this.tooltipLocalshoplLink, 'mouseover', this.tooltipLocalshop.show, this.tooltipLocalshop, true);
	YAHOO.util.Event.addListener(this.tooltipLocalshoplLink, 'mouseout', this.tooltipLocalshop.hide, this.tooltipLocalshop, true);
	}*/
	if (YAHOO.util.Dom.get('ebt-hotel-box')) {
		this.tooltipHotel = new ToolTip('ebt-hotel-box');
		this.tooltipHotelLink = YAHOO.util.Dom.get('ebt-hotel-link');
		YAHOO.util.Event.addListener(this.tooltipHotelLink, 'mouseover', this.showCompleteYourTrip, this.tooltipHotel);
		YAHOO.util.Event.addListener(this.tooltipHotelLink, 'mouseout', this.tooltipHotel.hide, this.tooltipHotel, true);
	}
	if (YAHOO.util.Dom.getElementsByClassName('shopping-cart') && YAHOO.util.Dom.getElementsByClassName('shopping-cart')[0]) {
		YAHOO.util.Dom.getElementsByClassName('shopping-cart')[0].onclick = function () {
			if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "ShoppingCartLink", "z_ebt_eventplace" : "homepage", "z_ebt_event" : "1"});
		}
	}
	/*v1.0*/
	/*if (YAHOO.util.Dom.get('ebt-best-price-box')) {
	this.tooltipBestPrice = new ToolTip('ebt-best-price-box');
	this.tooltipBestPriceLink = YAHOO.util.Dom.get('ebt-best-price-link');
	YAHOO.util.Event.addListener(this.tooltipBestPriceLink, 'mouseover', this.tooltipBestPrice.show, this.tooltipBestPrice, true);
	YAHOO.util.Event.addListener(this.tooltipBestPriceLink, 'mouseout', this.tooltipBestPrice.hide, this.tooltipBestPrice, true);
	}*/
	
/*	if (YAHOO.util.Dom.get('ebt-multiple-city-box')) {
		this.tooltipMultiCity = new ToolTip('ebt-multiple-city-box');
		this.tooltipMultiCityLink = YAHOO.util.Dom.get('ebt-multiple-city-link');
		YAHOO.util.Event.addListener(this.tooltipMultiCityLink, 'mouseover', this.tooltipMultiCity.show, this.tooltipMultiCity, true);
		YAHOO.util.Event.addListener(this.tooltipMultiCityLink, 'mouseout', this.tooltipMultiCity.hide, this.tooltipMultiCity, true);
	}
*/
	
}
DBFlightSearch.prototype.initUpdate = function () {
	this.waitingPageActive = false;
	this.initBestPriceGuarantee(this.inputSearchCriteria.bestPriceGuarantee);
	this.initCabinClass(this.inputSearchCriteria.brandedCabinClasses);
	this.initOrigins(this.inputSearchCriteria.allowedOrigins, this.inputSearchCriteria.defaultOrigin);
	this.initDefaultSearch(this.inputSearchCriteria.defaultSearchByPeriod);
	this.flightDater.update(this, this.inputSearchCriteria.dateFormat, this.inputSearchCriteria.defaultDaysDeparture, this.inputSearchCriteria.defaultDaysAfterDeparture, this.inputSearchCriteria.maximumAdvancePurchase, this.inputSearchCriteria.months, this.inputSearchCriteria.shortWeekDays, this.closeText);
}
DBFlightSearch.prototype.initAdults = function (minNum, maxNum) {
	var adultBox = YAHOO.util.Dom.get('ebt-number-adults');
	var option;
	if (adultBox) {
		for (var i = minNum; i <= maxNum; i++) {
			option = new HTMLNode(document, 'option', {value:i.toString()}, i.toString());
			adultBox.appendChild(option);
		}
	}
}
DBFlightSearch.prototype.initBestPriceGuarantee = function (show) {
	if (show) {
		var oBP = YAHOO.util.Dom.getElementsByClassName('best-price');
		if ( oBP.length > 0 ) {
			YAHOO.util.Dom.getElementsByClassName('best-price')[0].style.display = 'block';
		}
	}
}
DBFlightSearch.prototype.initCabinClass = function (ccData) {
	this.cabinClassBox = YAHOO.util.Dom.get('ebt-cabin-class');
	this.cabinClassBox.options.length = 0; // CB 20091117 Added line to remove previous cabin classes because of a second call
	var option;
	for (var i = 0; i < ccData.length; i++) {
		option = new HTMLNode(document, 'option', {value:ccData[i].brandedCabinClassCode}, ccData[i].name);
		this.cabinClassBox.appendChild(option);
	}
	YAHOO.util.Event.addListener(YAHOO.util.Dom.get('ebt-departure-place'), 'blur', this.getCabinClasses, this, true);
	YAHOO.util.Event.addListener(YAHOO.util.Dom.get('ebt-destination-place'), 'blur', this.getCabinClasses, this, true);
	YAHOO.util.Event.addListener(YAHOO.util.Dom.get('ebt-destination-place-oj'), 'blur', this.getCabinClasses, this, true);
}
DBFlightSearch.prototype.initDefaultSearch = function (defaultPeriod) {
	if (defaultPeriod) {
		YAHOO.util.Dom.get('ebt-flexible-dates').checked = 'checked';
	} else {
		YAHOO.util.Dom.get('ebt-fixed-dates').checked = 'checked';
	}
}
DBFlightSearch.prototype.initOrigins = function (origins, defaultOrigin) {
	this.originBox = YAHOO.util.Dom.get('ebt-departure-place');
	while (this.originBox.childNodes[0])
	{
		this.originBox.removeChild(this.originBox.childNodes[0]);
	}
	var option;
	YAHOO.util.Dom.addClass(this.originBox, "waiting");
    this.originBox.disabled="disabled";

	for (var i = 0; i < origins.length; i++) {
		option = new HTMLNode(document, 'option', {value:origins[i].code}, origins[i].content);
		if (origins[i].code == defaultOrigin) option.selected = 'selected';
		this.originBox.appendChild(option);
	}
	this.originBox.disabled="";
    YAHOO.util.Dom.removeClass(this.originBox, "waiting");

}
DBFlightSearch.prototype.showCompleteYourTrip = function (e, args) {
	if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "complete_your_trip", "z_ebt_eventplace" : "homepage", "z_ebt_event" : "1"});
	args.show();
}
DBFlightSearch.prototype.doSubmitData2 = function (e) {
	YAHOO.util.Dom.get('goToPage').value = "home_openjaw";
	this.doSubmitDataRoot(e);
}
DBFlightSearch.prototype.doSubmitData = function (e) {
	YAHOO.util.Dom.get('goToPage').value = "";
	this.doSubmitDataRoot(e);
}
DBFlightSearch.prototype.doSubmitDataRoot = function (e) {
	this.setCabinClassParameter();
	YAHOO.util.Event.preventDefault(e);
	try {top.document.documentElement.scrollTop = 0} catch (e) {};
	document.body.className = 'waiting';
	this.waitingPageActive = true;
	if ((YAHOO.util.Dom.hasClass(YAHOO.util.Dom.get('ebt-from-place'), 'error') || YAHOO.util.Dom.hasClass(YAHOO.util.Dom.get('ebt-destination-place'), 'error') || YAHOO.util.Dom.hasClass(YAHOO.util.Dom.get('ebt-from-place-oj'), 'error') || YAHOO.util.Dom.hasClass(YAHOO.util.Dom.get('ebt-destination-place-oj'), 'error'))) {
		if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "autocomplete_no_selection_from_list", "z_ebt_eventplace" : "homepage", "z_ebt_event" : "1"});
	}
	if (this.recentSearches && YAHOO.util.Dom.getElementsByClassName('error').length < 1) this.recentSearches.add();
	this.formatDataBeforeSubmit();
	document.forms['ebt-flight-searchform'].action = this.submitButton.href;
	YAHOO.util.Event.preventDefault(e); //Prevents from button href to get fired.
	document.forms['ebt-flight-searchform'].submit();
}
DBFlightSearch.prototype.setCabinClassParameter = function () {
	var cabinClass = YAHOO.util.Dom.get('ebt-cabin-class');
	var ccIndex = cabinClass.selectedIndex;
	var ccValue = cabinClass.options[cabinClass.selectedIndex].value;
	var cffccValue = "ECONOMY";
	if (ccValue.indexOf( "BUS") > -1)
	{
		cffccValue = "BUSINESS";
	}
	YAHOO.util.Dom.get('cffcc').value = cffccValue;
}
DBFlightSearch.prototype.showErrors = function (e) {
	var errorContainer = YAHOO.util.Dom.get('ebt-home-error-messages');
	var errorDisplayContainer = YAHOO.util.Dom.get('error-message-home-container');
	if (errorContainer && errorDisplayContainer && errorContainer.innerHTML != '') {
		errorDisplayContainer.innerHTML = errorContainer.innerHTML;
		errorDisplayContainer.id = 'error-message-home-container-show';
	}
}
DBFlightSearch.prototype.toggle = function (e) {
	YAHOO.util.Event.preventDefault(e);
	this.toggleLink.blur();
	if (this.opened) {
		this.extendedData.style.display = 'none';
		this.opened = false;
		YAHOO.util.Dom.removeClass(this.toggleLink, 'modify-is-open');
		if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "change_search", "z_ebt_event" : "1", "z_ebt_eventvalue" : "open"});
	} else {
		this.extendedData.style.display = 'block';
		this.opened = true;
		YAHOO.util.Dom.addClass(this.toggleLink, 'modify-is-open');
		if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "change_search", "z_ebt_event" : "1", "z_ebt_eventvalue" : "close"});
	}
}
DBFlightSearch.prototype.hideReturnDates = function () {
	YAHOO.util.Dom.get('ebt-return-label').disabled = 'disabled';
	YAHOO.util.Dom.get('ebt-return-date').style.backgroundColor = '#FFFFFF';
	YAHOO.util.Dom.get('ebt-return-date-icon').disabled = true;
	//YAHOO.util.Dom.get('ebt-destination-place').style.color = '#DBDBDB';
	//YAHOO.util.Dom.getPreviousSibling(YAHOO.util.Dom.get('ebt-destination-place')).style.color = "#DBDBDB";
	
	YAHOO.util.Dom.get('ebt-return-date').style.color = '#DBDBDB';
	YAHOO.util.Dom.get('ebt-fixed-dates').click();
	YAHOO.util.Dom.get('ebt-flexible-dates-label').disabled = 'disabled';
	YAHOO.util.Dom.get('ebt-flexible-dates-label').style.color = '#DBDBDB';
	YAHOO.util.Dom.get('ebt-flexible-dates').disabled = 'disabled';
	YAHOO.util.Event.removeListener(this.openJawButton, 'click');
	YAHOO.util.Dom.get('ebt-open-jaw-opt-link').disabled = 'disabled';
	YAHOO.util.Dom.replaceClass('ebt-open-jaw-opt-link', '', 'disabled-link'); 
	YAHOO.util.Dom.get('single-forward-arrow').className = 'single-forward-arrow-grey';
	YAHOO.util.Dom.get('ebt-return-label').style.color = '#DBDBDB';
	if (YAHOO.util.Dom.get('ebt-open-jaw-opt')) YAHOO.util.Dom.get('ebt-open-jaw-opt').disabled = 'disabled';
	YAHOO.util.Dom.get('ebt-return-date-icon').style.cursor = "default";
	var img = YAHOO.util.Dom.get('ebt-return-date-icon').getElementsByTagName('img')[0];
	img.src="/travel/generic/images/icon-calendar-inactive_tcm169-187455.gif";

	//prevent calender use
	YAHOO.util.Dom.get('ebt-return-date').style.display = 'none';
	this.fakeRetDate = YAHOO.util.Dom.getElementsByClassName('fake-ebt-return-date');
	YAHOO.util.Dom.setStyle(this.fakeRetDate, 'display','inline');
	YAHOO.util.Dom.setStyle(this.fakeRetDate, 'width','91px');
	YAHOO.util.Dom.setStyle(this.fakeRetDate, 'color', '#DBDBDB');
	YAHOO.util.Event.removeListener(this.fakeRetDate, 'click');
	this.retDateIcon = YAHOO.util.Dom.get('ebt-return-date-icon');
	YAHOO.util.Event.removeListener(this.retDateIcon, "click");	
}

DBFlightSearch.prototype.showReturnDates = function () {
	YAHOO.util.Dom.get('ebt-return-label').disabled = '';
	YAHOO.util.Dom.get('ebt-return-date').style.color = '#003145';
	YAHOO.util.Dom.get('ebt-return-date-icon').disabled = false;
	YAHOO.util.Dom.get('ebt-destination-place').disabled = '';
	YAHOO.util.Dom.getPreviousSibling(YAHOO.util.Dom.get('ebt-destination-place')).style.color = "";
	YAHOO.util.Dom.get('ebt-flexible-dates-label').disabled = '';
	YAHOO.util.Dom.get('ebt-flexible-dates').disabled = '';
	YAHOO.util.Dom.get('ebt-flexible-dates-label').style.color = '#003145';
	YAHOO.util.Dom.get('ebt-open-jaw-opt-link').disabled = '';
	YAHOO.util.Event.addListener(this.openJawButton, 'click', this.doSubmitData2, this, true);
	YAHOO.util.Dom.removeClass('ebt-open-jaw-opt-link', 'disabled-link');
	YAHOO.util.Dom.get('single-forward-arrow').className = 'single-forward-arrow';
	YAHOO.util.Dom.get('ebt-return-label').style.color = '';
	if (YAHOO.util.Dom.get('ebt-open-jaw-opt')) YAHOO.util.Dom.get('ebt-open-jaw-opt').disabled = '';
	YAHOO.util.Dom.get('ebt-return-date-icon').style.cursor = "pointer";
	var img = YAHOO.util.Dom.get('ebt-return-date-icon').getElementsByTagName('img')[0];
	img.src="/travel/generic/images/icon-calendar-active_tcm169-187339.gif";
	
	//use calendar
	this.retDate = YAHOO.util.Dom.get('ebt-return-date');
	YAHOO.util.Dom.setStyle(this.retDate, 'display','inline');
	this.fakeRetDate = YAHOO.util.Dom.getElementsByClassName('fake-ebt-return-date');
	YAHOO.util.Dom.setStyle(this.fakeRetDate, 'display','none');
	
	this.flightDater = new FlightDater(this, this.inputSearchCriteria.dateFormat, 	this.inputSearchCriteria.defaultDaysDeparture, this.inputSearchCriteria.defaultDaysAfterDeparture, 	this.inputSearchCriteria.maximumAdvancePurchase, this.inputSearchCriteria.months, 	this.inputSearchCriteria.shortWeekDays, this.closeText);
}

DBFlightSearch.prototype.getInitialCabinClasses = function () {
	var callback = {
		success: this.parseCabinClasses,
		scope: this
	};

	var url = this.cabinClassURL
	YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
}
DBFlightSearch.prototype.getCabinClasses = function (e) {
	var callback = {
		success: this.parseCabinClasses,
		scope: this
	};
	var orgBox = YAHOO.util.Dom.get('ebt-departure-place');
	if (orgBox) var org = orgBox.options[orgBox.selectedIndex].value;
	var dest = YAHOO.util.Dom.get('ebt-airportcode').value;

	var url = this.cabinClassURL + '&origin=' + org + '&destination=' + dest;
	YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
}
DBFlightSearch.prototype.parseCabinClasses = function (o) {
	if (this.waitingPageActive) return;
	var currentSelected = this.cabinClassBox.selectedIndex;
	var ccOptions = (eval('(' + o.responseText + ')'));
	var newOption;
	while (this.cabinClassBox.childNodes[0]) this.cabinClassBox.removeChild(this.cabinClassBox.childNodes[0]);
	for (var i =0; i < ccOptions.options.length; i+=2) {
		newOption = new HTMLNode(document, 'option', {}, ccOptions.options[i]);
		newOption.value = ccOptions.options[i+1];
		this.cabinClassBox.appendChild(newOption);
	}
	if (currentSelected == 2 && this.cabinClassBox.options.length == 2) currentSelected = 1;
	try {this.cabinClassBox.selectedIndex = currentSelected} catch (e) {}

}
DBFlightSearch.prototype.initShoppingCartLink	= function () {	
	var scLink = YAHOO.util.Dom.get('ebt-shoppingcart-link');
	var cookie = getCookie(this.ebtPage.pos + "_ShoppingCartCookie");
	var today = new Date();

	if (scLink && cookie) {
		var date, y, m, d;
		var scItems = eval(cookie.split('+')[1]);
		var total = scItems.length;

		for (var i = 0; i < scItems.length; i++) {
			y = scItems[i].split('-')[0];
			m = scItems[i].split('-')[1];
			d = scItems[i].split('-')[2];
			date = new Date(parseInt(y, 10), parseInt((m - 1), 10), parseInt((d), 10) + 1);
			if (today.getTime() > date.getTime()) {
				total--;
			}
		}
		if (total=='undefined') total=0;
		scLink.innerHTML = total;

		if (total > 0) {
			YAHOO.util.Dom.addClass(scLink.parentNode.parentNode, 'show');
			YAHOO.util.Event.addListener(scLink, "click", function () {document.body.className = 'waiting'}); 
		}
		return;
	}
}
DBFlightSearch.prototype.formatDataBeforeSubmit = function () {
	var depDate = YAHOO.util.Dom.get('ebt-departure-date').value.split('/');
	if (depDate[this.flightDater.yPos].length == 2) {
		depDate[this.flightDater.yPos] = '20' + depDate[this.flightDater.yPos];
	}
	if (depDate[this.flightDater.mPos].length == 1) {
		depDate[this.flightDater.mPos] = '0' + depDate[this.flightDater.mPos];
	}
	if (depDate[this.flightDater.dPos].length == 1) {
		depDate[this.flightDater.dPos] = '0' + depDate[this.flightDater.dPos];
	}
	YAHOO.util.Dom.get('ebt-departure-date').value = depDate[this.flightDater.yPos] + '-' + depDate[this.flightDater.mPos] + '-' + depDate[this.flightDater.dPos];

	var retDate = YAHOO.util.Dom.get('ebt-return-date').value.split('/');
	if (retDate[this.flightDater.yPos].length == 2) {
		retDate[this.flightDater.yPos] = '20' + retDate[this.flightDater.yPos];
	}
	if (retDate[this.flightDater.mPos].length == 1) {
		retDate[this.flightDater.mPos] = '0' + retDate[this.flightDater.mPos];
	}
	if (retDate[this.flightDater.dPos].length == 1) {
		retDate[this.flightDater.dPos] = '0' + retDate[this.flightDater.dPos];
	}

	YAHOO.util.Dom.get('ebt-return-date').value = retDate[this.flightDater.yPos] + '-' + retDate[this.flightDater.mPos] + '-' + retDate[this.flightDater.dPos];

	if (YAHOO.util.Dom.get('ebt-one-way').checked)
	{
		YAHOO.util.Dom.get('ebt-return-date').value = "";
	}
	else 
	{
		YAHOO.util.Dom.get('ebt-return-date').value = retDate[this.flightDater.yPos] + '-' + retDate[this.flightDater.mPos] + '-' + retDate[this.flightDater.dPos];
	}

	YAHOO.util.Dom.get('ebt-inboundOrigin').value = YAHOO.util.Dom.get('ebt-airportcode').value;
	YAHOO.util.Dom.get('ebt-inboundOrigin-location-type').value = YAHOO.util.Dom.get('ebt-outbound-destination-location-type').value;
	YAHOO.util.Dom.get('ebt-inboundDestination').value = YAHOO.util.Dom.get('ebt-departure-place').options[YAHOO.util.Dom.get('ebt-departure-place').selectedIndex].value;
}
// --------------------------------------------------------------------------------------------
//
// FlightDater component
//
// --------------------------------------------------------------------------------------------
function FlightDater (bookingTool, dateFormat, depDate, retDate, maxDate, months, days, closeText) {
	this.bookingTool = bookingTool;
	this.initDateFormat(dateFormat);
	var today = new Date();
	this.depDate = this.formatDate(dateFormat, (today.getTime() + (depDate * 1000 * 60 * 60 * 24)));
	this.retDate = this.formatDate(dateFormat, (today.getTime() + ((depDate + retDate) * 1000 * 60 * 60 * 24)));
	this.minDate = this.formatDate('mm/dd/yyyy', today);
	this.maxDate = this.formatDate('mm/dd/yyyy', (today.getTime() + (maxDate * 1000 * 60 * 60 * 24)));

	// init departuredate
	this.depDateIcon = YAHOO.util.Dom.get('ebt-departure-date-icon');
	this.depCalendar = new EBTCalendar (null, YAHOO.util.Dom.get('ebt-departure-date'), dateFormat, this.depDate, this.minDate, this.maxDate, months, days, closeText);
	YAHOO.util.Event.addListener(this.depDateIcon, "click", this.depCalendar.show, [this.depCalendar, YAHOO.util.Dom.get('ebt-departure-date')], true);

	// init returndate
	this.retDateIcon = YAHOO.util.Dom.get('ebt-return-date-icon');
	this.retCalendar = new EBTCalendar(null, YAHOO.util.Dom.get('ebt-return-date'), dateFormat, this.retDate, this.minDate, this.maxDate, months, days, closeText);
	YAHOO.util.Event.addListener(this.retDateIcon, "click", this.retCalendar.show, [this.retCalendar, YAHOO.util.Dom.get('ebt-return-date')], true);
	this.depCalendar.cal.selectEvent.subscribe(this.selectdepDate, this, true);
	this.depDateChange = new YAHOO.util.CustomEvent("dateChange", this);
	this.selectdepDate();

}

FlightDater.prototype.update = function (bookingTool, dateFormat, depDate, retDate, maxDate, months, days, closeText) {
	this.initDateFormat(dateFormat);
	var today = new Date();
	this.depDate = this.formatDate(dateFormat, (today.getTime() + (depDate * 1000 * 60 * 60 * 24)));
	this.retDate = this.formatDate(dateFormat, (today.getTime() + ((depDate + retDate) * 1000 * 60 * 60 * 24)));
	this.minDate = this.formatDate('mm/dd/yyyy', today);
	this.maxDate = this.formatDate('mm/dd/yyyy', (today.getTime() + (maxDate * 1000 * 60 * 60 * 24)));
	
	// init departuredate
	this.depDateIcon = YAHOO.util.Dom.get('ebt-departure-date-icon');
	this.depCalendar = new EBTCalendar (null, YAHOO.util.Dom.get('ebt-departure-date'), dateFormat, this.depDate, this.minDate, this.maxDate, months, days, closeText);
	YAHOO.util.Event.addListener(this.depDateIcon, "click", this.depCalendar.show, [this.depCalendar, YAHOO.util.Dom.get('ebt-departure-date'), true], true); 
	
	// init returndate
	this.retDateIcon = YAHOO.util.Dom.get('ebt-return-date-icon');
	this.retCalendar = new EBTCalendar (null, YAHOO.util.Dom.get('ebt-return-date'), dateFormat, this.retDate, this.minDate, this.maxDate, months, days, closeText);
	YAHOO.util.Event.addListener(this.retDateIcon, "click", this.retCalendar.show, [this.retCalendar, YAHOO.util.Dom.get('ebt-return-date'), true], true); 
	this.depCalendar.cal.selectEvent.subscribe(this.selectdepDate, this, true);
	this.depDateChange = new YAHOO.util.CustomEvent("dateChange", this);
	this.selectdepDate();
}

FlightDater.prototype.formatDate = function (format, d) {
	var date = new Date(d);
	var dPos, mPos, yPos;
	var sDate = format.split('/');

	// determine format;
	sDate[0] == 'mm' ? mPos = 0 : (sDate[1] == 'mm' ? mPos = 1 : mPos = 2);
	sDate[0] == 'dd' ? dPos = 0 : (sDate[1] == 'dd' ? dPos = 1 : dPos = 2);
	sDate[0].indexOf('yy') != -1 ? yPos = 0 : (sDate[1].indexOf('yy') != -1 ? yPos = 1 : yPos = 2);

	// format new date in array
	var aFormattedDate = new Array();
	aFormattedDate[dPos] = date.getDate();
	aFormattedDate[mPos] = date.getMonth() + 1;
	aFormattedDate[yPos] = date.getFullYear();

	// make string from array
	var s = aFormattedDate[0] + '/' + aFormattedDate[1] + '/' + aFormattedDate[2];

	return s;
}
FlightDater.prototype.initDateFormat = function (format) {
	var sDate = format.split('/');

	// determine format;
	sDate[0] == 'mm' ? this.mPos = 0 : (sDate[1] == 'mm' ? this.mPos = 1 : this.mPos = 2);
	sDate[0] == 'dd' ? this.dPos = 0 : (sDate[1] == 'dd' ? this.dPos = 1 : this.dPos = 2);
	sDate[0].indexOf('yy') != -1 ? this.yPos = 0 : (sDate[1].indexOf('yy') != -1 ? this.yPos = 1 : this.yPos = 2);
}
FlightDater.prototype.selectdepDate = function (e) {
	// update Return calendar
	var selectedDepDate = this.depCalendar.getSelectedDates()[0];
	this.retCalendar.cal.cfg.setProperty("mindate", selectedDepDate);
	if ((selectedDepDate > this.retCalendar.getSelectedDates()[0])) {
		this.retCalendar.cal.select(selectedDepDate);
	}
	this.depDateChange.fire(selectedDepDate);
}
// --------------------------------------------------------------------------------------------
//
// ChildrensBox component
//
// --------------------------------------------------------------------------------------------
function ChildrensBox (bookingTool, months) {
	this.bookingTool = bookingTool;
	this.months = months;
	this.createChildrensBoxDOM();
	this.cbTooltipElement = new ToolTip('ebt-children-tooltip');
	this.cbTooltipLink = YAHOO.util.Dom.get('ebt-children-tooltiplink');
	this.cbTooltipLinkText = this.cbTooltipLink.innerHTML;
	this.childrenList = YAHOO.util.Dom.get('ebt-children-listed');
	this.childrenFormdata = YAHOO.util.Dom.get('ebt-children-formdata');
	this.cbCheckBox = YAHOO.util.Dom.get('ebt-with-children');
	this.cbInfantQty = YAHOO.util.Dom.get('infQty');
	this.cbChildQty = YAHOO.util.Dom.get('chdQty');

	// init language dependent texts for children's box
	this.infantText = YAHOO.util.Dom.get('ebt-cb-infant-text').innerHTML;
	this.childText = YAHOO.util.Dom.get('ebt-cb-child-text').innerHTML;
	this.youngadultText = YAHOO.util.Dom.get('ebt-cb-youngadult-text').innerHTML;
	this.adultText = YAHOO.util.Dom.get('ebt-cb-adult-text').innerHTML;
	this.removeText = YAHOO.util.Dom.get('ebt-cb-remove-text').innerHTML;
	this.errorText = YAHOO.util.Dom.get('ebt-cb-error-text').innerHTML;

	this.nrOfChildren = 0;
	this.maxChildren = 9;
	this.children = new Array();
	this.childrenAdmin = new Array();
	this.years = new Array();
	var today = new Date();
	var thisYear = today.getFullYear();
	var yearIndex = 0;
	for (var i = thisYear - 15; i <= thisYear; i++) {
		this.years[yearIndex] = i;
		yearIndex++;
	}
	var currentChildren = this.childrenFormdata.getElementsByTagName('input');
	if (currentChildren.length > 0) {
		this.init(currentChildren);
	} else {
		// add first child (by default);
		// this.clickAddChild();
	}

	// init click event to open popup
	YAHOO.util.Event.addListener(this.cbCheckBox, 'click', this.open, [this, this.cbCheckBox] , true);

	// init click event to close popup and cancel
	YAHOO.util.Event.addListener(this.cbCloseBut, 'click', this.cancelAndclose, this, true);

	// init button to add Child
	YAHOO.util.Event.addListener(this.addChildBut, 'click', this.clickAddChild, this, true);

	// init click event to save entered data
	YAHOO.util.Event.addListener(this.cbSubmitForm, 'click', this.saveAndClose, this, true);
}
ChildrensBox.prototype.createChildrensBoxDOM = function () {
	var targetDocument = this.bookingTool.ebtPage.targetDoc;
	this.cbPopupElement = new HTMLNode(targetDocument, 'div', {id:'ebt-children-box'}, '<h3>' + YAHOO.util.Dom.get('ebt-cb-title').innerHTML + '</h3>');

	this.cbCloseBut = new HTMLNode(targetDocument, 'a', {href:'javascript:;'}, 'Close', 'close-overlay');
	this.cbPopupElement.appendChild(this.cbCloseBut);

	// removed the h4 by Cor
	// var cbContent = new HTMLNode(targetDocument, 'div', {}, '<h4>' + YAHOO.util.Dom.get('ebt-cb-subtitle').innerHTML + '</h4>', 'childrens-content');
	var cbContent = new HTMLNode(targetDocument, 'div', {}, '', 'childrens-content');
	var helpLink = new HTMLNode(targetDocument, 'a', {id:'tt-help-children', href:'http://www.klm.com/travel/nl_en/travel_information/travel_planning/children/index.htm', target:'_blank'}, YAHOO.util.Dom.get('ebt-cb-helptext').innerHTML, 'help-overlay');
	//cbContent.appendChild(helpLink);

	var cbInnerContent = new HTMLNode(targetDocument, 'div', {}, '<p>' + YAHOO.util.Dom.get('ebt-cb-introtext').innerHTML + '</p>', 'inner-content');
	cbInnerContent.appendChild(helpLink);
	this.childrenContainer = new HTMLNode(targetDocument, 'div', {id:'ebt-child-form'}, null, 'form-container');
	cbInnerContent.appendChild(this.childrenContainer);

	this.maxChildrenError = new HTMLNode(targetDocument, 'div', {id:'ebt-maxchildren-error'}, '<p class="date-warning">' + YAHOO.util.Dom.get('ebt-cb-max-error').innerHTML + '</p>');
	cbInnerContent.appendChild(this.maxChildrenError);
	cbContent.appendChild(cbInnerContent);
	this.cbPopupElement.appendChild(cbContent);

	var footer = new HTMLNode(targetDocument, 'div', {}, null, 'footer');
	var span1 = new HTMLNode(targetDocument, 'span', {}, null, 'add-child');
	this.addChildBut = new HTMLNode(targetDocument, 'a', {id:'ebt-add-child', href:'javascript:;'}, YAHOO.util.Dom.get('ebt-cb-add-text').innerHTML);
	span1.appendChild(this.addChildBut);
	footer.appendChild(span1);

	this.cbSubmitForm = new HTMLNode(targetDocument, 'a', {id:'ebt-children-submit', href:'javascript:;'}, null, 'button');
	var span2 = new HTMLNode(targetDocument, 'span', {}, YAHOO.util.Dom.get('ebt-cb-save-text').innerHTML, 'save-button');
	this.cbSubmitForm.appendChild(span2);
	footer.appendChild(this.cbSubmitForm);

	this.cbPopupElement.appendChild(footer);
	targetDocument.body.appendChild(this.cbPopupElement);
}
ChildrensBox.prototype.open = function (e, args) {
	var base = args[0];
	var checkBox = args[1];

	if (checkBox.checked && base.childrenAdmin) {
		while(base.nrOfChildren > 0) base.children[base.nrOfChildren-1].remove();
		if (base.childrenAdmin.length == 0)
		base.clickAddChild();
		else {
			for (var i = 0; i < base.childrenAdmin.length; i++) {
				base.addChild(base.childrenAdmin[i]);
			}
		}
		base.maxChildrenError.style.display = 'none';
		if (base.bookingTool.ebtPage.lightBox) base.bookingTool.ebtPage.lightBox.show(null, base.cbPopupElement, base, "cancelAndclose");
		base.animateOpen();
	} else {
		while(base.nrOfChildren > 0) base.children[base.nrOfChildren-1].remove();
		base.childrenAdmin = [];
		base.returnFormElements();
		base.cbTooltipLink.innerHTML = base.cbTooltipLinkText;
		base.cbTooltipLink.className = '';
		base.cbCheckBox.checked = false;
		YAHOO.util.Event.removeListener(base.cbTooltipLink, 'mouseover', base.cbTooltipElement.show);
	}
}
ChildrensBox.prototype.animateOpen = function () {
	if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "children_box", "z_ebt_event" : "1", "z_ebt_eventvalue" : "open"});
	this.cbPopupElement.style.display = 'block';
	var attributes = {
		opacity: { to: 1 }
	}
	anim = new YAHOO.util.Motion(this.cbPopupElement, attributes,.5, YAHOO.util.Easing.easeOut);
	anim.animate();
}
ChildrensBox.prototype.cancelAndclose = function () {
	this.maxChildrenError.style.display = 'none';
	if (this.childrenAdmin.length == 0) {
		this.cbCheckBox.checked = false;
	}
	this.close();
}
ChildrensBox.prototype.saveAndClose = function () {
	if (this.nrOfChildren > 0) {
		// ignore saveclick if date error(s)
		for (var i = 0; i < this.nrOfChildren; i++) {
			if (this.children[i].hasError) return;
		}
		if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "children_box", "z_ebt_eventplace" : "homepage", "z_ebt_event" : "1", "z_ebt_eventvalue" : "save all"});
		this.cbTooltipLink.className = 'ebt-children-tooltiplink';
		this.cbTooltipLink.href='javascript:void(0);';
		this.cbTooltipLink.innerHTML = this.nrOfChildren + '&nbsp;'  + this.cbTooltipLinkText;
		while (this.childrenList.childNodes.length > 0) {
			this.childrenList.removeChild (this.childrenList.firstChild);
		}
		var newChild;
		this.childrenAdmin = [];
		for (var i = 0; i < this.nrOfChildren; i++) {
			newChild = document.createElement('li');
			newChild.innerHTML = this.children[i].day + '-' + this.months[this.children[i].month -1] + '-' + this.children[i].year + ' (' + this.children[i].ageGroupText + ')';
			this.childrenList.appendChild(newChild);
			this.childrenAdmin[i] = [this.children[i].selectedDayIndex, this.children[i].selectedMonthIndex, this.children[i].selectedYearIndex];
		}
		YAHOO.util.Event.removeListener(this.cbTooltipLink, 'mouseover', this.cbTooltipElement.show);
		YAHOO.util.Event.addListener(this.cbTooltipLink, 'mouseover', this.cbTooltipElement.show, this.cbTooltipElement, true);
		YAHOO.util.Event.removeListener(this.cbTooltipLink, 'mouseout', this.cbTooltipElement.hide);
		YAHOO.util.Event.addListener(this.cbTooltipLink, 'mouseout', this.cbTooltipElement.hide, this.cbTooltipElement, true);
		YAHOO.util.Event.removeListener(this.cbTooltipLink, 'click', this.open);
		YAHOO.util.Event.addListener(this.cbTooltipLink, 'click', this.open, [this, this.cbCheckBox], true);
	} else {
		while(this.nrOfChildren > 0) this.children[base.nrOfChildren-1].remove();
		this.childrenAdmin = [];
		this.cbTooltipLink.innerHTML = this.cbTooltipLinkText;
		this.cbTooltipLink.className = '';
		this.cbCheckBox.checked = false;
		YAHOO.util.Event.removeListener(this.cbTooltipLink, 'mouseover', this.cbTooltipElement.show);
	}
	this.returnFormElements();
	this.close();
}
ChildrensBox.prototype.returnFormElements = function () {
	this.cbChildQty.value = 0;
	this.cbInfantQty.value = 0;
	numInfants = 0;
	numChildren = 0;
	while (this.childrenFormdata.childNodes.length > 0) this.childrenFormdata.removeChild(this.childrenFormdata.firstChild);
	if (this.childrenAdmin) {
		for (var i = 0; i < this.childrenAdmin.length; i++) {
			if(this.children[i].isInfant){
				numInfants = numInfants + 1;
			}
			if(this.children[i].isChild){
				numChildren = numChildren + 1;
			}
			var inputEl = document.createElement('input');
			inputEl.type = 'hidden';
			inputEl.id = 'child[' + i + '].day';
			inputEl.name = 'child[' + i + '].day';
			inputEl.value = this.children[i].day;
			this.childrenFormdata.appendChild(inputEl);

			inputEl = document.createElement('input');
			inputEl.type = 'hidden';
			inputEl.id = 'child[' + i + '].month';
			inputEl.name = 'child[' + i + '].month';
			inputEl.value = this.children[i].month;
			this.childrenFormdata.appendChild(inputEl);

			inputEl = document.createElement('input');
			inputEl.type = 'hidden';
			inputEl.id = 'child[' + i + '].year';
			inputEl.name = 'child[' + i + '].year';
			inputEl.value = this.children[i].year;
			this.childrenFormdata.appendChild(inputEl);

			inputEl = document.createElement('input');
			inputEl.type = 'hidden';
			inputEl.id = 'child[' + i + '].isInfant';
			inputEl.name = 'child[' + i + '].infant';
			inputEl.value = this.children[i].isInfant;
			this.childrenFormdata.appendChild(inputEl);

			inputEl = document.createElement('input');
			inputEl.type = 'hidden';
			inputEl.id = 'child[' + i + '].isChild';
			inputEl.name = 'child[' + i + '].child';
			inputEl.value = this.children[i].isChild;
			this.childrenFormdata.appendChild(inputEl);

			inputEl = document.createElement('input');
			inputEl.type = 'hidden';
			inputEl.id = 'child[' + i + '].isYoungAdult';
			inputEl.name = 'child[' + i + '].youngAdult';
			inputEl.value = this.children[i].isYoungAdult;
			this.childrenFormdata.appendChild(inputEl);
		}
		this.cbChildQty.value = numChildren;
		this.cbInfantQty.value = numInfants;
	}
}
ChildrensBox.prototype.close = function () {
	var attributes = {
		opacity: { to: 0 }
	}
	anim = new YAHOO.util.Motion(this.cbPopupElement, attributes,.5, YAHOO.util.Easing.easeOut);
	anim.cb = this;
	anim.onComplete.subscribe(this.finishClose);
	anim.animate();
	if (this.bookingTool.ebtPage.lightBox) this.bookingTool.ebtPage.lightBox.hide();
	YAHOO.util.Event.removeListener(document, 'mousedown')
}
ChildrensBox.prototype.finishClose = function () {
	this.cb.cbPopupElement.style.display = 'none';
}
ChildrensBox.prototype.init = function (inputFields) {
	this.cbCheckBox.checked = true;
	var yearIndex;
	for (var i=0; i < inputFields.length; i+=6) {
		yearIndex = 0;
		while ((yearIndex < this.years.length) && (this.years[yearIndex] != inputFields[i+2].value)) yearIndex++;
		this.addChild([(inputFields[i].value - 1), (inputFields[i+1].value - 1), yearIndex]);
	}
	this.saveAndClose();
}
ChildrensBox.prototype.addChild = function (initValues) {
	if (this.nrOfChildren < this.maxChildren) {
		this.nrOfChildren++;
		this.children[this.nrOfChildren-1] = new Child(this, this.nrOfChildren, initValues);
	} else {
		this.maxChildrenError.style.display = 'block';
	}
}
ChildrensBox.prototype.clickAddChild = function () {
	if (this.nrOfChildren < this.maxChildren) {
		this.nrOfChildren++;
		this.children[this.nrOfChildren-1] = new Child(this, this.nrOfChildren, null);
		if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "children_box", "z_ebt_event" : "1", "z_ebt_eventvalue" : "add child"});
	} else {
		if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "children_box", "z_ebt_event" : "1", "z_ebt_eventvalue" : "more_then_9"});
		this.maxChildrenError.style.display = 'block';
	}
}
ChildrensBox.prototype.updateChildOrder = function (num) {
	this.maxChildrenError.style.display = 'none';
	for (var i = num; i < this.nrOfChildren; i++) {
		this.children[i-1] = this.children[i];
		this.children[i-1].updateOrderNr(i);
	}
	this.children[this.nrOfChildren - 1] = null;
	this.nrOfChildren--;
}
ChildrensBox.prototype.updateChildrensData = function () {
	for (var i = 0; i < this.nrOfChildren; i++) {
		this.children[i].checkDate();
	}
	while (this.childrenList.childNodes.length > 0) this.childrenList.removeChild (this.childrenList.firstChild);
	var newChild;
	for (var i = 0; i < this.nrOfChildren; i++) {
		newChild = document.createElement('li');
		newChild.innerHTML = this.children[i].day + '-' + this.months[this.children[i].month -1] + '-' + this.children[i].year + ' (' + this.children[i].ageGroupText + ')';
		this.childrenList.appendChild(newChild);
	}
}
// --------------------------------------------------------------------------------------------
//
// Child component
//
// --------------------------------------------------------------------------------------------
function Child (cb, num, selectedValues) {
	this.childrenBox = cb;
	this.targetDocument = this.childrenBox.bookingTool.ebtPage.targetDoc;
	this.container = this.targetDocument.createElement('fieldset');
	this.num = num;
	this.saved = false;
	this.generateChildsHTML();
	// ranking for child
	YAHOO.util.Event.addListener(this.removeBut, 'click', this.remove, this,  true);
	// referrer to errortext
	YAHOO.util.Event.addListener(this.dayBox, 'change', this.checkDate, this, true);
	YAHOO.util.Event.addListener(this.monthBox, 'change', this.checkDate, this, true);
	YAHOO.util.Event.addListener(this.yearBox, 'change', this.checkDate, this, true);
	if (selectedValues && selectedValues.length == 3) {
		this.dayBox.selectedIndex = selectedValues[0];
		this.monthBox.selectedIndex = selectedValues[1];
		this.yearBox.selectedIndex = selectedValues[2];
	}
	// init default date set
	this.checkDate();
}
Child.prototype.generateChildsHTML = function () {
	var days = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'];

	this.rankingText = new HTMLNode(this.targetDocument, 'span', {id:"ebt-ranking-" + this.num}, this.num, 'ranking');
	this.container.appendChild(this.rankingText);

	this.dayBox = new HTMLNode(this.targetDocument, 'select', {id:"ebt-child-day-" + this.num}, '');

	var o;
	for (var i = 0; i < days.length; i++) {
		o = new HTMLNode(this.targetDocument, 'option', {value:days[i]}, days[i]);
		this.dayBox.appendChild(o);
	}
	this.container.appendChild(this.dayBox);

	this.monthBox = new HTMLNode(this.targetDocument, 'select', {id:"ebt-child-month-" + this.num}, '');
	for (i = 0; i < this.childrenBox.months.length; i++) {
		o = new HTMLNode(this.targetDocument, 'option', {value:i+1}, this.childrenBox.months[i]);
		this.monthBox.appendChild(o);
	}
	this.container.appendChild(this.monthBox);

	this.yearBox = new HTMLNode(this.targetDocument, 'select', {id:"ebt-child-year-" + this.num}, '');
	var today = new Date();
	var thisYear = today.getFullYear();
	var yearIndex = 0;
	for (i = thisYear - 15; i <= thisYear; i++) {
		o = new HTMLNode(this.targetDocument, 'option', {value:i}, i);
		this.yearBox.appendChild(o);
		this.childrenBox.years[yearIndex] = i;
		yearIndex++;
	}
	this.container.appendChild(this.yearBox);

	this.ageGroup = new HTMLNode(this.targetDocument, 'span', {id:"ebt-child-agegroup-" + this.num}, this.childrenBox.youngadultText, 'classification');
	this.container.appendChild(this.ageGroup);

	this.removeBut = new HTMLNode(this.targetDocument, 'span', {id:"ebt-child-remove-" + this.num}, '<a href="javascript:;" id="ebt-child-remove-' + this.num + '">' + this.childrenBox.removeText + '</a>', 'remove-record');
	this.container.appendChild(this.removeBut);

	this.errorP = new HTMLNode(this.targetDocument, 'p', {id:"ebt-child-error-" + this.num}, this.childrenBox.errorText, 'date-warning');
	this.container.appendChild(this.errorP);
	this.childrenBox.childrenContainer.appendChild(this.container);
}
Child.prototype.generateYears = function () {
	var today = new Date();
	var thisYear = today.getFullYear();
	var sHTML = '';
	var yearIndex = 0;
	for (var i = thisYear - 15; i <= thisYear; i++) {
		sHTML += '<option value="' + i + '">' + i + '</option>';
		this.childrenBox.years[yearIndex] = i;
		yearIndex++;
	}

	return sHTML;
}
Child.prototype.checkDate = function () {
	this.selectedDayIndex = this.dayBox.options.selectedIndex;
	this.day = parseInt(this.dayBox.options[this.selectedDayIndex].value, 10);
	this.selectedMonthIndex = this.monthBox.options.selectedIndex;
	this.month = parseInt(this.monthBox.options[this.selectedMonthIndex].value, 10);
	this.selectedYearIndex = this.yearBox.options.selectedIndex;
	this.year = parseInt(this.yearBox.options[this.selectedYearIndex].value, 10);
	this.isInfant = this.isChild = this.isYoungAdult = false;
	var date = new Date(this.year, this.month-1, this.day);
	var today = new Date();
	if ((date.getMonth() + 1) == this.month && date < today) {
		this.errorP.style.display = 'none';
		this.hasError = false;
	} else {
		if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "children_box", "z_ebt_event" : "1", "z_ebt_eventvalue" : "wrong_dob"});
		this.errorP.style.display = 'block';
		this.hasError = true;
		this.ageGroup.innerHTML = '';
		return;
	}
	// check age group for entered birthdate
	if (this.childrenBox.bookingTool.flightDater && this.childrenBox.bookingTool.flightDater.depCalendar) {
		var refDate = this.childrenBox.bookingTool.flightDater.depCalendar.getSelectedDates()[0];
	} else {
		var refDate = new Date();
	}
	refDate.setDate(refDate.getDate());
	// check if Infant
	refDate.setFullYear(refDate.getFullYear() - 2);
	if (refDate < date) {
		this.ageGroup.innerHTML = this.ageGroupText = this.childrenBox.infantText;
		this.isInfant = true;
		return;
	}
	// check if Child
	refDate.setFullYear(refDate.getFullYear() - 10);
	if (refDate < date) {
		this.ageGroup.innerHTML = this.ageGroupText = this.childrenBox.childText;
		this.isChild = true;
		return;
	}
	// check if Young adult
	refDate.setFullYear(refDate.getFullYear() - 3);
	if (refDate < date) {
		this.ageGroup.innerHTML = this.ageGroupText = this.childrenBox.youngadultText;
		this.isYoungAdult = true;
		return;
	}
	this.ageGroup.innerHTML = this.ageGroupText = this.childrenBox.adultText;
}
Child.prototype.remove = function () {
	if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "children_box", "z_ebt_event" : "1", "z_ebt_eventvalue" : "remove child"});
	this.container.parentNode.removeChild(this.container);
	this.childrenBox.updateChildOrder(this.num);
}
Child.prototype.updateOrderNr = function (newNr) {
	this.num = newNr;
	if (newNr % 2 == 0)
	this.container.className = 'fieldset-even';
	else
	this.container.className = '';
	this.rankingText.id = 'ebt-ranking-' + newNr;
	this.rankingText.innerHTML = newNr;
	this.ageGroup.id = 'ebt-child-agegroup-' + newNr;
	this.removeBut.id = 'ebt-child-remove-' + newNr;
	this.errorP.id = 'ebt-child-error-' + newNr;
	this.dayBox.id = this.dayBox.name = 'ebt-child-day-' + newNr;
	this.monthBox.id = this.monthBox.name = 'ebt-child-month-' + newNr;
	this.yearBox.id = this.yearBox.name = 'ebt-child-year-' + newNr;
}
// --------------------------------------------------------------------------------------------
//
// RecentSearch component
//
// --------------------------------------------------------------------------------------------
function RecentSearch (bookingTool) {
	this.bookingTool = bookingTool;
	var c = getCookie('klm-ebt-searches');
	if (c) {
		this.searches = eval('(' + unescape(c) + ')').searches;
		if (this.searches[0].p != this.bookingTool.ebtPage.pos) {
			this.searches = new Array();
		}
	} else {
		this.searches = new Array();
	}

	this.createDOM();
	this.rsLink = YAHOO.util.Dom.get('ebt-recent-search-link');
	this.rsPopupElement = YAHOO.util.Dom.get('ebt-rs-box');

	// init click event to open popup
	YAHOO.util.Event.addListener(this.rsLink, 'click', this.open, this, true);

	// init click event to close popup
	YAHOO.util.Event.addListener(this.rsCloseBut, 'click', this.close, this, true);
	YAHOO.util.Event.addListener(this.cbBack, 'click', this.close, this, true);
}
RecentSearch.prototype.createDOM = function () {
	var targetDocument = this.bookingTool.ebtPage.targetDoc;
	this.rsPopupElement = new HTMLNode(targetDocument, 'div', {id:'ebt-rs-box'}, '<h3>' + YAHOO.util.Dom.get('ebt-rs-title').innerHTML + '</h3>');

	this.rsCloseBut = new HTMLNode(targetDocument, 'a', {id:'ebt-rs-close', href:'javascript:;'}, 'Close', 'close-overlay');
	this.rsPopupElement.appendChild(this.rsCloseBut);

	var rsContent = new HTMLNode(targetDocument, 'div', {}, '<p>' + YAHOO.util.Dom.get('ebt-rs-intro').innerHTML + '</p>', 'content');
	var rsSpacer = new HTMLNode(targetDocument, 'div', {}, null, 'line-spacer');
	rsContent.appendChild(rsSpacer);

	var s, a, t, p, d, pHTML;
	for (var i = 0; i < this.searches.length; i++) {
		s =  new HTMLNode(targetDocument, 'div', {}, null, 'ebt-rs');
		a = new HTMLNode(targetDocument, 'a', {href:'javascript:;'}, '<span>' + YAHOO.util.Dom.get('ebt-rs-selecttext').innerHTML + '</span>', 'button ebt-button-special');
		YAHOO.util.Event.addListener(a, 'click', this.selectSearch, [this, i], true);
		s.appendChild(a);

		t = new HTMLNode(targetDocument, 'table', {cellspacing:'0'});
		var tbody = new HTMLNode(targetDocument, 'tbody', {});
		var tr = new HTMLNode(targetDocument, 'tr');
		var td = new HTMLNode(targetDocument, 'td', {width:'59'}, YAHOO.util.Dom.get('ebt-rs-fromtext').innerHTML);
		tr.appendChild(td);
		if (this.searches[i].oos) {
			td = new HTMLNode(targetDocument, 'td', {width:'370'}, '<strong>' + this.searches[i].oos + '</strong>');
		} else {
			td = new HTMLNode(targetDocument, 'td', {width:'370'}, '<strong>' + '' + '</strong>');
		}
		tr.appendChild(td);
		td = new HTMLNode(targetDocument, 'td', {width:'70'}, YAHOO.util.Dom.get('ebt-rs-deptext').innerHTML);
		tr.appendChild(td);
		td = new HTMLNode(targetDocument, 'td', {width:'80'}, '<strong>' + this.searches[i].od + '</strong>');
		tr.appendChild(td);
		tbody.appendChild(tr);

		tr = new HTMLNode(targetDocument, 'tr');
		td = new HTMLNode(targetDocument, 'td', {width:'59'}, YAHOO.util.Dom.get('ebt-rs-totext').innerHTML);
		tr.appendChild(td);
		td = new HTMLNode(targetDocument, 'td', {width:'370'}, '<strong>' + this.searches[i].ois + '</strong>');
		tr.appendChild(td);
		if (this.searches[i].i == '1' ) {
			td = new HTMLNode(targetDocument, 'td', {width:'70'}, YAHOO.util.Dom.get('ebt-rs-rettext').innerHTML);
			tr.appendChild(td);
			td = new HTMLNode(targetDocument, 'td', {width:'80'}, '<strong>' + this.searches[i].id + '</strong>');
			tr.appendChild(td);
		}
		tbody.appendChild(tr);

		if (this.searches[i].i == '2') {
			tr = new HTMLNode(targetDocument, 'tr');
			td = new HTMLNode(targetDocument, 'td', {width:'59'}, YAHOO.util.Dom.get('ebt-rs-fromtext').innerHTML);
			tr.appendChild(td);
			td = new HTMLNode(targetDocument, 'td', {width:'370'}, '<strong>' + this.searches[i].dos + '</strong>');
			tr.appendChild(td);
			td = new HTMLNode(targetDocument, 'td', {width:'70'}, YAHOO.util.Dom.get('ebt-rs-rettext').innerHTML);
			tr.appendChild(td);
			td = new HTMLNode(targetDocument, 'td', {width:'80'}, '<strong>' + this.searches[i].id + '</strong>');
			tr.appendChild(td);
			tbody.appendChild(tr);
			tr = new HTMLNode(targetDocument, 'tr');
			td = new HTMLNode(targetDocument, 'td', {width:'59'}, YAHOO.util.Dom.get('ebt-rs-totext').innerHTML);
			tr.appendChild(td);
			td = new HTMLNode(targetDocument, 'td', {width:'370'}, '<strong>' + this.searches[i].dis + '</strong>');
			tr.appendChild(td);
			tbody.appendChild(tr);
		}

		t.appendChild(tbody);
		s.appendChild(t);

		pHTML = this.searches[i].cct + ', ' + YAHOO.util.Dom.get('ebt-number-adults')[this.searches[i].a].value + ' ' + YAHOO.util.Dom.get('ebt-rs-adulttext').innerHTML;
		if (this.searches[i].c.length > 0) {
			pHTML += ', ' + this.searches[i].noc + ' ' + YAHOO.util.Dom.get('ebt-rs-childrentext').innerHTML;
		}
		if (this.searches[i].hotel == "true") {
			pHTML += ', ' + YAHOO.util.Dom.get('ebt-rs-hoteltext').innerHTML;
		}
		p = new HTMLNode(targetDocument, 'p', {}, pHTML);
		s.appendChild(p);

		d =  new HTMLNode(targetDocument, 'div', {}, null, 'ebt-rs-bot');
		s.appendChild(d);

		rsContent.appendChild(s);
		// Added this for blue line between searches
		var rsSpacer = new HTMLNode(targetDocument, 'div', {}, null, 'line-spacer');
		rsContent.appendChild(rsSpacer);
	}

	this.rsPopupElement.appendChild(rsContent);

	var footer = new HTMLNode(targetDocument, 'div', {}, null, 'footer');
	this.cbBack = new HTMLNode(targetDocument, 'a', {href:'javascript:;'}, '<span>' + YAHOO.util.Dom.get('ebt-rs-backtext').innerHTML + '</span>', 'button white ebt-button-back');

	footer.appendChild(this.cbBack);
	this.rsPopupElement.appendChild(footer);

	targetDocument.body.appendChild(this.rsPopupElement);
}
RecentSearch.prototype.open = function (e, args) {
	this.rsPopupElement.style.display = 'block';
	var attributes = {
		opacity: { to: 1 }
	}
	anim = new YAHOO.util.Motion(this.rsPopupElement, attributes,.5, YAHOO.util.Easing.easeOut);
	anim.animate();
	if (this.bookingTool.ebtPage.lightBox) this.bookingTool.ebtPage.lightBox.show(null, this.rsPopupElement, this, "close");
}

RecentSearch.prototype.close = function () {
	var attributes = {
		opacity: { to: 0 }
	}
	anim = new YAHOO.util.Motion(this.rsPopupElement, attributes,.5, YAHOO.util.Easing.easeOut);
	anim.rs = this;
	anim.onComplete.subscribe(this.finishClose);
	anim.animate();
	if (this.bookingTool.ebtPage.lightBox) this.bookingTool.ebtPage.lightBox.hide();
	YAHOO.util.Event.removeListener(document, 'mousedown')
}
RecentSearch.prototype.finishClose = function () {
	this.rs.rsPopupElement.style.display = 'none';
}
RecentSearch.prototype.add = function () {
	var s = new Object();
	s.p = this.bookingTool.ebtPage.pos;

	var orgOut = YAHOO.util.Dom.get('ebt-departure-place');
	s.oov = orgOut[orgOut.selectedIndex].value;
	s.oos = orgOut[orgOut.selectedIndex].text;
	s.oic = YAHOO.util.Dom.get('ebt-airportcode').value;
	s.ois = YAHOO.util.Dom.get('ebt-destination-place').value;
	s.odlt = YAHOO.util.Dom.get('ebt-outbound-destination-location-type').value;

	if (YAHOO.util.Dom.get('ebt-airportcode-from-oj')) {
		s.doc = YAHOO.util.Dom.get('ebt-airportcode-from-oj').value;
		s.dos = YAHOO.util.Dom.get('ebt-from-place-oj').value;
		s.dic = YAHOO.util.Dom.get('ebt-airportcode-dest-oj').value;
		s.dis = YAHOO.util.Dom.get('ebt-destination-place-oj').value;
		s.iolt = YAHOO.util.Dom.get('ebt-inbound-origin-location-type').value;
		s.idlt = YAHOO.util.Dom.get('ebt-inbound-destination-location-type').value;
	}

	s.i = this.getItinerary();
	s.fs = YAHOO.util.Dom.get('ebt-flexible-dates').checked;
	var cabinClass = YAHOO.util.Dom.get('ebt-cabin-class');
	s.cc = cabinClass.selectedIndex;
	s.cct = cabinClass.options[cabinClass.selectedIndex].text;
	s.od = YAHOO.util.Dom.get('ebt-departure-date').value;
	s.id = YAHOO.util.Dom.get('ebt-return-date').value;
	s.a = YAHOO.util.Dom.get('ebt-number-adults').selectedIndex;
	s.noc = this.bookingTool.childrensBox.childrenAdmin.length;
	s.c = this.getChildren();

	this.findMatch(s);
	this.searches.unshift(s);
	this.storeCookies();
}
RecentSearch.prototype.findMatch = function (s) {
	var matchFound = false;
	if (this.searches.length == 0) return;
	for (var i = 0; i < this.searches.length; i++) {
		matchFound = this.searchesEqual(s, this.searches[i]);
		if (matchFound) {
			this.searches.splice(i, 1)
			return;
		}
	}
}
RecentSearch.prototype.searchesEqual = function (s, storedS) {
	if (s.oov != storedS.oov) return false;
	if (s.oos != storedS.oos) return false;
	if (s.oic != storedS.oic) return false;
	if (s.doc != storedS.doc) return false;
	if (s.dic != storedS.dic) return false;
	if (s.odlt != storedS.odlt) return false;
	if (s.iolt != storedS.iolt) return false;
	if (s.idlt != storedS.idlt) return false;
	if (s.i != storedS.i) return false;
	if ((s.fs && storedS.fs == 'false') || (!s.fs && storedS.fs == 'true')) return false;
	if (s.cc != storedS.cc) return false;
	if (s.cct != storedS.cct) return false;
	if (s.od != storedS.od) return false;
	if (s.id != storedS.id) return false;
	if (s.a != storedS.a) return false;
	if (this.childrenUnique(s.c, storedS.c)) return false;

	return true;
}
RecentSearch.prototype.childrenUnique = function (newC, C) {
	// counter added because C is stored as one-dimensional array and newC as 2-dimensional
	var counter = 0;
	for (var i = 0; i < newC.length; i++) {
		for (var j = 0; j < newC[i].length; j++) {
			if (parseInt(newC[i][j], 10) != parseInt(C[counter], 10)) {return true;}
			counter++;
		}
	}
	return false;
}

RecentSearch.prototype.storeCookies = function () {
	var cookieVal = '{"searches":[';
	for (var i = 0; i < 5; i++) {
		if (this.searches[i]) {
			cookieVal += "{";
			for (var prop in this.searches[i]) {
				if (prop == "c") {
					cookieVal += '"' + prop + '": [' + this.searches[i][prop] + '],';
				} else {
					cookieVal += '"' + prop + '":"' + this.searches[i][prop] + '",';
				}
			}
			// remove last ","
			cookieVal = cookieVal.substr(0, cookieVal.length - 1);
			cookieVal += "}";
			if (this.searches[i+1] && i < 5) cookieVal += ",";
		}
	}
	cookieVal += "]}";
	if (escape(cookieVal).length > 3000) {
		this.searches.pop();
		this.storeCookies();
	} else {
		setCookie('klm-ebt-searches', cookieVal, 30);
	}
}
RecentSearch.prototype.selectSearch = function (e, args) {
	var base = args[0];
	var index = args[1];
	var s = base.searches[index];
	base.close();

	if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "recent_search", "z_ebt_eventplace" : "homepage", "z_ebt_event" : "1"});
	var dep = YAHOO.util.Dom.get('ebt-departure-place');
	for (var i = 0; i < dep.options.length; i++) {
		if (dep.options[i].value == s.oov) {
			dep.selectedIndex = i;
			break;
		}
	}
	YAHOO.util.Dom.get('ebt-airportcode').value = s.oic;
	YAHOO.util.Dom.get('ebt-destination-place').value = s.ois;
	YAHOO.util.Dom.get('ebt-destination-place').style.color = '#023167';
	YAHOO.util.Dom.get('ebt-outbound-destination-location-type').value = s.odlt;
	if (YAHOO.util.Dom.get('ebt-airportcode-from-oj')) {
		YAHOO.util.Dom.get('ebt-airportcode-from-oj').value = s.doc;
		YAHOO.util.Dom.get('ebt-from-place-oj').value = s.dos;
		YAHOO.util.Dom.get('ebt-from-place-oj').style.color = '#023167';
		YAHOO.util.Dom.get('ebt-airportcode-dest-oj').value = s.dic;
		YAHOO.util.Dom.get('ebt-destination-place-oj').value = s.dis;
		YAHOO.util.Dom.get('ebt-destination-place-oj').style.color = '#023167';
		YAHOO.util.Dom.get('ebt-inbound-origin-location-type').value = s.iolt;
		YAHOO.util.Dom.get('ebt-inbound-destination-location-type').value = s.idlt;
	}

	if (s.fs == 'true') {
		var ebtFlex = YAHOO.util.Dom.get('ebt-flexible-dates');
		var ebtFix = YAHOO.util.Dom.get('ebt-fixed-dates');
		if ( ebtFlex ) {
			ebtFlex.checked = true;
		}
		if ( ebtFix ) {
			ebtFix.checked = false;
		}
	} else {
		var ebtFlex = YAHOO.util.Dom.get('ebt-flexible-dates');
		var ebtFix = YAHOO.util.Dom.get('ebt-fixed-dates');
		if ( ebtFlex ) {
			ebtFlex.checked = false;
		}
		if ( ebtFix ) {
			ebtFix.checked = true;
		}
	}
	YAHOO.util.Dom.get('ebt-number-adults').selectedIndex = s.a;
	if (new Date(s.od).getTime() + (24 * 60 * 60 * 1000) >= new Date().getTime()) {
		base.bookingTool.flightDater.depCalendar.cal.select(s.od);
	} else {
		base.bookingTool.flightDater.depCalendar.cal.select(base.bookingTool.flightDater.depCalendar.defaultDate);
	}
	base.bookingTool.flightDater.retCalendar.cal.select(s.id);
	// set Children
	if (s.c.length > 0) {
		while(base.bookingTool.childrensBox.nrOfChildren > 0) base.bookingTool.childrensBox.children[base.bookingTool.childrensBox.nrOfChildren-1].remove();
		base.bookingTool.childrensBox.childrenAdmin = [];
		base.bookingTool.childrensBox.cbCheckBox.checked = true;
		for (var i = 0; i < base.searches[index].c.length; i+=3) {
			base.bookingTool.childrensBox.addChild([s.c[i], s.c[i+1], s.c[i+2]]);
		}
		base.bookingTool.childrensBox.saveAndClose();
	} else {
		while(base.bookingTool.childrensBox.nrOfChildren > 0) base.bookingTool.childrensBox.children[base.bookingTool.childrensBox.nrOfChildren-1].remove();
		base.bookingTool.childrensBox.childrenAdmin = [];
		base.bookingTool.childrensBox.cbCheckBox.checked = false;
		base.bookingTool.childrensBox.saveAndClose();
	}
	base.setItinerary(s.i);
	if (s.cc == 2) s.cc = 1;
	YAHOO.util.Dom.get('ebt-cabin-class').selectedIndex = s.cc;
	base.bookingTool.getCabinClasses();

}
RecentSearch.prototype.getChildren = function () {
	return this.bookingTool.childrensBox.childrenAdmin;
}
RecentSearch.prototype.getItinerary = function () {
	if (YAHOO.util.Dom.get('ebt-open-jaw-opt') && YAHOO.util.Dom.get('ebt-open-jaw-opt').checked) {
		return 2;	// Open Jaw
	} else if (YAHOO.util.Dom.get('ebt-round-trip').checked) {
		return 1;	// Retour ticket
	} else {
		return 0;	// One way
	}
}
RecentSearch.prototype.setItinerary = function (itinerary) {
	if (itinerary == 2) {
		if (YAHOO.util.Dom.get('ebt-open-jaw-opt')) YAHOO.util.Dom.get('ebt-open-jaw-opt').checked = 'checked';
		YAHOO.util.Dom.addClass(document.body, 'open-jaw');
		YAHOO.util.Dom.get('ebt-round-trip').click();
		return;
	} else {
		if (YAHOO.util.Dom.get('ebt-open-jaw-opt')) YAHOO.util.Dom.get('ebt-open-jaw-opt').checked = '';
		YAHOO.util.Dom.removeClass(document.body, 'open-jaw');
	}
	if (itinerary == 1) {
		YAHOO.util.Dom.get('ebt-round-trip').click();
	} else {
		var ebtOneWay = YAHOO.util.Dom.get('ebt-one-way');
		if ( ebtOneWay ) {
			ebtOneWay.click();
		}
	}
}
// --------------------------------------------------------------------------------------------
//
// Find destination component
//
// --------------------------------------------------------------------------------------------
function FindDestinationBox (bookingTool) {
	this.bookingTool = bookingTool;
	// init language dependent texts for find destination box
if ( YAHOO.util.Dom.get('ebt-fd-title') != null )
{
	this.titleText = YAHOO.util.Dom.get('ebt-fd-title').innerHTML;
	this.introText = YAHOO.util.Dom.get('ebt-fd-intro').innerHTML;
	this.buttonText = YAHOO.util.Dom.get('ebt-fd-buttontext').innerHTML;
	this.chooseCountryText = YAHOO.util.Dom.get('ebt-fd-choosecountry').innerHTML;
	this.chooseAirportText = YAHOO.util.Dom.get('ebt-fd-chooseairport').innerHTML;
	this.buttonCloseText = YAHOO.util.Dom.get('ebt-cb-close').innerHTML;

	this.createFindDestinationBoxDOM();

	this.airportBox.disabled='disabled';
	
	YAHOO.util.Dom.addClass(YAHOO.util.Dom.get('ebt-finddest-submit'), 'disabled');
	YAHOO.util.Event.addListener(this.countryBox, 'change', this.changeCountry, this, true);
	YAHOO.util.Event.addListener(this.airportBox, 'change', this.changeAirport, this, true);

	// init click events to open popup
	// for outbound destination:
	YAHOO.util.Event.addListener(YAHOO.util.Dom.get('ebt-od-find-destination-link'), 'click', this.open, [this, YAHOO.util.Dom.get('ebt-od-find-destination-link')], true);
	// for outbound destination:
	YAHOO.util.Event.addListener(YAHOO.util.Dom.get('ebt-io-find-destination-link'), 'click', this.open, [this, YAHOO.util.Dom.get('ebt-io-find-destination-link')], true);
	// for outbound destination:
	YAHOO.util.Event.addListener(YAHOO.util.Dom.get('ebt-id-find-destination-link'), 'click', this.open, [this, YAHOO.util.Dom.get('ebt-id-find-destination-link')], true);

	var helptipLink = YAHOO.util.Dom.getElementsByClassName("helptip-link", "a", "ebt-autosuggest-helptip")[0];
	YAHOO.util.Event.addListener(helptipLink, 'click', this.findHelptipLink, this, true);

	YAHOO.util.Event.addListener(this.fdCloseBut, 'click', this.close, this, true);
	YAHOO.util.Event.addListener(this.submitBut, 'click', this.saveAndClose, this, true);

}
}

FindDestinationBox.prototype.createFindDestinationBoxDOM = function () {
	var targetDocument = this.bookingTool.ebtPage.targetDoc;
	this.fdPopupElement = new HTMLNode(targetDocument, 'div', {id:'ebt-finddestination-box'}, '<h3>' + this.titleText + '</h3>');

	this.fdCloseBut = new HTMLNode(targetDocument, 'a', {href:'javascript:;'}, this.buttonCloseText, 'close-overlay');
	this.fdPopupElement.appendChild(this.fdCloseBut);

	var fdContent = new HTMLNode(targetDocument, 'div', {}, '', 'content');
	
	var mybr = new HTMLNode(targetDocument, 'br', {clear: 'all'});
	fdContent.appendChild(mybr);

	var fdInnerContent = new HTMLNode(targetDocument, 'div', {}, null, 'inner-content');
	
	var destForm = new HTMLNode(targetDocument, 'div', {id:'ebt-finddestination-form'}, null, 'form-container');
	var fieldset = new HTMLNode(targetDocument, 'fieldset', null, null);

	var labelCountry = new HTMLNode(targetDocument, 'label', {'for':'ebt-finddestination-country'}, this.chooseCountryText);
	fieldset.appendChild(labelCountry);

	this.countryBox = new HTMLNode(targetDocument, 'select', {id:'ebt-finddestination-country'});
	var firstOption = new HTMLNode(targetDocument, 'option', {value:null}, null);
	this.countryBox.appendChild(firstOption);
	
	fieldset.appendChild(this.countryBox);  

	var labelAirport = new HTMLNode(targetDocument, 'label', {'for':'ebt-finddestination-airport'}, this.chooseAirportText);
	fieldset.appendChild(labelAirport);
	
	this.airportBox = new HTMLNode(targetDocument, 'select', {id:'ebt-finddestination-airport'});
	var firstOption = new HTMLNode(targetDocument, 'option', {value:null}, null);
	this.airportBox.appendChild(firstOption);

	fieldset.appendChild(this.airportBox);  

	destForm.appendChild(fieldset);
	fdInnerContent.appendChild(destForm);
	fdContent.appendChild(fdInnerContent);
	this.fdPopupElement.appendChild(fdContent);

	var footer = new HTMLNode(targetDocument, 'div', {}, null, 'footer');
	this.submitBut = new HTMLNode(targetDocument, 'a', {id:'ebt-finddest-submit', href:'javascript:;'});
	var span = new HTMLNode(targetDocument, 'span', {},  this.buttonText, 'save-button');
	this.submitBut.appendChild(span);
	footer.appendChild(this.submitBut);

	this.fdPopupElement.appendChild(footer);
	//[QC720] fdPopupElement should be appended to #klm-doc
	var oTargetDoc = YAHOO.util.Dom.get('klm-doc');
	if ( oTargetDoc == null ) {
		oTargetDoc = targetDocument.body;
	}
	oTargetDoc.appendChild(this.fdPopupElement);

	YAHOO.util.Dom.addClass(this.submitBut, 'button');
}
FindDestinationBox.prototype.parseData = function () {
if ( this.countryBox != null )
{
	this.countryBox.style.display = 'none';
	var countries = new Array();
	var countriesandcities = new Array();
	var airportToData = this.bookingTool.inputSearchCriteria.allowedDestinations;
	for(i=0; i<airportToData.length; i++) {
		var country = airportToData[i].country;
		var city = airportToData[i].city;
		var airportname = airportToData[i].name;
		countriesandcities[i] = new Array(3);
		countriesandcities[i][0] = country;
		countriesandcities[i][1] = city;
		countriesandcities[i][2] = airportname;
		var doublecheck=false;
		for(j=0; j<countries.length; j++) {
			if(country == countries[j]){doublecheck=true;break;}
		}
		if(!doublecheck) {
			countries.push(country);
		}
	}
	countries.sort();
	for(i=0; i<countries.length; i++) {
		var newoption = document.createElement('option');
		newoption.innerHTML = countries[i];
		newoption.value = countries[i];
		this.countryBox.appendChild(newoption);
	}
}
}
FindDestinationBox.prototype.findHelptipLink = function(e, args) {
	var helptipLink = YAHOO.util.Dom.getElementsByClassName("helptip-link", "a", YAHOO.util.Dom.get("ebt-autosuggest-helptip"))[0];
	var el = YAHOO.util.Dom.get('ebt-od-find-destination-link');    
	if(helptipLink.id.search("-io-") > -1)
		el = YAHOO.util.Dom.get('ebt-io-find-destination-link') 
	else if(helptipLink.id.search("-id-") > -1) 
		el = YAHOO.util.Dom.get('ebt-id-find-destination-link');    
	 this.open(e, [this, el]);
}
FindDestinationBox.prototype.open = function (e, args) {
	var base = args[0];
	var link = args[1];
	base.countryBox.style.display = 'block';
	base.target = link.id;
	if (base.bookingTool.ebtPage.lightBox) base.bookingTool.ebtPage.lightBox.show(null, base.fdPopupElement, base, "close");
	base.animateOpen();
}
FindDestinationBox.prototype.animateOpen = function () {
	this.fdPopupElement.style.display = 'block';
	var attributes = {
		opacity: { to: 1 }
	}
	anim = new YAHOO.util.Motion(this.fdPopupElement, attributes,.5, YAHOO.util.Easing.easeOut);
	anim.animate();
}
FindDestinationBox.prototype.saveAndClose = function () {
	if (YAHOO.util.Dom.hasClass(YAHOO.util.Dom.get('ebt-finddest-submit'), 'disabled')) return;
	this.returnFormElements();
	this.close();
}
FindDestinationBox.prototype.returnFormElements = function () {
	var inputField;
	var hiddenTypeField;
	var hiddenCodeField;
	var airportToData = this.bookingTool.inputSearchCriteria.allowedDestinations
	if (this.target.search('-od-') != -1) {
		inputField = YAHOO.util.Dom.get('ebt-destination-place');
		hiddenTypeField = YAHOO.util.Dom.get('ebt-outbound-destination-location-type'); 
		hiddenCodeField = YAHOO.util.Dom.get('ebt-airportcode');
	}
	if (this.target.search('-io-') != -1) {
		inputField = YAHOO.util.Dom.get('ebt-from-place-oj');
		hiddenTypeField = YAHOO.util.Dom.get('ebt-inbound-origin-location-type');   
		hiddenCodeField = YAHOO.util.Dom.get('ebt-airportcode-from-oj');
	}
	if (this.target.search('-id-') != -1) {
		inputField = YAHOO.util.Dom.get('ebt-destination-place-oj');
		hiddenTypeField = YAHOO.util.Dom.get('ebt-inbound-destination-location-type');  
		hiddenCodeField = YAHOO.util.Dom.get('ebt-airportcode-dest-oj');
	}
	var selectedIndex = this.airportBox.childNodes[this.airportBox.selectedIndex].className;
	var selectedAirport = airportToData[selectedIndex];
	var city = selectedAirport.city;
	var state = selectedAirport.state;
	var country = selectedAirport.country;
	var airport = selectedAirport.name;
	var code = selectedAirport.code;
	var citygroup = selectedAirport.group;
	var sMarkup = "";
	sMarkup += city + ' - ' + airport + ' (' + code + ')';
	// add state if available
	sMarkup += state ? ", " + state + ", " : ", "; 
	sMarkup += country; 
	inputField.value = sMarkup;
	inputField.style.color = '#023167';
	YAHOO.util.Dom.removeClass(inputField, 'error');
	if (citygroup) {hiddenTypeField.value = 'city'} else {hiddenTypeField.value = 'airport';}
	hiddenCodeField.value = code;
}

FindDestinationBox.prototype.close = function () {
	var attributes = {
		opacity: { to: 0 }
	}
	anim = new YAHOO.util.Motion(this.fdPopupElement, attributes,.5, YAHOO.util.Easing.easeOut);
	anim.fd = this;
	anim.onComplete.subscribe(this.finishClose);
	anim.animate();
	if (this.bookingTool.ebtPage.lightBox){
		this.bookingTool.ebtPage.lightBox.hide();
		YAHOO.util.Event.removeListener(document, 'mousedown');
	}
	YAHOO.util.Dom.addClass(YAHOO.util.Dom.get('ebt-finddest-submit'), 'disabled');
	this.countryBox.selectedIndex = 0;
	this.airportBox.selectedIndex = 0;
	this.airportBox.disabled = 'disabled';
}
FindDestinationBox.prototype.finishClose = function () {
	this.fd.fdPopupElement.style.display = 'none';
}
FindDestinationBox.prototype.changeCountry = function (type, args, base) { 
	var fdairportbox = this.airportBox;
	var fdcountrybox = this.countryBox;
	var airportToData = this.bookingTool.inputSearchCriteria.allowedDestinations
	fdairportbox.selectedIndex = 0;
	if(fdcountrybox.selectedIndex < 1) {fdairportbox.disabled='disabled';}
	else {
		fdairportbox.disabled=false;
		while (this.airportBox.childNodes[1]) {
			this.airportBox.removeChild(this.airportBox.childNodes[1]);
		}

		for(i=0; i<airportToData.length; i++) {
			if(airportToData[i].country == fdcountrybox.value) {
				var newoption = document.createElement('option');
				newoption.innerHTML = airportToData[i].city + ' - ' + airportToData[i].name + '(' + airportToData[i].code + ')';
				newoption.className = i;
				this.airportBox.appendChild(newoption);
			}
		}

	}
	YAHOO.util.Dom.addClass(YAHOO.util.Dom.get('ebt-finddest-submit'), 'disabled');
}
FindDestinationBox.prototype.changeAirport = function (type, args, base) { 
	YAHOO.util.Dom.removeClass(YAHOO.util.Dom.get('ebt-finddest-submit'), 'disabled');
}
/*
* 2010-01-18 : Migration Version 1
*/

// --------------------------------------------------------------------------------------------
//
// Lightbox component
//
// --------------------------------------------------------------------------------------------
function Lightbox (ebtPage) {
	this.ebtPage = ebtPage;
	this.lbElement = parent.document.createElement('div');
	this.lbElement.className = 'lightbox';
	parent.document.body.appendChild(this.lbElement);
	if (this.ebtPage.browser == 'ie6' || this.ebtPage.browser == 'ie55') this.selects = document.getElementById(this.ebtPage.container.id).getElementsByTagName('select');
}
Lightbox.prototype.show = function () {
	if (this.ebtPage.browser == 'ie6' || this.ebtPage.browser == 'ie55') this.hideSelectBoxes();
	this.lbElement.style.display = 'block';
	var attributes = {
		opacity: { to: .8 }
	}
	anim = new YAHOO.util.Motion(this.lbElement, attributes,.5, YAHOO.util.Easing.easeOut);
	anim.animate();
}
Lightbox.prototype.hide = function () {
	var attributes = {
		opacity: { to: 0 }
	}
	anim = new YAHOO.util.Motion(this.lbElement, attributes,.5, YAHOO.util.Easing.easeOut);
	anim.lb = this;
	anim.onComplete.subscribe(this.finishHide);
	anim.animate();
}
Lightbox.prototype.finishHide = function () {
	if (this.lb.ebtPage.browser == 'ie6' || this.lb.ebtPage.browser == 'ie55') this.lb.showSelectBoxes();
	this.lb.lbElement.style.display = 'none';
}
Lightbox.prototype.hideSelectBoxes = function () {
	for (var i = 0; i < this.selects.length; i++) {
		this.selects[i].style.visibility = 'hidden';
	}
}
Lightbox.prototype.showSelectBoxes = function () {
	for (var i = 0; i < this.selects.length; i++) {
		this.selects[i].style.visibility = 'visible';
	}
}
// --------------------------------------------------------------------------------------------
//
// ToolTip component
//
// --------------------------------------------------------------------------------------------
function ToolTip (container, link, deltaX, deltaY) {
	this.container = container.tagName ? container : YAHOO.util.Dom.get(container);
	this.link = link;
	this.deltaX = deltaX;
	this.deltaY = deltaY;
 	if (document.all) {
		this.iframe = document.createElement('iframe');
		this.iframe.className = 'tooltip-iframe';
		// src added to make sure there is no problem with secure/non-secure items
		this.iframe.src = '/travel/generic/static/empty.html';
		this.iframe.frameBorder = 0;
		this.container.appendChild(this.iframe);
	}
}
ToolTip.prototype.show = function () {
	if (!isNaN(this.deltaX) && !isNaN(this.deltaX)) {
		this.container.style.left = calculateLeft(this.link) + this.deltaX + "px";
		this.container.style.top = calculateTop(this.link) + this.deltaY + "px";
		this.container.style.bottom = "auto";
	}
	this.toShow = setTimeout(createContextFunction(this, "doShow"), 300);
}
ToolTip.prototype.showPos = function (e, args) {
	var ieFix = document.all ? 120 : 30; 
	var leftCorr =  YAHOO.util.Dom.hasClass(args[0].container, 'goleft') ? -300 : 0;
	args[0].container.style.left = (args[1].offsetLeft + ieFix + leftCorr) + "px";
	args[0].container.parentNode.style.zIndex = 200;
	args[0].toShow = setTimeout(createContextFunction(args[0], "doShow"), 300);
}
ToolTip.prototype.hide = function () {
	clearTimeout(this.toShow);
	this.toShow = -1;
	this.container.style.display = 'none';
}
ToolTip.prototype.doShow = function () {
	this.container.style.display = 'block';
	if (document.all) {
		this.iframe.style.width = (this.container.offsetWidth)+ 'px';
		this.iframe.style.height = (this.container.offsetHeight) + 'px';
	}
}
// --------------------------------------------------------------------------------------------
//
// HoverToolTip component
//
// --------------------------------------------------------------------------------------------
function HoverToolTip (container) {
	this.container = container.tagName ? container : YAHOO.util.Dom.get(container);
}
HoverToolTip.prototype.show = function (e, args) {
	args.followMouse(e, args);
	if (args.container) args.container.style.display = 'block';
}
HoverToolTip.prototype.hide = function (e, args) {
	args.priceset = false;
	if (args.container) args.container.style.display = 'none';
}
HoverToolTip.prototype.followMouse = function (e, args) {
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}
	YAHOO.util.Dom.setX(args.container, posx);
	YAHOO.util.Dom.setY(args.container, posy + 34);
}
// --------------------------------------------------------------------------------------------
//
// ClickToolTip component
//
// --------------------------------------------------------------------------------------------
function ClickToolTip (cont, myLink, deltaX, deltaY) {
	this.container = cont;
	this.deltaX = deltaX;
	this.deltaY = deltaY;
	YAHOO.util.Event.addListener(myLink, 'click', this.show, [this, myLink], true);
	YAHOO.util.Event.addListener(myLink, 'blur', this.hide, this, true);
}
ClickToolTip.prototype.show = function (e, args) {
	YAHOO.util.Event.preventDefault(e);
	var base = args[0];
	var myLink = args[1];
	base.container.style.left = ((YAHOO.util.Dom.getX(myLink) + base.deltaX) - YAHOO.util.Dom.getX(YAHOO.util.Dom.get('ebt-main-container'))) + "px";
	base.container.style.top = (YAHOO.util.Dom.getY(myLink) + base.deltaY) + "px";
	base.container.style.display = 'block';
}
ClickToolTip.prototype.hide = function (e) {
	this.container.style.display = 'none';
}
// --------------------------------------------------------------------------------------------
//
// HTMLNode component
//
// --------------------------------------------------------------------------------------------
function HTMLNode(target, type, attributes, innerHtml, className, hrefText) {
	var newNode = target.createElement(type);
	for (var prop in attributes) {
		newNode.setAttribute(prop, attributes[prop]);
	}
	if (type = 'a' && hrefText) newNode.href = hrefText;
	if (className) newNode.className = className;
	if (innerHtml) newNode.innerHTML = innerHtml;
	return newNode;
}
// --------------------------------------------------------------------------------------------
//
// PriceBreakdown component
//
// --------------------------------------------------------------------------------------------
function PriceBreakdown (hideText) {
	this.toggleLink = YAHOO.util.Dom.get('ebt-show-price-breakdown');
	this.hideText = hideText;
	if (this.toggleLink) this.showText = this.toggleLink.innerHTML;
	this.extendedData = YAHOO.util.Dom.get('ebt-price-breakdown');
	this.opened = false;
	YAHOO.util.Event.addListener(this.toggleLink, 'click', this.toggle, this, true);
	
	this.totalAdultPrice = YAHOO.util.Dom.get('ebt-total-adult-price');
	this.totalPriceTop = YAHOO.util.Dom.get('ebt-total-price-top');
	this.totalPriceBot = YAHOO.util.Dom.get('ebt-total-price-bot');
	this.adultPrice = YAHOO.util.Dom.get('ebt-adult-price');
	this.childPrice = YAHOO.util.Dom.get('ebt-child-price');
	this.infantPrice = YAHOO.util.Dom.get('ebt-infant-price');
	this.adultTax = YAHOO.util.Dom.get('ebt-adult-tax');
	this.childTax = YAHOO.util.Dom.get('ebt-child-tax');
	this.infantTax = YAHOO.util.Dom.get('ebt-infant-tax');
	this.adultFee = YAHOO.util.Dom.get('ebt-adult-fee');
	this.childFee = YAHOO.util.Dom.get('ebt-child-fee');
	this.infantFee = YAHOO.util.Dom.get('ebt-infant-fee');
	this.adultTotal = YAHOO.util.Dom.get('ebt-adult-total');
	this.childTotal = YAHOO.util.Dom.get('ebt-child-total');
	this.infantTotal = YAHOO.util.Dom.get('ebt-infant-total');
	this.departPrice = YAHOO.util.Dom.get('ebt-depart-price');
	this.returnPrice = YAHOO.util.Dom.get('ebt-return-price');
	if (YAHOO.util.Dom.get('ebt-best-price-pb-link')) {
		this.tooltipBestPrice = new ToolTip('ebt-best-price-box');
		this.tooltipBestPriceLink = YAHOO.util.Dom.get('ebt-best-price-pb-link');
		YAHOO.util.Event.addListener(this.tooltipBestPriceLink, 'mouseover', this.tooltipBestPrice.show, this.tooltipBestPrice, true);
		YAHOO.util.Event.addListener(this.tooltipBestPriceLink, 'mouseout', this.tooltipBestPrice.hide, this.tooltipBestPrice, true);
	}
}
PriceBreakdown.prototype.toggle = function (e) {
	YAHOO.util.Event.preventDefault(e);
	if (this.opened) {
		this.opened = false;
		this.toggleLink.innerHTML = this.showText;
		YAHOO.util.Dom.removeClass(this.toggleLink, 'hide-price-breakdown');
		this.extendedData.style.display = 'none';
		if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "price_details", "z_ebt_eventplace" : "customize", "z_ebt_event" : "1", "z_ebt_eventvalue" : "close"});
	} else {
		this.opened = true;
		this.toggleLink.innerHTML = this.hideText;
		YAHOO.util.Dom.addClass(this.toggleLink, 'hide-price-breakdown');
		this.extendedData.style.display = 'block';
		if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "price_details", "z_ebt_eventplace" : "customize", "z_ebt_event" : "1", "z_ebt_eventvalue" : "open"});
	}
}
PriceBreakdown.prototype.update = function (prices) {
	if (!prices || prices.length == 0) {
		prices = null;
	}
	if (this.adultPrice) this.adultPrice.innerHTML = prices ? prices[0] : '-';
	if (this.adultTax) this.adultTax.innerHTML = prices ? prices[1] : '-';
	if (this.adultFee) this.adultFee.innerHTML = prices ? prices[2] : '-';
	
	if (this.childPrice) this.childPrice.innerHTML = prices ? prices[3] : '-';
	if (this.childTax) this.childTax.innerHTML = prices ? prices[4] : '-';
	if (this.childFee) this.childFee.innerHTML = prices ? prices[5] : '-';

	if (this.infantPrice) this.infantPrice.innerHTML = prices ? prices[6] : '-';
	if (this.infantTax) this.infantTax.innerHTML = prices ? prices[7] : '-';
	if (this.infantFee) this.infantFee.innerHTML = prices ? prices[8] : '-';
	
	if (this.totalAdultPrice) this.totalAdultPrice.innerHTML = prices ? prices[9] : '-';
	if (this.adultTotal) this.adultTotal.innerHTML = prices ? prices[10] : '-';
	if (this.childTotal) this.childTotal.innerHTML = prices ? prices[11] : '-';
	if (this.infantTotal) this.infantTotal.innerHTML = prices ? prices[12] : '-';
	if (this.totalPriceTop) this.totalPriceTop.innerHTML = prices ? prices[13] : '-';
	if (this.totalPriceBot) this.totalPriceBot.innerHTML = prices ? prices[13] : '-';
	if (this.departPrice) this.departPrice.innerHTML = prices ? prices[14] : '-';
	if (this.returnPrice) this.returnPrice.innerHTML = prices ? prices[15] : '-';
}
// --------------------------------------------------------------------------------------------
//
// PriceBumbMessage component
//
// --------------------------------------------------------------------------------------------
function PriceBumbMessage(page) {
	this.ebtPage = page;
	this.pbText = YAHOO.util.Dom.get('ebt-pb-text').innerHTML;
	this.createPBMDOM();
}
PriceBumbMessage.prototype.createPBMDOM = function () {
	var targetDocument = this.ebtPage.targetDoc;
	this.pbPopupElement = new HTMLNode(targetDocument, 'div', {id:'ebt-pricebumb-message'}, '<div id="ebt-pricebumb-top">&nbsp;</div><p>' + this.pbText + '</p>');
	targetDocument.body.appendChild(this.pbPopupElement);
}
PriceBumbMessage.prototype.show = function () {
	if (this.ebtPage.lightBox) this.ebtPage.lightBox.show();
	var dd = document.documentElement ? document.documentElement : document.body;
	this.pbPopupElement.style.top = (dd.scrollTop + 200) + 'px';
	this.pbPopupElement.style.display = 'block';
	var attributes = {
		opacity: { to: 1 }
	}
	anim = new YAHOO.util.Motion(this.pbPopupElement, attributes,.5, YAHOO.util.Easing.easeOut);
	anim.animate();
	this.timeOut = setTimeout(createContextFunction(this, "close"), 1100);
}
PriceBumbMessage.prototype.close = function () {
	clearTimeout(this.timeOut);
	this.timeOut = -1;
	var attributes = {
		opacity: { to: 0 }
	}
	anim = new YAHOO.util.Motion(this.pbPopupElement, attributes,.5, YAHOO.util.Easing.easeOut);
	anim.pb = this;
	anim.onComplete.subscribe(this.finishClose);
	anim.animate();
	if (this.ebtPage.lightBox) this.ebtPage.lightBox.hide();
}
PriceBumbMessage.prototype.finishClose = function () {
	this.pb.pbPopupElement.style.display = 'none';
}
// --------------------------------------------------------------------------------------------
//
// general functions
//
// --------------------------------------------------------------------------------------------
function createContextFunction(context, method, method2) {
	return (function(x){
		method = (method == "post") ? method2 : method;
		eval("context."+method+"(x)");
		return false;
	});
}
// compare function to compare Arrays
Array.prototype.compare = function(testArr) {
    if (this.length != testArr.length) return false;
    for (var i = 0; i < testArr.length; i++) {
        if (this[i].compare) { 
            if (!this[i].compare(testArr[i])) return false;
        }
        if (this[i] !== testArr[i]) return false;
    }
    return true;
}
/* get, set, and delete cookies */
function getCookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
		return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}
	
function setCookie( name, value, expires, path, domain, secure ) {
	path = '/';
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires ) {
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name+"="+escape( value ) +
		( ( expires ) ? ";expires="+expires_date.toGMTString() : "" ) + //expires.toGMTString()
		( ( path ) ? ";path=" + path : "" ) +
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
}
	
function deleteCookie( name, path, domain ) {
	if ( getCookie( name ) ) document.cookie = name + "=" +
			( ( path ) ? ";path=" + path : "") +
			( ( domain ) ? ";domain=" + domain : "" ) +
			";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

// --------------------------------------------------------------------------------------------
//
// checkoutpage 4 -- confirmation
//
// --------------------------------------------------------------------------------------------
function showConditions () {
	var showConditionsLinks = YAHOO.util.Dom.getElementsByClassName('ebt-show-conditions', 'a', 'left-check-out');
	var showConditionsHTML = YAHOO.util.Dom.getElementsByClassName('cond-popup', 'div', 'left-check-out');
	for (var i = 0; i < showConditionsLinks.length; i++) {
		new ClickToolTip(showConditionsHTML[i], showConditionsLinks[i], 0, -85);
	}
}

// --------------------------------------------------------------------------------------------
//
// Open Jaw
//
// --------------------------------------------------------------------------------------------

function Openjaw (fs) {
	this.flightSearch = fs;
	this.docBody = document.getElementsByTagName('body');
	this.ojCheck = document.getElementById('ebt-open-jaw-opt');
	this.init();
}

Openjaw.prototype.init = function () {
	YAHOO.util.Event.addListener(this.ojCheck, 'click', this.toggleOpenJaw, [this, this.ojCheck], true);
	YAHOO.util.Event.addListener(YAHOO.util.Dom.get('ebt-departure-place'), 'blur', this.prefillFields, [this, this.ojCheck], true);
	
	if (this.ojCheck && this.ojCheck.checked) {
		YAHOO.util.Dom.addClass(document.body, 'open-jaw');
		// prefill fields
		if (YAHOO.util.Dom.get('ebt-airportcode-from-oj').value) YAHOO.util.Dom.get('ebt-from-place-oj').style.color = '#023167';
	}
}
Openjaw.prototype.toggleOpenJaw = function (e, args) {
	var base = args[0];
	var check = args[1];
	
	if(check && check.checked) {
		YAHOO.util.Dom.addClass(document.body, 'open-jaw');
		// prefill fields
		YAHOO.util.Dom.get('ebt-from-place-oj').value = YAHOO.util.Dom.get('ebt-destination-place').value;
		YAHOO.util.Dom.get('ebt-airportcode-from-oj').value = YAHOO.util.Dom.get('ebt-airportcode').value;
		if (YAHOO.util.Dom.get('ebt-airportcode-from-oj').value) YAHOO.util.Dom.get('ebt-from-place-oj').style.color = '#023167';

		YAHOO.util.Dom.get('ebt-airportcode-dest-oj').value = YAHOO.util.Dom.get('ebt-departure-place').options[YAHOO.util.Dom.get('ebt-departure-place').selectedIndex].value;		
		YAHOO.util.Dom.get('ebt-destination-place-oj').value = YAHOO.util.Dom.get('ebt-departure-place').options[YAHOO.util.Dom.get('ebt-departure-place').selectedIndex].text;
		YAHOO.util.Dom.get('ebt-destination-place-oj').style.color = '#023167';
	} else {
		YAHOO.util.Dom.removeClass(document.body, 'open-jaw');
	}
}
function calculateTop(object) {if (object) return object.offsetTop + calculateTop(object.offsetParent); else return 0;}
function calculateLeft(object) {if (object) return object.offsetLeft + calculateLeft(object.offsetParent); else return 0;}
function isChild(ancestor, candidate) {
	while (candidate && candidate != ancestor.parentNode) {
		if (candidate == ancestor) return true;
		candidate = candidate.parentNode;
	}
	return false;
}

// --------------------------------------------------------------------------------------------
//
// EBTCalendar component
//
// --------------------------------------------------------------------------------------------
function EBTCalendar (container, inputBox, dateFormat, defaultDate, minDate, maxDate, months, days, closeText) {
	if (!container) {
		this.container = new HTMLNode(document, 'div', null, '', 'ebt-calendar');
		document.body.appendChild(this.container);
	} else {
		this.container = container;
	}
	this.homepage = true;
	this.closeText = closeText ? closeText : 'close';
	this.closeBut = new HTMLNode(document, 'a', {href:'javascript:;'}, this.closeText, 'close-calendar');
	this.container.appendChild(this.closeBut);
	this.tableContainer = new HTMLNode(document, 'div', {id:'cal' + Math.random()});
	this.container.appendChild(this.tableContainer);
	this.cal = new YAHOO.widget.Calendar('myCal', this.tableContainer.id, {mindate:minDate, maxdate:maxDate});
	this.inputBox = inputBox;
	this.dateFormat = dateFormat;
	this.minDate = minDate;
	this.maxDate = maxDate;
	this.months = months;
	this.days = days;
	this.mover = false;
	this.configDateFormat();
	this.initEvents();
	this.defaultDate = defaultDate;
	if (defaultDate) this.cal.select(this.defaultDate);
}
EBTCalendar.prototype.configDateFormat = function () {
	this.cal.cfg.setProperty("WEEKDAYS_SHORT", this.days);
	this.cal.cfg.setProperty("MONTHS_LONG", this.months);
	var sDate = this.dateFormat.split('/');
	sDate[0] == 'mm' ? this.mPos = 1 : (sDate[1] == 'mm' ? this.mPos = 2 : this.mPos = 3);
	sDate[0] == 'dd' ? this.dPos = 1 : (sDate[1] == 'dd' ? this.dPos = 2 : this.dPos = 3);
	sDate[0].indexOf('yy') != -1 ? this.yPos = 1 : (sDate[1].indexOf('yy') != -1 ? this.yPos = 2 : this.yPos = 3);
	this.cal.cfg.setProperty("MDY_MONTH_POSITION", this.mPos);
	this.cal.cfg.setProperty("MDY_DAY_POSITION", this.dPos);
	this.cal.cfg.setProperty("MDY_YEAR_POSITION", this.yPos);
	this.cal.cfg.setProperty("START_WEEKDAY", 1);
	this.yearShort = sDate[this.yPos-1].length > 2 ? false : true;
}
EBTCalendar.prototype.initEvents = function () {
	YAHOO.util.Event.addListener(this.container, "mouseover", this.overCal, this, true); 
	YAHOO.util.Event.addListener(this.container, "mouseout", this.outCal, this, true); 
	YAHOO.util.Event.addListener(this.inputBox, "focus", this.show, [this, this.inputBox], true); 
	YAHOO.util.Event.addListener(this.closeBut, "click", this.close, this, true); 
	YAHOO.util.Event.addListener(this.inputBox, "keydown", this.close, this, true); 
	YAHOO.util.Event.addListener(this.inputBox, "blur", this.checkEnteredDate, this, true); 
	this.cal.selectEvent.subscribe(this.selectDate, this, true);
	this.cal.renderEvent.subscribe(this.updateCalNavigation, this, true);

	this.dateInputError = new YAHOO.util.CustomEvent("dateError", this);
	this.dateNoError = new YAHOO.util.CustomEvent("dateNoError", this);
}
EBTCalendar.prototype.overCal = function (e) {
	this.mover = true;
}
EBTCalendar.prototype.outCal = function (e) {
	try {if (isChild(this.container, YAHOO.util.Event.resolveTextNode(YAHOO.util.Event.getRelatedTarget(e)))) return} catch(e) {}
	this.mover = false;
}
EBTCalendar.prototype.show = function (e, args) {
	var base = args[0];
	var inputBox = args[1];
	
	if (inputBox.disabled) return;
	if (base.homepage) {
		if (inputBox.id.indexOf('depart') > -1) 
			if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "calendar_departure", "z_ebt_eventplace" : "homepage", "z_ebt_event" : "1"});
		else 
			if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "calendar_return", "z_ebt_eventplace" : "homepage", "z_ebt_event" : "1"});
	}
	if (inputBox) inputBox.select();
	if (base.cal.getSelectedDates().length > 0) {
		base.cal.cfg.setProperty("pagedate", (base.cal.getSelectedDates()[0].getMonth() + 1) + '/' + base.cal.getSelectedDates()[0].getFullYear());
	}
	base.cal.render();
	base.container.style.display = 'block';
	YAHOO.util.Dom.setXY(base.container, [calculateLeft(inputBox) + (document.all ? 2 : 0), calculateTop(inputBox) + 16]);
}
EBTCalendar.prototype.close = function (e) {
	this.mover = false;
	this.container.style.display = 'none';
}
EBTCalendar.prototype.selectDate = function (e, args) {
	var selectedRetDate = args[0][0];
	var selDay = selectedRetDate[2];
	var selMonth = selectedRetDate[1];
	var selYear = selectedRetDate[0];

	selectedDate = selDay + '/' + selMonth + '/' + selYear;
	this.close();
	this.inputBox.value = this.formatDate(selectedDate);
	YAHOO.util.Dom.removeClass(this.inputBox, 'error');
	this.dateNoError.fire(this.inputBox); 
}
EBTCalendar.prototype.formatDate = function (date) {
	var aDate = date.split('/');
	var aFormattedDate = new Array();
	
	aFormattedDate[this.dPos-1] = aDate[0];
	aFormattedDate[this.mPos-1] = aDate[1];
	aFormattedDate[this.yPos-1] = aDate[2];
	if (this.yearShort) aFormattedDate[this.yPos-1] = aFormattedDate[this.yPos-1].substr(2, 2); // show only last 2 characters of year
	var s = aFormattedDate[0] + '/' + aFormattedDate[1] + '/' + aFormattedDate[2];
	
	return s;
}
EBTCalendar.prototype.checkEnteredDate = function (e) {
	if (this.mover) return;
	this.close();
	var dateValues = this.inputBox.value.split('/');
	var day = parseInt(dateValues[this.dPos-1], 10);
	var month = parseInt(dateValues[this.mPos-1], 10);
	var year = parseInt(dateValues[this.yPos-1], 10);
	if (this.yearShort) year += 2000;
	var date = new Date(year, month-1, day);
	if ((date.getMonth() + 1) != month) {
		this.dateInputError.fire(this.inputBox); 
		YAHOO.util.Dom.addClass(this.inputBox, 'error');
		if (this.homepage) {
			if (this.inputBox.id.indexOf('depart') > -1) 
				if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "departure_date_validation", "z_ebt_eventplace" : "homepage", "z_ebt_event" : "1", "z_ebt_eventvalue" : "nonvalid"});
			else 
				if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "return_date_validation", "z_ebt_eventplace" : "homepage", "z_ebt_event" : "1", "z_ebt_eventvalue" : "nonvalid"});
		}
		return false;
	} else {
		this.dateNoError.fire(this.inputBox);
		YAHOO.util.Dom.removeClass(this.inputBox, 'error');
		this.cal.select(date);
		if (this.homepage) {
			if (this.inputBox.id.indexOf('depart') > -1) 
				if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "departure_date_validation", "z_ebt_eventplace" : "homepage", "z_ebt_event" : "1", "z_ebt_eventvalue" : "valid"});
			else 
				if (_metron2) _metron2.measureVariablesAndCommit({"z_ebt_eventtype" : "return_date_validation", "z_ebt_eventplace" : "homepage", "z_ebt_event" : "1", "z_ebt_eventvalue" : "valid"});
		}
		return true;
	}
}
EBTCalendar.prototype.getSelectedDates = function () {
	return this.cal.getSelectedDates();
}
EBTCalendar.prototype.updateCalNavigation = function (e) {
	var mindate = new Date(this.cal.cfg.getProperty("minDate"));
	var maxdate = new Date(this.cal.cfg.getProperty("maxDate"));
	maxdate.setMonth(maxdate.getMonth() - 1);
	if (this.cal.cfg.getProperty("pagedate").getTime() <= mindate.getTime()) {
		YAHOO.util.Dom.getElementsByClassName('calnavleft', 'a', this.cal.oDomContainer)[0].style.display = 'none';
	};
	if (this.cal.cfg.getProperty("pagedate").getTime() > maxdate.getTime()) {
		YAHOO.util.Dom.getElementsByClassName('calnavright', 'a', this.cal.oDomContainer)[0].style.display = 'none';
	};
}
/*
* 2010-01-18 : Migration Version 1
*/

if (top.location != document.location){
	document.domain = 'klm.com';
}
try {
	// var _metron2 = new Metron();
} catch (e) {}


// --------------------------------------------------------------------------------------------
//
// EBTPage component
//
// --------------------------------------------------------------------------------------------
function EBTPage (container) {
	this.container = YAHOO.util.Dom.get(container);
	//this.initShoppingCartText();
	this.resetInputColorStyles();
	//this.initTextDecoration();
	this.canScriptDomain = this.checkScriptingPoss();
	this.browser = this.getBrowser();
	//this.attachCSS('static/css/ebt-elements.css');
	//if (this.browser == 'ie55') this.attachCSS('static/css/ebt-elements-ie.css');
	//if (this.browser == 'ie6') this.attachCSS('static/css/ebt-elements-ie6.css');
	//if (this.browser == 'ie7') this.attachCSS('static/css/ebt-elements-ie7.css');
	//if (this.browser == 'safari') this.attachCSS('static/css/safari.css', document);
	//if (this.canScriptDomain) this.lightBox = new Lightbox(this);
	//the following gives an error in ie6+ , have to ask Cor about this
	if (this.canScriptDomain)
	{
		var klmdoc = YAHOO.util.Dom.get('klm-doc');
		this.lightBox = new LayOver(klmdoc, "lightbox", .4, .5);
	}
}
EBTPage.prototype.checkScriptingPoss = function () {
	try {
		var o = parent.document.body.offsetHeight;
		this.targetDoc = parent.document;
		
		return true;
	} catch (e) {
		this.targetDoc = document;
		
		return false;
	}
}
EBTPage.prototype.getBrowser = function () {
	var ua = navigator.userAgent.toLowerCase();
	if (ua.indexOf('opera')!=-1) { // Opera (check first in case of spoof)
		return 'opera';
	} else if (ua.indexOf('msie 7')!=-1) { // IE7
		return 'ie7';
	} else if (ua.indexOf('msie 6') !=-1) { // IE6
		return 'ie6';
	} else if (ua.indexOf('msie') !=-1) { // IE5.5
		return 'ie55';
	} else if (ua.indexOf('safari')!=-1) { // Safari (check before Gecko because it includes "like Gecko")
		return 'safari';
	} else if (ua.indexOf('gecko') != -1) { // Gecko
		return 'gecko';
	} else {
		return false;
	}
}
EBTPage.prototype.attachCSS = function (css, target) {
	if (target) {
		var headID = target.getElementsByTagName("head")[0];
		var cssNode = target.createElement('link');
	} else {
		var headID = this.targetDoc.getElementsByTagName("head")[0];
		var cssNode = this.targetDoc.createElement('link');
	}
	cssNode.type = 'text/css';
	cssNode.rel = 'stylesheet';
	cssNode.href = '$JUNCTION/$COUNTRY_CODE_$LANGUAGE_CODE/' + css;
	cssNode.media = 'screen, print';
	headID.appendChild(cssNode);
}

//do not display shopping cart text if local shop present
EBTPage.prototype.initShoppingCartText = function () {
	var lsText = YAHOO.util.Dom.getElementsByClassName('local-shop'); 
	var scDisplay = YAHOO.util.Dom.get('shopping-cart-text');
	var bpIcon = YAHOO.util.Dom.getElementsByClassName('best-price');
	
	if (lsText[0]) {
		YAHOO.util.Dom.addClass(scDisplay,'shopping-cart-nodisplay');
		YAHOO.util.Dom.removeClass(scDisplay,'shopping-cart-display');		
		
	} else {
		YAHOO.util.Dom.addClass(scDisplay,'shopping-cart-display');
		YAHOO.util.Dom.removeClass(scDisplay,'shopping-cart-nodisplay');
		
		// move best price upwards
		YAHOO.util.Dom.setStyle(bpIcon[0], 'top', '0px');
	}	
	
	// if shopping cart visible, keep best price in place
	var scClass = YAHOO.util.Dom.getElementsByClassName('shopping-cart');	
	var scStyle = YAHOO.util.Dom.getStyle(scClass, 'display');
	if ((scDisplay[0]) && (scStyle != 'none')) {
		YAHOO.util.Dom.setStyle(bpIcon[0], 'top', '25px');
	}
}


// reset textcolor on focus inputboxes
EBTPage.prototype.resetInputColorStyles = function() {
	
	YAHOO.util.Event.addListener("ebt-destination-place", "focus", function () {this.style.color = '#003145'});
	YAHOO.util.Event.addListener("ebt-departure-date", "focus",  function () {this.style.color = '#003145'});
	YAHOO.util.Event.addListener("ebt-return-date", "focus",  function () {this.style.color = '#003145'});
}


EBTPage.prototype.initTextDecoration = function() {
	
	//if (this.browser == 'ie6') {
		YAHOO.util.Event.addListener("ebt-children-tooltiplink", "mouseover", function () {this.style.textDecoration = 'underline'});
		YAHOO.util.Event.addListener("ebt-children-tooltiplink", "mouseout", function () {this.style.textDecoration = 'none'});
	//}
}

// clear inputfield on focus
EBTPage.prototype.clearTextField = function() {
		YAHOO.util.Event.addListener("ebt-destination-place", "focus", function () {this.value = ""});
}
/*
* 2010-01-18 : Migration Version 1
* 2010-01-29 : Seeta : Added priority 3 for airport name 
*/
var EBTAutocomplete = function (inputField, data, airportcode_field) {
	this.ACDS = null;
	this.data = new Array();
	this.airportcode_field = YAHOO.util.Dom.get(airportcode_field);

	
	if(YAHOO.lang.isObject(inputField))
		this.input = inputField;
	else
		this.input = YAHOO.util.Dom.get(inputField);
	
	if(!this.input.title){
		this.input.title = this.input.value;
	}
	
	this.defaultText = this.input.title;
	
	YAHOO.util.Event.addListener(this.input, 'focus', this.onFieldFocus, this);
	YAHOO.util.Event.addListener(this.input, "focus", this.autoHelptip, this, true); 
	YAHOO.util.Event.addListener(this.input, 'blur', this.onFieldBlur, this);
	YAHOO.util.Event.addListener(this.input, "keyup", this.onInputKeyUp, this); 

		
	this.datacontainer = YAHOO.util.Dom.get(this.input.id + '-container');
	if(!this.datacontainer){
		this.datacontainer = document.createElement('div');
		this.datacontainer.id = this.input.id + '-container';
		YAHOO.util.Dom.insertAfter(this.datacontainer, this.input);
	}
	
	YAHOO.util.Dom.addClass(this.input, "waiting");
	this.input.disabled = "disabled";
	this.ACDS = new YAHOO.widget.DS_JSFunction(this.getMatches, {scope: this});
	this.loadRecords(data); 
	
	this.autocomplete = new YAHOO.widget.AutoComplete(this.input, this.datacontainer, this.ACDS);
	this.autocomplete.queryDelay = 0;
	this.autocomplete.maxResultsDisplayed = 100;
	this.autocomplete.formatResult = this.formatResult;
	this.autocomplete.obj = this;
	this.autocomplete.itemSelectEvent.subscribe(this.onSelect);
	this.autocomplete.dataReturnEvent.subscribe(this.onDataReturn);
}

EBTAutocomplete.prototype.autoHelptip = function (e) {
    if (YAHOO.util.Dom.get('ebt-autosuggest-helptip') != null)
	{
		YAHOO.util.Dom.addClass('ebt-autosuggest-helptip', 'on'); 
		var parentXY;
		if (YAHOO.util.Dom.get('db_ebt7_content') != null){
			parentXY = YAHOO.util.Dom.getXY(YAHOO.util.Dom.get('db_ebt7_content'));
		}
		var helptip = YAHOO.util.Dom.get('ebt-autosuggest-helptip');
		if ( typeof MINIBOOKINGTOOL == "undefined" || !MINIBOOKINGTOOL) {
			YAHOO.util.Dom.setStyle(helptip, 'left', (YAHOO.util.Dom.getX(this.input) - parentXY[0]) - 6 + 'px');
			YAHOO.util.Dom.setStyle(helptip, 'top', (YAHOO.util.Dom.getY(this.input) - parentXY[1] + parseInt(this.input.offsetHeight, 10) - 1) + 'px');
		}
		var helptipLink = YAHOO.util.Dom.getElementsByClassName("helptip-link", "a", helptip)[0];
            switch(YAHOO.util.Event.getTarget(e).id) {
                case "ebt-destination-place": helptipLink.id = "autoHelptip-od-link";
					break;
			    case "ebt-from-place-oj": helptipLink.id = "autoHelptip-io-link";
					break;
				case "ebt-destination-place-oj": helptipLink.id = "autoHelptip-id-link"; 
                 }
    }
}
EBTAutocomplete.prototype.onDataReturn = function (e, args) {
	var autoComplete = args[0];
	var query = args[1];
	var results = args[2];
	var error = YAHOO.util.Dom.get('ebt-destination-place-error');
	if (results.length == 0 && query.length > 2)  {
		YAHOO.util.Dom.addClass(autoComplete._oTextbox, 'error');
        if (error != null)
		{
			YAHOO.util.Dom.addClass('ebt-autosuggest-helptip', 'error');
			YAHOO.util.Dom.addClass('ebt-autosuggest-helptip', 'on');
			YAHOO.util.Dom.addClass('ebt-destination-place', 'error');
			error.style.display = 'block';
		}
		return;
	}
	YAHOO.util.Dom.removeClass(autoComplete._oTextbox, 'error');
    if (error != null)
	{
		YAHOO.util.Dom.removeClass('ebt-autosuggest-helptip', 'error');
		YAHOO.util.Dom.removeClass('ebt-destination-place', 'error');
		error.style.display = 'none';
		if (results.length > 0 && query.length > 2)  {
			YAHOO.util.Dom.removeClass('ebt-autosuggest-helptip', 'on');
			error.style.display = 'none';
		}else {
			YAHOO.util.Dom.addClass('ebt-autosuggest-helptip', 'on');
		}
	}
}


EBTAutocomplete.prototype.onSelect = function (e, args) {
	var base = args[0];
	var record = args[2];

	base.obj.input.value = record[0] + ' - ' + record[3] + ' (' + record[4] + '), ';
	if(record[1] != ''){ //Display state and country.
		base.obj.input.value = base.obj.input.value + record[1] + ', ' + record[2];
	}else{ //display country only, no state available.
		base.obj.input.value = base.obj.input.value + record[2];
	}
	base.obj.airportcode_field.value = record[4]; //airportCode;
	//YAHOO.util.Dom.removeClass(YAHOO.util.Dom.get('ebt-autosuggest-helptip'), 'on');
	base.obj.input.blur();
}


EBTAutocomplete.prototype.onInputKeyUp = function(e, obj){
	obj.airportcode_field.value = obj.input.value;
}


EBTAutocomplete.prototype.onFieldFocus = function(e, obj){
	var field = YAHOO.util.Event.getTarget(e);
	if(field.value == field.title){
		field.value = '';
		field.style.color = '#023167';
	}
}

EBTAutocomplete.prototype.formatResult = function(oResultData, sQuery, sResultMatch){
	var city = oResultData[0];
	var state = oResultData[1];
	var country = oResultData[2];
	var airport = oResultData[3];
	var airportCode = oResultData[4];
	var cityGroup = oResultData[5];
	var numberOf = oResultData[6];
	
	sQuery = unescape(sQuery);		
	// highlight (<strong>) searchquery in resultlist
	var regExp = new RegExp("(.*)(" + sQuery + ")(.*)", "i");
	city = city.replace(regExp, '$1<strong>$2</strong>$3');
	if (state) state = state.replace(regExp, '$1<strong>$2</strong>$3');
	country = country.replace(regExp, '$1<strong>$2</strong>$3');
	airport = airport.replace(regExp, '$1<strong>$2</strong>$3');
	airportCode = airportCode.replace(regExp, '$1<strong>$2</strong>$3');
	if (cityGroup) {
		airportCode = numberOf;
	}
	// return markup for ac-suggestions
	var sMarkup = city;
	// add state if available
	sMarkup += ' - ' + airport + ' (' + airportCode + ')';
	sMarkup += state ? ", " + state + ", " : ", "; 
	sMarkup += country 
	// if airportgroup, make italic;
	if (cityGroup) sMarkup = '<i>' + sMarkup + '</i>';
	
	return (sMarkup);
}

EBTAutocomplete.prototype.onFieldBlur = function(e, obj){
	var field = YAHOO.util.Event.getTarget(e);
	if(field.value == ''){
		field.value = field.title;
		field.style.color = '#CACACA';
	}
	YAHOO.util.Dom.removeClass('ebt-autosuggest-helptip', 'on');
}

EBTAutocomplete.prototype.loadXML = function(xmlFile){
	var callback = { 
		success: this.parseData, 
		failure: this.handleFailure,
		scope: this
	};
	var sXMLData = YAHOO.util.Connect.asyncRequest('GET', xmlFile, callback, null);
}


EBTAutocomplete.prototype.loadRecords = function(data){
	var record;
	for(var i = 0; i < data.length; i++){
		record = new Array();
		record[0] = data[i].city; // City
		record[1] = data[i].state; // State
		record[2] = data[i].country; // Country
		record[3] = data[i].name; // Airportname
		record[4] = data[i].code; // AirportCode
		record[5] = data[i].group; // grouping name
		if (record[5]) {
			record[6] = data[i].numberof; // Number of airports in this group
		}
		this.data.push(record);
	}
	YAHOO.util.Dom.removeClass(this.input, "waiting");
	this.input.disabled = "";
}

EBTAutocomplete.prototype.parseData = function(o){
	var records = o.responseXML.getElementsByTagName('Airport');
	var record;

	for (var i = 0; i < records.length; i++) {
		record = new Array();
		record[0] = records[i].childNodes[0].nodeValue; //general name

		record[0] = records[i].getAttribute("city"); // City
		record[1] = records[i].getAttribute("state"); // State
		record[2] = records[i].getAttribute("country"); // Country
		record[3] = records[i].getAttribute("name"); // Airportname
		record[4] = records[i].getAttribute("code"); // AirportCode
		record[5] = records[i].getAttribute("group"); // grouping name
		if (record[5]) {
			record[6] = records[i].getAttribute("numberof"); // Number of airports in this group
		}
		this.data.push(record);
	}
}

EBTAutocomplete.prototype.handleFailure = function(o){
	
}

EBTAutocomplete.prototype.getMatches = function(sQuery){
	sQuery = unescape(sQuery);
	var aResults = [];
	if (sQuery.length < 3) return aResults;
	// priority array; defines order to show results: airportcode, airportname, city, state, country
	// var priority = [0,5, 4, 1, 2, 3, 6];
	// only check the general name, the city, the airport name, the airportcode and the group name
	var data = this.data;
	var priority = [0,3,4,1,6,2,5];
	var exp = "(.*)(" + sQuery + ")(.*)";
	var regExp = new RegExp(exp, "i");
	
	for (var i = 0; i < data.length; i++) {
		for (var j = 0; j < data[i].length; j++) {
			if (regExp.test(data[i][priority[j]])) {
				aResults.push(data[i]);
				aResults[aResults.length - 1][8] = j;
				break;
			}
		}
	};

	aResults.sort(this.acSort);
	return (this.sortABC(aResults));
}

EBTAutocomplete.prototype.sortABC = function(results){
	var arSorted = new Array();
	var arSub = new Array();
	if (results[0])	var group = results[0][8];

	for (var i = 0; i < results.length; i++) {
		if (results[i][8] == group) {
			arSub[arSub.length] = results[i]
		} else {
			arSub.sort(this.initialSort);
			arSorted = arSorted.concat(arSub);
			arSub = new Array();
			arSub[arSub.length] = results[i]
			group = results[i][8];
		}
	}
	arSub.sort(this.initialSort);
	arSorted = arSorted.concat(arSub);
	
	return arSorted;
}

EBTAutocomplete.prototype.acSort = function(a, b){
	if (parseInt(a[8], 10) >= parseInt(b[8], 10)) return 1;
	if (parseInt(a[8], 10) < parseInt(b[8], 10)) return -1;
	return 0;
}

EBTAutocomplete.prototype.initialSort = function(a, b){
	if (a[0] >= b[0]) return 1;
	return -1;
}
/*
* 2010-01-18 : Migration Version 1
*/

DateLib = {};
//
// This method return the number of days for a given month in a given year, taking leap years into account.
//
// year     : integer representing the year
// month    : integer representing the month (>= 1 and <= 12) for which the number of days should be returned
//
DateLib.getNrDaysInMonth = function(year, month) {
    var months = { 1:31, 2:undefined, 3:31, 4:30, 5:31, 6:30, 7:31, 8:31, 9:30, 10:31, 11:30, 12:31 };
    if (IsNull(year) || IsNull(month) || month < 1 || month > 12) 
        return 0;
    months["2"] = ((year % 4 == 0) ^ (year % 100 == 0) ^ (year % 400 == 0)) ? 29 : 28;
    return months[parseInt(month, 10)];
}
//
// Parse a value representing a date to a valid Date instance.
//
// date : a valid Date instance or a string formatted as: "yyyymmdd".
//
DateLib.parse = function(value)
{
    if (value instanceof Date)
    {
        return value;
    }
    else if ((typeof(value) == "string" || typeof(value) == "number") && value.toString().length == 8)
    {
        value = value.toString();
    
        var date = new Date();
        date.setFullYear(parseInt(value.substring(0,4), 10), parseInt(value.substring(4,6), 10), parseInt(value.substring(6,8), 10));
        date.setHours(0,0,0,0);

        return date;
    }
    return null;
}
//
// Checks if a given value represents a valid date
//
// date : a valid Date instance or a string formatted as: "yyyymmdd"
//
DateLib.isDate = function(value) { 
    return !IsNull(value) && (value instanceof Date || DateLib.parse(value)); 
}
/*
* 2010-01-18 : Migration Version 1
* 2010-02-09 : Siawash, Change the expires date cookie
*/

var FFP = function(){
	//Containers
	this.oContainer = YAHOO.util.Dom.get('ffp');
	this.oTeaserBox = YAHOO.util.Dom.get('body-basic');
	this.oLoginBox = YAHOO.util.Dom.get('body-cookie');
	this.oLoggedInBox = YAHOO.util.Dom.get('body-loggedin');
	
	//Form elements
	this.oForm = YAHOO.util.Dom.get('ffp_login');
	this.oSuccessUrl = YAHOO.util.Dom.get('ffp-successUrl');
	this.oActionUrl = YAHOO.util.Dom.get('ffp-actionUrl');
	this.oUsername = YAHOO.util.Dom.get('ffp-number');
	this.oPassword = YAHOO.util.Dom.get('ffp-pincode');
	this.oRemember = YAHOO.util.Dom.get('ffp-remember');
	
	this.oButton = YAHOO.util.Dom.get('btn-login-ffp');
	this.oLoginButton = YAHOO.util.Dom.get('btn-ffp-show-login');
	this.oLogoutButton = YAHOO.util.Dom.get('btn-ffp-logout');
	
	//Placeholders
	this.oFFPHeader = YAHOO.util.Dom.get('ffp_level');
	this.oNamePH = YAHOO.util.Dom.get('ffp_name');
	this.oMilesPH = YAHOO.util.Dom.get('ffp_miles');
	
	this.oLoadingContainer = YAHOO.util.Dom.get('ffp_loading');
	this.oFlightContainer = YAHOO.util.Dom.get('customer-flight');
	
	
	this.oActionForm = YAHOO.util.Dom.get('klm-form');
	this.oActionFormLogonType = YAHOO.util.Dom.get('logonType');
	this.oActionFormSuccessUrl = YAHOO.util.Dom.get('successUrl');
	this.oActionFormActionUrl = YAHOO.util.Dom.get('actionUrl');
	this.oActionFormUsername = YAHOO.util.Dom.get('id');

	this.isPopup = YAHOO.util.Dom.hasClass(YAHOO.util.Dom.get('klm-doc'), 'popup');

	this.hasActionForm = false;
	
	if(!this.oActionForm){
		this.oActionForm = document.forms['klm-form'];
	}

	if(this.oActionForm && this.oActionFormSuccessUrl && this.oActionFormActionUrl && this.oActionFormLogonType){
		if(this.oActionFormLogonType.value == 'FB'){
			this.hasActionForm = true;
		}
	}
	
	this.logged_in = false;

	if(!this.oForm){
		this.oForm = document.forms['ffp_login'];
	}

	if (this.oSuccessUrl && this.oSuccessUrl.value == "") this.oSuccessUrl.value = window.location.pathname;	 
	if (this.oActionUrl && this.oActionUrl.value == "") this.oActionUrl.value = window.location.pathname;
	this.userdata = null;
	
	try{
		this.userdata = fb_customer;
		if(this.userdata){
			this.logged_in = true;
		}
	}catch(e){}
	
	this.username = YAHOO.util.Cookie.get("ffp");
	if(!this.username) this.username = "";
	
	if(this.oForm){
		if(this.oForm.action.indexOf('http') != 0){
			this.oForm.action = 'https://' + location.host + this.oForm.action;
		} else if(this.oForm.action.indexOf('https') != 0){
			this.oForm.action = this.oForm.action.replace('http', 'https');
		}

		if(this.oLogoutButton.href.indexOf('http') != 0){
			this.oLogoutButton.href = 'https://' + location.host + this.oLogoutButton.href;
		} else if(this.oLogoutButton.href.indexOf('https') != 0){
			this.oLogoutButton.href = this.oLogoutButton.href.replace('http', 'https');
		}

		YAHOO.util.Event.addListener(this.oButton, 'click', this.login, this);
		YAHOO.util.Event.addListener(this.oLoginButton, 'click', this.showLogin, this);
		YAHOO.util.Event.addListener(this.oLogoutButton, 'click', this.logout, this);
		YAHOO.util.Event.addListener(this.oUsername, 'keyup', this.login, this);
		YAHOO.util.Event.addListener(this.oPassword, 'keyup', this.login, this);
	}
	this.errorHandler = new ErrorHandler({container: YAHOO.util.Dom.getElementsByClassName('c24')[0], from: this, id: 'form-error-box'});

	this.init();
	
	if(this.hasActionForm){
		this.initActionForm();
	}
}

FFP.prototype.initActionForm = function(){
	if(!this.isPopup){
		this.oActionFormActionUrl.value = this.oActionUrl.value;
	}else{
		this.oActionFormActionUrl.value = window.location;
		this.oActionFormSuccessUrl.value = window.location;
		if(this.logged_in){
			if(window.opener.parent){
				var url = unescape(this.getQSVar('forwardurl'));
				if(url.indexOf('?') >= 0){
					url = url + '&';
				}else{
					url = url + '?';
				}
				url = url + 'BV_SessionID=' + this.userdata.SessionID + '&BV_EngineID=' + this.userdata.EngineID + '&FBSessionID=' + this.userdata.SessionID + '&FBCloneID=' + this.userdata.EngineID;
				window.opener.parent.location.href = url;
				window.close();
			}
		}
	}
	this.oActionFormUsername.value = this.oUsername.value;
}

FFP.prototype.getQSVar = function(varname) {
  hu = window.location.search.substring(1);
  gy = hu.split("&");
  returnValue = null;
  for (i=0;i<gy.length;i++) {
    ft = gy[i].split("=");
    if (ft[0] == varname) {
      returnValue = ft[1];
    }
  }
  return returnValue;
}

FFP.prototype.init = function(){
	var result = this.getQSVar('result');
	if(result){
		this.errorHandler.addMessage(this.getMessage(result));
	}
	if(this.getQSVar('succesUrl') != null && this.getQSVar('succesUrl') != ''){
		if(this.oForm){
			this.oSuccessUrl.value = this.getQSVar('succesUrl');
		}
		if(this.oActionFormSuccessUrl){
			this.oActionFormSuccessUrl.value = this.getQSVar('succesUrl');
		}
	}else if(this.getQSVar('successUrl') != null && this.getQSVar('successUrl') != ''){
		if(this.oForm){
			this.oSuccessUrl.value = this.getQSVar('successUrl');
		}
		if(this.oActionFormSuccessUrl){
			this.oActionFormSuccessUrl.value = this.getQSVar('successUrl');
		}
	}
	if(this.oForm){
		if(!this.hasActionForm){
			if(this.userdata){
				this.logged_in = true;
				this.handleData();
			}else if(this.username){
				this.handleLogin();
			}else{
				this.handleTeaser();
			}
		}else{
			this.oContainer.style.display = 'none';
		}
	}
}

FFP.prototype.getMessage = function(resultCode){
	var oErrorContainer = YAHOO.util.Dom.get('ffp-error-' + resultCode);
	if(!oErrorContainer){
		oErrorContainer = YAHOO.util.Dom.get('ffp-error-0');
	}
	return oErrorContainer.innerHTML;
}

FFP.prototype.login = function(e, obj){
	if ( (e.type == 'keyup' && e.keyCode == 13) || e.type == 'click' ) {
		YAHOO.util.Event.preventDefault(e);
		if(obj.oRemember.checked){
			var now = new Date();
			now.setFullYear(now.getFullYear() + 1);
			YAHOO.util.Cookie.set("ffp", obj.oUsername.value, { 
				path: "/",
				domain: "klm.com",
				expires: now
			}); 
		}
		obj.oForm.submit();
	}
}

FFP.prototype.logout = function(e, obj){
	YAHOO.util.Event.preventDefault(e);
	obj.oForm.action = obj.oLogoutButton.href;
	YAHOO.util.Cookie.remove('jffp', {path: '/', secure: true});
	obj.oForm.submit();

}

FFP.prototype.showLogin = function(e, obj){
	YAHOO.util.Event.preventDefault(e);
	obj.handleLogin();
}

FFP.prototype.handleTeaser = function(){
	this.oTeaserBox.style.display = 'block';
	this.oLoginBox.style.display = 'none';
	if(this.oLoggedInBox) this.oLoggedInBox.style.display = 'none';
}

FFP.prototype.handleLogin = function(){
	this.oTeaserBox.style.display = 'none';
	this.oLoginBox.style.display = 'block';
	if(this.oLoggedInBox) this.oLoggedInBox.style.display = 'none';
	this.oUsername.value = this.username;
}

FFP.prototype.handleData = function(){
	var sLevel = "Ivory";
	var sClass = "ivory";
	this.oTeaserBox.style.display = 'none';
	this.oLoginBox.style.display = 'none';
	if(this.oLoggedInBox){
		this.oLoggedInBox.style.display = 'block';

		if(this.userdata.Gender == "M"){
			this.oNamePH.innerHTML = 'Mr. ' + this.userdata.FirstName + ' ' + this.userdata.LastName;
		} else {
			this.oNamePH.innerHTML = 'Mrs. ' + this.userdata.FirstName + ' ' + this.userdata.LastName;
		}

		if(this.userdata.CreditMiles){
			this.oMilesPH.innerHTML = this.userdata.CreditMiles;
		}else{
			this.oMilesPH.innerHTML = 0;
		}
		
		switch(this.userdata.Tier){
			case '1': sLevel = "Ivory"; break;
			case '2': sLevel = "Silver"; break;
			case '3': sLevel = "Platinum"; break;
			case '4': sLevel = "Ivory"; break;
			case '5': sLevel = "Ivory"; break;
			case '6': sLevel = "Gold"; break;
			case '7': sLevel = "Platinum"; break;
			case 'A': sLevel = "Ivory"; break;
			case 'B': sLevel = "Silver"; break;
			case 'C': sLevel = "Platinum"; break;
			case 'J': sLevel = "Ivory"; break;
			case 'M': sLevel = "Platinum"; break;
			case 'P': sLevel = "Ivory"; break;
			case 'R': sLevel = "Gold"; break;
		}

		if (this.userdata.MemberType.toLowerCase() == 'c2') sLevel = "Club 2000";
			
		this.oFFPHeader.className = sLevel.toLowerCase().replace(' ', '');
		this.oFFPHeader.innerHTML = sLevel;
		
		YAHOO.util.Cookie.set('jffp', 'BV_SessionID=' + this.userdata.SessionID + '&BV_EngineID=' + this.userdata.EngineID + '&FBSessionID=' + this.userdata.SessionID + '&FBCloneID=' + this.userdata.EngineID, { 
			path: "/",
			domain: "klm.com",
			secure: true
		});
		
		this.getFlightInfo();
		
	}
}

FFP.prototype.getQueryValue = function(varname){
	var q = window.location.search.substring(1);
	var arrQ = q.split("&");
	var returnValue = null;
	
	for (i=0;i < arrQ.length;i++) {
		keyValuePair = arrQ[i].split("=");
		if (keyValuePair[0] == varname) {
			returnValue = keyValuePair[1];
		}
	}
	return returnValue;
}

FFP.prototype.getFlightInfo = function(){
	var request = {
		COUNTRY : countryCode,
		LANG: languageCode,
		POS: countryCode,
		type : 'mmb-traveldata',
		BV_SessionID : this.userdata.SessionID,
		BV_EngineID : this.userdata.EngineID,
		context : 'getNextBookings'
	};
	
	var widget = new Widget(request, {success: this.HandleResponse, failure: this.ErrorHandler, argument: this});
	widget.Post();
}

FFP.prototype.ErrorHandler = function(response){
	response.argument.oLoadingContainer.style.display = 'none';
}

FFP.prototype.HandleResponse = function(response){
	response.argument.oLoadingContainer.style.display = 'none';
	if(response && !response.responseText.match('</html>')){
		response.argument.oFlightContainer.innerHTML = response.responseText;
	}
}


YAHOO.util.Event.onDOMReady(function(){
		window.ffp = new FFP();
});
/*
* 2010-01-18 : Migration Version 1
*/

var Widget = function(request, callback){
	this.widgetBrokerUrl = '/commercial/widgetbroker/widgetbroker';
	this.request = request;
	
	this.callback = callback;
	
	this.transaction = null;
}

Widget.prototype.Get = function(){
	this.transaction = YAHOO.util.Connect.asyncRequest('GET', this.widgetBrokerUrl + '?' + this._getQueryString(), this.callback, null);
}

Widget.prototype.Post = function(){
	this.transaction = YAHOO.util.Connect.asyncRequest('POST', this.widgetBrokerUrl, this.callback, this._getQueryString());
}

Widget.prototype._getQueryString = function(){
	var queryString = "";
	var iCount = 1;
	for(var key in this.request){
		if(iCount == 1)
			queryString = key + '=' + this.request[key];
		else
			queryString = queryString + '&' + key + '=' + this.request[key];
		iCount++;
	}
	return queryString;
}
