// ETWP Javascript Minimiser 1.5.0.0

// Included: D:\Shared\Replicated\Shared_JS\jQuery\1.3.2\jquery-1.3.2.min.js
// Included: D:\Shared\Replicated\Shared_JS\swfobject\2.0\swfobject.js
// Included: D:\Shared\Replicated\Shared_JS\ufo\3.22\ufo.js
// Included: D:\Shared\Replicated\Shared_JS\NewMind\1.0.2\core-min.js
// Included: D:\Shared\Replicated\Shared_JS\jQuery\plugins\jquery.flyTo.js
// Included: D:\Shared\Replicated\Shared_JS\jQuery\plugins\jquery.color.js
// Included: D:\Shared\Replicated\Shared_JS\jquery\plugins\blockui\jquery.blockui.min.js
// Included: D:\Shared\Replicated\Shared_JS\jQuery\plugins\calendar\jquery.date.js
// Included: D:\Shared\Replicated\Shared_JS\jQuery\plugins\calendar\jquery.bgiframe.js
// Included: D:\Shared\Replicated\Shared_JS\jquery\ui\1.7.3\ui\minified\ui.datepicker.min.js
// Included: D:\Shared\Replicated\Shared_JS\NewMind\1.0.2\SlfCatAvailUI.js
// Included: D:\Shared\Replicated\Shared_JS\Mapstraction\0.0.155nm\mapstraction-min.js
// Included: D:\Shared\Replicated\Shared_JS\jscoord\jscoord-1.1.1nm-min.js
// Included: D:\Shared\Replicated\Shared_JS\NewMind\1.0.2\mapping-min.js
// Included: D:\Shared\Replicated\Shared_JS\NewMind\1.0.2\mapping.tourism-min.js

/*
 * jQuery JavaScript Library v1.3.2
 * http://jquery.com/
 *
 * Copyright (c) 2009 John Resig
 * Dual licensed under the MIT and GPL licenses.
 * http://docs.jquery.com/License
 *
 * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
 * Revision: 6246
 */
(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
/*
 * 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 R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();


/*	SWFObject v2.0 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject=function(){var Z="undefined",P="object",B="Shockwave Flash",h="ShockwaveFlash.ShockwaveFlash",W="application/x-shockwave-flash",K="SWFObjectExprInst",G=window,g=document,N=navigator,f=[],H=[],Q=null,L=null,T=null,S=false,C=false;var a=function(){var l=typeof g.getElementById!=Z&&typeof g.getElementsByTagName!=Z&&typeof g.createElement!=Z&&typeof g.appendChild!=Z&&typeof g.replaceChild!=Z&&typeof g.removeChild!=Z&&typeof g.cloneNode!=Z,t=[0,0,0],n=null;if(typeof N.plugins!=Z&&typeof N.plugins[B]==P){n=N.plugins[B].description;if(n){n=n.replace(/^.*\s+(\S+\s+\S+$)/,"$1");t[0]=parseInt(n.replace(/^(.*)\..*$/,"$1"),10);t[1]=parseInt(n.replace(/^.*\.(.*)\s.*$/,"$1"),10);t[2]=/r/.test(n)?parseInt(n.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof G.ActiveXObject!=Z){var o=null,s=false;try{o=new ActiveXObject(h+".7")}catch(k){try{o=new ActiveXObject(h+".6");t=[6,0,21];o.AllowScriptAccess="always"}catch(k){if(t[0]==6){s=true}}if(!s){try{o=new ActiveXObject(h)}catch(k){}}}if(!s&&o){try{n=o.GetVariable("$version");if(n){n=n.split(" ")[1].split(",");t=[parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10)]}}catch(k){}}}}var v=N.userAgent.toLowerCase(),j=N.platform.toLowerCase(),r=/webkit/.test(v)?parseFloat(v.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,i=false,q=j?/win/.test(j):/win/.test(v),m=j?/mac/.test(j):/mac/.test(v);/*@cc_on i=true;@if(@_win32)q=true;@elif(@_mac)m=true;@end@*/return{w3cdom:l,pv:t,webkit:r,ie:i,win:q,mac:m}}();var e=function(){if(!a.w3cdom){return }J(I);if(a.ie&&a.win){try{g.write("<script id=__ie_ondomload defer=true src=//:><\/script>");var i=c("__ie_ondomload");if(i){i.onreadystatechange=function(){if(this.readyState=="complete"){this.parentNode.removeChild(this);V()}}}}catch(j){}}if(a.webkit&&typeof g.readyState!=Z){Q=setInterval(function(){if(/loaded|complete/.test(g.readyState)){V()}},10)}if(typeof g.addEventListener!=Z){g.addEventListener("DOMContentLoaded",V,null)}M(V)}();function V(){if(S){return }if(a.ie&&a.win){var m=Y("span");try{var l=g.getElementsByTagName("body")[0].appendChild(m);l.parentNode.removeChild(l)}catch(n){return }}S=true;if(Q){clearInterval(Q);Q=null}var j=f.length;for(var k=0;k<j;k++){f[k]()}}function J(i){if(S){i()}else{f[f.length]=i}}function M(j){if(typeof G.addEventListener!=Z){G.addEventListener("load",j,false)}else{if(typeof g.addEventListener!=Z){g.addEventListener("load",j,false)}else{if(typeof G.attachEvent!=Z){G.attachEvent("onload",j)}else{if(typeof G.onload=="function"){var i=G.onload;G.onload=function(){i();j()}}else{G.onload=j}}}}}function I(){var l=H.length;for(var j=0;j<l;j++){var m=H[j].id;if(a.pv[0]>0){var k=c(m);if(k){H[j].width=k.getAttribute("width")?k.getAttribute("width"):"0";H[j].height=k.getAttribute("height")?k.getAttribute("height"):"0";if(O(H[j].swfVersion)){if(a.webkit&&a.webkit<312){U(k)}X(m,true)}else{if(H[j].expressInstall&&!C&&O("6.0.65")&&(a.win||a.mac)){D(H[j])}else{d(k)}}}}else{X(m,true)}}}function U(m){var k=m.getElementsByTagName(P)[0];if(k){var p=Y("embed"),r=k.attributes;if(r){var o=r.length;for(var n=0;n<o;n++){if(r[n].nodeName.toLowerCase()=="data"){p.setAttribute("src",r[n].nodeValue)}else{p.setAttribute(r[n].nodeName,r[n].nodeValue)}}}var q=k.childNodes;if(q){var s=q.length;for(var l=0;l<s;l++){if(q[l].nodeType==1&&q[l].nodeName.toLowerCase()=="param"){p.setAttribute(q[l].getAttribute("name"),q[l].getAttribute("value"))}}}m.parentNode.replaceChild(p,m)}}function F(i){if(a.ie&&a.win&&O("8.0.0")){G.attachEvent("onunload",function(){var k=c(i);if(k){for(var j in k){if(typeof k[j]=="function"){k[j]=function(){}}}k.parentNode.removeChild(k)}})}}function D(j){C=true;var o=c(j.id);if(o){if(j.altContentId){var l=c(j.altContentId);if(l){L=l;T=j.altContentId}}else{L=b(o)}if(!(/%$/.test(j.width))&&parseInt(j.width,10)<310){j.width="310"}if(!(/%$/.test(j.height))&&parseInt(j.height,10)<137){j.height="137"}g.title=g.title.slice(0,47)+" - Flash Player Installation";var n=a.ie&&a.win?"ActiveX":"PlugIn",k=g.title,m="MMredirectURL="+G.location+"&MMplayerType="+n+"&MMdoctitle="+k,p=j.id;if(a.ie&&a.win&&o.readyState!=4){var i=Y("div");p+="SWFObjectNew";i.setAttribute("id",p);o.parentNode.insertBefore(i,o);o.style.display="none";G.attachEvent("onload",function(){o.parentNode.removeChild(o)})}R({data:j.expressInstall,id:K,width:j.width,height:j.height},{flashvars:m},p)}}function d(j){if(a.ie&&a.win&&j.readyState!=4){var i=Y("div");j.parentNode.insertBefore(i,j);i.parentNode.replaceChild(b(j),i);j.style.display="none";G.attachEvent("onload",function(){j.parentNode.removeChild(j)})}else{j.parentNode.replaceChild(b(j),j)}}function b(n){var m=Y("div");if(a.win&&a.ie){m.innerHTML=n.innerHTML}else{var k=n.getElementsByTagName(P)[0];if(k){var o=k.childNodes;if(o){var j=o.length;for(var l=0;l<j;l++){if(!(o[l].nodeType==1&&o[l].nodeName.toLowerCase()=="param")&&!(o[l].nodeType==8)){m.appendChild(o[l].cloneNode(true))}}}}}return m}function R(AE,AC,q){var p,t=c(q);if(typeof AE.id==Z){AE.id=q}if(a.ie&&a.win){var AD="";for(var z in AE){if(AE[z]!=Object.prototype[z]){if(z=="data"){AC.movie=AE[z]}else{if(z.toLowerCase()=="styleclass"){AD+=' class="'+AE[z]+'"'}else{if(z!="classid"){AD+=" "+z+'="'+AE[z]+'"'}}}}}var AB="";for(var y in AC){if(AC[y]!=Object.prototype[y]){AB+='<param name="'+y+'" value="'+AC[y]+'" />'}}t.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AD+">"+AB+"</object>";F(AE.id);p=c(AE.id)}else{if(a.webkit&&a.webkit<312){var AA=Y("embed");AA.setAttribute("type",W);for(var x in AE){if(AE[x]!=Object.prototype[x]){if(x=="data"){AA.setAttribute("src",AE[x])}else{if(x.toLowerCase()=="styleclass"){AA.setAttribute("class",AE[x])}else{if(x!="classid"){AA.setAttribute(x,AE[x])}}}}}for(var w in AC){if(AC[w]!=Object.prototype[w]){if(w!="movie"){AA.setAttribute(w,AC[w])}}}t.parentNode.replaceChild(AA,t);p=AA}else{var s=Y(P);s.setAttribute("type",W);for(var v in AE){if(AE[v]!=Object.prototype[v]){if(v.toLowerCase()=="styleclass"){s.setAttribute("class",AE[v])}else{if(v!="classid"){s.setAttribute(v,AE[v])}}}}for(var u in AC){if(AC[u]!=Object.prototype[u]&&u!="movie"){E(s,u,AC[u])}}t.parentNode.replaceChild(s,t);p=s}}return p}function E(k,i,j){var l=Y("param");l.setAttribute("name",i);l.setAttribute("value",j);k.appendChild(l)}function c(i){return g.getElementById(i)}function Y(i){return g.createElement(i)}function O(k){var j=a.pv,i=k.split(".");i[0]=parseInt(i[0],10);i[1]=parseInt(i[1],10);i[2]=parseInt(i[2],10);return(j[0]>i[0]||(j[0]==i[0]&&j[1]>i[1])||(j[0]==i[0]&&j[1]==i[1]&&j[2]>=i[2]))?true:false}function A(m,j){if(a.ie&&a.mac){return }var l=g.getElementsByTagName("head")[0],k=Y("style");k.setAttribute("type","text/css");k.setAttribute("media","screen");if(!(a.ie&&a.win)&&typeof g.createTextNode!=Z){k.appendChild(g.createTextNode(m+" {"+j+"}"))}l.appendChild(k);if(a.ie&&a.win&&typeof g.styleSheets!=Z&&g.styleSheets.length>0){var i=g.styleSheets[g.styleSheets.length-1];if(typeof i.addRule==P){i.addRule(m,j)}}}function X(k,i){var j=i?"visible":"hidden";if(S){c(k).style.visibility=j}else{A("#"+k,"visibility:"+j)}}return{registerObject:function(l,i,k){if(!a.w3cdom||!l||!i){return }var j={};j.id=l;j.swfVersion=i;j.expressInstall=k?k:false;H[H.length]=j;X(l,false)},getObjectById:function(l){var i=null;if(a.w3cdom&&S){var j=c(l);if(j){var k=j.getElementsByTagName(P)[0];if(!k||(k&&typeof j.SetVariable!=Z)){i=j}else{if(typeof k.SetVariable!=Z){i=k}}}}return i},embedSWF:function(n,u,r,t,j,m,k,p,s){if(!a.w3cdom||!n||!u||!r||!t||!j){return }r+="";t+="";if(O(j)){X(u,false);var q=(typeof s==P)?s:{};q.data=n;q.width=r;q.height=t;var o=(typeof p==P)?p:{};if(typeof k==P){for(var l in k){if(k[l]!=Object.prototype[l]){if(typeof o.flashvars!=Z){o.flashvars+="&"+l+"="+k[l]}else{o.flashvars=l+"="+k[l]}}}}J(function(){R(q,o,u);if(q.id==u){X(u,true)}})}else{if(m&&!C&&O("6.0.65")&&(a.win||a.mac)){X(u,false);J(function(){var i={};i.id=i.altContentId=u;i.width=r;i.height=t;i.expressInstall=m;D(i)})}}},getFlashPlayerVersion:function(){return{major:a.pv[0],minor:a.pv[1],release:a.pv[2]}},hasFlashPlayerVersion:O,createSWF:function(k,j,i){if(a.w3cdom&&S){return R(k,j,i)}else{return undefined}},createCSS:function(j,i){if(a.w3cdom){A(j,i)}},addDomLoadEvent:J,addLoadEvent:M,getQueryParamValue:function(m){var l=g.location.search||g.location.hash;if(m==null){return l}if(l){var k=l.substring(1).split("&");for(var j=0;j<k.length;j++){if(k[j].substring(0,k[j].indexOf("="))==m){return k[j].substring((k[j].indexOf("=")+1))}}}return""},expressInstallCallback:function(){if(C&&L){var i=c(K);if(i){i.parentNode.replaceChild(L,i);if(T){X(T,true);if(a.ie&&a.win){L.style.display="block"}}L=null;T=null;C=false}}}}}();


/*	Unobtrusive Flash Objects (UFO) v3.22 <http://www.bobbyvandersluis.com/ufo/>
	Copyright 2005-2007 Bobby van der Sluis
	This software is licensed under the CC-GNU LGPL <http://creativecommons.org/licenses/LGPL/2.1/>
*/

var UFO = {
	req: ["movie", "width", "height", "majorversion", "build"],
	opt: ["play", "loop", "menu", "quality", "scale", "salign", "wmode", "bgcolor", "base", "flashvars", "devicefont", "allowscriptaccess", "seamlesstabbing", "allowfullscreen", "allownetworking"],
	optAtt: ["id", "name", "align"],
	optExc: ["swliveconnect"],
	ximovie: "ufo.swf",
	xiwidth: "215",
	xiheight: "138",
	ua: navigator.userAgent.toLowerCase(),
	pluginType: "",
	fv: [0,0],
	foList: [],
		
	create: function(FO, id) {
		if (!UFO.uaHas("w3cdom") || UFO.uaHas("ieMac")) return;
		UFO.getFlashVersion();
		UFO.foList[id] = UFO.updateFO(FO);
		UFO.createCSS("#" + id, "visibility:hidden;");
		UFO.domLoad(id);
	},

	updateFO: function(FO) {
		if (typeof FO.xi != "undefined" && FO.xi == "true") {
			if (typeof FO.ximovie == "undefined") FO.ximovie = UFO.ximovie;
			if (typeof FO.xiwidth == "undefined") FO.xiwidth = UFO.xiwidth;
			if (typeof FO.xiheight == "undefined") FO.xiheight = UFO.xiheight;
		}
		FO.mainCalled = false;
		return FO;
	},

	domLoad: function(id) {
		var _t = setInterval(function() {
			if ((document.getElementsByTagName("body")[0] != null || document.body != null) && document.getElementById(id) != null) {
				UFO.main(id);
				clearInterval(_t);
			}
		}, 250);
		if (typeof document.addEventListener != "undefined") {
			document.addEventListener("DOMContentLoaded", function() { UFO.main(id); clearInterval(_t); } , null); // Gecko, Opera 9+
		}
	},

	main: function(id) {
		var _fo = UFO.foList[id];
		if (_fo.mainCalled) return;
		UFO.foList[id].mainCalled = true;
		document.getElementById(id).style.visibility = "hidden";
		if (UFO.hasRequired(id)) {
			if (UFO.hasFlashVersion(parseInt(_fo.majorversion, 10), parseInt(_fo.build, 10))) {
				if (typeof _fo.setcontainercss != "undefined" && _fo.setcontainercss == "true") UFO.setContainerCSS(id);
				UFO.writeSWF(id);
			}
			else if (_fo.xi == "true" && UFO.hasFlashVersion(6, 65)) {
				UFO.createDialog(id);
			}
		}
		document.getElementById(id).style.visibility = "visible";
	},
	
	createCSS: function(selector, declaration) {
		var _h = document.getElementsByTagName("head")[0]; 
		var _s = UFO.createElement("style");
		if (!UFO.uaHas("ieWin")) _s.appendChild(document.createTextNode(selector + " {" + declaration + "}")); // bugs in IE/Win
		_s.setAttribute("type", "text/css");
		_s.setAttribute("media", "screen"); 
		_h.appendChild(_s);
		if (UFO.uaHas("ieWin") && document.styleSheets && document.styleSheets.length > 0) {
			var _ls = document.styleSheets[document.styleSheets.length - 1];
			if (typeof _ls.addRule == "object") _ls.addRule(selector, declaration);
		}
	},
	
	setContainerCSS: function(id) {
		var _fo = UFO.foList[id];
		var _w = /%/.test(_fo.width) ? "" : "px";
		var _h = /%/.test(_fo.height) ? "" : "px";
		UFO.createCSS("#" + id, "width:" + _fo.width + _w +"; height:" + _fo.height + _h +";");
		if (_fo.width == "100%") {
			UFO.createCSS("body", "margin-left:0; margin-right:0; padding-left:0; padding-right:0;");
		}
		if (_fo.height == "100%") {
			UFO.createCSS("html", "height:100%; overflow:hidden;");
			UFO.createCSS("body", "margin-top:0; margin-bottom:0; padding-top:0; padding-bottom:0; height:100%;");
		}
	},

	createElement: function(el) {
		return (UFO.uaHas("xml") && typeof document.createElementNS != "undefined") ?  document.createElementNS("http://www.w3.org/1999/xhtml", el) : document.createElement(el);
	},

	createObjParam: function(el, aName, aValue) {
		var _p = UFO.createElement("param");
		_p.setAttribute("name", aName);	
		_p.setAttribute("value", aValue);
		el.appendChild(_p);
	},

	uaHas: function(ft) {
		var _u = UFO.ua;
		switch(ft) {
			case "w3cdom":
				return (typeof document.getElementById != "undefined" && typeof document.getElementsByTagName != "undefined" && (typeof document.createElement != "undefined" || typeof document.createElementNS != "undefined"));
			case "xml":
				var _m = document.getElementsByTagName("meta");
				var _l = _m.length;
				for (var i = 0; i < _l; i++) {
					if (/content-type/i.test(_m[i].getAttribute("http-equiv")) && /xml/i.test(_m[i].getAttribute("content"))) return true;
				}
				return false;
			case "ieMac":
				return /msie/.test(_u) && !/opera/.test(_u) && /mac/.test(_u);
			case "ieWin":
				return /msie/.test(_u) && !/opera/.test(_u) && /win/.test(_u);
			case "gecko":
				return /gecko/.test(_u) && !/applewebkit/.test(_u);
			case "opera":
				return /opera/.test(_u);
			case "safari":
				return /applewebkit/.test(_u);
			default:
				return false;
		}
	},
	
	getFlashVersion: function() {
		if (UFO.fv[0] != 0) return;  
		if (navigator.plugins && typeof navigator.plugins["Shockwave Flash"] == "object") {
			UFO.pluginType = "npapi";
			var _d = navigator.plugins["Shockwave Flash"].description;
			if (typeof _d != "undefined") {
				_d = _d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
				var _m = parseInt(_d.replace(/^(.*)\..*$/, "$1"), 10);
				var _r = /r/.test(_d) ? parseInt(_d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
				UFO.fv = [_m, _r];
			}
		}
		else if (window.ActiveXObject) {
			UFO.pluginType = "ax";
			try { // avoid fp 6 crashes
				var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
			}
			catch(e) {
				try { 
					var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
					UFO.fv = [6, 0];
					_a.AllowScriptAccess = "always"; // throws if fp < 6.47 
				}
				catch(e) {
					if (UFO.fv[0] == 6) return;
				}
				try {
					var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
				}
				catch(e) {}
			}
			if (typeof _a == "object") {
				var _d = _a.GetVariable("$version"); // bugs in fp 6.21/6.23
				if (typeof _d != "undefined") {
					_d = _d.replace(/^\S+\s+(.*)$/, "$1").split(",");
					UFO.fv = [parseInt(_d[0], 10), parseInt(_d[2], 10)];
				}
			}
		}
	},

	hasRequired: function(id) {
		var _l = UFO.req.length;
		for (var i = 0; i < _l; i++) {
			if (typeof UFO.foList[id][UFO.req[i]] == "undefined") return false;
		}
		return true;
	},
	
	hasFlashVersion: function(major, release) {
		return (UFO.fv[0] > major || (UFO.fv[0] == major && UFO.fv[1] >= release)) ? true : false;
	},

	writeSWF: function(id) {
		var _fo = UFO.foList[id];
		var _e = document.getElementById(id);
		if (UFO.pluginType == "npapi") {
			if (UFO.uaHas("gecko") || UFO.uaHas("xml")) {
				while(_e.hasChildNodes()) {
					_e.removeChild(_e.firstChild);
				}
				var _obj = UFO.createElement("object");
				_obj.setAttribute("type", "application/x-shockwave-flash");
				_obj.setAttribute("data", _fo.movie);
				_obj.setAttribute("width", _fo.width);
				_obj.setAttribute("height", _fo.height);
				var _l = UFO.optAtt.length;
				for (var i = 0; i < _l; i++) {
					if (typeof _fo[UFO.optAtt[i]] != "undefined") _obj.setAttribute(UFO.optAtt[i], _fo[UFO.optAtt[i]]);
				}
				var _o = UFO.opt.concat(UFO.optExc);
				var _l = _o.length;
				for (var i = 0; i < _l; i++) {
					if (typeof _fo[_o[i]] != "undefined") UFO.createObjParam(_obj, _o[i], _fo[_o[i]]);
				}
				_e.appendChild(_obj);
			}
			else {
				var _emb = "";
				var _o = UFO.opt.concat(UFO.optAtt).concat(UFO.optExc);
				var _l = _o.length;
				for (var i = 0; i < _l; i++) {
					if (typeof _fo[_o[i]] != "undefined") _emb += ' ' + _o[i] + '="' + _fo[_o[i]] + '"';
				}
				_e.innerHTML = '<embed type="application/x-shockwave-flash" src="' + _fo.movie + '" width="' + _fo.width + '" height="' + _fo.height + '" pluginspage="http://www.macromedia.com/go/getflashplayer"' + _emb + '></embed>';
			}
		}
		else if (UFO.pluginType == "ax") {
			var _objAtt = "";
			var _l = UFO.optAtt.length;
			for (var i = 0; i < _l; i++) {
				if (typeof _fo[UFO.optAtt[i]] != "undefined") _objAtt += ' ' + UFO.optAtt[i] + '="' + _fo[UFO.optAtt[i]] + '"';
			}
			var _objPar = "";
			var _l = UFO.opt.length;
			for (var i = 0; i < _l; i++) {
				if (typeof _fo[UFO.opt[i]] != "undefined") _objPar += '<param name="' + UFO.opt[i] + '" value="' + _fo[UFO.opt[i]] + '" />';
			}
			var _p = window.location.protocol == "https:" ? "https:" : "http:";
			_e.innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + _objAtt + ' width="' + _fo.width + '" height="' + _fo.height + '" codebase="' + _p + '//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + _fo.majorversion + ',0,' + _fo.build + ',0"><param name="movie" value="' + _fo.movie + '" />' + _objPar + '</object>';
		}
	},
		
	createDialog: function(id) {
		var _fo = UFO.foList[id];
		UFO.createCSS("html", "height:100%; overflow:hidden;");
		UFO.createCSS("body", "height:100%; overflow:hidden;");
		UFO.createCSS("#xi-con", "position:absolute; left:0; top:0; z-index:1000; width:100%; height:100%; background-color:#fff; filter:alpha(opacity:75); opacity:0.75;");
		UFO.createCSS("#xi-dia", "position:absolute; left:50%; top:50%; margin-left: -" + Math.round(parseInt(_fo.xiwidth, 10) / 2) + "px; margin-top: -" + Math.round(parseInt(_fo.xiheight, 10) / 2) + "px; width:" + _fo.xiwidth + "px; height:" + _fo.xiheight + "px;");
		var _b = document.getElementsByTagName("body")[0];
		var _c = UFO.createElement("div");
		_c.setAttribute("id", "xi-con");
		var _d = UFO.createElement("div");
		_d.setAttribute("id", "xi-dia");
		_c.appendChild(_d);
		_b.appendChild(_c);
		var _mmu = window.location;
		if (UFO.uaHas("xml") && UFO.uaHas("safari")) {
			var _mmd = document.getElementsByTagName("title")[0].firstChild.nodeValue = document.getElementsByTagName("title")[0].firstChild.nodeValue.slice(0, 47) + " - Flash Player Installation";
		}
		else {
			var _mmd = document.title = document.title.slice(0, 47) + " - Flash Player Installation";
		}
		var _mmp = UFO.pluginType == "ax" ? "ActiveX" : "PlugIn";
		var _uc = typeof _fo.xiurlcancel != "undefined" ? "&xiUrlCancel=" + _fo.xiurlcancel : "";
		var _uf = typeof _fo.xiurlfailed != "undefined" ? "&xiUrlFailed=" + _fo.xiurlfailed : "";
		UFO.foList["xi-dia"] = { movie:_fo.ximovie, width:_fo.xiwidth, height:_fo.xiheight, majorversion:"6", build:"65", flashvars:"MMredirectURL=" + _mmu + "&MMplayerType=" + _mmp + "&MMdoctitle=" + _mmd + _uc + _uf };
		UFO.writeSWF("xi-dia");
	},

	expressInstallCallback: function() {
		var _b = document.getElementsByTagName("body")[0];
		var _c = document.getElementById("xi-con");
		_b.removeChild(_c);
		UFO.createCSS("body", "height:auto; overflow:auto;");
		UFO.createCSS("html", "height:auto; overflow:auto;");
	},

	cleanupIELeaks: function() {
		var _o = document.getElementsByTagName("object");
		var _l = _o.length;
		for (var i = 0; i < _l; i++) {
			_o[i].style.display = "none";
			for (var x in _o[i]) {
				if (typeof _o[i][x] == "function") {
					_o[i][x] = null;
				}
			}
		}
	}

};

if (typeof window.attachEvent != "undefined" && UFO.uaHas("ieWin")) {
	window.attachEvent("onunload", UFO.cleanupIELeaks);
}



var NewMind=NewMind||{};NewMind.extend=function(B,C){if(!C||!B){throw new Error("NewMind.extend failed, please check that all dependencies are included.")}var A=function(){};A.prototype=C.prototype;B.prototype=new A();B.prototype.constructor=B;B.superclass=C.prototype;if(C.prototype.constructor==Object.prototype.constructor){C.prototype.constructor=C}B.prototype.superclass=C};NewMind.correctFloatError=function(C){var B=6;if(arguments.length>1){B=arguments[1]}var A=Math.pow(10,B);return Math.round(A*C)/A};NewMind.bind=function(B,A){return function(){return B.apply(A,arguments)}};NewMind.mergeWith=function(C,A){if(typeof (A)==="string"){arguments.callee.call(this,C,A.split("."))}else{if(typeof (A)==="object"&&A.constructor===Array){var D=A.shift();if(!this.hasOwnProperty(D)){this[D]={}}if(A.length>0){arguments.callee.call(this[D],C,A)}else{arguments.callee.call(this[D],C)}}else{for(var B in C){if(C.hasOwnProperty(B)){if(typeof this[B]==="undefined"||C[B].constructor!==Object){this[B]=C[B]}else{if(this[B].constructor!==Object){throw ("Type missmatch")}else{arguments.callee.call(this[B],C[B])}}}}}}};NewMind.merge=function(C,A,B){NewMind.mergeWith.call(C,A,B)};NewMind.countProps=function(C,A){var D=0;for(var B in C){if((typeof (A)!=="undefined"&&A)||C.hasOwnProperty(B)){D++}}return D};NewMind.registerNameSpace=function(){var E=null;for(var F=0;F<arguments.length;F++){var D=arguments[F];if(D){var B=window;var A=(""+D).split(".");for(var C=0;C<A.length;C++){var G=A[C];B[G]=B[G]||{};B=B[G]}E=B}}return E};NewMind.CustomEvent=function(C){var B=[];var A=null;if(arguments.length>1){A=arguments[1]}this.subscribe=function(F){var D=A;var E=null;if(arguments.length>1){E=arguments[1]}if(arguments.length>2&&arguments[2]===true){D=E}B.push({f:F,s:D,v:E})};this.fire=function(){for(var D=0;D<B.length;D++){B[D].f.apply(B[D].s,[C,arguments,B[D].v])}}};NewMind.correctPNG=function(){for(var G=0;G<document.images.length;G=G+1){var D=document.images[G];var F=D.src.toUpperCase();if(F.substring(F.length-3,F.length)==="PNG"){var B=D.id?"id='"+D.id+"' ":"";var E=D.className?"class='"+D.className+"' ":"";var H=D.title?"title='"+D.title+"' ":"title='"+D.alt+"' ";var C="display:inline-block;"+D.style.cssText;if(D.align==="left"){C="float:left;"+C}if(D.align==="right"){C="float:right;"+C}if(D.parentElement.href){C="cursor:hand;"+C}var A="<span "+B+E+H;A+=' style="width:'+D.width+"px; height:"+D.height+"px;"+C+";";A+="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader";A+="(src='"+D.src+"', sizingMethod='scale');\"></span>";D.outerHTML=A;G=G-1}}};NewMind.registerNameSpace("NewMind.dom");NewMind.dom.getTopRelTo=function(B,A){return NewMind.dom.getSumOfValsUpTree(B,A,"offsetParent","offsetTop")};NewMind.dom.getLeftRelTo=function(B,A){return NewMind.dom.getSumOfValsUpTree(B,A,"offsetParent","offsetLeft")};NewMind.dom.getSumOfValsUpTree=function(E,C,B,A){var D=0;if(B=="offsetParent"&&C==document.body){C=null}while(E[B]!==C&&E[B]!==null){D+=E[A];E=E[B]}return D};NewMind.dom.addEventListener=function(C,A,B){if(arguments.length>3){var D=arguments[3];handler=function(E){B(E,D)}}else{handler=B}if(typeof window.addEventListener!="undefined"){C.addEventListener(A,handler,false)}else{if(typeof document.addEventListener!="undefined"){C.addEventListener(A,handler,false)}else{if(typeof window.attachEvent!="undefined"){C.attachEvent("on"+A,handler)}}}};NewMind.dom.getEventSource=function(B){var A=B.currentTarget||B.target||B.srcElement;if(A&&3==A.nodeType){return A.parentNode}else{return A}};NewMind.dom.addFormChangeEvent=function(A){A.nmChanged=new NewMind.CustomEvent();var C=A.elements;for(var D=0;D<C.length;D++){var B=C[D].getAttribute("type");if(!(B=="hidden"||B=="submit"||B=="reset")){NewMind.dom.addEventListener(C[D],"focus",NewMind.dom.handleInputFocus);NewMind.dom.addEventListener(C[D],"blur",NewMind.dom.handleInputBlur)}}};NewMind.dom.handleInputFocus=function(B){var A=NewMind.dom.getEventSource(B);if(A.type=="checkbox"||A.type=="radio"){A.oldValue=A.checked}else{A.oldValue=A.value}};NewMind.dom.handleInputBlur=function(B){var A=NewMind.dom.getEventSource(B);if(A.type=="checkbox"||A.type=="radio"){if(A.oldValue!==A.checked){A.form.nmChanged.fire(A)}}else{if(A.oldValue!==A.value){A.form.nmChanged.fire(A)}}};NewMind.GetQuerystringData=function(B){var I;if(typeof (B)=="string"){I=B}else{I=String(document.location)}if(I.indexOf("#")!==-1){I=I.substring(0,I.indexOf("#"))}function K(){this.get=function(O){return this[String(O).toLowerCase()]};this.set=function(O,P){this[String(O).toLowerCase()]=(P===null?null:String(P))};this.remove=function(O){this[String(O).toLowerCase()]=0};this.toString=function(){var P="";for(strProp in this){if(strProp==strProp.toLowerCase()){var O=this[strProp];if((String(typeof (O))==="string")||(O===null)){if(P===""){P="?"}else{P+="&"}P+=strProp;if(O!==null){P+="="+O}}}}return P}}var A=new K();if(I.indexOf("?")!==-1){I=I.substring(I.indexOf("?")+1);var N=I.split("&");var G=[];for(var M=0;M<N.length;M++){var E=N[M];var H=E.indexOf("=");var J,L;if(H==-1){J=E;L=null}else{J=E.substring(0,H);L=E.substring(H+1)}var D=false;for(var C=0;C<G.length;C++){if(G[C].name===J.toLowerCase()){G[C].value+=","+L;D=true;break}}if(!D){G.push({name:J.toLowerCase(),value:L})}}for(var F=0;F<G.length;F++){A[G[F].name]=G[F].value}}return A};


(function(){
	
/**
 * jQuery plugin to animate some element moving to the location of another element
 * @author Derek Fowler
 * $('.ep_Add').eq(0).flyTo('#excursionHelp');
 * 
 * $('.ep_Add').flyTo('#excursionHelp').queue(function () {
 *     $(this).remove();
 *     $(this).dequeue();
 * });
 *
 */

jQuery.fn.flyTo = function(selector, settings) {
	settings = jQuery.extend({
		clone: true,
		opacity: 0.5,
		duration: 2000,
		finishHidden: true
	}, settings);
	

	var toReturn = null;
	
	var destinationOfMove = jQuery(selector).get(0);
	
	if(destinationOfMove) {
		var destTop = getSumOfValsUpTree(destinationOfMove, document.body, 'offsetParent', 'offsetTop');
		var destLeft = getSumOfValsUpTree(destinationOfMove, document.body, 'offsetParent', 'offsetLeft');
						
		toReturn = this.map(function(){
			
			var startTop = getSumOfValsUpTree(this, document.body, 'offsetParent', 'offsetTop');
			var startLeft = getSumOfValsUpTree(this, document.body, 'offsetParent', 'offsetLeft');
			
			var thingToMove;
			if(settings.clone) {
				thingToMove = jQuery(this).clone();
			}
			else {
				thingToMove = jQuery(this).remove();
			}
			
			thingToMove.css('position', 'absolute');
			thingToMove.css('top', startTop + 'px');
			thingToMove.css('left', startLeft + 'px');
			thingToMove.css('opacity', settings.opacity);
									
			thingToMove.appendTo(document.body);
						
			thingToMove.animate({ top: destTop + 'px', left: destLeft + 'px' }, settings.duration );
			
			if(settings.finishHidden) {
				thingToMove.queue(function () {
	 				$(this).remove();
	 				$(this).dequeue();
				});
			}
			
			return thingToMove.get(0);
			
		});
		
	}
	
	// return an empty jQuery object if we've nothing to return
	if(toReturn === null){
		toReturn = jQuery();
	}
	return toReturn;
	
};

function getSumOfValsUpTree(elmFrom, elmAncestor, strParentProp, strPropToSum) {
	var s = 0;
	/*
	 * IE's root level offset parent is HTML, not BODY
	 * so if we're looking for offset relative to the
	 * page then just let it run to null.
	 */
	if(strParentProp == 'offsetParent' && elmAncestor == document.body) {
		elmAncestor = null;
	}
	while(elmFrom[strParentProp] !== elmAncestor && elmFrom[strParentProp] !== null) {
		s += elmFrom[strPropToSum];
		elmFrom = elmFrom[strParentProp];
	}
	return s;
}

})();


/*
 * jQuery Color Animations
 * Copyright 2007 John Resig
 * Released under the MIT and GPL licenses.
 */

(function(jQuery){

	// We override the animation for all of these color styles
	jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
		jQuery.fx.step[attr] = function(fx){
			if ( fx.state == 0 ) {
				fx.start = getColor( fx.elem, attr );
				fx.end = getRGB( fx.end );
			}

			fx.elem.style[attr] = "rgb(" + [
				Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
				Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
				Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
			].join(",") + ")";
		}
	});

	// Color Conversion functions from highlightFade
	// By Blair Mitchelmore
	// http://jquery.offput.ca/highlightFade/

	// Parse strings looking for color tuples [255,255,255]
	function getRGB(color) {
		var result;

		// Check if we're already dealing with an array of colors
		if ( color && color.constructor == Array && color.length == 3 )
			return color;

		// Look for rgb(num,num,num)
		if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
			return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];

		// Look for rgb(num%,num%,num%)
		if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
			return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];

		// Look for #a0b1c2
		if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
			return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];

		// Look for #fff
		if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
			return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];

		// Otherwise, we're most likely dealing with a named color
		return colors[jQuery.trim(color).toLowerCase()];
	}
	
	function getColor(elem, attr) {
		var color;

		do {
			color = jQuery.curCSS(elem, attr);

			// Keep going until we find an element that has color, or we hit the body
			if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
				break; 

			attr = "backgroundColor";
		} while ( elem = elem.parentNode );

		return getRGB(color);
	};
	
	// Some named colors to work with
	// From Interface by Stefan Petre
	// http://interface.eyecon.ro/

	var colors = {
		aqua:[0,255,255],
		azure:[240,255,255],
		beige:[245,245,220],
		black:[0,0,0],
		blue:[0,0,255],
		brown:[165,42,42],
		cyan:[0,255,255],
		darkblue:[0,0,139],
		darkcyan:[0,139,139],
		darkgrey:[169,169,169],
		darkgreen:[0,100,0],
		darkkhaki:[189,183,107],
		darkmagenta:[139,0,139],
		darkolivegreen:[85,107,47],
		darkorange:[255,140,0],
		darkorchid:[153,50,204],
		darkred:[139,0,0],
		darksalmon:[233,150,122],
		darkviolet:[148,0,211],
		fuchsia:[255,0,255],
		gold:[255,215,0],
		green:[0,128,0],
		indigo:[75,0,130],
		khaki:[240,230,140],
		lightblue:[173,216,230],
		lightcyan:[224,255,255],
		lightgreen:[144,238,144],
		lightgrey:[211,211,211],
		lightpink:[255,182,193],
		lightyellow:[255,255,224],
		lime:[0,255,0],
		magenta:[255,0,255],
		maroon:[128,0,0],
		navy:[0,0,128],
		olive:[128,128,0],
		orange:[255,165,0],
		pink:[255,192,203],
		purple:[128,0,128],
		violet:[128,0,128],
		red:[255,0,0],
		silver:[192,192,192],
		white:[255,255,255],
		yellow:[255,255,0]
	};
	
})(jQuery);



/*
* jQuery blockUI plugin
* Version 2.14 (18-JAN-2009)
* @requires jQuery v1.2.3 or later
*
* Examples at: http://malsup.com/jquery/block/
* Copyright (c) 2007-2008 M. Alsup
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
* 
* Thanks to Amir-Hossein Sobhi for some excellent contributions!
*/

;(function($){if(/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery)||/^1.1/.test($.fn.jquery)){alert('blockUI requires jQuery v1.2.3 or later!  You are using v'+$.fn.jquery);return;}$.fn._fadeIn=$.fn.fadeIn;var noOp=function(){};var mode=document.documentMode||0;var setExpr=$.browser.msie&&(($.browser.version<8&&!mode)||mode<8);var ie6=$.browser.msie&&/MSIE6.0/.test(navigator.userAgent)&&!mode;$.blockUI=function(opts){install(window,opts);};$.unblockUI=function(opts){remove(window,opts);};$.growlUI=function(title,message,timeout,onClose){var $m=$('<div class="growlUI"></div>');if(title)$m.append('<h1>'+title+'</h1>');if(message)$m.append('<h2>'+message+'</h2>');if(timeout==undefined)timeout=3000;$.blockUI({message:$m,fadeIn:700,fadeOut:1000,centerY:false,timeout:timeout,showOverlay:false,onUnblock:onClose,css:$.blockUI.defaults.growlCSS});};$.fn.block=function(opts){return this.unblock({fadeOut:0}).each(function(){if($.css(this,'position')=='static')this.style.position='relative';if($.browser.msie)this.style.zoom=1;install(this,opts);});};$.fn.unblock=function(opts){return this.each(function(){remove(this,opts);});};$.blockUI.version=2.39;$.blockUI.defaults={message:'<h1>Please wait...</h1>',title:null,draggable:true,theme:false,css:{padding:0,margin:0,width:'30%',top:'40%',left:'35%',textAlign:'center',color:'#000',border:'3px solid #aaa',backgroundColor:'#fff',cursor:'wait'},themedCSS:{width:'30%',top:'40%',left:'35%'},overlayCSS:{backgroundColor:'#000',opacity:0.6,cursor:'wait'},growlCSS:{width:'350px',top:'10px',left:'',right:'10px',border:'none',padding:'5px',opacity:0.6,cursor:'default',color:'#fff',backgroundColor:'#000','-webkit-border-radius':'10px','-moz-border-radius':'10px','border-radius':'10px'},iframeSrc:/^https/i.test(window.location.href||'')?'javascript:false':'about:blank',forceIframe:false,baseZ:1000,centerX:true,centerY:true,allowBodyStretch:true,bindEvents:true,constrainTabKey:true,fadeIn:200,fadeOut:400,timeout:0,showOverlay:true,focusInput:true,applyPlatformOpacityRules:true,onBlock:null,onUnblock:null,quirksmodeOffsetHack:4,blockMsgClass:'blockMsg'};var pageBlock=null;var pageBlockEls=[];function install(el,opts){var full=(el==window);var msg=opts&&opts.message!==undefined?opts.message:undefined;opts=$.extend({},$.blockUI.defaults,opts||{});opts.overlayCSS=$.extend({},$.blockUI.defaults.overlayCSS,opts.overlayCSS||{});var css=$.extend({},$.blockUI.defaults.css,opts.css||{});var themedCSS=$.extend({},$.blockUI.defaults.themedCSS,opts.themedCSS||{});msg=msg===undefined?opts.message:msg;if(full&&pageBlock)remove(window,{fadeOut:0});if(msg&&typeof msg!='string'&&(msg.parentNode||msg.jquery)){var node=msg.jquery?msg[0]:msg;var data={};$(el).data('blockUI.history',data);data.el=node;data.parent=node.parentNode;data.display=node.style.display;data.position=node.style.position;if(data.parent)data.parent.removeChild(node);}$(el).data('blockUI.onUnblock',opts.onUnblock);var z=opts.baseZ;var lyr1=($.browser.msie||opts.forceIframe)?$('<iframe class="blockUI" style="z-index:'+(z++)+';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>'):$('<div class="blockUI" style="display:none"></div>');var lyr2=opts.theme?$('<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+(z++)+';display:none"></div>'):$('<div class="blockUI blockOverlay" style="z-index:'+(z++)+';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');var lyr3,s;if(opts.theme&&full){s='<div class="blockUI '+opts.blockMsgClass+' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:fixed">'+'<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title||'&nbsp;')+'</div>'+'<div class="ui-widget-content ui-dialog-content"></div>'+'</div>';}else if(opts.theme){s='<div class="blockUI '+opts.blockMsgClass+' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:absolute">'+'<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title||'&nbsp;')+'</div>'+'<div class="ui-widget-content ui-dialog-content"></div>'+'</div>';}else if(full){s='<div class="blockUI '+opts.blockMsgClass+' blockPage" style="z-index:'+(z+10)+';display:none;position:fixed"></div>';}else{s='<div class="blockUI '+opts.blockMsgClass+' blockElement" style="z-index:'+(z+10)+';display:none;position:absolute"></div>';}lyr3=$(s);if(msg){if(opts.theme){lyr3.css(themedCSS);lyr3.addClass('ui-widget-content');}else lyr3.css(css);}if(!opts.theme&&(!opts.applyPlatformOpacityRules||!($.browser.mozilla&&/Linux/.test(navigator.platform))))lyr2.css(opts.overlayCSS);lyr2.css('position',full?'fixed':'absolute');if($.browser.msie||opts.forceIframe)lyr1.css('opacity',0.0);var layers=[lyr1,lyr2,lyr3],$par=full?$('body'):$(el);$.each(layers,function(){this.appendTo($par);});if(opts.theme&&opts.draggable&&$.fn.draggable){lyr3.draggable({handle:'.ui-dialog-titlebar',cancel:'li'});}var expr=setExpr&&(!$.boxModel||$('object,embed',full?null:el).length>0);if(ie6||expr){if(full&&opts.allowBodyStretch&&$.boxModel)$('html,body').css('height','100%');if((ie6||!$.boxModel)&&!full){var t=sz(el,'borderTopWidth'),l=sz(el,'borderLeftWidth');var fixT=t?'(0 - '+t+')':0;var fixL=l?'(0 - '+l+')':0;}$.each([lyr1,lyr2,lyr3],function(i,o){var s=o[0].style;s.position='absolute';if(i<2){full?s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"'):s.setExpression('height','this.parentNode.offsetHeight + "px"');full?s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'):s.setExpression('width','this.parentNode.offsetWidth + "px"');if(fixL)s.setExpression('left',fixL);if(fixT)s.setExpression('top',fixT);}else if(opts.centerY){if(full)s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');s.marginTop=0;}else if(!opts.centerY&&full){var top=(opts.css&&opts.css.top)?parseInt(opts.css.top):0;var expression='((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';s.setExpression('top',expression);}});}if(msg){if(opts.theme)lyr3.find('.ui-widget-content').append(msg);else lyr3.append(msg);if(msg.jquery||msg.nodeType)$(msg).show();}if(($.browser.msie||opts.forceIframe)&&opts.showOverlay)lyr1.show();if(opts.fadeIn){var cb=opts.onBlock?opts.onBlock:noOp;var cb1=(opts.showOverlay&&!msg)?cb:noOp;var cb2=msg?cb:noOp;if(opts.showOverlay)lyr2._fadeIn(opts.fadeIn,cb1);if(msg)lyr3._fadeIn(opts.fadeIn,cb2);}else{if(opts.showOverlay)lyr2.show();if(msg)lyr3.show();if(opts.onBlock)opts.onBlock();}bind(1,el,opts);if(full){pageBlock=lyr3[0];pageBlockEls=$(':input:enabled:visible',pageBlock);if(opts.focusInput)setTimeout(focus,20);}else center(lyr3[0],opts.centerX,opts.centerY);if(opts.timeout){var to=setTimeout(function(){full?$.unblockUI(opts):$(el).unblock(opts);},opts.timeout);$(el).data('blockUI.timeout',to);}};function remove(el,opts){var full=(el==window);var $el=$(el);var data=$el.data('blockUI.history');var to=$el.data('blockUI.timeout');if(to){clearTimeout(to);$el.removeData('blockUI.timeout');}opts=$.extend({},$.blockUI.defaults,opts||{});bind(0,el,opts);if(opts.onUnblock===null){opts.onUnblock=$el.data('blockUI.onUnblock');$el.removeData('blockUI.onUnblock');}var els;if(full)els=$('body').children().filter('.blockUI').add('body > .blockUI');else els=$('.blockUI',el);if(full)pageBlock=pageBlockEls=null;if(opts.fadeOut){els.fadeOut(opts.fadeOut);setTimeout(function(){reset(els,data,opts,el);},opts.fadeOut);}else reset(els,data,opts,el);};function reset(els,data,opts,el){els.each(function(i,o){if(this.parentNode)this.parentNode.removeChild(this);});if(data&&data.el){data.el.style.display=data.display;data.el.style.position=data.position;if(data.parent)data.parent.appendChild(data.el);$(el).removeData('blockUI.history');}if(typeof opts.onUnblock=='function' )opts.onUnblock(el,opts);};function bind(b,el,opts){var full=el==window,$el=$(el);if(!b&&(full&&!pageBlock||!full&&!$el.data('blockUI.isBlocked')))return;if(!full)$el.data('blockUI.isBlocked',b);if(!opts.bindEvents||(b&&!opts.showOverlay))return;var events='mousedown mouseup keydown keypress';b?$(document).bind(events,opts,handler):$(document).unbind(events,handler);};function handler(e){if(e.keyCode&&e.keyCode==9){if(pageBlock&&e.data.constrainTabKey){var els=pageBlockEls;var fwd=!e.shiftKey&&e.target===els[els.length-1];var back=e.shiftKey&&e.target===els[0];if(fwd||back){setTimeout(function(){focus(back)},10);return false;}}}var opts=e.data;if($(e.target).parents('div.'+opts.blockMsgClass).length>0)return true;return $(e.target).parents().children().filter('div.blockUI').length==0;};function focus(back){if(!pageBlockEls)return;var e=pageBlockEls[back===true?pageBlockEls.length-1:0];if(e)e.focus();};function center(el,x,y){var p=el.parentNode,s=el.style;var l=((p.offsetWidth-el.offsetWidth)/2)-sz(p,'borderLeftWidth');var t=((p.offsetHeight-el.offsetHeight)/2)-sz(p,'borderTopWidth');if(x)s.left=l>0?(l+'px'):'0';if(y)s.top=t>0?(t+'px'):'0';};function sz(el,p){return parseInt($.css(el,p))||0;};})(jQuery);



/*
 * Date prototype extensions. Doesn't depend on any
 * other code. Doens't overwrite existing methods.
 *
 * Adds dayNames, abbrDayNames, monthNames and abbrMonthNames static properties and isLeapYear,
 * isWeekend, isWeekDay, getDaysInMonth, getDayName, getMonthName, getDayOfYear, getWeekOfYear,
 * setDayOfYear, addYears, addMonths, addDays, addHours, addMinutes, addSeconds methods
 *
 * Copyright (c) 2006 Jörn Zaefferer and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 *
 * Additional methods and properties added by Kelvin Luck: firstDayOfWeek, dateFormat, zeroTime, asString, fromString -
 * I've added my name to these methods so you know who to blame if they are broken!
 * 
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * An Array of day names starting with Sunday.
 * 
 * @example dayNames[0]
 * @result 'Sunday'
 *
 * @name dayNames
 * @type Array
 * @cat Plugins/Methods/Date
 */
Date.dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];

/**
 * An Array of abbreviated day names starting with Sun.
 * 
 * @example abbrDayNames[0]
 * @result 'Sun'
 *
 * @name abbrDayNames
 * @type Array
 * @cat Plugins/Methods/Date
 */
Date.abbrDayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];

/**
 * An Array of month names starting with Janurary.
 * 
 * @example monthNames[0]
 * @result 'January'
 *
 * @name monthNames
 * @type Array
 * @cat Plugins/Methods/Date
 */
Date.monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];

/**
 * An Array of abbreviated month names starting with Jan.
 * 
 * @example abbrMonthNames[0]
 * @result 'Jan'
 *
 * @name monthNames
 * @type Array
 * @cat Plugins/Methods/Date
 */
Date.abbrMonthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];

/**
 * The first day of the week for this locale.
 *
 * @name firstDayOfWeek
 * @type Number
 * @cat Plugins/Methods/Date
 * @author Kelvin Luck
 */
Date.firstDayOfWeek = 1;

/**
 * The format that string dates should be represented as (e.g. 'dd/mm/yyyy' for UK, 'mm/dd/yyyy' for US, 'yyyy-mm-dd' for Unicode etc).
 *
 * @name format
 * @type String
 * @cat Plugins/Methods/Date
 * @author Kelvin Luck
 */
Date.format = 'dd/mm/yyyy';
//Date.format = 'mm/dd/yyyy';
//Date.format = 'yyyy-mm-dd';
//Date.format = 'dd mmm yy';

/**
 * The first two numbers in the century to be used when decoding a two digit year. Since a two digit year is ambiguous (and date.setYear
 * only works with numbers < 99 and so doesn't allow you to set years after 2000) we need to use this to disambiguate the two digit year codes.
 *
 * @name format
 * @type String
 * @cat Plugins/Methods/Date
 * @author Kelvin Luck
 */
Date.fullYearStart = '20';

(function() {

	/**
	 * Adds a given method under the given name 
	 * to the Date prototype if it doesn't
	 * currently exist.
	 *
	 * @private
	 */
	function add(name, method) {
		if( !Date.prototype[name] ) {
			Date.prototype[name] = method;
		}
	};
	
	/**
	 * Checks if the year is a leap year.
	 *
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.isLeapYear();
	 * @result true
	 *
	 * @name isLeapYear
	 * @type Boolean
	 * @cat Plugins/Methods/Date
	 */
	add("isLeapYear", function() {
		var y = this.getFullYear();
		return (y%4==0 && y%100!=0) || y%400==0;
	});
	
	/**
	 * Checks if the day is a weekend day (Sat or Sun).
	 *
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.isWeekend();
	 * @result false
	 *
	 * @name isWeekend
	 * @type Boolean
	 * @cat Plugins/Methods/Date
	 */
	add("isWeekend", function() {
		return this.getDay()==0 || this.getDay()==6;
	});
	
	/**
	 * Check if the day is a day of the week (Mon-Fri)
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.isWeekDay();
	 * @result false
	 * 
	 * @name isWeekDay
	 * @type Boolean
	 * @cat Plugins/Methods/Date
	 */
	add("isWeekDay", function() {
		return !this.isWeekend();
	});
	
	/**
	 * Gets the number of days in the month.
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.getDaysInMonth();
	 * @result 31
	 * 
	 * @name getDaysInMonth
	 * @type Number
	 * @cat Plugins/Methods/Date
	 */
	add("getDaysInMonth", function() {
		return [31,(this.isLeapYear() ? 29:28),31,30,31,30,31,31,30,31,30,31][this.getMonth()];
	});
	
	/**
	 * Gets the name of the day.
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.getDayName();
	 * @result 'Saturday'
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.getDayName(true);
	 * @result 'Sat'
	 * 
	 * @param abbreviated Boolean When set to true the name will be abbreviated.
	 * @name getDayName
	 * @type String
	 * @cat Plugins/Methods/Date
	 */
	add("getDayName", function(abbreviated) {
		return abbreviated ? Date.abbrDayNames[this.getDay()] : Date.dayNames[this.getDay()];
	});

	/**
	 * Gets the name of the month.
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.getMonthName();
	 * @result 'Janurary'
	 *
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.getMonthName(true);
	 * @result 'Jan'
	 * 
	 * @param abbreviated Boolean When set to true the name will be abbreviated.
	 * @name getDayName
	 * @type String
	 * @cat Plugins/Methods/Date
	 */
	add("getMonthName", function(abbreviated) {
		return abbreviated ? Date.abbrMonthNames[this.getMonth()] : Date.monthNames[this.getMonth()];
	});

	/**
	 * Get the number of the day of the year.
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.getDayOfYear();
	 * @result 11
	 * 
	 * @name getDayOfYear
	 * @type Number
	 * @cat Plugins/Methods/Date
	 */
	add("getDayOfYear", function() {
		var tmpdtm = new Date("1/1/" + this.getFullYear());
		return Math.floor((this.getTime() - tmpdtm.getTime()) / 86400000);
	});
	
	/**
	 * Get the number of the week of the year.
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.getWeekOfYear();
	 * @result 2
	 * 
	 * @name getWeekOfYear
	 * @type Number
	 * @cat Plugins/Methods/Date
	 */
	add("getWeekOfYear", function() {
		return Math.ceil(this.getDayOfYear() / 7);
	});

	/**
	 * Set the day of the year.
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.setDayOfYear(1);
	 * dtm.toString();
	 * @result 'Tue Jan 01 2008 00:00:00'
	 * 
	 * @name setDayOfYear
	 * @type Date
	 * @cat Plugins/Methods/Date
	 */
	add("setDayOfYear", function(day) {
		this.setMonth(0);
		this.setDate(day);
		return this;
	});
	
	/**
	 * Add a number of years to the date object.
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.addYears(1);
	 * dtm.toString();
	 * @result 'Mon Jan 12 2009 00:00:00'
	 * 
	 * @name addYears
	 * @type Date
	 * @cat Plugins/Methods/Date
	 */
	add("addYears", function(num) {
		this.setFullYear(this.getFullYear() + num);
		return this;
	});
	
	/**
	 * Add a number of months to the date object.
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.addMonths(1);
	 * dtm.toString();
	 * @result 'Tue Feb 12 2008 00:00:00'
	 * 
	 * @name addMonths
	 * @type Date
	 * @cat Plugins/Methods/Date
	 */
	add("addMonths", function(num) {
		var tmpdtm = this.getDate();
		
		this.setMonth(this.getMonth() + num);
		
		if (tmpdtm > this.getDate())
			this.addDays(-this.getDate());
		
		return this;
	});
	
	/**
	 * Add a number of days to the date object.
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.addDays(1);
	 * dtm.toString();
	 * @result 'Sun Jan 13 2008 00:00:00'
	 * 
	 * @name addDays
	 * @type Date
	 * @cat Plugins/Methods/Date
	 */
	add("addDays", function(num) {
		this.setDate(this.getDate() + num);
		return this;
	});
	
	/**
	 * Add a number of hours to the date object.
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.addHours(24);
	 * dtm.toString();
	 * @result 'Sun Jan 13 2008 00:00:00'
	 * 
	 * @name addHours
	 * @type Date
	 * @cat Plugins/Methods/Date
	 */
	add("addHours", function(num) {
		this.setHours(this.getHours() + num);
		return this;
	});

	/**
	 * Add a number of minutes to the date object.
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.addMinutes(60);
	 * dtm.toString();
	 * @result 'Sat Jan 12 2008 01:00:00'
	 * 
	 * @name addMinutes
	 * @type Date
	 * @cat Plugins/Methods/Date
	 */
	add("addMinutes", function(num) {
		this.setMinutes(this.getMinutes() + num);
		return this;
	});
	
	/**
	 * Add a number of seconds to the date object.
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.addSeconds(60);
	 * dtm.toString();
	 * @result 'Sat Jan 12 2008 00:01:00'
	 * 
	 * @name addSeconds
	 * @type Date
	 * @cat Plugins/Methods/Date
	 */
	add("addSeconds", function(num) {
		this.setSeconds(this.getSeconds() + num);
		return this;
	});
	
	/**
	 * Sets the time component of this Date to zero for cleaner, easier comparison of dates where time is not relevant.
	 * 
	 * @example var dtm = new Date();
	 * dtm.zeroTime();
	 * dtm.toString();
	 * @result 'Sat Jan 12 2008 00:01:00'
	 * 
	 * @name zeroTime
	 * @type Date
	 * @cat Plugins/Methods/Date
	 * @author Kelvin Luck
	 */
	add("zeroTime", function() {
		this.setMilliseconds(0);
		this.setSeconds(0);
		this.setMinutes(0);
		this.setHours(0);
		return this;
	});
	
	/**
	 * Returns a string representation of the date object according to Date.format.
	 * (Date.toString may be used in other places so I purposefully didn't overwrite it)
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.asString();
	 * @result '12/01/2008' // (where Date.format == 'dd/mm/yyyy'
	 * 
	 * @name asString
	 * @type Date
	 * @cat Plugins/Methods/Date
	 * @author Kelvin Luck
	 */
	add("asString", function() {
		var r = Date.format;
		return r
			.split('yyyy').join(this.getFullYear())
			.split('yy').join((this.getFullYear() + '').substring(2))
			.split('mmm').join(this.getMonthName(true))
			.split('mm').join(_zeroPad(this.getMonth()+1))
			.split('dd').join(_zeroPad(this.getDate()));
	});
	
	/**
	 * Returns a new date object created from the passed String according to Date.format or false if the attempt to do this results in an invalid date object
	 * (We can't simple use Date.parse as it's not aware of locale and I chose not to overwrite it incase it's functionality is being relied on elsewhere)
	 *
	 * @example var dtm = Date.fromString("12/01/2008");
	 * dtm.toString();
	 * @result 'Sat Jan 12 2008 00:00:00' // (where Date.format == 'dd/mm/yyyy'
	 * 
	 * @name fromString
	 * @type Date
	 * @cat Plugins/Methods/Date
	 * @author Kelvin Luck
	 */
	Date.fromString = function(s)
	{
		var f = Date.format;
		var d = new Date('01/01/1977');
		var iY = f.indexOf('yyyy');
		if (iY > -1) {
			d.setFullYear(Number(s.substr(iY, 4)));
		} else {
			// TODO - this doesn't work very well - are there any rules for what is meant by a two digit year?
			d.setFullYear(Number(Date.fullYearStart + s.substr(f.indexOf('yy'), 2)));
		}
		var iM = f.indexOf('mmm');
		if (iM > -1) {
			var mStr = s.substr(iM, 3);
			for (var i=0; i<Date.abbrMonthNames.length; i++) {
				if (Date.abbrMonthNames[i] == mStr) break;
			}
			d.setMonth(i);
		} else {
			d.setMonth(Number(s.substr(f.indexOf('mm'), 2)) - 1);
		}
		d.setDate(Number(s.substr(f.indexOf('dd'), 2)));
		if (isNaN(d.getTime())) {
			return false;
		}
		return d;
	};
	
	// utility method
	var _zeroPad = function(num) {
		var s = '0'+num;
		return s.substring(s.length-2)
		//return ('0'+num).substring(-2); // doesn't work on IE :(
	};
	
})();


/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
 * Licensed under the MIT License (LICENSE.txt).
 *
 * Version 2.1.2
 */

(function($){

$.fn.bgiframe = ($.browser.msie && /msie 6\.0/i.test(navigator.userAgent) ? function(s) {
    s = $.extend({
        top     : 'auto', // auto == .currentStyle.borderTopWidth
        left    : 'auto', // auto == .currentStyle.borderLeftWidth
        width   : 'auto', // auto == offsetWidth
        height  : 'auto', // auto == offsetHeight
        opacity : true,
        src     : 'javascript:false;'
    }, s);
    var html = '<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+
                   'style="display:block;position:absolute;z-index:-1;'+
                       (s.opacity !== false?'filter:Alpha(Opacity=\'0\');':'')+
                       'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+
                       'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+
                       'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+
                       'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+
                '"/>';
    return this.each(function() {
        if ( $(this).children('iframe.bgiframe').length === 0 )
            this.insertBefore( document.createElement(html), this.firstChild );
    });
} : function() { return this; });

// old alias
$.fn.bgIframe = $.fn.bgiframe;

function prop(n) {
    return n && n.constructor === Number ? n + 'px' : n;
}

})(jQuery);


/*
 * jQuery UI Datepicker 1.7.3
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Datepicker
 *
 * Depends:
 *	ui.core.js
 */
(function($){$.extend($.ui,{datepicker:{version:"1.7.3"}});var PROP_NAME="datepicker";function Datepicker(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass="ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],dateFormat:"mm/dd/yy",firstDay:0,isRTL:false};this._defaults={showOn:"focus",showAnim:"show",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,showMonthAfterYear:false,yearRange:"-10:+10",showOtherMonths:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"normal",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false};$.extend(this._defaults,this.regional[""]);this.dpDiv=$('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>')}$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",log:function(){if(this.debug){console.log.apply("",arguments)}},setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase();var inline=(nodeName=="div"||nodeName=="span");if(!target.id){target.id="dp"+(++this.uuid)}var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{});if(nodeName=="input"){this._connectDatepicker(target,inst)}else{if(inline){this._inlineDatepicker(target,inst)}}},_newInst:function(target,inline){var id=target[0].id.replace(/([:\[\]\.])/g,"\\\\$1");return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:$('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}},_connectDatepicker:function(target,inst){var input=$(target);inst.append=$([]);inst.trigger=$([]);if(input.hasClass(this.markerClassName)){return}var appendText=this._get(inst,"appendText");var isRTL=this._get(inst,"isRTL");if(appendText){inst.append=$('<span class="'+this._appendClass+'">'+appendText+"</span>");input[isRTL?"before":"after"](inst.append)}var showOn=this._get(inst,"showOn");if(showOn=="focus"||showOn=="both"){input.focus(this._showDatepicker)}if(showOn=="button"||showOn=="both"){var buttonText=this._get(inst,"buttonText");var buttonImage=this._get(inst,"buttonImage");inst.trigger=$(this._get(inst,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$('<button type="button"></button>').addClass(this._triggerClass).html(buttonImage==""?buttonText:$("<img/>").attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?"before":"after"](inst.trigger);inst.trigger.click(function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput==target){$.datepicker._hideDatepicker()}else{$.datepicker._showDatepicker(target)}return false})}input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst)},_inlineDatepicker:function(target,inst){var divSpan=$(target);if(divSpan.hasClass(this.markerClassName)){return}divSpan.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst));this._updateDatepicker(inst);this._updateAlternate(inst)},_dialogDatepicker:function(input,dateText,onSelect,settings,pos){var inst=this._dialogInst;if(!inst){var id="dp"+(++this.uuid);this._dialogInput=$('<input type="text" id="'+id+'" size="1" style="position: absolute; top: -100px;"/>');this._dialogInput.keydown(this._doKeyDown);$("body").append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],PROP_NAME,inst)}extendRemove(inst.settings,settings||{});this._dialogInput.val(dateText);this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);if(!this._pos){var browserWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;var browserHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY]}this._dialogInput.css("left",this._pos[0]+"px").css("top",this._pos[1]+"px");inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI){$.blockUI(this.dpDiv)}$.data(this._dialogInput[0],PROP_NAME,inst);return this},_destroyDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();$.removeData(target,PROP_NAME);if(nodeName=="input"){inst.append.remove();inst.trigger.remove();$target.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress)}else{if(nodeName=="div"||nodeName=="span"){$target.removeClass(this.markerClassName).empty()}}},_enableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=false;inst.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().removeClass("ui-state-disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)})},_disableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=true;inst.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().addClass("ui-state-disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)});this._disabledInputs[this._disabledInputs.length]=target},_isDisabledDatepicker:function(target){if(!target){return false}for(var i=0;i<this._disabledInputs.length;i++){if(this._disabledInputs[i]==target){return true}}return false},_getInst:function(target){try{return $.data(target,PROP_NAME)}catch(err){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(target,name,value){var inst=this._getInst(target);if(arguments.length==2&&typeof name=="string"){return(name=="defaults"?$.extend({},$.datepicker._defaults):(inst?(name=="all"?$.extend({},inst.settings):this._get(inst,name)):null))}var settings=name||{};if(typeof name=="string"){settings={};settings[name]=value}if(inst){if(this._curInst==inst){this._hideDatepicker(null)}var date=this._getDateDatepicker(target);extendRemove(inst.settings,settings);this._setDateDatepicker(target,date);this._updateDatepicker(inst)}},_changeDatepicker:function(target,name,value){this._optionDatepicker(target,name,value)},_refreshDatepicker:function(target){var inst=this._getInst(target);if(inst){this._updateDatepicker(inst)}},_setDateDatepicker:function(target,date,endDate){var inst=this._getInst(target);if(inst){this._setDate(inst,date,endDate);this._updateDatepicker(inst);this._updateAlternate(inst)}},_getDateDatepicker:function(target){var inst=this._getInst(target);if(inst&&!inst.inline){this._setDateFromField(inst)}return(inst?this._getDate(inst):null)},_doKeyDown:function(event){var inst=$.datepicker._getInst(event.target);var handled=true;var isRTL=inst.dpDiv.is(".ui-datepicker-rtl");inst._keyEvent=true;if($.datepicker._datepickerShowing){switch(event.keyCode){case 9:$.datepicker._hideDatepicker(null,"");break;case 13:var sel=$("td."+$.datepicker._dayOverClass+", td."+$.datepicker._currentClass,inst.dpDiv);if(sel[0]){$.datepicker._selectDay(event.target,inst.selectedMonth,inst.selectedYear,sel[0])}else{$.datepicker._hideDatepicker(null,$.datepicker._get(inst,"duration"))}return false;break;case 27:$.datepicker._hideDatepicker(null,$.datepicker._get(inst,"duration"));break;case 33:$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M");break;case 34:$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M");break;case 35:if(event.ctrlKey||event.metaKey){$.datepicker._clearDate(event.target)}handled=event.ctrlKey||event.metaKey;break;case 36:if(event.ctrlKey||event.metaKey){$.datepicker._gotoToday(event.target)}handled=event.ctrlKey||event.metaKey;break;case 37:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,(isRTL?+1:-1),"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M")}break;case 38:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,-7,"D")}handled=event.ctrlKey||event.metaKey;break;case 39:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,(isRTL?-1:+1),"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M")}break;case 40:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,+7,"D")}handled=event.ctrlKey||event.metaKey;break;default:handled=false}}else{if(event.keyCode==36&&event.ctrlKey){$.datepicker._showDatepicker(this)}else{handled=false}}if(handled){event.preventDefault();event.stopPropagation()}},_doKeyPress:function(event){var inst=$.datepicker._getInst(event.target);if($.datepicker._get(inst,"constrainInput")){var chars=$.datepicker._possibleChars($.datepicker._get(inst,"dateFormat"));var chr=String.fromCharCode(event.charCode==undefined?event.keyCode:event.charCode);return event.ctrlKey||(chr<" "||!chars||chars.indexOf(chr)>-1)}},_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!="input"){input=$("input",input.parentNode)[0]}if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput==input){return}var inst=$.datepicker._getInst(input);var beforeShow=$.datepicker._get(inst,"beforeShow");extendRemove(inst.settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));$.datepicker._hideDatepicker(null,"");$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog){input.value=""}if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight}var isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css("position")=="fixed";return !isFixed});if(isFixed&&$.browser.opera){$.datepicker._pos[0]-=document.documentElement.scrollLeft;$.datepicker._pos[1]-=document.documentElement.scrollTop}var offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;inst.rangeStart=null;inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});$.datepicker._updateDatepicker(inst);offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:($.datepicker._inDialog&&$.blockUI?"static":(isFixed?"fixed":"absolute")),display:"none",left:offset.left+"px",top:offset.top+"px"});if(!inst.inline){var showAnim=$.datepicker._get(inst,"showAnim")||"show";var duration=$.datepicker._get(inst,"duration");var postProcess=function(){$.datepicker._datepickerShowing=true;if($.browser.msie&&parseInt($.browser.version,10)<7){$("iframe.ui-datepicker-cover").css({width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4})}};if($.effects&&$.effects[showAnim]){inst.dpDiv.show(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[showAnim](duration,postProcess)}if(duration==""){postProcess()}if(inst.input[0].type!="hidden"){inst.input[0].focus()}$.datepicker._curInst=inst}},_updateDatepicker:function(inst){var dims={width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4};var self=this;inst.dpDiv.empty().append(this._generateHTML(inst)).find("iframe.ui-datepicker-cover").css({width:dims.width,height:dims.height}).end().find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout",function(){$(this).removeClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).removeClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).removeClass("ui-datepicker-next-hover")}}).bind("mouseover",function(){if(!self._isDisabledDatepicker(inst.inline?inst.dpDiv.parent()[0]:inst.input[0])){$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");$(this).addClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).addClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).addClass("ui-datepicker-next-hover")}}}).end().find("."+this._dayOverClass+" a").trigger("mouseover").end();var numMonths=this._getNumberOfMonths(inst);var cols=numMonths[1];var width=17;if(cols>1){inst.dpDiv.addClass("ui-datepicker-multi-"+cols).css("width",(width*cols)+"em")}else{inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("")}inst.dpDiv[(numMonths[0]!=1||numMonths[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");if(inst.input&&inst.input[0].type!="hidden"&&inst==$.datepicker._curInst){$(inst.input[0]).focus()}},_checkOffset:function(inst,offset,isFixed){var dpWidth=inst.dpDiv.outerWidth();var dpHeight=inst.dpDiv.outerHeight();var inputWidth=inst.input?inst.input.outerWidth():0;var inputHeight=inst.input?inst.input.outerHeight():0;var viewWidth=(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)+$(document).scrollLeft();var viewHeight=(window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight)+$(document).scrollTop();offset.left-=(this._get(inst,"isRTL")?(dpWidth-inputWidth):0);offset.left-=(isFixed&&offset.left==inst.input.offset().left)?$(document).scrollLeft():0;offset.top-=(isFixed&&offset.top==(inst.input.offset().top+inputHeight))?$(document).scrollTop():0;offset.left-=(offset.left+dpWidth>viewWidth&&viewWidth>dpWidth)?Math.abs(offset.left+dpWidth-viewWidth):0;offset.top-=(offset.top+dpHeight>viewHeight&&viewHeight>dpHeight)?Math.abs(offset.top+dpHeight+inputHeight*2-viewHeight):0;return offset},_findPos:function(obj){while(obj&&(obj.type=="hidden"||obj.nodeType!=1)){obj=obj.nextSibling}var position=$(obj).offset();return[position.left,position.top]},_hideDatepicker:function(input,duration){var inst=this._curInst;if(!inst||(input&&inst!=$.data(input,PROP_NAME))){return}if(inst.stayOpen){this._selectDate("#"+inst.id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear))}inst.stayOpen=false;if(this._datepickerShowing){duration=(duration!=null?duration:this._get(inst,"duration"));var showAnim=this._get(inst,"showAnim");var postProcess=function(){$.datepicker._tidyDialog(inst)};if(duration!=""&&$.effects&&$.effects[showAnim]){inst.dpDiv.hide(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[(duration==""?"hide":(showAnim=="slideDown"?"slideUp":(showAnim=="fadeIn"?"fadeOut":"hide")))](duration,postProcess)}if(duration==""){this._tidyDialog(inst)}var onClose=this._get(inst,"onClose");if(onClose){onClose.apply((inst.input?inst.input[0]:null),[(inst.input?inst.input.val():""),inst])}this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if($.blockUI){$.unblockUI();$("body").append(this.dpDiv)}}this._inDialog=false}this._curInst=null},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(event){if(!$.datepicker._curInst){return}var $target=$(event.target);if(($target.parents("#"+$.datepicker._mainDivId).length==0)&&!$target.hasClass($.datepicker.markerClassName)&&!$target.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI)){$.datepicker._hideDatepicker(null,"")}},_adjustDate:function(id,offset,period){var target=$(id);var inst=this._getInst(target[0]);if(this._isDisabledDatepicker(target[0])){return}this._adjustInstDate(inst,offset+(period=="M"?this._get(inst,"showCurrentAtPos"):0),period);this._updateDatepicker(inst)},_gotoToday:function(id){var target=$(id);var inst=this._getInst(target[0]);if(this._get(inst,"gotoCurrent")&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear}else{var date=new Date();inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear()}this._notifyChange(inst);this._adjustDate(target)},_selectMonthYear:function(id,select,period){var target=$(id);var inst=this._getInst(target[0]);inst._selectingMonthYear=false;inst["selected"+(period=="M"?"Month":"Year")]=inst["draw"+(period=="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target)},_clickMonthYear:function(id){var target=$(id);var inst=this._getInst(target[0]);if(inst.input&&inst._selectingMonthYear&&!$.browser.msie){inst.input[0].focus()}inst._selectingMonthYear=!inst._selectingMonthYear},_selectDay:function(id,month,year,td){var target=$(id);if($(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[0])){return}var inst=this._getInst(target[0]);inst.selectedDay=inst.currentDay=$("a",td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;if(inst.stayOpen){inst.endDay=inst.endMonth=inst.endYear=null}this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear));if(inst.stayOpen){inst.rangeStart=this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));this._updateDatepicker(inst)}},_clearDate:function(id){var target=$(id);var inst=this._getInst(target[0]);inst.stayOpen=false;inst.endDay=inst.endMonth=inst.endYear=inst.rangeStart=null;this._selectDate(target,"")},_selectDate:function(id,dateStr){var target=$(id);var inst=this._getInst(target[0]);dateStr=(dateStr!=null?dateStr:this._formatDate(inst));if(inst.input){inst.input.val(dateStr)}this._updateAlternate(inst);var onSelect=this._get(inst,"onSelect");if(onSelect){onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst])}else{if(inst.input){inst.input.trigger("change")}}if(inst.inline){this._updateDatepicker(inst)}else{if(!inst.stayOpen){this._hideDatepicker(null,this._get(inst,"duration"));this._lastInput=inst.input[0];if(typeof(inst.input[0])!="object"){inst.input[0].focus()}this._lastInput=null}}},_updateAlternate:function(inst){var altField=this._get(inst,"altField");if(altField){var altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat");var date=this._getDate(inst);dateStr=this.formatDate(altFormat,date,this._getFormatConfig(inst));$(altField).each(function(){$(this).val(dateStr)})}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),""]},iso8601Week:function(date){var checkDate=new Date(date.getFullYear(),date.getMonth(),date.getDate());var firstMon=new Date(checkDate.getFullYear(),1-1,4);var firstDay=firstMon.getDay()||7;firstMon.setDate(firstMon.getDate()+1-firstDay);if(firstDay<4&&checkDate<firstMon){checkDate.setDate(checkDate.getDate()-3);return $.datepicker.iso8601Week(checkDate)}else{if(checkDate>new Date(checkDate.getFullYear(),12-1,28)){firstDay=new Date(checkDate.getFullYear()+1,1-1,4).getDay()||7;if(firstDay>4&&(checkDate.getDay()||7)<firstDay-3){return 1}}}return Math.floor(((checkDate-firstMon)/86400000)/7)+1},parseDate:function(format,value,settings){if(format==null||value==null){throw"Invalid arguments"}value=(typeof value=="object"?value.toString():value+"");if(value==""){return null}var shortYearCutoff=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff;var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var year=-1;var month=-1;var day=-1;var doy=-1;var literal=false;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var getNumber=function(match){lookAhead(match);var origSize=(match=="@"?14:(match=="y"?4:(match=="o"?3:2)));var size=origSize;var num=0;while(size>0&&iValue<value.length&&value.charAt(iValue)>="0"&&value.charAt(iValue)<="9"){num=num*10+parseInt(value.charAt(iValue++),10);size--}if(size==origSize){throw"Missing number at position "+iValue}return num};var getName=function(match,shortNames,longNames){var names=(lookAhead(match)?longNames:shortNames);var size=0;for(var j=0;j<names.length;j++){size=Math.max(size,names[j].length)}var name="";var iInit=iValue;while(size>0&&iValue<value.length){name+=value.charAt(iValue++);for(var i=0;i<names.length;i++){if(name==names[i]){return i+1}}size--}throw"Unknown name at position "+iInit};var checkLiteral=function(){if(value.charAt(iValue)!=format.charAt(iFormat)){throw"Unexpected literal at position "+iValue}iValue++};var iValue=0;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{checkLiteral()}}else{switch(format.charAt(iFormat)){case"d":day=getNumber("d");break;case"D":getName("D",dayNamesShort,dayNames);break;case"o":doy=getNumber("o");break;case"m":month=getNumber("m");break;case"M":month=getName("M",monthNamesShort,monthNames);break;case"y":year=getNumber("y");break;case"@":var date=new Date(getNumber("@"));year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"'":if(lookAhead("'")){checkLiteral()}else{literal=true}break;default:checkLiteral()}}}if(year==-1){year=new Date().getFullYear()}else{if(year<100){year+=new Date().getFullYear()-new Date().getFullYear()%100+(year<=shortYearCutoff?0:-100)}}if(doy>-1){month=1;day=doy;do{var dim=this._getDaysInMonth(year,month-1);if(day<=dim){break}month++;day-=dim}while(true)}var date=this._daylightSavingAdjust(new Date(year,month-1,day));if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day){throw"Invalid date"}return date},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TIMESTAMP:"@",W3C:"yy-mm-dd",formatDate:function(format,date,settings){if(!date){return""}var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var formatNumber=function(match,value,len){var num=""+value;if(lookAhead(match)){while(num.length<len){num="0"+num}}return num};var formatName=function(match,value,shortNames,longNames){return(lookAhead(match)?longNames[value]:shortNames[value])};var output="";var literal=false;if(date){for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{output+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":output+=formatNumber("d",date.getDate(),2);break;case"D":output+=formatName("D",date.getDay(),dayNamesShort,dayNames);break;case"o":var doy=date.getDate();for(var m=date.getMonth()-1;m>=0;m--){doy+=this._getDaysInMonth(date.getFullYear(),m)}output+=formatNumber("o",doy,3);break;case"m":output+=formatNumber("m",date.getMonth()+1,2);break;case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);break;case"y":output+=(lookAhead("y")?date.getFullYear():(date.getYear()%100<10?"0":"")+date.getYear()%100);break;case"@":output+=date.getTime();break;case"'":if(lookAhead("'")){output+="'"}else{literal=true}break;default:output+=format.charAt(iFormat)}}}}return output},_possibleChars:function(format){var chars="";var literal=false;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{chars+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":case"m":case"y":case"@":chars+="0123456789";break;case"D":case"M":return null;case"'":if(lookAhead("'")){chars+="'"}else{literal=true}break;default:chars+=format.charAt(iFormat)}}}return chars},_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name]},_setDateFromField:function(inst){var dateFormat=this._get(inst,"dateFormat");var dates=inst.input?inst.input.val():null;inst.endDay=inst.endMonth=inst.endYear=null;var date=defaultDate=this._getDefaultDate(inst);var settings=this._getFormatConfig(inst);try{date=this.parseDate(dateFormat,dates,settings)||defaultDate}catch(event){this.log(event);date=defaultDate}inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();inst.currentDay=(dates?date.getDate():0);inst.currentMonth=(dates?date.getMonth():0);inst.currentYear=(dates?date.getFullYear():0);this._adjustInstDate(inst)},_getDefaultDate:function(inst){var date=this._determineDate(this._get(inst,"defaultDate"),new Date());var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);return date},_determineDate:function(date,defaultDate){var offsetNumeric=function(offset){var date=new Date();date.setDate(date.getDate()+offset);return date};var offsetString=function(offset,getDaysInMonth){var date=new Date();var year=date.getFullYear();var month=date.getMonth();var day=date.getDate();var pattern=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;var matches=pattern.exec(offset);while(matches){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);break;case"w":case"W":day+=parseInt(matches[1],10)*7;break;case"m":case"M":month+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break;case"y":case"Y":year+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break}matches=pattern.exec(offset)}return new Date(year,month,day)};date=(date==null?defaultDate:(typeof date=="string"?offsetString(date,this._getDaysInMonth):(typeof date=="number"?(isNaN(date)?defaultDate:offsetNumeric(date)):date)));date=(date&&date.toString()=="Invalid Date"?defaultDate:date);if(date){date.setHours(0);date.setMinutes(0);date.setSeconds(0);date.setMilliseconds(0)}return this._daylightSavingAdjust(date)},_daylightSavingAdjust:function(date){if(!date){return null}date.setHours(date.getHours()>12?date.getHours()+2:0);return date},_setDate:function(inst,date,endDate){var clear=!(date);var origMonth=inst.selectedMonth;var origYear=inst.selectedYear;date=this._determineDate(date,new Date());inst.selectedDay=inst.currentDay=date.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=date.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=date.getFullYear();if(origMonth!=inst.selectedMonth||origYear!=inst.selectedYear){this._notifyChange(inst)}this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?"":this._formatDate(inst))}},_getDate:function(inst){var startDate=(!inst.currentYear||(inst.input&&inst.input.val()=="")?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return startDate},_generateHTML:function(inst){var today=new Date();today=this._daylightSavingAdjust(new Date(today.getFullYear(),today.getMonth(),today.getDate()));var isRTL=this._get(inst,"isRTL");var showButtonPanel=this._get(inst,"showButtonPanel");var hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext");var navigationAsDateFormat=this._get(inst,"navigationAsDateFormat");var numMonths=this._getNumberOfMonths(inst);var showCurrentAtPos=this._get(inst,"showCurrentAtPos");var stepMonths=this._get(inst,"stepMonths");var stepBigMonths=this._get(inst,"stepBigMonths");var isMultiMonth=(numMonths[0]!=1||numMonths[1]!=1);var currentDate=this._daylightSavingAdjust((!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");var drawMonth=inst.drawMonth-showCurrentAtPos;var drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--}if(maxDate){var maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-numMonths[1]+1,maxDate.getDate()));maxDraw=(minDate&&maxDraw<minDate?minDate:maxDraw);while(this._daylightSavingAdjust(new Date(drawYear,drawMonth,1))>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--}}}inst.drawMonth=drawMonth;inst.drawYear=drawYear;var prevText=this._get(inst,"prevText");prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst)));var prev=(this._canAdjustMonth(inst,-1,drawYear,drawMonth)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#'+inst.id+"', -"+stepMonths+", 'M');\" title=\""+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>":(hideIfNoPrevNext?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>"));var nextText=this._get(inst,"nextText");nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst)));var next=(this._canAdjustMonth(inst,+1,drawYear,drawMonth)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#'+inst.id+"', +"+stepMonths+", 'M');\" title=\""+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>":(hideIfNoPrevNext?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>"));var currentText=this._get(inst,"currentText");var gotoDate=(this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today);currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst)));var controls=(!inst.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery.datepicker._hideDatepicker();">'+this._get(inst,"closeText")+"</button>":"");var buttonPanel=(showButtonPanel)?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(isRTL?controls:"")+(this._isInRange(inst,gotoDate)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery.datepicker._gotoToday(\'#'+inst.id+"');\">"+currentText+"</button>":"")+(isRTL?"":controls)+"</div>":"";var firstDay=parseInt(this._get(inst,"firstDay"),10);firstDay=(isNaN(firstDay)?0:firstDay);var dayNames=this._get(inst,"dayNames");var dayNamesShort=this._get(inst,"dayNamesShort");var dayNamesMin=this._get(inst,"dayNamesMin");var monthNames=this._get(inst,"monthNames");var monthNamesShort=this._get(inst,"monthNamesShort");var beforeShowDay=this._get(inst,"beforeShowDay");var showOtherMonths=this._get(inst,"showOtherMonths");var calculateWeek=this._get(inst,"calculateWeek")||this.iso8601Week;var endDate=inst.endDay?this._daylightSavingAdjust(new Date(inst.endYear,inst.endMonth,inst.endDay)):currentDate;var defaultDate=this._getDefaultDate(inst);var html="";for(var row=0;row<numMonths[0];row++){var group="";for(var col=0;col<numMonths[1];col++){var selectedDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,inst.selectedDay));var cornerClass=" ui-corner-all";var calender="";if(isMultiMonth){calender+='<div class="ui-datepicker-group ui-datepicker-group-';switch(col){case 0:calender+="first";cornerClass=" ui-corner-"+(isRTL?"right":"left");break;case numMonths[1]-1:calender+="last";cornerClass=" ui-corner-"+(isRTL?"left":"right");break;default:calender+="middle";cornerClass="";break}calender+='">'}calender+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+cornerClass+'">'+(/all|left/.test(cornerClass)&&row==0?(isRTL?next:prev):"")+(/all|right/.test(cornerClass)&&row==0?(isRTL?prev:next):"")+this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,row>0||col>0,monthNames,monthNamesShort)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var thead="";for(var dow=0;dow<7;dow++){var day=(dow+firstDay)%7;thead+="<th"+((dow+firstDay+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+dayNames[day]+'">'+dayNamesMin[day]+"</span></th>"}calender+=thead+"</tr></thead><tbody>";var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear==inst.selectedYear&&drawMonth==inst.selectedMonth){inst.selectedDay=Math.min(inst.selectedDay,daysInMonth)}var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var numRows=(isMultiMonth?6:Math.ceil((leadDays+daysInMonth)/7));var printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays));for(var dRow=0;dRow<numRows;dRow++){calender+="<tr>";var tbody="";for(var dow=0;dow<7;dow++){var daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,""]);var otherMonth=(printDate.getMonth()!=drawMonth);var unselectable=otherMonth||!daySettings[0]||(minDate&&printDate<minDate)||(maxDate&&printDate>maxDate);tbody+='<td class="'+((dow+firstDay+6)%7>=5?" ui-datepicker-week-end":"")+(otherMonth?" ui-datepicker-other-month":"")+((printDate.getTime()==selectedDate.getTime()&&drawMonth==inst.selectedMonth&&inst._keyEvent)||(defaultDate.getTime()==printDate.getTime()&&defaultDate.getTime()==selectedDate.getTime())?" "+this._dayOverClass:"")+(unselectable?" "+this._unselectableClass+" ui-state-disabled":"")+(otherMonth&&!showOtherMonths?"":" "+daySettings[1]+(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" "+this._currentClass:"")+(printDate.getTime()==today.getTime()?" ui-datepicker-today":""))+'"'+((!otherMonth||showOtherMonths)&&daySettings[2]?' title="'+daySettings[2]+'"':"")+(unselectable?"":" onclick=\"DP_jQuery.datepicker._selectDay('#"+inst.id+"',"+drawMonth+","+drawYear+', this);return false;"')+">"+(otherMonth?(showOtherMonths?printDate.getDate():"&#xa0;"):(unselectable?'<span class="ui-state-default">'+printDate.getDate()+"</span>":'<a class="ui-state-default'+(printDate.getTime()==today.getTime()?" ui-state-highlight":"")+(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" ui-state-active":"")+'" href="#">'+printDate.getDate()+"</a>"))+"</td>";printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate)}calender+=tbody+"</tr>"}drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++}calender+="</tbody></table>"+(isMultiMonth?"</div>"+((numMonths[0]>0&&col==numMonths[1]-1)?'<div class="ui-datepicker-row-break"></div>':""):"");group+=calender}html+=group}html+=buttonPanel+($.browser.msie&&parseInt($.browser.version,10)<7&&!inst.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':"");inst._keyEvent=false;return html},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,secondary,monthNames,monthNamesShort){minDate=(inst.rangeStart&&minDate&&selectedDate<minDate?selectedDate:minDate);var changeMonth=this._get(inst,"changeMonth");var changeYear=this._get(inst,"changeYear");var showMonthAfterYear=this._get(inst,"showMonthAfterYear");var html='<div class="ui-datepicker-title">';var monthHtml="";if(secondary||!changeMonth){monthHtml+='<span class="ui-datepicker-month">'+monthNames[drawMonth]+"</span> "}else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);monthHtml+='<select class="ui-datepicker-month" onchange="DP_jQuery.datepicker._selectMonthYear(\'#'+inst.id+"', this, 'M');\" onclick=\"DP_jQuery.datepicker._clickMonthYear('#"+inst.id+"');\">";for(var month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())){monthHtml+='<option value="'+month+'"'+(month==drawMonth?' selected="selected"':"")+">"+monthNamesShort[month]+"</option>"}}monthHtml+="</select>"}if(!showMonthAfterYear){html+=monthHtml+((secondary||changeMonth||changeYear)&&(!(changeMonth&&changeYear))?"&#xa0;":"")}if(secondary||!changeYear){html+='<span class="ui-datepicker-year">'+drawYear+"</span>"}else{var years=this._get(inst,"yearRange").split(":");var year=0;var endYear=0;if(years.length!=2){year=drawYear-10;endYear=drawYear+10}else{if(years[0].charAt(0)=="+"||years[0].charAt(0)=="-"){year=drawYear+parseInt(years[0],10);endYear=drawYear+parseInt(years[1],10)}else{year=parseInt(years[0],10);endYear=parseInt(years[1],10)}}year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);html+='<select class="ui-datepicker-year" onchange="DP_jQuery.datepicker._selectMonthYear(\'#'+inst.id+"', this, 'Y');\" onclick=\"DP_jQuery.datepicker._clickMonthYear('#"+inst.id+"');\">";for(;year<=endYear;year++){html+='<option value="'+year+'"'+(year==drawYear?' selected="selected"':"")+">"+year+"</option>"}html+="</select>"}if(showMonthAfterYear){html+=(secondary||changeMonth||changeYear?"&#xa0;":"")+monthHtml}html+="</div>";return html},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=="Y"?offset:0);var month=inst.drawMonth+(period=="M"?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period=="D"?offset:0);var date=this._daylightSavingAdjust(new Date(year,month,day));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=="M"||period=="Y"){this._notifyChange(inst)}},_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange){onChange.apply((inst.input?inst.input[0]:null),[inst.selectedYear,inst.selectedMonth+1,inst])}},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return(numMonths==null?[1,1]:(typeof numMonths=="number"?[1,numMonths]:numMonths))},_getMinMaxDate:function(inst,minMax,checkRange){var date=this._determineDate(this._get(inst,minMax+"Date"),null);return(!checkRange||!inst.rangeStart?date:(!date||inst.rangeStart>date?inst.rangeStart:date))},_getDaysInMonth:function(year,month){return 32-new Date(year,month,32).getDate()},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay()},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);var date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[1]),1));if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()))}return this._isInRange(inst,date)},_isInRange:function(inst,date){var newMinDate=(!inst.rangeStart?null:this._daylightSavingAdjust(new Date(inst.selectedYear,inst.selectedMonth,inst.selectedDay)));newMinDate=(newMinDate&&inst.rangeStart<newMinDate?inst.rangeStart:newMinDate);var minDate=newMinDate||this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");return((!minDate||date>=minDate)&&(!maxDate||date<=maxDate))},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear}var date=(day?(typeof day=="object"?day:this._daylightSavingAdjust(new Date(year,month,day))):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))}});function extendRemove(target,props){$.extend(target,props);for(var name in props){if(props[name]==null||props[name]==undefined){target[name]=props[name]}}return target}function isArray(a){return(a&&(($.browser.safari&&typeof a=="object"&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))))}$.fn.datepicker=function(options){if(!$.datepicker.initialized){$(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv);$.datepicker.initialized=true}var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=="string"&&(options=="isDisabled"||options=="getDate")){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}if(options=="option"&&arguments.length==2&&typeof arguments[1]=="string"){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}return this.each(function(){typeof options=="string"?$.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options)})};$.datepicker=new Datepicker();$.datepicker.initialized=false;$.datepicker.uuid=new Date().getTime();$.datepicker.version="1.7.3";window.DP_jQuery=$})(jQuery);


// Need this for JQuery intellisense
/// <reference path="../../jQuery/1.3.2/jquery-1.3.2-vsdoc.js" />
/**
* @author EPotapova and MJJames
*/


NewMind.registerNameSpace("NewMind.SlfCatAvailUI");

NewMind.SlfCatAvailUI = function () {
	var objSlfCatCalAvailUI;
	var objSlfCatCal;
	var objAvailStays = {};
	var strBookPostUrl = '';
	//Set the sitebuilder ajax url as default
	//will be overriden it in Init() for ETWP 
	var sBaseUrl = '/sitebuilder/ajax/slfcatavailcal.asp';
	//ETWP partilal render control key list
	var sPartRenderCtlList = '';
	NewMind.SlfCatAvailUI.ChildPricingEnabled = false;

	var initSlfCatUI = function () {
		initNextPrevMonthLinks();
		initBookableStayLinks();
		initAvailSearchForm();
	};

	var reinitSlfCatUI = function () {
		initNextPrevMonthLinks();
		initBookableStayLinks();
	};

	var updateSlfCatUI = function (sUrl, objToUpdate, bReInitUI, e) {
		//alert(objToUpdate.attr('class'));
		//tidy up the url, remove all appart from query string variables
		sUrl = sUrl.substring(sUrl.indexOf("?"), sUrl.length);
		$.get(sBaseUrl + sUrl + sPartRenderCtlList, {}, function (data) {
			objToUpdate.html(data);
			if (bReInitUI) { reinitSlfCatUI(); }
			if (objToUpdate.attr('id') === 'SelectedStaySummary') {
				//ensure the action is set on the booking form
				objToUpdate.find('form.FrmUnitOptions').attr('action', strBookPostUrl);
			}
		});
	};

	// Update requirement summary generated by RequirementSummary control
	// Applicable to ETWP only
	var updateRequirementSummary = function (objSearchForm) {
		var reqSummary = $('div.ctl_RequirementSummary  dl#reqsummary');
		if (reqSummary.length > 0) {

			var iNights = parseInt(objSearchForm.find('select#nights').attr('value'), 10);
			reqSummary.find('dd#nonights').text(iNights);

			var sArrivalDate = objSearchForm.find('input#isostartdate').attr('value');
			var dayfield = sArrivalDate.split("/")[0];
			var monthfield = sArrivalDate.split("/")[1];
			var yearfield = sArrivalDate.split("/")[2];
			var d = new Date(yearfield, monthfield - 1, dayfield);

			reqSummary.find('dd#arrivaldate').text(d.toDateString());
			d.setDate(d.getDate() + iNights);
			reqSummary.find('dd#departuredate').text(d.toDateString());
			//for child pricing getting our adults and children requirements is a bit different
			if (NewMind.SlfCatAvailUI.ChildPricingEnabled) {
				var adults = 0;
				//jQuery's .val only gives us the first unit's value so instead we spin through each input and add the number to our variable, thus a running count
				objSearchForm.find(".adults select").each(function () { adults += Number($(this).val()); });
				var children = 0;
				objSearchForm.find(".children select").each(function () { children += Number($(this).val()); });
				var childages = [];
				objSearchForm.find(".childagefield select:visible").each(function () { childages.push(Number($(this).val())); });
				//now we have our values assign them
				reqSummary.find("dd.noadults").text(adults);
				reqSummary.find("dd.nochildren").text(children);
				reqSummary.find("dd.childages").text(childages.join(","));
			}
		}
	};

	var initNextPrevMonthLinks = function () {
		//alert(objSlfCatCal.find('div.SC_CalNavLinks a').length);
		objSlfCatCal.find('div.SC_CalNavLinks a').one('click', function (e) {
			e.preventDefault();
			//alert('next'+'div.'+$(this).attr('class'));
			var objCal = objSlfCatCal.find('div.' + $(this).attr('class'));
			if (objCal.css('display') === 'none') {
				objCal.show();
			}
			else {
				updateSlfCatUI($(this).attr('href'), objSlfCatCalAvailUI.find('div.SlfCatAvailCalWrapper'), true, e);
			}

		});
	};

	var initAvailSearchForm = function () {

		if (NewMind.SlfCatAvailUI.ChildPricingEnabled) {
			initChildPricing();
		}

		$('div.SlfCatAvailUI form#SC_CalendarForm').submit(function (e) {
			e.preventDefault();
			//default the url
			var sUrl = '?';
			//stash our form
			var $form = $(this);


			//if child pricing is enabled then our form values were serialized as _adults _children, selfcat won't know what to do with these
			if (NewMind.SlfCatAvailUI.ChildPricingEnabled) {
				var loopCounter = 0;
				var validGuestRequirement = false;

				//find each unit
				$form.find(".roomsReqRow").each(function () {
					//for each unit find the adults number
					var $this = $(this);
					var $adults = $find(".adults select");
					var guests = Number($adults.val());
					//our form id is the adults id with _adults removed
					var fieldid = $adults.attr("id").replace("_adults", "");

					//if we have a children element and it's not disabled
					var $children = $find(".children select:not(:disabled)");
					var ages = [];
					if ($children.length > 0) {
						//then append the number of children
						guests += Number($children.val());
						$find(".childagefield select:visible").each(function () {
							ages.push($(this).val());
						});
					}

					if (guests > 0) {
						validGuestRequirement = true;
						if (sUrl !== "?") {
							sUrl += "&";
						}
						//finally add this form value to the url
						sUrl += fieldid + "=" + guests;
						if (ages.length > 0) {
							sUrl += "&" + fieldid + "_childages=" + ages.join(",");
						}
					}

					loopCounter++;

				});
				if (!validGuestRequirement) {
					alert("Please Ensure You Have Provided Guest Requirements Before Searching");
					return;
				}
				if (loopCounter > 0) {
					sUrl += "&";
				}
				sUrl += $form.find("select#nights,input:not(.roomsReqRow input)").serialize();
			}
			else {
				//serialize our form values
				sUrl += $form.serialize();
			}
			updateSlfCatUI(sUrl, objSlfCatCalAvailUI.find('div.SlfCatAvailCalWrapper'), true, e);
			updateRequirementSummary($(this));
		});
	};

	var initBookableStayLinks = function () {
		var objAvailStayTDs = objSlfCatCal.find('td.i,td.a');
		//alert('objTds.length = '+objTds.length);
		var objAvailStayStartTDs = objSlfCatCal.find('td.i:has(a),td.a:has(a)');
		var objAvailStmtTDs = objSlfCatCal.find('td.availstmt_week');
		var objSelectedStayDetails = objSlfCatCal.find('div#SelectedStaySummary');
		var objSummary;

		var getWeekAvailStmtData = function (obj) {
			//alert(objStayLink);
			var sDate = obj.attr('id').replace('AvailStmt_', '');
			var objWeekAvailStmtData = objAvailStays.WeekAvailStmtData;
			var objThisWeekAvailStmt;
			for (var i = 0, n = objWeekAvailStmtData.length; i < n; ++i) {
				if (objWeekAvailStmtData[i].isostartdate === sDate) {
					objThisWeekAvailStmt = objWeekAvailStmtData[i];
					break;
				}
			}
			//alert(objThisWeekAvailStmt.isostartdate);
			return objThisWeekAvailStmt;
		};

		var getStayData = function (objStayLink) {
			//alert(objStayLink);
			var sDate = objStayLink.attr('id').replace('Stay_', '');
			var objAvailStaysData = objAvailStays.AvailStaysData;
			var objThisStayData;
			for (var i = 0, n = objAvailStaysData.length; i < n; ++i) {
				if (objAvailStaysData[i].isostartdate === sDate) {
					objThisStayData = objAvailStaysData[i];
					break;
				}
			}
			//alert(objThisStayData.nights);
			return objThisStayData;
		};

		objAvailStayStartTDs.click(function (e) {
			e.preventDefault();
			$('td.selected').removeClass('selected');
			$(this).addClass('selected');
			if (objSummary.length > 0) {
				objSummary.remove();
			}
			var objLink = $(this).find('a');
			if (objLink.length > 0) {
				var objThisStayData = getStayData(objLink);
				var sUrl = objLink.attr('href');
				updateStaySummary(sUrl, objThisStayData, e);
			}

		});

		objAvailStmtTDs.hover(
			function (e) {
				var objThisWeekAvailStmtData = getWeekAvailStmtData($(this));
				var sSummary = buildSummary(objThisWeekAvailStmtData, true, e);
				drawSummary(sSummary, this, e);
			},
			function (e) { }
		);

		objAvailStayStartTDs.hover(
			function (e) {

				$('td.highlighted').removeClass('highlighted');
				var objLink = $(this).find('a');
				var objThisStayData = getStayData(objLink);
				var sSummary = buildSummary(objThisStayData, false, e);

				//sSummary = '<span class="title">Available stay 3 nights for £69.00</span><span class="staydates">Saturday, 9th May 2009 - Tuesday, 12th May 2009</span><span class="unitname">Blue Cottage (£23.00 per room/unit per night)</span>';

				drawSummary(sSummary, this, e);

				var iNights = parseInt(objThisStayData.nights, 10);
				var iCount = 0;
				for (var i = 0, n = objAvailStayTDs.length; i < n; ++i) {
					//$(objAvailStayTDs[i]).removeClass('highlighted');

					if (objAvailStayTDs[i] === this) { iCount = 1; }
					if ((iCount >= 1) && (iCount <= iNights)) {
						$(objAvailStayTDs[i]).addClass('highlighted');
						iCount = iCount + 1;
					}
					if (iCount > iNights) { break; }
				}


			},
			function (e) { }
		);

		var highlightStay = function (objItems, iQty, sClass) {
			var iCount = 0;
			for (var i = 0, n = objAvailStayTDs.length; i < n; ++i) {
				//$(objAvailStayTDs[i]).removeClass('highlighted');

				if (objAvailStayTDs[i] === this) {
					iCount = 1;
				}
				if ((iCount >= 1) && (iCount <= iNights)) {
					$(objAvailStayTDs[i]).addClass('highlighted');
					iCount = iCount + 1;
				}
				if (iCount > iNights) {
					break;
				}
			}
		};
		var buildSummary = function (objStayData, bAvailStmt, e) {
			var objUnitData = objStayData.unitdata;
			var sUnitName = '';
			var sAvailStatement = '';

			for (var i = 0, n = objUnitData.length; i < n; ++i) {
				sUnitName = sUnitName + '<span class="unitname">' + objUnitData[i].unitname;
				if (bAvailStmt) {
					//MJ -	bit of a scam.... the avail statement could have encoded entities, like £ which is &#163 , but the & has been encoded into &amp;
					//		we need to decode this and any other entities so use jquery to create a fake element, set it's html and get the text out
					//		crazy but it works
					sUnitName = sUnitName + ' - ' + $("<div />").html(objUnitData[i].unitavailstmt).text();
				}
				if (i < n - 1) {
					sUnitName = sUnitName + '<br/>';
				}
				sUnitName = sUnitName + '</span>';

			}

			var sSummary = '';
			var sTittle = '';
			if (bAvailStmt) {
				sTittle = 'Availability information:';
			}
			else {
				sTittle = 'Available stay: ';
				var sNights = objStayData.nights;
				var sPrice = objStayData.price;
				if ((sNights !== undefined) && (sPrice !== undefined)) { sTittle = sTittle + ' ' + sNights + ' nights for ' + sPrice; }

			}
			sSummary = sSummary + '<span class="title">' + sTittle + '</span>';

			var sIsoStartDate = objStayData.isostartdate;
			var sAvailType = objStayData.availtype;

			var sNiceStayDates = objStayData.nicestaydates;
			if (sNiceStayDates !== undefined) { sSummary = sSummary + '<span class="staydates">' + sNiceStayDates + '</span>'; }
			sSummary = sSummary + sUnitName;

			return sSummary;
		};


		var drawSummary = function (sSummary, objThis, e) {
			objSummary = $('body > div#SlfCatStaySummary');
			if (objSummary.length === 0) {
				objSummary = $('<div id="SlfCatStaySummary">' + sSummary + '</div>');
				$('body').append(objSummary);
			}
			else {
				objSummary.html(sSummary);
			}

			//use jquery to get our offset's
			var $offset = $(objThis).offset();
			
			var iOffSetTop = $offset.top;
			var iOffSetLeft = $offset.left;

			objSummary.css('position', 'absolute');
			objSummary.css('top', (iOffSetTop + 17) + 'px');
			objSummary.css('left', (iOffSetLeft + 9) + 'px');

			$('body').children().one('click', function (e) {
				if ($(this).attr('id') !== objSummary.attr('id')) {
					objSummary.remove();
				}
			});
			objSummary.one('click', function (e) {
				$(this).remove();
			});

		};

		var updateStaySummary = function (sUrl, objThisStayData, e) {
			if (objSelectedStayDetails.length === 0) {
				objSelectedStayDetails = $('<div id="SelectedStaySummary"></div>');
				objSelectedStayDetails.insertBefore(objSlfCatCal.find('div.SC_Product'));
				objSelectedStayDetails.hide();
				updateSlfCatUI(sUrl, objSelectedStayDetails, false, e);
				objSelectedStayDetails.slideDown("slow");
			} else {
				//alert(objSelectedStayDetails.length);
				var objStayPrice = objSelectedStayDetails.find('dd.stayprice');
				objStayPrice.html(objThisStayData.price);
				var objStayDates = objSelectedStayDetails.find('dd.staydates');
				objStayDates.html(objThisStayData.nicestaydates);
				var objIsostartdateInput = objSelectedStayDetails.find('input[name="isostartdate"]');
				objIsostartdateInput.attr('value', objThisStayData.isostartdate);

				//Update Bookable
				var objBookable = objSlfCatCalAvailUI.find('div.pnStayButtons');
				var bBookButtonPresent = objBookable.find('input.btnBookStay').length > 0;
				//alert('objThisStayData.bookable = ' + objThisStayData.bookable + ' bBookButtonPresent' + bBookButtonPresent);

				if (objThisStayData.bookable === 'True' && !bBookButtonPresent) {
					objBookable.html(String(objAvailStays.BookBtn));
				} else if (objThisStayData.bookable === 'False' && bBookButtonPresent) {
					objBookable.html(String(objAvailStays.TeleBookMessage));
				}
			}


		};

	};

	var initChildPricing = function () {
		var $roomReqs = $(".roomsReqRow");
		var $adults = $roomReqs.find(".adults select");
		var maxPeople = $adults.find("option:last").val();
		var adults = $adults.change(function (e) {
			var $element = $(this);
			var adults = Number($element.val());
			//if our adults value is set to less than the maximum occupants we can allow the user to select children
			//otherwise disable the children control
			if (adults < maxPeople) {
				adultsValueChanged($element, maxPeople);
			}
			else {
				$element.closest(".roomsReqRow").find(".children select").attr("disabled", "disabled");
			}
		}).val();

		if (adults < maxPeople) {
			adultsValueChanged($adults, maxPeople);
		}
		//if we have already done a search and our adults are the same as the max occupancy disable the ability to add children
		if (adults === maxPeople) {
			$roomReqs.find(".children select").attr("disabled", "disabled");
		}

		setupChildAges($roomReqs);

	};

	var adultsValueChanged = function ($element, maxPeople) {
		var adults = Number($element.val());
		var $children = $element.closest(".roomsReqRow").find(".children select");
		$children.removeAttr("disabled");
		//although the children can now be selected, disable any options which would mean we have more children and adults than the room allows
		var $options = $children.find("option").each(function () {
			var $this = $(this);
			if (Number($val()) > (maxPeople - adults)) {
				//if we are already selected remove the selected attribute AND make the first of our siblings selected - usually 0 
				if ($attr("selected")) {
					$removeAttr("selected");
					$siblings().eq(0).attr("selected", "selected");
				}
				$attr("disabled", "disabled");
			}
			else {
				$removeAttr("disabled");
			}
		});
	};

	var setupChildAges = function ($containerSelector) {
		//find our children field
		var $childrenField = $containerSelector.find(".children select");
		//bind our change event
		$childrenField.change(function (e) {
			var $this = $(this);
			var value = $val();
			//call showhideAgeFields passing our values
			showhideAgeFields($this, value);

		});
		//hide the children age labels and wrappers
		$childrenField.parent().siblings("span.childrenageslabel").hide().siblings("span.childrenagesfield").find("span.childageWrapper").hide();
		//we now need to call showhideAgeFields to ensure any children we have already specified show
		$childrenField.each(function () {
			var $this = $(this);
			showhideAgeFields($this, $val());
		});
	};

	var showhideAgeFields = function ($this, value) {
		$parent().siblings("span.childrenageslabel").hide().siblings("span.childrenagesfield").find("span.childageWrapper").hide().each(function (i) {
			if (!isNaN(value) && i < Number(value)) {
				$(this).show().parent().siblings("span.childrenageslabel").show();
			}
		});
	};

	return {

		Init: function (sBookPostUrl) {
			objSlfCatCal = $('div.SlfCatAvailCalWrapper');
			objSlfCatCalAvailUI = $('div.SlfCatAvailUI');
			strBookPostUrl = sBookPostUrl;
			if (objSlfCatCalAvailUI.parent().hasClass('SlfCatAvailUIWrapper')) {
				sBaseUrl = '';
				var sCtlKey = objSlfCatCalAvailUI.parent().attr('id').replace('c', '');
				sPartRenderCtlList = '&PartialRenderType=data&PartialRenderControlList=' + sCtlKey;
			}
			initSlfCatUI();
		},

		AvailStays: function (data) {
			objAvailStays = data;
		}
	};

} ();


//AddEventListener(window, 'load', NewMind.SlfCatAvailUI.Init);






(function(){function $m(){var elements=[];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}function loadScript(src,callback){var script=document.createElement("script");script.type="text/javascript";script.src=src;if(callback){var evl={};evl.handleEvent=function(e){callback()};script.addEventListener("load",evl,true)}document.getElementsByTagName("head")[0].appendChild(script);return }function convertLatLonXY_Yahoo(point,level){var size=1<<(26-level);var pixel_per_degree=size/360;var pixel_per_radian=size/(2*Math.PI);var origin=new YCoordPoint(size/2,size/2);var answer=new YCoordPoint();answer.x=Math.floor(origin.x+point.lon*pixel_per_degree);var sin=Math.sin(point.lat*Math.PI/180);answer.y=Math.floor(origin.y+0.5*Math.log((1+sin)/(1-sin))*-pixel_per_radian);return answer}function loadStyle(href){var link=document.createElement("link");link.type="text/css";link.rel="stylesheet";link.href=href;document.getElementsByTagName("head")[0].appendChild(link);return }function getStyle(el,prop){var y;if(el.currentStyle){y=el.currentStyle[prop]}else{if(window.getComputedStyle){y=window.getComputedStyle(el,"").getPropertyValue(prop)}}return y}function lonToMetres(lon,lat){return lon*(111200*Math.cos(lat*(Math.PI/180)))}function metresToLon(m,lat){return m/(111200*Math.cos(lat*(Math.PI/180)))}function getDegreesFromGoogleZoomLevel(pixels,zoom){return(360*pixels)/(Math.pow(2,zoom+8))}function getGoogleZoomLevelFromDegrees(pixels,degrees){return logN((360*pixels)/degrees,2)-8}function logN(number,base){return Math.log(number)/Math.log(base)}function Mapstraction(element,api,debug){this.api=api;this.maps={};this.currentElement=$m(element);this.eventListeners=[];this.markers=[];this.polylines=[];this.images=[];this.loaded={};this.onload={};if(debug===true){this.debug=true}else{this.debug=false}this.svn_revision_string="$Revision: 1.10 $";this.addControlsArgs={};this.addAPI($m(element),api)}Mapstraction.prototype.swap=function(element,api){if(this.api==api){return }var center=this.getCenter();var zoom=this.getZoom();this.currentElement.style.visibility="hidden";this.currentElement.style.display="none";this.currentElement=$m(element);this.currentElement.style.visibility="visible";this.currentElement.style.display="block";this.api=api;if(this.maps[this.api]===undefined){this.addAPI($m(element),api);this.setCenterAndZoom(center,zoom);for(var i=0;i<this.markers.length;i++){this.addMarker(this.markers[i],true)}for(var j=0;j<this.polylines.length;j++){this.addPolyline(this.polylines[j],true)}}else{this.setCenterAndZoom(center,zoom)}this.addControls(this.addControlsArgs)};Mapstraction.prototype.addAPI=function(element,api){me=this;this.loaded[api]=false;this.onload[api]=[];switch(api){case"yahoo":if(YMap){this.maps[api]=new YMap(element);YEvent.Capture(this.maps[api],EventsList.MouseClick,function(event,location){me.clickHandler(location.Lat,location.Lon,location,me)});YEvent.Capture(this.maps[api],EventsList.changeZoom,function(){me.moveendHandler(me)});YEvent.Capture(this.maps[api],EventsList.endPan,function(){me.moveendHandler(me)});this.loaded[api]=true}else{alert("Yahoo map script not imported")}break;case"google":if(GMap2){if(GBrowserIsCompatible()){this.maps[api]=new GMap2(element);var mt=this.maps[api].getMapTypes();for(var i=0;i<mt.length;i++){mt[i].getMinimumResolution=function(){return 9}}GEvent.addListener(this.maps[api],"click",function(marker,location){if(location){me.clickHandler(location.y,location.x,location,me)}});GEvent.addListener(this.maps[api],"moveend",function(){me.moveendHandler(me)});GEvent.addListener(this.maps[api],"click",function(marker,location){if(marker){me.callEventListeners("openinfobox",{infoBox:marker,marker:marker.mapstractionMarker})}});this.loaded[api]=true}else{alert("browser not compatible with Google Maps")}}else{alert("Google map script not imported")}break;case"microsoft":if(VEMap){element.style.position="relative";var msft_width=parseFloat(getStyle($m(element),"width"));var msft_height=parseFloat(getStyle($m(element),"height"));var ffv=0;var ffn="Firefox/";var ffp=navigator.userAgent.indexOf(ffn);if(ffp!=-1){ffv=parseFloat(navigator.userAgent.substring(ffp+ffn.length))}if(ffv>=1.5){Msn.Drawing.Graphic.CreateGraphic=function(f,b){return new Msn.Drawing.SVGGraphic(f,b)}}this.maps[api]=new VEMap(element.id);this.maps[api].LoadMap();this.maps[api].AttachEvent("onclick",function(e){me.clickHandler(e.view.LatLong.Latitude,e.view.LatLong.Longitude,me)});this.maps[api].AttachEvent("onchangeview",function(e){me.moveendHandler(me)});this.resizeTo(msft_width,msft_height);this.loaded[api]=true}else{alert("Virtual Earth script not imported")}break;case"openlayers":this.maps[api]=new OpenLayers.Map(element.id);this.loaded[api]=true;break;case"openstreetmap":if(GMap2){if(GBrowserIsCompatible()){this.maps[api]=new GMap2(element);GEvent.addListener(this.maps[api],"click",function(marker,location){if(location){me.clickHandler(location.y,location.x,location,me)}});GEvent.addListener(this.maps[api],"moveend",function(){me.moveendHandler(me)});var copyright=new GCopyright(1,new GLatLngBounds(new GLatLng(-90,-180),new GLatLng(90,180)),0,"copyleft");var copyrightCollection=new GCopyrightCollection("OSM");copyrightCollection.addCopyright(copyright);var tilelayers=[];tilelayers[0]=new GTileLayer(copyrightCollection,1,18);tilelayers[0].getTileUrl=function(a,b){return"http://tile.openstreetmap.org/"+b+"/"+a.x+"/"+a.y+".png"};tilelayers[0].isPng=function(){return true};tilelayers[0].getOpacity=function(){return 1};var custommap=new GMapType(tilelayers,new GMercatorProjection(19),"OSM",{errorMessage:"More OSM coming soon"});this.maps[api].addMapType(custommap);this.loaded[api]=true;var myPoint=new LatLonPoint(50.6805,-1.4062505);this.setCenterAndZoom(myPoint,11);this.maps[api].setMapType(custommap)}else{alert("browser not compatible with Google Maps")}}else{alert("Google map script not imported")}break;case"multimap":if(MultimapViewer){if(this.debug){window.print_debug=function(strMessage){var dbg=document.getElementById("debug");if(dbg){dbg.innerHTML+="<p>MUlTIMAP: "+strMessage+"</p>"}else{alert(strMessage)}}}this.maps[api]=MMFactory.createViewer(element);this.maps[api].setAllowedZoomFactors(9,20);this.maps[api].addEventHandler("click",function(eventType,eventTarget,arg1,arg2,arg3){if(arg1){me.clickHandler(arg1.lat,arg1.lon,me)}});this.maps[api].addEventHandler("changeZoom",function(eventType,eventTarget,arg1,arg2,arg3){me.moveendHandler(me)});this.maps[api].addEventHandler("endPan",function(eventType,eventTarget,arg1,arg2,arg3){me.moveendHandler(me)});this.maps[api].addEventHandler("openInfoBox",function(eventType,eventTarget,arg1,arg2,arg3){me.callEventListeners("openinfobox",{infoBox:eventTarget,marker:arg1.mapstractionMarker})});this.loaded[api]=true}else{alert("Multimap map script not imported")}break;case"map24":if(Map24){Map24.loadApi(["core_api","wrapper_api"],function(){Map24.MapApplication.init({NodeName:element.id,MapType:"Static"});me.maps[api]=Map24.MapApplication.Map;Map24.MapApplication.Map.addListener("Map24.Event.MapClick",function(e){me.clickHandler(e.Coordinate.Latitude/60,e.Coordinate.Longitude/60,me);e.stop()});Map24.MapApplication.Map.addListener("MapPanStop",function(e){me.moveendHandler(me)});var client=Map24.MapApplication.Map.MapClient.Static;me.loaded[api]=true;for(var i=0;i<me.onload[api].length;i++){me.onload[api][i]()}},"2.0.1247")}else{alert("map24 api not loaded")}break;case"mapquest":MQInitOverlays(function(){self.loaded[api]=true;self.maps[api]=new MQTileMap(element);for(var i=0;i<self.onload[api].length;i++){self.onload[api][i]()}});break;case"freeearth":this.maps[api]=new FE.Map($m(element));self=this;this.maps[api].onLoad=function(){self.freeEarthLoaded=true;self.loaded[api]=true;for(var i=0;i<self.onload[api].length;i++){self.onload[api][i]()}};this.maps[api].load();break;default:if(this.debug){alert(api+" not supported by mapstraction")}}};Mapstraction.prototype.isLoaded=function(api){if(api===null){api=this.api}return this.loaded[api]};Mapstraction.prototype.setDebug=function(debug){if(debug!==null){this.debug=debug}return this.debug};Mapstraction.prototype.setInternalDebug=function(bDebug){switch(this.api){case"multimap":if(bDebug){window.print_debug=function(strErr){alert("Multimap error: "+strErr)}}else{window.print_debug=null}break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.setInternalDebug")}break}};Mapstraction.prototype.resizeTo=function(width,height){if(this.loaded[this.api]===false){self=this;this.onload[this.api].push(function(){self.resizeTo(width,height)});return }switch(this.api){case"yahoo":this.maps[this.api].resizeTo(new YSize(width,height));break;case"google":case"openstreetmap":this.currentElement.style.width=width;this.currentElement.style.height=height;this.maps[this.api].checkResize();break;case"microsoft":this.maps[this.api].Resize(width,height);break;case"multimap":this.currentElement.style.width=width;this.currentElement.style.height=height;this.maps[this.api].resize();break;case"mapquest":this.currentElement.style.width=width;this.currentElement.style.height=height;this.maps[this.api].setSize(new MQSize(width,height));break;case"map24":Map24.MapApplication.Map.Canvas.c.resizeTo(width,height);break}};Mapstraction.prototype.clickHandler=function(lat,lon,me){this.callEventListeners("click",{location:new LatLonPoint(lat,lon)})};Mapstraction.prototype.moveendHandler=function(me){this.callEventListeners("moveend",{})};Mapstraction.prototype.addEventListener=function(){var listener={};listener.event_type=arguments[0];listener.callback_function=arguments[1];if(arguments.length==3){listener.back_compat_mode=false;listener.callback_object=arguments[2]}else{listener.back_compat_mode=true;listener.callback_object=null}this.eventListeners.push(listener)};Mapstraction.prototype.callEventListeners=function(sEventType,oEventArgs){oEventArgs.source=this;for(var i=0;i<this.eventListeners.length;i++){var evLi=this.eventListeners[i];if(evLi.event_type==sEventType){if(evLi.back_compat_mode){if(evLi.event_type=="click"){evLi.callback_function(oEventArgs.location)}else{evLi.callback_function()}}else{var scope=evLi.callback_object||this;evLi.callback_function.call(scope,oEventArgs)}}}};Mapstraction.prototype.addControls=function(args){if(this.loaded[this.api]===false){self=this;this.onload[this.api].push(function(){self.addControls(args)});return }var map=this.maps[this.api];this.addControlsArgs=args;switch(this.api){case"google":case"openstreetmap":if(this.controls){while((ctl=this.controls.pop())){map.removeControl(ctl)}}else{this.controls=[]}c=this.controls;if(args.zoom||args.pan){if(args.zoom=="large"){c.unshift(new GLargeMapControl());map.addControl(c[0])}else{c.unshift(new GSmallMapControl());map.addControl(c[0])}}if(args.scale){c.unshift(new GScaleControl());map.addControl(c[0])}if(this.api!="openstreetmap"){if(args.overview){c.unshift(new GOverviewMapControl());map.addControl(c[0])}if(args.map_type||args.maxResolution){c.unshift(new GMapTypeControl());map.addControl(c[0])}}break;case"yahoo":if(args.pan){map.addPanControl()}else{map.removePanControl()}if(args.zoom=="large"){map.addZoomLong()}else{if(args.zoom=="small"){map.addZoomShort()}else{map.removeZoomScale()}}break;case"openlayers":map.addControl(new OpenLayers.Control.LayerSwitcher());break;case"multimap":pan_zoom_widget="MM";if(args.zoom&&args.zoom=="small"){pan_zoom_widget=pan_zoom_widget+"Small"}if(args.pan){pan_zoom_widget=pan_zoom_widget+"Pan"}if(args.zoom){pan_zoom_widget=pan_zoom_widget+"Zoom"}pan_zoom_widget=pan_zoom_widget+"Widget";if(pan_zoom_widget!="MMWidget"){eval(" map.addWidget( new "+pan_zoom_widget+"() );")}if(args.map_type){map.addWidget(new MMMapTypeWidget())}if(args.overview){map.addWidget(new MMOverviewWidget())}break;case"mapquest":if(this.controls){while((ctl=this.controls.pop())){map.removeControl(ctl)}}else{this.controls=[]}c=this.controls;if(args.pan){c.unshift(new MQPanControl());map.addControl(c[0],new MQMapCornerPlacement(MQMapCorner.TOP_LEFT,new MQSize(0,0)))}if(args.zoom=="large"){c.unshift(new MQLargeZoomControl());map.addControl(c[0],new MQMapCornerPlacement(MQMapCorner.TOP_LEFT,new MQSize(0,0)))}else{if(args.zoom=="small"){c.unshift(new MQZoomControl());map.addControl(c[0],new MQMapCornerPlacement(MQMapCorner.BOTTOM_LEFT,new MQSize(0,0)))}}if(args.map_type){c.unshift(new MQViewControl());map.addControl(c[0],new MQMapCornerPlacement(MQMapCorner.TOP_RIGHT,new MQSize(0,0)))}break}};Mapstraction.prototype.addSmallControls=function(){if(this.loaded[this.api]===false){self=this;this.onload[this.api].push(function(){self.addSmallControls()});return }var map=this.maps[this.api];switch(this.api){case"yahoo":map.addPanControl();map.addZoomShort();this.addControlsArgs.pan=true;this.addControlsArgs.zoom="small";break;case"google":case"openstreetmap":map.addControl(new GSmallMapControl());this.addControlsArgs.zoom="small";break;case"openlayers":map.addControl(new OpenLayers.Control.LayerSwitcher());break;case"multimap":smallPanzoomWidget=new MMSmallPanZoomWidget();map.addWidget(smallPanzoomWidget);this.addControlsArgs.pan=true;this.addControlsArgs.zoom="small";break;case"mapquest":map.addControl(new MQZoomControl(map));map.addControl(new PanControl(map));this.addControlsArgs.pan=true;this.addControlsArgs.zoom="small";break}};Mapstraction.prototype.addLargeControls=function(){if(this.loaded[this.api]===false){self=this;this.onload[this.api].push(function(){self.addLargeControls()});return }var map=this.maps[this.api];switch(this.api){case"yahoo":map.addPanControl();map.addZoomLong();this.addControlsArgs.pan=true;this.addControlsArgs.zoom="large";break;case"google":map.addControl(new GMapTypeControl());map.addControl(new GOverviewMapControl());this.addControlsArgs.overview=true;this.addControlsArgs.map_type=true;case"openstreetmap":map.addControl(new GLargeMapControl());map.addControl(new GScaleControl());this.addControlsArgs.pan=true;this.addControlsArgs.zoom="large";this.addControlsArgs.scale=true;break;case"multimap":panzoomWidget=new MMPanZoomWidget();map.addWidget(panzoomWidget);this.addControlsArgs.pan=true;this.addControlsArgs.zoom="large";break;case"mapquest":map.addControl(new MQLargeZoomControl(map));map.addControl(new PanControl(map));map.addControl(new MQViewControl(map));this.addControlsArgs.pan=true;this.addControlsArgs.zoom="large";this.addControlsArgs.map_type=true;break}};Mapstraction.prototype.addMapTypeControls=function(){if(this.loaded[this.api]===false){self=this;this.onload[this.api].push(function(){self.addMapTypeControls()});return }var map=this.maps[this.api];switch(this.api){case"yahoo":map.addTypeControl();break;case"google":case"openstreetmap":map.addControl(new GMapTypeControl());break;case"multimap":map.addWidget(new MMMapTypeWidget());break;case"mapquest":map.addControl(new MQViewControl(map));break}};Mapstraction.prototype.dragging=function(on){if(this.loaded[this.api]===false){self=this;this.onload[this.api].push(function(){self.dragging(on)});return }var map=this.maps[this.api];switch(this.api){case"google":case"openstreetmap":if(on){map.enableDragging()}else{map.disableDragging()}break;case"yahoo":if(on){map.enableDragMap()}else{map.disableDragMap()}break;case"multimap":if(on){map.setOption("drag","dragmap")}else{map.setOption("drag","")}break;case"mapquest":map.enableDragging(on);break}};Mapstraction.prototype.setCenterAndZoom=function(point,zoom){if(this.loaded[this.api]===false){self=this;this.onload[this.api].push(function(){self.setCenterAndZoom(point,zoom)});return }var map=this.maps[this.api];switch(this.api){case"yahoo":var yzoom=18-zoom;map.drawZoomAndCenter(point.toYahoo(),yzoom);break;case"google":case"openstreetmap":map.setCenter(point.toGoogle(),zoom);break;case"microsoft":map.SetCenterAndZoom(point.toMicrosoft(),zoom);break;case"openlayers":map.setCenter(new OpenLayers.LonLat(point.lng,point.lat),zoom);break;case"multimap":map.goToPosition(new MMLatLon(point.lat,point.lng),zoom);break;case"map24":var newSettings={};newSettings.Latitude=point.lat*60;newSettings.Longitude=point.lon*60;var client=map.MapClient.Static;var dLon=getDegreesFromGoogleZoomLevel(client.getCanvasSize().Width,zoom);newSettings.MinimumWidth=lonToMetres(dLon,point.lat);Map24.MapApplication.center(newSettings);break;case"mapquest":map.setCenter(new MQLatLng(point.lat,point.lng),zoom-3);break;case"freeearth":if(this.freeEarthLoaded){map.setTargetLatLng(point.toFreeEarth())}else{self=this;this.freeEarthOnLoad.push(function(){self.setCenterAndZoom(point)})}break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.setCenterAndZoom")}}};Mapstraction.prototype.addMarker=function(marker,old){if(this.loaded[this.api]===false){self=this;this.onload[this.api].push(function(){self.addMarker(marker,old)});return }var map=this.maps[this.api];marker.api=this.api;marker.map=this.maps[this.api];switch(this.api){case"yahoo":var ypin=marker.toYahoo();marker.setChild(ypin);map.addOverlay(ypin);if(!old){this.markers.push(marker)}break;case"google":case"openstreetmap":var gpin=marker.toGoogle();marker.setChild(gpin);map.addOverlay(gpin);if(!old){this.markers.push(marker)}break;case"microsoft":var mpin=marker.toMicrosoft();marker.setChild(mpin);map.AddPushpin(mpin);if(!old){this.markers.push(marker)}break;case"openlayers":break;case"multimap":var mmpin=marker.toMultiMap();marker.setChild(mmpin);map.addOverlay(mmpin);if(!old){this.markers.push(marker)}break;case"map24":var m24pin=marker.toMap24();marker.setChild(m24pin);m24pin.commit();if(!old){this.markers.push(marker)}break;case"mapquest":var mqpin=marker.toMapQuest();marker.setChild(mqpin);map.addPoi(mqpin);if(!old){this.markers.push(marker)}break;case"freeearth":var fepin=marker.toFreeEarth();marker.setChild(fepin);map.addOverlay(fepin);if(!old){this.markers.push(marker)}break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.addMarker")}}};Mapstraction.prototype.addMarkerWithData=function(marker,data){marker.addData(data);this.addMarker(marker)};Mapstraction.prototype.addPolylineWithData=function(polyline,data){polyline.addData(data);this.addPolyline(polyline)};Mapstraction.prototype.removeMarker=function(marker){if(this.loaded[this.api]===false){self=this;this.onload[this.api].push(function(){self.removeMarker(marker)});return }var map=this.maps[this.api];var tmparray=[];while(this.markers.length>0){current_marker=this.markers.pop();if(marker==current_marker){switch(this.api){case"google":case"openstreetmap":map.removeOverlay(marker.proprietary_marker);break;case"yahoo":map.removeOverlay(marker.proprietary_marker);break;case"microsoft":map.DeletePushpin(marker.pinID);break;case"multimap":map.removeOverlay(marker.proprietary_marker);break;case"mapquest":map.removePoi(marker.proprietary_marker);break;case"map24":marker.proprietary_marker.remove();break}marker.onmap=false;break}else{tmparray.push(current_marker)}}this.markers=this.markers.concat(tmparray)};Mapstraction.prototype.removeAllMarkers=function(){if(this.loaded[this.api]===false){self=this;this.onload[this.api].push(function(){self.removeAllMarkers()});return }var map=this.maps[this.api];switch(this.api){case"yahoo":map.removeMarkersAll();break;case"google":case"openstreetmap":map.clearOverlays();break;case"microsoft":map.DeleteAllPushpins();break;case"multimap":map.removeAllOverlays();break;case"mapquest":map.removeAllPois();break;case"map24":var current_marker;while(this.markers.length>0){current_marker=this.markers.pop();current_marker.proprietary_marker.remove()}break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.removeAllMarkers")}}this.markers=[]};Mapstraction.prototype.declutterMarkers=function(opts){if(this.loaded[this.api]===false){self=this;this.onload[this.api].push(function(){self.declutterMarkers(opts)});return }var map=this.maps[this.api];switch(this.api){case"multimap":var mmdcopts={};if("marker" in opts){var mmmkr=opts.marker.toMultiMap();mmdcopts.cluster_icon=mmmkr.getOption("icon")}map.declutterGroup(opts.groupName,mmdcopts);break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.declutterMarkers")}}};Mapstraction.prototype.addPolyline=function(polyline,old){if(this.loaded[this.api]===false){self=this;this.onload[this.api].push(function(){self.addPolyline(polyline,old)});return }var map=this.maps[this.api];polyline.api=this.api;polyline.map=this.maps[this.api];switch(this.api){case"yahoo":ypolyline=polyline.toYahoo();polyline.setChild(ypolyline);map.addOverlay(ypolyline);if(!old){this.polylines.push(polyline)}break;case"google":case"openstreetmap":gpolyline=polyline.toGoogle();polyline.setChild(gpolyline);map.addOverlay(gpolyline);if(!old){this.polylines.push(polyline)}break;case"microsoft":mpolyline=polyline.toMicrosoft();polyline.setChild(mpolyline);map.AddPolyline(mpolyline);if(!old){this.polylines.push(polyline)}break;case"multimap":mmpolyline=polyline.toMultiMap();polyline.setChild(mmpolyline);map.addOverlay(mmpolyline);if(!old){this.polylines.push(polyline)}break;case"mapquest":mqpolyline=polyline.toMapQuest();polyline.setChild(mqpolyline);map.addOverlay(mqpolyline);if(!old){this.polylines.push(polyline)}break;case"map24":var m24polyline=polyline.toMap24();polyline.setChild(m24polyline);m24polyline.commit();if(!old){this.polylines.push(polyline)}break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.addPolyline")}}};Mapstraction.prototype.removePolyline=function(polyline){if(this.loaded[this.api]===false){self=this;this.onload[this.api].push(function(){self.removePolyline(polyline)});return }var map=this.maps[this.api];var tmparray=[];while(this.polylines.length>0){current_polyline=this.polylines.pop();if(polyline==current_polyline){switch(this.api){case"google":case"openstreetmap":map.removeOverlay(polyline.proprietary_polyline);break;case"yahoo":map.removeOverlay(polyline.proprietary_polyline);break;case"microsoft":map.DeletePolyline(polyline.pllID);break;case"multimap":map.removeOverlay(polyline.proprietary_polyline);break;case"mapquest":map.removeOverlay(polyline.proprietary_polyline);break;case"map24":polyline.proprietary_polyline.remove();break}polyline.onmap=false;break}else{tmparray.push(current_polyline)}}this.polylines=this.polylines.concat(tmparray)};Mapstraction.prototype.removeAllPolylines=function(){if(this.loaded[this.api]===false){self=this;this.onload[this.api].push(function(){self.removeAllPolylines()});return }var map=this.maps[this.api];switch(this.api){case"yahoo":for(var i=0,length=this.polylines.length;i<length;i++){map.removeOverlay(this.polylines[i].proprietary_polyline)}break;case"google":case"openstreetmap":for(var i=0,length=this.polylines.length;i<length;i++){map.removeOverlay(this.polylines[i].proprietary_polyline)}break;case"microsoft":map.DeleteAllPolylines();break;case"multimap":for(var i=0,length=this.polylines.length;i<length;i++){this.polylines[i].proprietary_polyline.remove()}break;case"mapquest":map.removeAllOverlays();break;case"map24":var current_polyline;while(this.polylines.length>0){current_polyline=this.polylines.pop();current_polyline.proprietary_polyline.remove()}break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.removeAllPolylines")}}this.polylines=[]};Mapstraction.prototype.getCenter=function(){if(this.loaded[this.api]===false){return null}var map=this.maps[this.api];var point=undefined;var pt;switch(this.api){case"yahoo":pt=map.getCenterLatLon();point=new LatLonPoint(pt.Lat,pt.Lon);break;case"google":case"openstreetmap":pt=map.getCenter();point=new LatLonPoint(pt.lat(),pt.lng());break;case"microsoft":pt=map.GetCenter();point=new LatLonPoint(pt.Latitude,pt.Longitude);break;case"multimap":pt=map.getMapBounds().getCenter();point=new LatLonPoint(pt.lat,pt.lon);break;case"mapquest":pt=map.getCenter();point=new LatLonPoint(pt.getLatitude(),pt.getLongitude());break;case"map24":pt=map.MapClient.Static.getCurrentMapView().getCenter();point=new LatLonPoint(pt.Y/60,pt.X/60);break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.getCenter")}}return point};Mapstraction.prototype.setCenter=function(point){if(this.loaded[this.api]===false){self=this;this.onload[this.api].push(function(){self.setCenter(point)});return }var map=this.maps[this.api];switch(this.api){case"yahoo":map.panToLatLon(point.toYahoo());break;case"google":case"openstreetmap":map.setCenter(point.toGoogle());break;case"microsoft":map.SetCenter(point.toMicrosoft());break;case"multimap":map.goToPosition(point.toMultiMap());break;case"mapquest":map.setCenter(point.toMapQuest());break;case"freeearth":if(this.freeEarthLoaded){map.setTargetLatLng(point.toFreeEarth())}else{self=this;this.freeEarthOnLoad.push(function(){self.setCenterAndZoom(point)})}break;case"map24":var mv=map.MapClient.Static.getCurrentMapView();var newSettings={};newSettings.MinimumWidth=lonToMetres(mv.LowerRight.Longitude-mv.TopLeft.Longitude,(mv.LowerRight.Latitude+mv.TopLeft.Latitude)/2);newSettings.Latitude=point.lat*60;newSettings.Longitude=point.lon*60;Map24.MapApplication.center(newSettings);break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.setCenter")}}};Mapstraction.prototype.setZoom=function(zoom){if(this.loaded[this.api]===false){self=this;this.onload[this.api].push(function(){self.setZoom(zoom)});return }var map=this.maps[this.api];switch(this.api){case"yahoo":var yzoom=18-zoom;map.setZoomLevel(yzoom);break;case"google":case"openstreetmap":map.setZoom(zoom);break;case"microsoft":map.SetZoomLevel(zoom);break;case"multimap":map.setZoomFactor(zoom);break;case"mapquest":map.setZoomLevel(zoom-3);break;case"map24":var point=this.getCenter();var newSettings={};newSettings.Latitude=point.lat*60;newSettings.Longitude=point.lon*60;var client=map.MapClient.Static;var dLon=getDegreesFromGoogleZoomLevel(client.getCanvasSize().Width,zoom);newSettings.MinimumWidth=lonToMetres(dLon,point.lat);Map24.MapApplication.center(newSettings);break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.setZoom")}}};Mapstraction.prototype.autoCenterAndZoom=function(){if(this.loaded[this.api]===false){self=this;this.onload[this.api].push(function(){self.autoCenterAndZoom()});return }var lat_max=-90;var lat_min=90;var lon_max=-180;var lon_min=180;for(var i=0;i<this.markers.length;i++){lat=this.markers[i].location.lat;lon=this.markers[i].location.lon;if(lat>lat_max){lat_max=lat}if(lat<lat_min){lat_min=lat}if(lon>lon_max){lon_max=lon}if(lon<lon_min){lon_min=lon}}this.setBounds(new BoundingBox(lat_min,lon_min,lat_max,lon_max))};Mapstraction.prototype.centerAndZoomOnPoints=function(points){var bounds=new BoundingBox(points[0].lat,points[0].lon,points[0].lat,points[0].lon);for(var i=1,len=points.length;i<len;i++){bounds.extend(points[i])}this.setBounds(bounds)};Mapstraction.prototype.getZoom=function(){if(this.loaded[this.api]===false){self=this;return -1}var map=this.maps[this.api];switch(this.api){case"yahoo":return 18-map.getZoomLevel();case"google":case"openstreetmap":return map.getZoom();case"microsoft":return map.GetZoomLevel();case"multimap":return map.getZoomFactor();case"mapquest":return map.getZoomLevel()+3;case"map24":var mv=map.MapClient.Static.getCurrentMapView();var dLon=(mv.LowerRight.Longitude-mv.TopLeft.Longitude)/60;var width=map.MapClient.Static.getCanvasSize().Width;var zoom=getGoogleZoomLevelFromDegrees(width,dLon);return Math.round(zoom);default:if(this.debug){alert(this.api+" not supported by Mapstraction.getZoom")}}};Mapstraction.prototype.getZoomLevelForBoundingBox=function(bbox){if(this.loaded[this.api]===false){self=this;return -1}var map=this.maps[this.api];var ne=bbox.getNorthEast();var sw=bbox.getSouthWest();var zoom;switch(this.api){case"google":case"openstreetmap":var gbox=new GLatLngBounds(sw.toGoogle(),ne.toGoogle());zoom=map.getBoundsZoomLevel(gbox);return zoom;case"multimap":var mmlocation=map.getAutoScaleLocation([sw.toMultiMap(),ne.toMultiMap()]);zoom=mmlocation.zoom_factor;return zoom;case"map24":var dLon=ne.lon-sw.lon;var width=map.MapClient.Static.getCanvasSize().Width;zoom=getGoogleZoomLevelFromDegrees(width,dLon);return Math.round(zoom);default:if(this.debug){alert(this.api+" not supported by Mapstraction.getZoomLevelForBoundingBox")}}};Mapstraction.ROAD=1;Mapstraction.SATELLITE=2;Mapstraction.HYBRID=3;Mapstraction.prototype.setMapType=function(type){if(this.loaded[this.api]===false){self=this;this.onload[this.api].push(function(){self.setMapType(type)});return }var map=this.maps[this.api];switch(this.api){case"yahoo":switch(type){case Mapstraction.ROAD:map.setMapType(YAHOO_MAP_REG);break;case Mapstraction.SATELLITE:map.setMapType(YAHOO_MAP_SAT);break;case Mapstraction.HYBRID:map.setMapType(YAHOO_MAP_HYB);break;default:map.setMapType(YAHOO_MAP_REG)}break;case"google":case"openstreetmap":switch(type){case Mapstraction.ROAD:map.setMapType(G_NORMAL_MAP);break;case Mapstraction.SATELLITE:map.setMapType(G_SATELLITE_MAP);break;case Mapstraction.HYBRID:map.setMapType(G_HYBRID_MAP);break;default:map.setMapType(G_NORMAL_MAP)}break;case"microsoft":switch(type){case Mapstraction.ROAD:map.SetMapStyle(Msn.VE.MapStyle.Road);break;case Mapstraction.SATELLITE:map.SetMapStyle(Msn.VE.MapStyle.Aerial);break;case Mapstraction.HYBRID:map.SetMapStyle(Msn.VE.MapStyle.Hybrid);break;default:map.SetMapStyle(Msn.VE.MapStyle.Road)}break;case"multimap":maptypes=map.getAvailableMapTypes();maptype=-1;for(var i=0;i<maptypes.length;i++){switch(maptypes[i]){case MM_WORLD_MAP:if(type==Mapstraction.ROAD){maptype=maptypes[i]}default_type=maptypes[i];break;case MM_WORLD_AERIAL:if(type==Mapstraction.SATELLITE){maptype=maptypes[i]}break;case MM_WORLD_HYBRID:if(type==Mapstraction.HYBRID){maptype=maptypes[i]}break}}if(maptype==-1){maptype=default_type}map.setMapType(maptype);break;case"mapquest":switch(type){case Mapstraction.ROAD:map.setMapType("map");break;case Mapstraction.SATELLITE:map.setMapType("sat");break;case Mapstraction.HYBRID:map.setMapType("hyb");break}break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.setMapType")}}};Mapstraction.prototype.getMapType=function(){if(this.loaded[this.api]===false){self=this;return -1}var map=this.maps[this.api];var type;switch(this.api){case"yahoo":type=map.getCurrentMapType();switch(type){case YAHOO_MAP_REG:return Mapstraction.ROAD;case YAHOO_MAP_SAT:return Mapstraction.SATELLITE;case YAHOO_MAP_HYB:return Mapstraction.HYBRID;default:return null}break;case"google":case"openstreetmap":type=map.getCurrentMapType();switch(type){case G_NORMAL_MAP:return Mapstraction.ROAD;case G_SATELLITE_MAP:return Mapstraction.SATELLITE;case G_HYBRID_MAP:return Mapstraction.HYBRID;default:return null}break;case"microsoft":type=map.GetMapStyle();switch(type){case Msn.VE.MapStyle.Road:return Mapstraction.ROAD;case Msn.VE.MapStyle.Aerial:return Mapstraction.SATELLITE;case Msn.VE.MapStyle.Hybrid:return Mapstraction.HYBRID;default:return null}break;case"multimap":maptypes=map.getAvailableMapTypes();type=map.getMapType();switch(type){case MM_WORLD_MAP:return Mapstraction.ROAD;case MM_WORLD_AERIAL:return Mapstraction.SATELLITE;case MM_WORLD_HYBRID:return Mapstraction.HYBRID;default:return null}break;case"mapquest":type=map.getMapType();switch(type){case"map":return Mapstraction.ROAD;case"sat":return Mapstraction.SATELLITE;case"hyb":return Mapstraction.HYBRID;default:return null}break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.getMapType")}}};Mapstraction.prototype.getBounds=function(){if(this.loaded[this.api]===false){return null}var map=this.maps[this.api];switch(this.api){case"google":case"openstreetmap":var gbox=map.getBounds();var sw=gbox.getSouthWest();var ne=gbox.getNorthEast();return new BoundingBox(sw.lat(),sw.lng(),ne.lat(),ne.lng());case"yahoo":var ybox=map.getBoundsLatLon();return new BoundingBox(ybox.LatMin,ybox.LonMin,ybox.LatMax,ybox.LonMax);case"microsoft":var mbox=map.GetMapView();var nw=mbox.TopLeftLatLong;var se=mbox.BottomRightLatLong;return new BoundingBox(se.Latitude,nw.Longitude,nw.Latitude,se.Longitude);case"multimap":var mmbox=map.getMapBounds();var sw=mmbox.getSouthWest();var ne=mmbox.getNorthEast();return new BoundingBox(sw.lat,sw.lon,ne.lat,ne.lon);case"mapquest":var mqbox=map.getMapBounds();var se=mqbox.getLowerRightLatLng();var nw=mqbox.getUpperLeftLatLng();return new BoundingBox(se.lat,nw.lon,nw.lat,se.lon);case"map24":var mv=map.MapClient.Static.getCurrentMapView();var se=mv.LowerRight;var nw=mv.TopLeft;return new BoundingBox(se.Latitude/60,nw.Longitude/60,nw.Latitude/60,se.Longitude/60);default:if(this.debug){alert(this.api+" not supported by Mapstraction.getBounds")}}};Mapstraction.prototype.setBounds=function(bounds){if(this.loaded[this.api]===false){self=this;this.onload[this.api].push(function(){self.setBounds(bounds)});return }var map=this.maps[this.api];var sw=bounds.getSouthWest();var ne=bounds.getNorthEast();switch(this.api){case"google":case"openstreetmap":var gbounds=new GLatLngBounds(new GLatLng(sw.lat,sw.lon),new GLatLng(ne.lat,ne.lon));map.setCenter(gbounds.getCenter(),map.getBoundsZoomLevel(gbounds));break;case"yahoo":if(sw.lon>ne.lon){sw.lon-=360}var center=new YGeoPoint((sw.lat+ne.lat)/2,(ne.lon+sw.lon)/2);var container=map.getContainerSize();for(var zoom=1;zoom<=17;zoom++){var sw_pix=convertLatLonXY_Yahoo(sw,zoom);var ne_pix=convertLatLonXY_Yahoo(ne,zoom);if(sw_pix.x>ne_pix.x){sw_pix.x-=(1<<(26-zoom))}if(Math.abs(ne_pix.x-sw_pix.x)<=container.width&&Math.abs(ne_pix.y-sw_pix.y)<=container.height){map.drawZoomAndCenter(center,zoom);break}}break;case"microsoft":map.SetMapView([new VELatLong(sw.lat,sw.lon),new VELatLong(ne.lat,ne.lon)]);break;case"multimap":var mmlocation=map.getAutoScaleLocation([sw.toMultiMap(),ne.toMultiMap()]);map.goToPosition(mmlocation.coords,mmlocation.zoom_factor);break;case"mapquest":if(this.debug){alert(this.api+" not supported by Mapstraction.setBounds")}break;case"freeearth":var center=new LatLonPoint((sw.lat+ne.lat)/2,(ne.lon+sw.lon)/2);this.setCenter(center);break;case"map24":var settings={};settings.Latitude=((sw.lat+ne.lat)/2)*60;settings.Longitude=((sw.lon+ne.lon)/2)*60;settings.MinimumWidth=lonToMetres(ne.lon-sw.lon,(ne.lat+sw.lat)/2);Map24.MapApplication.center(settings);break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.setBounds")}}};Mapstraction.prototype.getWidthInMetres=function(){var llMapCenter=this.getCenter();var bbMapPort=this.getBounds();var llLeftCentre=new LatLonPoint(bbMapPort.sw.lon,llMapCenter.lat);var llRightCentre=new LatLonPoint(bbMapPort.ne.lon,llMapCenter.lat);return llLeftCentre.distance(llRightCentre)*1000};Mapstraction.prototype.getHeightInMetres=function(){var bbMapPort=this.getBounds();var llTop=new LatLonPoint(bbMapPort.sw.lon,bbMapPort.ne.lat);var llBottom=new LatLonPoint(bbMapPort.sw.lon,bbMapPort.sw.lat);return llTop.distance(llBottom)*1000};Mapstraction.prototype.addImageOverlay=function(id,src,opacity,west,south,east,north){if(this.loaded[this.api]===false){self=this;this.onload[this.api].push(function(){self.addImageOverlay(id,src,opacity,west,south,east,north)});return }var map=this.maps[this.api];var b=document.createElement("img");b.style.display="block";b.setAttribute("id",id);b.setAttribute("src",src);b.style.position="absolute";b.style.zIndex=1;b.setAttribute("west",west);b.setAttribute("south",south);b.setAttribute("east",east);b.setAttribute("north",north);switch(this.api){case"google":case"openstreetmap":map.getPane(G_MAP_MAP_PANE).appendChild(b);this.setImageOpacity(id,opacity);this.setImagePosition(id);GEvent.bind(map,"zoomend",this,function(){this.setImagePosition(id)});GEvent.bind(map,"moveend",this,function(){this.setImagePosition(id)});break;case"multimap":map.getContainer().appendChild(b);this.setImageOpacity(id,opacity);this.setImagePosition(id);me=this;map.addEventHandler("changeZoom",function(eventType,eventTarget,arg1,arg2,arg3){me.setImagePosition(id)});map.addEventHandler("drag",function(eventType,eventTarget,arg1,arg2,arg3){me.setImagePosition(id)});map.addEventHandler("endPan",function(eventType,eventTarget,arg1,arg2,arg3){me.setImagePosition(id)});break;default:b.style.display="none";if(this.debug){alert(this.api+"not supported by Mapstraction.addImageOverlay not supported")}break}};Mapstraction.prototype.setImageOpacity=function(id,opacity){if(opacity<0){opacity=0}if(opacity>=100){opacity=100}var c=opacity/100;var d=document.getElementById(id);if(typeof (d.style.filter)=="string"){d.style.filter="alpha(opacity:"+opacity+")"}if(typeof (d.style.KHTMLOpacity)=="string"){d.style.KHTMLOpacity=c}if(typeof (d.style.MozOpacity)=="string"){d.style.MozOpacity=c}if(typeof (d.style.opacity)=="string"){d.style.opacity=c}};Mapstraction.prototype.setImagePosition=function(id){if(this.loaded[this.api]===false){self=this;this.onload[this.api].push(function(){self.setImagePosition(id)});return }var map=this.maps[this.api];var x=document.getElementById(id);var d;var e;switch(this.api){case"google":case"openstreetmap":d=map.fromLatLngToDivPixel(new GLatLng(x.getAttribute("north"),x.getAttribute("west")));e=map.fromLatLngToDivPixel(new GLatLng(x.getAttribute("south"),x.getAttribute("east")));break;case"multimap":d=map.geoPosToContainerPixels(new MMLatLon(x.getAttribute("north"),x.getAttribute("west")));e=map.geoPosToContainerPixels(new MMLatLon(x.getAttribute("south"),x.getAttribute("east")));break}x.style.top=d.y.toString()+"px";x.style.left=d.x.toString()+"px";x.style.width=(e.x-d.x).toString()+"px";x.style.height=(e.y-d.y).toString()+"px"};Mapstraction.prototype.addGeoRSSOverlay=function(georssURL){if(this.loaded[this.api]===false){self=this;this.onload[this.api].push(function(){self.addGeoRSSOverlay(georssURL)});return }var map=this.maps[this.api];switch(this.api){case"yahoo":map.addOverlay(new YGeoRSS(georssURL));break;case"google":map.addOverlay(new GGeoXml(georssURL));break;case"microsoft":var veLayerSpec=new VELayerSpecification();veLayerSpec.Type=VELayerType.GeoRSS;veLayerSpec.ID=1;veLayerSpec.LayerSource=georssURL;veLayerSpec.Method="get";map.AddLayer(veLayerSpec);break;case"multimap":break;case"freeearth":if(this.freeEarthLoaded){var ferss=new FE.GeoRSS(georssURL);map.addOverlay(ferss)}else{self=this;this.freeEarthOnLoad.push(function(){self.addGeoRSSOverlay(georssURL)})}break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.addGeoRSSOverlay")}}};Mapstraction.prototype.addFilter=function(field,operator,value){if(!this.filters){this.filters=[]}this.filters.push([field,operator,value])};Mapstraction.prototype.removeFilter=function(field,operator,value){if(!this.filters){return }var del;for(var f=0;f<this.filters.length;f++){if(this.filters[f][0]==field&&(!operator||(this.filters[f][1]==operator&&this.filters[f][2]==value))){this.filters.splice(f,1);f--}}};Mapstraction.prototype.toggleFilter=function(field,operator,value){if(!this.filters){this.filters=[]}var found=false;for(var f=0;f<this.filters.length;f++){if(this.filters[f][0]==field&&this.filters[f][1]==operator&&this.filters[f][2]==value){this.filters.splice(f,1);f--;found=true}}if(!found){this.addFilter(field,operator,value)}};Mapstraction.prototype.removeAllFilters=function(){this.filters=[]};Mapstraction.prototype.doFilter=function(){if(this.loaded[this.api]===false){self=this;this.onload[this.api].push(function(){self.doFilter()});return }var map=this.maps[this.api];if(this.filters){switch(this.api){case"multimap":var mmfilters=[];for(var f=0;f<this.filters.length;f++){mmfilters.push(new MMSearchFilter(this.filters[f][0],this.filters[f][1],this.filters[f][2]))}map.setMarkerFilters(mmfilters);map.redrawMap();break;default:var vis;for(var m=0;m<this.markers.length;m++){vis=true;for(var f=0;f<this.filters.length;f++){if(!this.applyFilter(this.markers[m],this.filters[f])){vis=false}}if(vis){this.markers[m].show()}else{this.markers[m].hide()}}break}}};Mapstraction.prototype.applyFilter=function(o,f){var vis=true;switch(f[1]){case"ge":if(o.getAttribute(f[0])<f[2]){vis=false}break;case"le":if(o.getAttribute(f[0])>f[2]){vis=false}break;case"eq":if(o.getAttribute(f[0])!=f[2]){vis=false}break}return vis};Mapstraction.prototype.getAttributeExtremes=function(field){var min;var max;for(var m=0;m<this.markers.length;m++){if(!min||min>this.markers[m].getAttribute(field)){min=this.markers[m].getAttribute(field)}if(!max||max<this.markers[m].getAttribute(field)){max=this.markers[m].getAttribute(field)}}for(var p=0;m<this.polylines.length;m++){if(!min||min>this.polylines[p].getAttribute(field)){min=this.polylines[p].getAttribute(field)}if(!max||max<this.polylines[p].getAttribute(field)){max=this.polylines[p].getAttribute(field)}}return[min,max]};Mapstraction.prototype.getMap=function(){return this.maps[this.api]};function LatLonPoint(lat,lon){this.lat=lat;this.lon=lon;this.lng=lon}LatLonPoint.prototype.toYahoo=function(){return new YGeoPoint(this.lat,this.lon)};LatLonPoint.prototype.toGoogle=function(){return new GLatLng(this.lat,this.lon)};LatLonPoint.prototype.toMicrosoft=function(){return new VELatLong(this.lat,this.lon)};LatLonPoint.prototype.toMultiMap=function(){return new MMLatLon(this.lat,this.lon)};LatLonPoint.prototype.toMapQuest=function(){return new MQLatLng(this.lat,this.lon)};LatLonPoint.prototype.toFreeEarth=function(){return new FE.LatLng(this.lat,this.lon)};LatLonPoint.prototype.toMap24=function(){return new Map24.Point(this.lon,this.lat)};LatLonPoint.prototype.toString=function(){return this.lat+", "+this.lon};LatLonPoint.prototype.distance=function(otherPoint){var d,dr;dr=0.017453292519943295;d=Math.cos(otherPoint.lon*dr-this.lon*dr)*Math.cos(otherPoint.lat*dr-this.lat*dr);return Math.acos(d)*6378.137};LatLonPoint.prototype.equals=function(otherPoint){return this.lat==otherPoint.lat&&this.lon==otherPoint.lon};function BoundingBox(swlat,swlon,nelat,nelon){this.sw=new LatLonPoint(swlat,swlon);this.ne=new LatLonPoint(nelat,nelon)}BoundingBox.prototype.getSouthWest=function(){return this.sw};BoundingBox.prototype.getNorthEast=function(){return this.ne};BoundingBox.prototype.isEmpty=function(){return this.ne==this.sw};BoundingBox.prototype.contains=function(point){return point.lat>=this.sw.lat&&point.lat<=this.ne.lat&&point.lon>=this.sw.lon&&point.lon<=this.ne.lon};BoundingBox.prototype.toSpan=function(){return new LatLonPoint(Math.abs(this.sw.lat-this.ne.lat),Math.abs(this.sw.lon-this.ne.lon))};BoundingBox.prototype.extend=function(point){if(this.sw.lat>point.lat){this.sw.setLat(point.lat)}if(this.sw.lon>point.lon){this.sw.setLon(point.lon)}if(this.ne.lat<point.lat){this.ne.setLat(point.lat)}if(this.ne.lon<point.lon){this.ne.setLon(point.lon)}return };BoundingBox.prototype.toString=function(){return"SW lat:"+this.sw.lat+" lon:"+this.sw.lon+" -- NE lat:"+this.ne.lat+" lon:"+this.ne.lon};function Marker(point){this.location=point;this.onmap=false;this.proprietary_marker=false;this.attributes=[];this.pinID="mspin-"+new Date().getTime()+"-"+(Math.floor(Math.random()*Math.pow(2,16)))}Marker.prototype.setChild=function(some_proprietary_marker){this.proprietary_marker=some_proprietary_marker;some_proprietary_marker.mapstractionMarker=this;this.onmap=true};Marker.prototype.setLabel=function(labelText){this.labelText=labelText};Marker.prototype.addData=function(options){for(var sOptKey in options){switch(sOptKey){case"label":this.setLabel(options.label);break;case"infoBubble":this.setInfoBubble(options.infoBubble);break;case"icon":if(options.iconSize&&options.iconAnchor){this.setIcon(options.icon,options.iconSize,options.iconAnchor)}else{if(options.iconSize){this.setIcon(options.icon,options.iconSize)}else{this.setIcon(options.icon)}}break;case"infoDiv":this.setInfoDiv(options.infoDiv[0],options.infoDiv[1]);break;case"draggable":this.setDraggable(options.draggable);break;case"hover":this.setHover(options.hover);case"hoverIcon":this.setHoverIcon(options.hoverIcon);break;case"openBubble":this.openBubble();break;case"groupName":this.setGroupName(options.groupName);break;case"text":this.setText(options.text);break;default:this.setAttribute(sOptKey,options[sOptKey]);break}}};Marker.prototype.setInfoBubble=function(infoBubble){this.infoBubble=infoBubble};Marker.prototype.setText=function(text){this.text=text};Marker.prototype.setInfoDiv=function(infoDiv,div){this.infoDiv=infoDiv;this.div=div};Marker.prototype.setIcon=function(iconUrl,iconSize,iconAnchor){this.iconUrl=iconUrl;if(iconSize){this.iconSize=iconSize}if(iconAnchor){this.iconAnchor=iconAnchor}};Marker.prototype.setHoverIcon=function(hoverIconUrl){this.hoverIconUrl=hoverIconUrl};Marker.prototype.setDraggable=function(draggable){this.draggable=draggable};Marker.prototype.setHover=function(hover){this.hover=hover};Marker.prototype.setGroupName=function(sGrpName){this.groupName=sGrpName};Marker.prototype.toYahoo=function(){var ymarker;if(this.iconUrl){ymarker=new YMarker(this.location.toYahoo(),new YImage(this.iconUrl))}else{ymarker=new YMarker(this.location.toYahoo())}if(this.iconSize){ymarker.size=new YSize(this.iconSize[0],this.iconSize[1])}if(this.labelText){ymarker.addLabel(this.labelText)}if(this.infoBubble){var theInfo=this.infoBubble;var event_action;if(this.hover){event_action=EventsList.MouseOver}else{event_action=EventsList.MouseClick}YEvent.Capture(ymarker,event_action,function(){ymarker.openSmartWindow(theInfo)})}if(this.infoDiv){var theInfo=this.infoDiv;var div=this.div;var event_div;if(this.hover){event_action=EventsList.MouseOver}else{event_action=EventsList.MouseClick}YEvent.Capture(ymarker,event_action,function(){document.getElementById(div).innerHTML=theInfo})}return ymarker};Marker.prototype.toGoogle=function(){var options={};if(this.labelText){options.title=this.labelText}if(this.iconUrl){var icon=new GIcon(G_DEFAULT_ICON,this.iconUrl);if(this.iconSize){icon.iconSize=new GSize(this.iconSize[0],this.iconSize[1])}if(this.iconAnchor){icon.iconAnchor=new GPoint(this.iconAnchor[0],this.iconAnchor[1])}options.icon=icon}if(this.draggable){options.draggable=this.draggable}var gmarker=new GMarker(this.location.toGoogle(),options);if(this.infoBubble){var theInfo=this.infoBubble;var event_action;if(this.hover){event_action="mouseover"}else{event_action="click"}GEvent.addListener(gmarker,event_action,function(){gmarker.openInfoWindowHtml(theInfo,{maxWidth:100})})}if(this.hoverIconUrl){GEvent.addListener(gmarker,"mouseover",function(){gmarker.setImage(this.hoverIconUrl)});GEvent.addListener(gmarker,"mouseout",function(){gmarker.setImage(this.iconUrl)})}if(this.infoDiv){var theInfo=this.infoDiv;var div=this.div;var event_action;if(this.hover){event_action="mouseover"}else{event_action="click"}GEvent.addListener(gmarker,event_action,function(){document.getElementById(div).innerHTML=theInfo})}return gmarker};Marker.prototype.toMicrosoft=function(){var pin=new VEPushpin(this.pinID,this.location.toMicrosoft(),this.iconUrl,this.labelText,this.infoBubble);return pin};Marker.prototype.toMap24=function(){var ops={};ops.Longitude=this.location.lon*60;ops.Latitude=this.location.lat*60;if(this.infoBubble){ops.TooltipContent=this.infoBubble}if(this.labelText){}ops.LogoURL=this.iconUrl?this.iconUrl:"http://www.free-map.org.uk/images/marker.png";ops.TooltipLayout=Map24.MapObject.LAYOUT_BUBBLE;if(this.hover){ops.TooltipOpen="OnMouseOver"}else{ops.TooltipOpen="OnClick"}var m24Location=new Map24.Location(ops);return m24Location};Marker.prototype.toMultiMap=function(){var mmmarkeropts={};if(this.iconUrl){mmmarkeropts.icon=new MMIcon(this.iconUrl);if(this.iconSize){mmmarkeropts.icon.iconSize=new MMDimensions(this.iconSize[0],this.iconSize[1])}else{}if(this.iconAnchor){mmmarkeropts.icon.iconAnchor=new MMPoint(this.iconAnchor[0],this.iconAnchor[1])}if(this.groupName){mmmarkeropts.icon.groupName=this.groupName}}if(this.labelText){mmmarkeropts.label=this.labelText}if(this.text){mmmarkeropts.text=this.text}var mmmarker=new MMMarkerOverlay(this.location.toMultiMap(),mmmarkeropts);if(this.infoBubble){mmmarker.setInfoBoxContent(this.infoBubble)}if(this.infoDiv){}for(var key in this.attributes){mmmarker.setAttribute(key,this.attributes[key])}return mmmarker};Marker.prototype.toMapQuest=function(){var mqmarker=new MQPoi(this.location.toMapQuest());if(this.iconUrl){var mqicon=new MQMapIcon();mqicon.setImage(this.iconUrl,32,32,true,false);mqmarker.setIcon(mqicon)}if(this.labelText){mqmarker.setInfoTitleHTML(this.labelText)}if(this.infoBubble){mqmarker.setInfoContentHTML(this.infoBubble)}if(this.infoDiv){var theInfo=this.infoDiv;var div=this.div;MQEventManager.addListener(mqmarker,"click",function(){document.getElementById(div).innerHTML=theInfo})}return mqmarker};Marker.prototype.toFreeEarth=function(){var feicon;if(this.iconUrl){feicon=new FE.Icon(this.iconUrl)}else{feicon=new FE.Icon("http://freeearth.poly9.com/images/bullmarker.png")}var femarker=new FE.Pushpin(this.location.toFreeEarth(),feicon);if(this.infoBubble){var theBubble=this.infoBubble;FE.Event.addListener(femarker,"click",function(){femarker.openInfoWindowHtml(theBubble,200,100)})}if(this.infoDiv){var theInfo=this.infoDiv;var div=this.div;FE.Event.addListener(femarker,"click",function(){document.getElementById(div).innerHTML=theInfo})}return femarker};Marker.prototype.setAttribute=function(key,value){this.attributes[key]=value};Marker.prototype.getAttribute=function(key){return this.attributes[key]};Marker.prototype.openBubble=function(){if(this.api){switch(this.api){case"yahoo":var ypin=this.proprietary_marker;ypin.openSmartWindow(this.infoBubble);break;case"google":case"openstreetmap":var gpin=this.proprietary_marker;gpin.openInfoWindowHtml(this.infoBubble);break;case"microsoft":var pin=this.proprietary_marker;var el=$m(this.pinID+"_"+this.maps[this.api].GUID).onmouseover;setTimeout(el,1000);break;case"multimap":this.proprietary_marker.openInfoBox();break;case"mapquest":this.proprietary_marker.setRolloverEnabled(false);this.proprietary_marker.showInfoWindow();this.proprietary_marker.setRolloverEnabled(true);break}}else{alert("You need to add the marker before opening it")}};Marker.prototype.hide=function(){if(this.api){switch(this.api){case"google":case"openstreetmap":this.proprietary_marker.hide();break;case"yahoo":this.proprietary_marker.hide();break;case"map24":this.proprietary_marker.hide();break;case"multimap":this.proprietary_marker.setVisibility(false);break;case"mapquest":this.proprietary_marker.setVisible(false);break;default:if(this.debug){alert(this.api+"not supported by Marker.hide")}}}};Marker.prototype.show=function(){if(this.api){switch(this.api){case"google":case"openstreetmap":this.proprietary_marker.show();break;case"map24":this.proprietary_marker.show();break;case"yahoo":this.proprietary_marker.unhide();break;case"multimap":this.proprietary_marker.setVisibility(true);break;case"mapquest":this.proprietary_marker.setVisible(true);break;default:if(this.debug){alert(this.api+"not supported by Marker.show")}}}};function Polyline(points){this.points=points;this.attributes=[];this.onmap=false;this.proprietary_polyline=false;this.pllID="mspll-"+new Date().getTime()+"-"+(Math.floor(Math.random()*Math.pow(2,16)))}Polyline.prototype.addData=function(options){for(var sOpt in options){switch(sOpt){case"color":this.setColor(options.color);break;case"width":this.setWidth(options.width);break;case"opacity":this.setOpacity(options.opacity);break;case"closed":this.setClosed(options.closed);break;case"fillColor":this.setFillColor(options.fillColor);break;default:this.setAttribute(sOpt,options[sOpt]);break}}};Polyline.prototype.setChild=function(some_proprietary_polyline){this.proprietary_polyline=some_proprietary_polyline;this.onmap=true};Polyline.prototype.setColor=function(color){this.color=(color.length==7&&color[0]=="#")?color.toUpperCase():color};Polyline.prototype.setWidth=function(width){this.width=width};Polyline.prototype.setOpacity=function(opacity){this.opacity=opacity};Polyline.prototype.setClosed=function(bClosed){this.closed=bClosed};Polyline.prototype.setFillColor=function(sFillColor){this.fillColor=sFillColor};Polyline.prototype.toYahoo=function(){var ypolyline;var ypoints=[];for(var i=0,length=this.points.length;i<length;i++){ypoints.push(this.points[i].toYahoo())}ypolyline=new YPolyline(ypoints,this.color,this.width,this.opacity);return ypolyline};Polyline.prototype.toGoogle=function(){var gpolyline;var gpoints=[];for(var i=0,length=this.points.length;i<length;i++){gpoints.push(this.points[i].toGoogle())}gpolyline=new GPolyline(gpoints,this.color,this.width,this.opacity);return gpolyline};Polyline.prototype.toMap24=function(){var m24polyline;var m24longs="";var m24lats="";for(var i=0;i<this.points.length;i++){if(i){m24longs+="|";m24lats+="|"}m24longs+=(this.points[i].lon*60);m24lats+=(this.points[i].lat*60)}m24polyline=new Map24.Polyline({Longitudes:m24longs,Latitudes:m24lats,Color:this.color||"black",Width:this.width||3});return m24polyline};Polyline.prototype.toMicrosoft=function(){var mpolyline;var mpoints=[];for(var i=0,length=this.points.length;i<length;i++){mpoints.push(this.points[i].toMicrosoft())}var color;var opacity=this.opacity||1;if(this.color){color=new VEColor(parseInt(this.color.substr(1,2),16),parseInt(this.color.substr(3,2),16),parseInt(this.color.substr(5,2),16),opacity)}else{color=new VEColor(0,255,0,opacity)}mpolyline=new VEPolyline(this.pllID,mpoints,color,this.width);return mpolyline};Polyline.prototype.toMultiMap=function(){var mmpolyline;var mmpoints=[];for(var i=0,length=this.points.length;i<length;i++){mmpoints.push(this.points[i].toMultiMap())}mmpolyline=new MMPolyLineOverlay(mmpoints,this.color,this.opacity,this.width,this.closed,this.fillColor);return mmpolyline};Polyline.prototype.toMapQuest=function(){var mqpolyline=new MQLineOverlay();mqpolyline.setColor(this.color||"red");mqpolyline.setBorderWidth(this.width||3);mqpolyline.setKey("Line");mqpolyline.setColorAlpha(this.opacity);var mqpoints=new MQLatLngCollection();for(var i=0,length=this.points.length;i<length;i++){mqpoints.add(this.points[i].toMapQuest())}mqpolyline.setShapePoints(mqpoints);return mqpolyline};Polyline.prototype.toFreeEarth=function(){var fepoints=[];for(var i=0,length=this.points.length;i<length;i++){fepoints.push(this.points[i].toFreeEarth())}var fepolyline=new FE.Polyline(fepoints,this.color||"0xff0000",this.width||1,this.opacity||1);return fepolyline};Polyline.prototype.setAttribute=function(key,value){this.attributes[key]=value};Polyline.prototype.getAttribute=function(key){return this.attributes[key]};Polyline.prototype.show=function(){switch(this.api){case"multimap":if(!this.onmap){this.map.addOverlay(this.proprietary_polyline)}break;default:if(this.debug){alert(api+" not supported by Polyline.show")}break}};Polyline.prototype.hide=function(){switch(this.api){case"multimap":if(this.onmap){this.map.removeOverlay(this.proprietary_polyline);this.onmap=false}break;default:if(this.debug){alert(api+" not supported by Polyline.hide")}break}};Mapstraction.prototype.showRoute=function(route){if(this.loaded[this.api]===false){self=this;this.onload[this.api].push(function(){self.showRoute(route)});return }var map=this.maps[this.api];switch(this.api){case"mapquest":map.addRouteHighlight(route.bounding_box,"http://map.access.mapquest.com",route.session_id,true);break;default:if(this.debug){alert(api+" not supported by Mapstration.showRoute")}break}};window.mxn={BoundingBox:BoundingBox,LatLonPoint:LatLonPoint,Mapstraction:Mapstraction,Marker:Marker,Polyline:Polyline,fn:{metresToLon:metresToLon,loadScript:loadScript},activatePolluteMode:function(){if(window.BoundingBox||window.LatLonPoint||window.Mapstraction||window.Marker||window.Polyline){alert("Warning: Mapstraction pollute mode naming clash.")}window.BoundingBox=BoundingBox;window.LatLonPoint=LatLonPoint;window.Mapstraction=Mapstraction;window.Marker=Marker;window.Polyline=Polyline}}})();


function LatLng(B,A){this.lat=B;this.lng=A;this.distance=LatLngDistance;this.toOSRef=LatLngToOSRef;this.toUTMRef=LatLngToUTMRef;this.WGS84ToOSGB36=WGS84ToOSGB36;this.OSGB36ToWGS84=OSGB36ToWGS84;this.toString=LatLngToString}function LatLngToString(){return"("+this.lat+", "+this.lng+")"}function OSRef(B,A){this.easting=B;this.northing=A;this.toLatLng=OSRefToLatLng;this.toString=OSRefToString;this.toSixFigureString=OSRefToSixFigureString}function OSRefToString(){return"("+this.easting+", "+this.northing+")"}function OSRefToSixFigureString(){var C=Math.floor(this.easting/100000);var J=Math.floor(this.northing/100000);var D="";if(J<5){if(C<5){D="S"}else{D="T"}}else{if(J<10){if(C<5){D="N"}else{D="O"}}else{D="H"}}var I="";var E=65+((4-(J%5))*5)+(C%5);var A=E;if(E>=73){E++}I=chr(E);var F=Math.floor((this.easting-(100000*C))/100);var B=Math.floor((this.northing-(100000*J))/100);var H=F;if(F<100){H="0"+H}if(F<10){H="0"+H}var G=B;if(B<100){G="0"+G}if(B<10){G="0"+G}return D+I+H+G}function UTMRef(D,C,B,A){this.easting=D;this.northing=C;this.latZone=B;this.lngZone=A;this.toLatLng=UTMRefToLatLng;this.toString=UTMRefToString}function UTMRefToString(){return this.lngZone+this.latZone+" "+this.easting+" "+this.northing}function RefEll(A,B){this.maj=A;this.min=B;this.ecc=((A*A)-(B*B))/(A*A)}function sinSquared(A){return Math.sin(A)*Math.sin(A)}function cosSquared(A){return Math.cos(A)*Math.cos(A)}function tanSquared(A){return Math.tan(A)*Math.tan(A)}function sec(A){return 1/Math.cos(A)}function deg2rad(A){return A*(Math.PI/180)}function rad2deg(A){return A*(180/Math.PI)}function chr(A){var B=A.toString(16);if(B.length==1){B="0"+B}B="%"+B;return unescape(B)}function ord(A){var D=A.charAt(0);var B;for(B=0;B<256;++B){var C=B.toString(16);if(C.length==1){C="0"+C}C="%"+C;C=unescape(C);if(C==D){break}}return B}function LatLngDistance(L){var M=6366.707;var D=deg2rad(this.lat);var G=deg2rad(L.lat);var I=deg2rad(this.lng);var C=deg2rad(L.lng);var B=M*Math.cos(I)*Math.sin(D);var K=M*Math.sin(I)*Math.sin(D);var F=M*Math.cos(D);var A=M*Math.cos(C)*Math.sin(G);var J=M*Math.sin(C)*Math.sin(G);var E=M*Math.cos(G);var H=Math.sqrt((B-A)*(B-A)+(K-J)*(K-J)+(F-E)*(F-E));return H}function OSGB36ToWGS84(){var N=new RefEll(6377563.396,6356256.909);var c=N.maj;var Y=N.min;var K=N.ecc;var B=deg2rad(this.lat);var Q=deg2rad(this.lng);var P=c/(Math.sqrt(1-K*sinSquared(B)));var O=0;var M=(P+O)*Math.cos(B)*Math.cos(Q);var J=(P+O)*Math.cos(B)*Math.sin(Q);var I=((1-K)*P+O)*Math.sin(B);var d=446.448;var Z=-124.157;var X=542.06;var S=-0.0000204894;var E=deg2rad(0.00004172222);var D=deg2rad(0.00006861111);var C=deg2rad(0.00023391666);var L=d+(M*(1+S))+(-E*J)+(D*I);var W=Z+(C*M)+(J*(1+S))+(-E*I);var A=X+(-D*M)+(E*J)+(I*(1+S));var G=new RefEll(6378137,6356752.3141);c=G.maj;Y=G.min;K=G.ecc;var U=rad2deg(Math.atan(W/L));var T=Math.sqrt((L*L)+(W*W));var F=Math.atan(A/(T*(1-K)));for(var V=1;V<10;V++){P=c/(Math.sqrt(1-K*sinSquared(F)));phiN1=Math.atan((A+(K*P*Math.sin(F)))/T);F=phiN1}var R=rad2deg(F);this.lat=R;this.lng=U}function WGS84ToOSGB36(){var G=new RefEll(6378137,6356752.3141);var c=G.maj;var Y=G.min;var K=G.ecc;var B=deg2rad(this.lat);var Q=deg2rad(this.lng);var P=c/(Math.sqrt(1-K*sinSquared(B)));var O=0;var N=(P+O)*Math.cos(B)*Math.cos(Q);var J=(P+O)*Math.cos(B)*Math.sin(Q);var I=((1-K)*P+O)*Math.sin(B);var d=-446.448;var Z=124.157;var X=-542.06;var S=0.0000204894;var E=deg2rad(-0.00004172222);var D=deg2rad(-0.00006861111);var C=deg2rad(-0.00023391666);var M=d+(N*(1+S))+(-E*J)+(D*I);var W=Z+(C*N)+(J*(1+S))+(-E*I);var A=X+(-D*N)+(E*J)+(I*(1+S));var L=new RefEll(6377563.396,6356256.909);c=L.maj;Y=L.min;K=L.ecc;var U=rad2deg(Math.atan(W/M));var T=Math.sqrt((M*M)+(W*W));var F=Math.atan(A/(T*(1-K)));for(var V=1;V<10;V++){P=c/(Math.sqrt(1-K*sinSquared(F)));phiN1=Math.atan((A+(K*P*Math.sin(F)))/T);F=phiN1}var R=rad2deg(F);this.lat=R;this.lng=U}function OSRefToLatLng(J){if((typeof (J)==="undefined")||(J!==false)){J=true;}var U,G;if(J){U=this.easting;G=this.northing}else{var F=Y(this);U=F.easting;G=F.northing}var O=new RefEll(6377563.396,6356256.909);var i=0.9996012717;var V=-100000;var P=400000;var d=deg2rad(49);var A=deg2rad(-2);var e=O.maj;var c=O.min;var K=O.ecc;var D=0;var S=0;var W=(e-c)/(e+c);var H=0;var L=((G-V)/(e*i))+d;do{H=(c*i)*(((1+W+((5/4)*W*W)+((5/4)*W*W*W))*(L-d))-(((3*W)+(3*W*W)+((21/8)*W*W*W))*Math.sin(L-d)*Math.cos(L+d))+((((15/8)*W*W)+((15/8)*W*W*W))*Math.sin(2*(L-d))*Math.cos(2*(L+d)))-(((35/24)*W*W*W)*Math.sin(3*(L-d))*Math.cos(3*(L+d))));L+=(G-V-H)/(e*i)}while((G-V-H)>=0.001);var R=e*i*Math.pow(1-K*sinSquared(L),-0.5);var B=e*i*(1-K)*Math.pow(1-K*sinSquared(L),-1.5);var T=(R/B)-1;var Z=Math.tan(L)/(2*B*R);var Q=(Math.tan(L)/(24*B*Math.pow(R,3)))*(5+(3*tanSquared(L))+T-(9*tanSquared(L)*T));var h=(Math.tan(L)/(720*B*Math.pow(R,5)))*(61+(90*tanSquared(L))+(45*tanSquared(L)*tanSquared(L)));var C=sec(L)/R;var I=(sec(L)/(6*R*R*R))*((R/B)+(2*tanSquared(L)));var g=(sec(L)/(120*Math.pow(R,5)))*(5+(28*tanSquared(L))+(24*tanSquared(L)*tanSquared(L)));var f=(sec(L)/(5040*Math.pow(R,7)))*(61+(662*tanSquared(L))+(1320*tanSquared(L)*tanSquared(L))+(720*tanSquared(L)*tanSquared(L)*tanSquared(L)));D=L-(Z*Math.pow(U-P,2))+(Q*Math.pow(U-P,4))-(h*Math.pow(U-P,6));S=A+(C*(U-P))-(I*Math.pow(U-P,3))+(g*Math.pow(U-P,5))-(f*Math.pow(U-P,7));return new LatLng(rad2deg(D),rad2deg(S));function Y(M){var X=M.easting/100000;var j=M.northing/100000;var b=(-20.13152127*Math.pow(X,6))+(452.9685282*Math.pow(X,5))+(-4040.509066*Math.pow(X,4))+(18172.98757*Math.pow(X,3))+(-43165.25804*Math.pow(X,2))+(51036.20603*X)+(-23578.61857);var a=(-0.06414879*Math.pow(j,6))+(1.599167873*Math.pow(j,5))+(-15.19263463*Math.pow(j,4))+(68.2881115*Math.pow(j,3))+(-145.6116922*Math.pow(j,2))+(116.7793638*j)+(41.16123877);return new OSRef(M.easting+b,M.northing+a)}}function LatLngToOSRef(){var O=new RefEll(6377563.396,6356256.909);var f=0.9996012717;var T=-100000;var P=400000;var e=deg2rad(49);var B=deg2rad(-2);var d=O.maj;var c=O.min;var K=O.ecc;var D=deg2rad(this.lat);var R=deg2rad(this.lng);var S=0;var H=0;var W=(d-c)/(d+c);var Q=d*f*Math.pow(1-K*sinSquared(D),-0.5);var C=d*f*(1-K)*Math.pow(1-K*sinSquared(D),-1.5);var U=(Q/C)-1;var J=(c*f)*(((1+W+((5/4)*W*W)+((5/4)*W*W*W))*(D-e))-(((3*W)+(3*W*W)+((21/8)*W*W*W))*Math.sin(D-e)*Math.cos(D+e))+((((15/8)*W*W)+((15/8)*W*W*W))*Math.sin(2*(D-e))*Math.cos(2*(D+e)))-(((35/24)*W*W*W)*Math.sin(3*(D-e))*Math.cos(3*(D+e))));var L=J+T;var G=(Q/2)*Math.sin(D)*Math.cos(D);var X=(Q/24)*Math.sin(D)*Math.pow(Math.cos(D),3)*(5-tanSquared(D)+(9*U));var Z=(Q/720)*Math.sin(D)*Math.pow(Math.cos(D),5)*(61-(58*tanSquared(D))+Math.pow(Math.tan(D),4));var A=Q*Math.cos(D);var F=(Q/6)*Math.pow(Math.cos(D),3)*((Q/C)-tanSquared(D));var Y=(Q/120)*Math.pow(Math.cos(D),5)*(5-(18*tanSquared(D))+(Math.pow(Math.tan(D),4))+(14*U)-(58*tanSquared(D)*U));H=L+(G*Math.pow(R-B,2))+(X*Math.pow(R-B,4))+(Z*Math.pow(R-B,6));S=P+(A*(R-B))+(F*Math.pow(R-B,3))+(Y*Math.pow(R-B,5));return new OSRef(S,H)}function UTMRefToLatLng(){var E=new RefEll(6378137,6356752.314);var U=0.9996;var T=E.maj;var G=E.ecc;var S=G/(1-G);var D=(1-Math.sqrt(1-G))/(1+Math.sqrt(1-G));var H=this.easting-500000;var F=this.northing;var C=this.lngZone;var B=this.latZone;var A=(C-1)*6-180+3;if((ord(B)-ord("N"))<0){F-=10000000}var O=F/U;var M=O/(T*(1-G/4-3*G*G/64-5*Math.pow(G,3)/256));var P=M+(3*D/2-27*Math.pow(D,3)/32)*Math.sin(2*M)+(21*D*D/16-55*Math.pow(D,4)/32)*Math.sin(4*M)+(151*Math.pow(D,3)/96)*Math.sin(6*M);var N=T/Math.sqrt(1-G*Math.sin(P)*Math.sin(P));var J=Math.tan(P)*Math.tan(P);var R=S*Math.cos(P)*Math.cos(P);var K=T*(1-G)/Math.pow(1-G*Math.sin(P)*Math.sin(P),1.5);var Q=H/(N*U);var L=(P-(N*Math.tan(P)/K)*(Q*Q/2-(5+(3*J)+(10*R)-(4*R*R)-(9*S))*Math.pow(Q,4)/24+(61+(90*J)+(298*R)+(45*J*J)-(252*S)-(3*R*R))*Math.pow(Q,6)/720))*(180/Math.PI);var I=A+((Q-(1+2*J+R)*Math.pow(Q,3)/6+(5-(2*R)+(28*J)-(3*R*R)+(8*S)+(24*J*J))*Math.pow(Q,5)/120)/Math.cos(P))*(180/Math.PI);return new LatLng(L,I)}function LatLngToUTMRef(){var F=new RefEll(6378137,6356752.314);var T=0.9996;var S=F.maj;var H=F.ecc;var J=this.lng;var K=this.lat;var C=K*(Math.PI/180);var O=J*(Math.PI/180);var U=Math.floor((J+180)/6)+1;if(K>=56&&K<64&&J>=3&&J<12){U=32}if(K>=72&&K<84){if(J>=0&&J<9){U=31}else{if(J>=9&&J<21){U=33}else{if(J>=21&&J<33){U=35}else{if(J>=33&&J<42){U=37}}}}}var B=(U-1)*6-180+3;var P=B*(Math.PI/180);var Q=getUTMLatitudeZoneLetter(K);ePrimeSquared=(H)/(1-H);var N=S/Math.sqrt(1-H*Math.sin(C)*Math.sin(C));var I=Math.tan(C)*Math.tan(C);var R=ePrimeSquared*Math.cos(C)*Math.cos(C);var L=Math.cos(C)*(O-P);var G=S*((1-H/4-3*H*H/64-5*H*H*H/256)*C-(3*H/8+3*H*H/32+45*H*H*H/1024)*Math.sin(2*C)+(15*H*H/256+45*H*H*H/1024)*Math.sin(4*C)-(35*H*H*H/3072)*Math.sin(6*C));var E=(T*N*(L+(1-I+R)*Math.pow(L,3)/6+(5-18*I+I*I+72*R-58*ePrimeSquared)*Math.pow(L,5)/120)+500000);var D=(T*(G+N*Math.tan(C)*(L*L/2+(5-I+(9*R)+(4*R*R))*Math.pow(L,4)/24+(61-(58*I)+(I*I)+(600*R)-(330*ePrimeSquared))*Math.pow(L,6)/720)));if(K<0){D+=10000000}return new UTMRef(E,D,Q,U)}function getOSRefFromSixFigureReference(F){var E=F.substring(0,1);var D=F.substring(1,2);var C=parseInt(F.substring(2,5),10)*100;var G=parseInt(F.substring(5,8),10)*100;if(E=="H"){G+=1000000}else{if(E=="N"){G+=500000}else{if(E=="O"){G+=500000;C+=500000}else{if(E=="T"){C+=500000}}}}var B=ord(D);if(B>73){B--}var A=((B-65)%5)*100000;var H=(4-Math.floor((B-65)/5))*100000;return new OSRef(C+A,G+H)}function getUTMLatitudeZoneLetter(A){if((84>=A)&&(A>=72)){return"X"}else{if((72>A)&&(A>=64)){return"W"}else{if((64>A)&&(A>=56)){return"V"}else{if((56>A)&&(A>=48)){return"U"}else{if((48>A)&&(A>=40)){return"T"}else{if((40>A)&&(A>=32)){return"S"}else{if((32>A)&&(A>=24)){return"R"}else{if((24>A)&&(A>=16)){return"Q"}else{if((16>A)&&(A>=8)){return"P"}else{if((8>A)&&(A>=0)){return"N"}else{if((0>A)&&(A>=-8)){return"M"}else{if((-8>A)&&(A>=-16)){return"L"}else{if((-16>A)&&(A>=-24)){return"K"}else{if((-24>A)&&(A>=-32)){return"J"}else{if((-32>A)&&(A>=-40)){return"H"}else{if((-40>A)&&(A>=-48)){return"G"}else{if((-48>A)&&(A>=-56)){return"F"}else{if((-56>A)&&(A>=-64)){return"E"}else{if((-64>A)&&(A>=-72)){return"D"}else{if((-72>A)&&(A>=-80)){return"C"}else{return"Z"}}}}}}}}}}}}}}}}}}}}};


(function(){mxn.activatePolluteMode();NewMind.mapping=function(){var B={};var A=0;return{DEBUG:false,DEBUG_OUTPUT_DIV:null,DEFAULT_MAP_PROVIDER:"multimap",configure:function(C){for(var D in C){if(C.hasOwnProperty(D)){this[D]=C[D]}}},debugWrite:function(C){if(this.DEBUG&&this.DEBUG_OUTPUT_DIV){this.DEBUG_OUTPUT_DIV.innerHTML+=C+"<br/>"}},addMap:function(C,D){NewMind.mapping.debugWrite("Adding map "+C);B[C]=new NewMind.mapping.Map(C,D);return B[C]},getMap:function(C){if(typeof (C)=="string"){return B[C]||null}return C},getMapID:function(C){for(var D in B){if(B[D]===C){return D}}throw"Matching map object not found, object not created with addMap?"},getMapIDList:function(){var D=[];for(var C in B){if(B.hasOwnProperty(C)){D.push(C)}}return D},getNextInteger:function(){return ++A},addMarkerOkToShowDelegate:function(D,C){if(!("okToShowDelegates" in D)){D.okToShowDelegates=[];D.show=NewMind.mapping.markerShow}D.okToShowDelegates.push(C)},markerShow:function(){var D=true;for(var C=0;C<this.okToShowDelegates.length;C++){if(!this.okToShowDelegates[C].call(null,this)){D=false;break}}if(D){this.constructor.prototype.show.call(this)}else{this.hide()}}}}();NewMind.mapping.Map=function(K,F){var H=true;var C={};var L=0;var G={};var M=0;var J=F||NewMind.mapping.DEFAULT_MAP_PROVIDER;this.mapstractionMap=new mxn.Mapstraction(K,J,NewMind.mapping.DEBUG);this.getLoadingMessageClone=function(N){if((typeof (N)==="undefined")||(N!==true)){N=false}var O=document.createElement("div");O.className="loadingMessage";O.innerHTML="Loading...";O.style.display=N?"block":"none";this.mapstractionMap.currentElement.appendChild(O);return O};var D=this.getLoadingMessageClone();this.zoomChanged=new NewMind.CustomEvent("zoomChanged",this);this.infoBoxOpened=new NewMind.CustomEvent("infoBoxOpened",this);this.beforeUpdate=new NewMind.CustomEvent("beforeUpdate",this);this.afterUpdate=new NewMind.CustomEvent("afterUpdate",this);this.addOverlay=function(O,N){NewMind.mapping.debugWrite("Adding overlay "+O);if(!(O in C)){N.parentMap=this;N.OverlayID=O;N.init();C[O]=N;if(arguments.length>2&&arguments[2]===true){this.updateView()}}else{throw new Error("Overlay already exists with ID "+O)}};this.getOverlay=function(N){return C[N]||null};this.getOverlayList=function(){var N=[];for(var O in C){if(C.hasOwnProperty(O)){N.push(O)}}return N};this.getContainerID=function(){return K};var I=function(Q){var R=this.mapstractionMap.getCenter();var N=this.mapstractionMap.getZoom();var P=this.mapstractionMap.getBounds();if(isNaN(P.ne.lat)||isNaN(P.sw.lat)||isNaN(P.ne.lon)||isNaN(P.sw.lon)){NewMind.mapping.DebugOutput("Invalid Bounds (NaN encountered): "+P.ne+" to "+P.sw+" - Disable NewMind.mapping.MaponMapMove call");return }if((P.ne.lat===P.sw.lat)&&(P.ne.lon===P.sw.lon)){NewMind.mapping.DebugOutput("Empty Bounds: "+P.ne+" to "+P.sw+" - Disable NewMind.mapping.MaponMapMove call");return }NewMind.mapping.DebugOutput("NewMind.mapping.MaponMapMove: "+R.toString()+", zoom = "+N);var O=true;if(NewMind.mapping.DISABLE_STORE_POS_IN_HASH===true){O=false}if(O){window.location.hash="mapx="+NewMind.correctFloatError(R.lon)+"&mapy="+NewMind.correctFloatError(R.lat)+"&mapz="+N}if(M!=N){this.zoomChanged.fire(N-M)}M=N;this.updateView()};var E=function(O,N){this.cancelAllTrans()};var B=function(N){};var A=function(N){this.infoBoxOpened.fire(N.marker)};this.updateView=function(O,P){if((typeof (O)==="undefined")||(O!==true)){O=false}if((typeof (P)==="undefined")||(P!==true)){P=false}if(P){H=true}NewMind.mapping.DebugOutput("Map.updateView (bBoundless: "+O+"), showing: "+H);if(H){var N="d"+NewMind.mapping.getNextInteger().toString();G[N]=0;this.beforeUpdate.fire();this.showLoadingMessage();var R=this.mapstractionMap.getBounds();if(!O){NewMind.mapping.DebugOutput("Updating view "+R.toString()+" -- "+this.mapstractionMap.getZoom())}else{R.sw.lat=49.6;R.sw.lng=-10.8;R.sw.lon=R.sw.lng;R.ne.lat=61.3;R.ne.lng=3;R.ne.lon=R.ne.lng;NewMind.mapping.DebugOutput("Updating view [Boundless] "+R.toString()+" -- "+this.mapstractionMap.getZoom())}for(var Q in C){if(!C[Q].updateView(N,R)){G[N]++}}if(G[N]===0){this.updateDone(N)}this.afterUpdate.fire()}};this.showLoadingMessage=function(){D.style.display="block"};this.hideLoadingMessage=function(){D.style.display="none"};this.updateDone=function(N){if(N in G){G[N]--;if(G[N]<=0){delete G[N]}}if(NewMind.countProps(G)===0){this.hideLoadingMessage()}};this.cancelTran=function(N){if(N in G){for(var O in C){C[O].cancelTran(N)}G[N]=0;this.updateDone(N)}};this.cancelAllTrans=function(){for(var N in G){this.cancelTran(N)}};this.toggleVisibility=function(){H=!H;if(H){this.updateView()}};this.mapstractionMap.addEventListener("moveend",I,this);this.mapstractionMap.addEventListener("click",B,this);this.mapstractionMap.addEventListener("openinfobox",A,this);this.zoomChanged.subscribe(E)};NewMind.mapping.Overlay=function(){var A=true;this.AreaCovered=[];this.TileSize=new mxn.LatLonPoint(0.018,0.025);this.toggleShowHide=new NewMind.CustomEvent("toggleShowHide",this);this.OverlayID=undefined;this.parentMap=undefined;this.Active=true;this.IsDynamic=false;this.Data=undefined;this.DataSource=undefined;this.showHideCheckbox=undefined;this.DoneInitialLoad=false;this.waitingOnTiles={};this.waitingOn=0;this.show=function(){if(A===false){A=true;if(this.showHideCheckbox){this.showHideCheckbox.checked=true}this.toggleShowHide.fire(true)}};this.hide=function(){if(A===true){A=false;if(this.showHideCheckbox){this.showHideCheckbox.checked=false}this.toggleShowHide.fire(false)}};this.getShowing=function(){return A}};NewMind.mapping.Overlay.prototype={updateView:function(B,D){var C;if(this.IsDynamic){NewMind.mapping.DebugOutput("Updating dynamic overlay "+this.OverlayID+" - "+B);var A;if(D===null){A=null}else{A=this.getDataTileRequired(D)}if((D===null)||(A!==null)){C=this.DataSource.getData(B,A);if(C.complete){if(C.error===0){this.render(C.data)}NewMind.mapping.debugWrite("Updating done "+this.OverlayID+" - "+B);return true}else{this.waitingOnTiles[B]=A;NewMind.mapping.debugWrite("Updating not done "+this.OverlayID+" - "+B);return false}}NewMind.mapping.debugWrite("No update to do "+this.OverlayID+" - "+B)}else{if(this.DataSource!==undefined&&!this.DoneInitialLoad){C=this.DataSource.getData();this.Data=C.data;this.render(this.Data);this.DoneInitialLoad=true}else{if(!this.IsDynamic&&!this.DoneInitialLoad){this.render(this.Data);this.DoneInitialLoad=true}}}return true},dataReady:function(A){NewMind.mapping.debugWrite("Data returned for "+A.tranid);if(this.getTranValid(A.tranid)){if(A.error===0){try{this.render(A.data)}catch(C){if(NewMind.mapping.DEBUG){throw C}}var B=this.waitingOnTiles[A.tranid];this.AreaCovered.push(B)}delete this.waitingOnTiles[A.tranid];this.parentMap.updateDone.call(this.parentMap,A.tranid)}},cancelTran:function(A){if(A in this.waitingOnTiles){NewMind.mapping.debugWrite("Overlay update cancelled "+this.OverlayID+" - "+A);delete this.waitingOnTiles[A];this.parentMap.updateDone.call(this.parentMap,A)}},getTranValid:function(A){return A in this.waitingOnTiles},getDataTileBoundingBox:function(A){var C=Math.floor((A.lat+2e-7)/this.TileSize.lat);var B=Math.floor((A.lon+2e-7)/this.TileSize.lon);return new mxn.BoundingBox(NewMind.correctFloatError(C*this.TileSize.lat),NewMind.correctFloatError(B*this.TileSize.lon),NewMind.correctFloatError((C+1)*this.TileSize.lat),NewMind.correctFloatError((B+1)*this.TileSize.lon))},getCorrectedBoundingBox:function(E){var A=E.getSouthWest();var G=E.getNorthEast();var D=this.getDataTileBoundingBox(A);var C=this.getDataTileBoundingBox(G);var B=D.getSouthWest();var F=C.getNorthEast();return new mxn.BoundingBox(B.lat,B.lon,F.lat,F.lon)},getDataTileRequired:function(C){var B=this.getCorrectedBoundingBox(C);var D=B.getSouthWest();var A=B.getNorthEast();if(this.doneThisBoundingBox(B)){B=null}return B},doneThisBoundingBox:function(D){var B=D.getSouthWest();var A=D.getNorthEast();for(var C=0;C<this.AreaCovered.length;C++){if(this.AreaCovered[C].contains(B)&&this.AreaCovered[C].contains(A)){return true}}return false},getShowHideCheckbox:function(){if(!this.showHideCheckbox){this.showHideCheckbox=document.createElement("input");this.showHideCheckbox.type="checkbox";this.showHideCheckbox.id="chk-overlayshowhide-"+this.OverlayID;this.showHideCheckbox.className="chk-overlayshowhide";this.showHideCheckbox.checked=this.getShowing();NewMind.dom.addEventListener(this.showHideCheckbox,"click",NewMind.bind(this.showHideClickHandler,this))}return this.showHideCheckbox},showHideClickHandler:function(A){var B=NewMind.dom.getEventSource(A);if(B.checked){this.show()}else{this.hide()}},setDataSource:function(A){if(A&&A.isDynamic!==undefined&&A.overlay!==undefined&&typeof A.getData==="function"){this.DataSource=A;this.DataSource.overlay=this;this.IsDynamic=this.DataSource.isDynamic;this.DataSource.init()}else{this.Data=A}},init:function(){throw"Cannot call init on abstract NewMind.mapping.Overlay"},render:function(){throw"Cannot call render on abstract NewMind.mapping.Overlay"},reset:function(){this.DoneInitialLoad=false;this.AreaCovered=[]}};NewMind.mapping.MarkerOverlay=function(A){this.superclass.prototype.constructor.call(this);var B=null;this.setFilterPane=function(C){B=C};this.getFilterPane=function(){return B};this.LoadedMarkers=[];this.ImageOverlays=[];this.Decluttering=false;this.DeclutteringOptions={};this.markerAdded=new NewMind.CustomEvent("markerAdded",this);this.setDataSource(A)};NewMind.extend(NewMind.mapping.MarkerOverlay,NewMind.mapping.Overlay);NewMind.mapping.MarkerOverlay.prototype.init=function(){this.parentMap.zoomChanged.subscribe(this.handleZoomChanged,this,true);this.toggleShowHide.subscribe(this.onToggleShowHide,this,true);if(this.Decluttering){if(!("groupName" in this.DeclutteringOptions)){this.DeclutteringOptions.groupName=this.OverlayID}this.parentMap.mapstractionMap.declutterMarkers(this.DeclutteringOptions)}};NewMind.mapping.MarkerOverlay.prototype.render=function(A){if(A){this.addMarkers(A)}else{}};NewMind.mapping.MarkerOverlay.prototype.onToggleShowHide=function(C,B,D){for(var A=0;A<this.LoadedMarkers.length;A++){if(B[0]){this.LoadedMarkers[A].show()}else{this.LoadedMarkers[A].hide()}}for(var E=0;E<this.ImageOverlays.length;E++){if(B[0]){this.ImageOverlays[E].style.display="block"}else{this.ImageOverlays[E].style.display="none"}}};NewMind.mapping.MarkerOverlay.prototype.reset=function(){while(this.LoadedMarkers.length>0){var A=this.LoadedMarkers.pop();this.parentMap.mapstractionMap.removeMarker(A)}while(this.ImageOverlays.length>0){var B=this.ImageOverlays.pop();B.style.display="none"}this.superclass.prototype.reset.call(this)};NewMind.mapping.MarkerOverlay.prototype.handleZoomChanged=function(B,A,C){};NewMind.mapping.MarkerOverlay.prototype.addMarkers=function(D){for(var G=0;G<D.length;G++){markerData=D[G];markerData.groupName=this.OverlayID;var A=new mxn.LatLonPoint(markerData.lat,markerData.lon);var C=new mxn.Marker(A);C.addData(markerData);this.LoadedMarkers.push(C);if(markerData.showProximity){var F=mxn.fn.metresToLon(5000,A.lat);var E=mxn.fn.metresToLon(5000,0);var B="overlay_"+NewMind.mapping.getNextInteger();if(NewMind.env.platform.type==="enterprise"){strGraphicsPath="/engine"}else{strGraphicsPath="/sitebuilder"}this.parentMap.mapstractionMap.addImageOverlay(B,strGraphicsPath+"/shared_gfx/radius.png",30,A.lon-F,A.lat-E,A.lon+F,A.lat+E);if(typeof (correctPNG)!="undefined"){correctPNG()}this.ImageOverlays.push(document.getElementById(B))}this.parentMap.mapstractionMap.addMarker(C);this.markerAdded.fire(C)}};NewMind.mapping.PolylineOverlay=function(A){this.superclass.prototype.constructor.call(this);this.Polyline=undefined;this.LoadedMarkers=[];this.ImageOverlays=[];this.setDataSource(A)};NewMind.extend(NewMind.mapping.PolylineOverlay,NewMind.mapping.Overlay);NewMind.mapping.PolylineOverlay.prototype.init=function(){this.toggleShowHide.subscribe(this.onToggleShowHide,this,true)};NewMind.mapping.PolylineOverlay.prototype.onToggleShowHide=function(C,B,D){if(B[0]){this.parentMap.mapstractionMap.addPolyline(this.Polyline)}else{this.parentMap.mapstractionMap.removePolyline(this.Polyline)}for(var A=0;A<this.LoadedMarkers.length;A++){if(B[0]){this.LoadedMarkers[A].show()}else{this.LoadedMarkers[A].hide()}}};NewMind.mapping.PolylineOverlay.prototype.render=function(){if(this.Data){var B=[];var E=[];var F=null;var D=1;if(this.Data.documentElement){var A=this.Data.documentElement.getElementsByTagName("rtept");for(var G=0;G<A.length;G++){B.push(new mxn.LatLonPoint(A[G].getAttribute("lat"),A[G].getAttribute("lon")));var C=A[G].getElementsByTagName("desc");var H=NewMind.mapping.MapDataSource.prototype.getMarkerIcon("wf");if(C.length>0&&C[0].firstChild&&(C[0].firstChild.nodeName=="#text"||C[0].firstChild.nodeName=="#cdata-section")){E.push({lat:A[G].getAttribute("lat"),lon:A[G].getAttribute("lon"),infoBubble:C[0].firstChild.nodeValue,icon:H.iconUrl,iconSize:H.iconSize,iconAnchor:H.iconAnchor,label:"Show Route Information For WayPoint "+(D),text:D});D++}}}else{for(var I=0;I<this.Data.points.length;I++){B.push(new mxn.LatLonPoint(this.Data.points[I].lat,this.Data.points[I].lon))}F=this.Data}this.Polyline=new mxn.Polyline(B);if(F){this.Polyline.addData(F)}this.parentMap.mapstractionMap.addPolyline(this.Polyline);this.addMarkers(E);if(!this.getShowing()){this.toggleShowHide.fire(false)}}else{throw"No data"}};NewMind.mapping.PolylineOverlay.prototype.addMarkers=function(D){for(var G=0;G<D.length;G++){markerData=D[G];markerData.groupName=this.OverlayID;var A=new mxn.LatLonPoint(markerData.lat,markerData.lon);var C=new mxn.Marker(A);C.addData(markerData);this.LoadedMarkers.push(C);if(markerData.showProximity){var F=metresToLon(8047,A.lat);var E=metresToLon(8047,0);var B="overlay_"+NewMind.mapping.getNextInteger();if(NewMind.env.platform.type==="enterprise"){strGraphicsPath="/engine"}else{strGraphicsPath="/sitebuilder"}this.parentMap.mapstractionMap.addImageOverlay(B,strGraphicsPath+"/shared_gfx/radius.png",30,A.lon-F,A.lat-E,A.lon+F,A.lat+E);if(typeof (correctPNG)!="undefined"){correctPNG()}this.ImageOverlays.push(document.getElementById(B))}this.parentMap.mapstractionMap.addMarker(C)}};NewMind.mapping.PolylineOverlay.prototype.show=function(){for(var A=0;A<this.LoadedMarkers.length;A++){this.LoadedMarkers[A].show()}for(var B=0;B<this.ImageOverlays.length;B++){this.ImageOverlays[B].style.display="block"}};NewMind.mapping.PolylineOverlay.prototype.hide=function(){for(var A=0;A<this.LoadedMarkers.length;A++){this.LoadedMarkers[A].hide()}for(var B=0;B<this.ImageOverlays.length;B++){this.ImageOverlays[B].style.display="none"}};NewMind.mapping.MapDataSource=function(){};NewMind.mapping.MapDataSource.prototype={isDynamic:false,overlay:null,init:function(){},getData:function(){throw"Cannot call getData on abstract NewMind.mapping.MapDataSource"},getMarkerIcon:function(D,F){var C=null;if(typeof D==="string"){C=D}else{if(typeof D==="object"&&D.product&&D.product.product_key){C=D.product.product_key}}if(typeof F==="undefined"){F="def"}var B=(NewMind.env&&NewMind.env.platform&&NewMind.env.platform&&NewMind.env.platform.type==="enterprise");var A;if(B){if(NewMind.env.install.mapping.overrideicons){A="/images/DynamicMapping"}else{A="/engine"}}else{A="/sitebuilder"}var E=null;if(C!==null){E=String(C).toLowerCase()}return{iconUrl:A+"/shared_gfx/mkr-"+F+(E===null?"":"-"+E)+".png",iconSize:[23,26],iconAnchor:[12,26]}}};NewMind.mapping.DebugOutput=function(D){function E(G){function F(J,I){var K=String(J);while(K.length<I){K="0"+K}return K}var H=new Date();return F(H.getHours(),2)+":"+F(H.getMinutes(),2)+":"+F(H.getSeconds(),2)+"."+F(H.getMilliseconds(),3)}if(!NewMind.mapping.DEBUG){return }var C="DebugOutput";var A=document.getElementById(C);if(!A){A=document.createElement("div");A.id=C;var B=document.body;if(B.childNodes.length===0){B.appendChild(B)}else{B.insertBefore(A,B.childNodes[0])}}A.innerHTML+="["+E(new Date())+"] "+D.replace(/\n/g,"<br/>")+"<br/>"};NewMind.mapping.DebugOutputObject=function(E,A,D,B){var I;if(E===null){I="null"}else{if(typeof (E)!=="object"){I="DebugOutputObject - not an object: ["+typeof (E)+"] "+E}else{if(!A){A=[]}else{if(typeof (A)==="string"){A=[A]}}if(D!==true){D=false}if(B!==true){B=false}I="";var G;for(i in E){G=false;if((D)&&!E.hasOwnProperty(i)){G=true}else{var F=String(typeof E[i]).toUpperCase();for(var H=0;H<A.length;H++){var C=String(A[H]).toUpperCase();if(C===F){G=true;break}}}if(!G){I+="["+typeof E[i]+"] "+i;if(!B){I+=": "+E[i]}I+="\n"}}}}NewMind.mapping.DebugOutput(I)}})();


(function(){NewMind.registerNameSpace("NewMind.tourism");NewMind.registerNameSpace("NewMind.ETWP");NewMind.tourism.ProductMapDataSource=function(){this.isDynamic=true;this.SearchForm=null;this.LoadedProducts={}};NewMind.extend(NewMind.tourism.ProductMapDataSource,NewMind.mapping.MapDataSource);NewMind.tourism.ProductMapDataSource.prototype.init=function(){NewMind.ajax.itinUpdated.subscribe(this.onItinUpdated,this,true);this.overlay.markerAdded.subscribe(this.onMarkerAdded,this,true)};NewMind.tourism.ProductMapDataSource.prototype.onMarkerAdded=function(type,args,me){NewMind.mapping.addMarkerOkToShowDelegate(args[0],this.checkProductMarkerNotInExcursion);if(!this.checkProductMarkerNotInExcursion(args[0])){args[0].hide();setTimeout(function(){args[0].hide()},100)}};NewMind.tourism.ProductMapDataSource.prototype.setSearchForm=function(frm){this.SearchForm=frm};NewMind.tourism.ProductMapDataSource.prototype.getData=function(tranid,bbView){if(NewMind.env.search&&NewMind.env.search.numProds&&NewMind.env.search.numProds>NewMind.env.install.mapping.maxprods&&this.overlay.parentMap.mapstractionMap.getZoom()<10){this.doTooManyMessage();return{complete:true,error:1}}else{var llSW=new LatLng(bbView.sw.lat,bbView.sw.lon);var llNE=new LatLng(bbView.ne.lat,bbView.ne.lon);var osSW=llSW.toOSRef();var osNE=llNE.toOSRef();var strPostUrl;var bUsePost=false;var oData={};if(this.SearchForm){strPostUrl=this.SearchForm.action.replace(/\/searchresults/,"/ajax-products");oData=$(this.SearchForm).serializeArray()}else{if(NewMind.env.platform.type=="enterprise"){var intCtrlKey=NewMind.env.install.mapping.configurations[this.overlay.parentMap.getContainerID()].controlkey;if(NewMind.ETWP.ControlData[intCtrlKey]&&NewMind.ETWP.ControlData[intCtrlKey].TOv2QueryData){bUsePost=true;strPostUrl="/engine/MappingStubRetrieval.asp";$.extend(oData,{data:NewMind.ETWP.ControlData[intCtrlKey].TOv2QueryData,maxresults:NewMind.ajax.AJAX_MAPPING_DATA_MAXRESULTS})}else{if(NewMind.ETWP.ControlData[intCtrlKey]&&NewMind.ETWP.ControlData[intCtrlKey].SearchUrl){strPostUrl=NewMind.ETWP.ControlData[intCtrlKey].SearchUrl}else{strPostUrl=NewMind.ajax.CleanCurrentUrlForAjax()}if(strPostUrl.indexOf("?")===-1){strPostUrl+="?"}else{strPostUrl+="&"}var arrParams=[];arrParams.push("AsyncAction=search-stub");arrParams.push("PartialRenderControlList="+intCtrlKey);strPostUrl+=arrParams.join("&")}}else{strPostUrl=document.location.href;var iIndOfHash=strPostUrl.indexOf("#");if(iIndOfHash>-1){strPostUrl=strPostUrl.substring(0,iIndOfHash)}strPostUrl=strPostUrl.replace(/\/searchresults/,"/ajax-products");strPostUrl=strPostUrl.replace(/\/a-z/,"/ajax-az")}}if(NewMind.env.platform.type=="enterprise"){$.extend(oData,{dynMapN:bbView.ne.lon,dynMapE:bbView.ne.lat,dynMapS:bbView.sw.lon,dynMapW:bbView.sw.lat})}else{$.extend(oData,{dynMapN:Math.floor(osNE.northing),dynMapE:Math.floor(osNE.easting),dynMapS:Math.floor(osSW.northing),dynMapW:Math.floor(osSW.easting)})}var bCancel=(this.preGetData(strPostUrl,oData)===false);if(!bCancel){bComplete=false;var fnBoundSuccess=NewMind.bind(this.handleSuccess,this);var fnBoundFailure=NewMind.bind(this.handleFailure,this);var fncSubmit;if(bUsePost){fncSubmit=$.post}else{fncSubmit=$.get}fncSubmit(strPostUrl,oData,function(data,status){if(status=="success"){fnBoundSuccess(tranid,data)}else{fnBoundFailure(tranid)}})}}return{complete:(bCancel)}};NewMind.tourism.ProductMapDataSource.prototype.doTooManyMessage=function(){var mapEleId=this.overlay.parentMap.getContainerID();var jqMsg=$("#"+mapEleId+" .prodWarning");if(jqMsg.length===0){var eleMsg=$('<span class="prodWarning">Too many products to display, please zoom in to refine your search</span>').appendTo("#"+mapEleId).get(0);this.overlay.parentMap.beforeUpdate.subscribe(function(){$(eleMsg).hide(0)})}else{jqMsg.show(0)}};NewMind.tourism.ProductMapDataSource.prototype.preGetData=function(){};NewMind.tourism.ProductMapDataSource.prototype.handleSuccess=function(){var rawData=null;var iCounter=0;rawData=eval(arguments[1]);var result={tranid:arguments[0],error:0,data:[]};if(rawData.length>0){if(rawData[0].count){this.doTooManyMessage();result.error=1}else{while(rawData.length>0){var prodDataItem=rawData.pop();try{if(!this.LoadedProducts.hasOwnProperty("p"+prodDataItem.product_key.toString())){var mkr=this.getProdMarkerData(prodDataItem);this.LoadedProducts["p"+prodDataItem.product_key.toString()]=prodDataItem;result.data.push(mkr)}}catch(e){if(NewMind.mapping.DEBUG){throw e}}}}}this.overlay.dataReady(result)};NewMind.tourism.ProductMapDataSource.prototype.handleFailure=function(o){var result={tranid:arguments[0],error:1,data:[]};this.overlay.dataReady(result)};NewMind.tourism.ProductMapDataSource.prototype.getProdMarkerData=function(prodDataItem){var mkr={};if(prodDataItem.latitude!==null&&prodDataItem.longitude!==null&&NewMind.env.platform.type==="enterprise"){mkr.lat=prodDataItem.latitude;mkr.lon=prodDataItem.longitude}else{var osCoord=new OSRef(prodDataItem.eastings,prodDataItem.northings);var llCoord=osCoord.toLatLng();llCoord.OSGB36ToWGS84();mkr.lat=llCoord.lat;mkr.lon=llCoord.lng}mkr.label=prodDataItem.product_name;var strInfoBubble="";if(NewMind.env.platform.type==="enterprise"){}else{strInfoBubble+='<h4><a href="'+prodDataItem.detail_link+'">'+prodDataItem.product_name+"</a></h4>";strInfoBubble+='<p><img src="'+prodDataItem.image_path+'" style="float: left; margin: 0 4px 0 0;"/></p>';if(prodDataItem.short_desc!==""){strInfoBubble+="<p>"+prodDataItem.short_desc.substr(0,100)+"...</p>"}strInfoBubble+=prodDataItem.ep_add;if(prodDataItem.booklink!==""&&prodDataItem.bookimg!==""){strInfoBubble+='<p class="bookonline"><a rel="nofollow" href="'+prodDataItem.booklink+'" '+prodDataItem.bookjs+'><img src="/images/'+prodDataItem.bookimg+'" alt="Book '+prodDataItem.bookname+' Online"/></a></p>'}mkr.infoBubble=$("<div>"+strInfoBubble+"</div>").find("a.ep_Add").click(NewMind.ajax.itinButtonClickHandler).end().get(0)}var objIconData=this.getMarkerIcon(prodDataItem.prodtype_id);mkr.icon=objIconData.iconUrl;mkr.iconSize=objIconData.iconSize;mkr.iconAnchor=objIconData.iconAnchor;mkr.product=prodDataItem;return mkr};NewMind.tourism.ProductMapDataSource.prototype.getMarkerIcon=function(strProdType){return this.superclass.prototype.getMarkerIcon(strProdType)};NewMind.tourism.ProductMapDataSource.prototype.onItinUpdated=function(type,args,me){if(NewMind.env.platform.type=="enterprise"){return }var mkrs=this.overlay.LoadedMarkers;if(mkrs.length>0){for(var iMs=0;iMs<mkrs.length;iMs++){var mk=mkrs[iMs];if(this.checkProductMarkerNotInExcursion(mk)){if(this.overlay.getShowing()){mk.show()}}else{mk.hide()}}}};NewMind.tourism.ProductMapDataSource.prototype.checkProductMarkerNotInExcursion=function(oMkr){var bOkToShow=true;var prod=oMkr.getAttribute("product");for(var iEs=0;iEs<NewMind.env.excursion.length;iEs++){if(prod.product_key===NewMind.env.excursion[iEs].product_key){bOkToShow=false;break}}return bOkToShow};NewMind.tourism.ItineraryMapDataSource=function(){this.isDynamic=false;NewMind.ajax.itinUpdated.subscribe(this.onItinUpdated,this,true)};NewMind.extend(NewMind.tourism.ItineraryMapDataSource,NewMind.mapping.MapDataSource);NewMind.tourism.ItineraryMapDataSource.prototype.onItinUpdated=function(type,args,me){if(NewMind.env.platform.type=="enterprise"){return }this.overlay.reset();this.overlay.updateView()};NewMind.tourism.ItineraryMapDataSource.prototype.getData=function(bbView){var goodData=[];for(var iEC=0;iEC<NewMind.env.excursion.length;iEC++){var prodDataItem=NewMind.env.excursion[iEC];try{var mkr=NewMind.tourism.ProductMapDataSource.prototype.getProdMarkerData(prodDataItem);var objIconData=this.getMarkerIcon(prodDataItem.prodtype_id);mkr.icon=objIconData.iconUrl;mkr.iconSize=objIconData.iconSize;mkr.iconAnchor=objIconData.iconAnchor;$(mkr.infoBubble).addClass("itin");goodData.push(mkr)}catch(e){if(NewMind.mapping.DEBUG){alert(e)}}}return{complete:true,error:0,data:goodData}};NewMind.tourism.ItineraryMapDataSource.prototype.getMarkerIcon=function(strProdType){return this.superclass.prototype.getMarkerIcon(strProdType,"itn")};NewMind.tourism.ProductMarkerFilterWidget=function(prodMarkerOverlay,filterPaneElement){this.ProdMarkerOverlay=prodMarkerOverlay;prodMarkerOverlay.markerAdded.subscribe(this.onMarkerAdded,this,true);this.ProdMarkerOverlay.parentMap.mapstractionMap.addEventListener("moveend",this.onMapMove,this);this.FilterPane=filterPaneElement;this.FilterData={}};NewMind.tourism.ProductMarkerFilterWidget.prototype={discreteValuedFilters:{price:["less than &pound;50","between &pound;50 and &pound;100","greater than &pound;100"],grading:["1","2","3","4","5"]},onMarkerAdded:function(type,args,me){this.updateFilterData(args[0]);this.updateFilterList();NewMind.mapping.addMarkerOkToShowDelegate(args[0],this.checkWhetherMarkerShouldShow);if(!this.checkWhetherMarkerShouldShow(args[0])){args[0].hide()}},onFilterToggle:function(e,oVal){var elm=e;var bbViewPort=this.ProdMarkerOverlay.parentMap.mapstractionMap.getBounds();for(var iMk in oVal.markers){if(!oVal.markers.hasOwnProperty||oVal.markers.hasOwnProperty(iMk)){var prod=oVal.markers[iMk].getAttribute("product");if(elm.checked){oVal.markers[iMk].show();if(bbViewPort.contains(oVal.markers[iMk].location)&&this.checkWhetherMarkerShouldShow(oVal.markers[iMk])){$("div#mapProductList").find("ul").find("li.pk_"+prod.product_key).fadeIn()}}else{oVal.markers[iMk].hide();if(bbViewPort.contains(oVal.markers[iMk].location)){$("div#mapProductList").find("ul").find("li.pk_"+prod.product_key).fadeOut()}}}}},onMapMove:function(){this.updateFilterList()},checkWhetherMarkerShouldShow:function(oMkr){var bShowIt=true;if("applicableFilterVals" in oMkr){for(var iFv in oMkr.applicableFilterVals){if(!oMkr.applicableFilterVals.hasOwnProperty||oMkr.applicableFilterVals.hasOwnProperty(iFv)){if(!oMkr.applicableFilterVals[iFv].elmCheckbox.checked){bShowIt=false;break}}}}return bShowIt},updateFilterData:function(oNewMarker){var prod=oNewMarker.getAttribute("product");var aryFilters;switch(NewMind.env.page.prodtypes){case"ACCO":aryFilters=["category","price","bookable","grading"];break;case"DUMMY":break;default:aryFilters=["category"];break}var setBg=function(){$(this).css({backgroundColor:"#5899F5"});$(this).dequeue()};var clearBg=function(){$(this).css({backgroundColor:""});$(this).dequeue()};for(var iInd=0;iInd<aryFilters.length;iInd++){var sFilter=aryFilters[iInd];var bIgnore=false;var value="";switch(sFilter){case"category":value="";if(NewMind.env.page.catgrps.length>0){for(var iCg=0;iCg<NewMind.env.page.catgrps.length;iCg++){var cg=NewMind.env.page.catgrps[iCg];if((", "+cg.catkeys+", ").indexOf(", "+prod.topcategory_key+", ")>-1){value=cg.catgrpname;break}}}if(NewMind.env.page.cats !== undefined){if(NewMind.env.page.cats.length>0){for(var iC=0;iC<NewMind.env.page.cats.length;iC++){var cat=NewMind.env.page.cats[iC];if(cat.category_key===prod.topcategory_key){value=cat.category;break}}}}break;case"price":if(prod.min_price<50){value="less than &pound;50";if(NewMind.env.platform.type=="enterprise"){value=NewMind.ETWP.GetResource('NewMind.env.lang.resources.searchresults["dynamicmapping"]["filters"]["price"]["lessthan50"]',value)}}else{if(prod.min_price>=50&&prod.min_price<100){value="between &pound;50 and &pound;100";if(NewMind.env.platform.type=="enterprise"){value=NewMind.ETWP.GetResource('NewMind.env.lang.resources.searchresults["dynamicmapping"]["filters"]["price"]["between50and100"]',value)}}else{value="greater than &pound;100";if(NewMind.env.platform.type=="enterprise"){value=NewMind.ETWP.GetResource('NewMind.env.lang.resources.searchresults["dynamicmapping"]["filters"]["price"]["greaterthan100"]',value)}}}break;case"bookable":if(prod.bookable===true){value=" bookable online";if(NewMind.env.platform.type=="enterprise"){value=NewMind.ETWP.GetResource('NewMind.env.lang.resources.searchresults["dynamicmapping"]["filters"]["bookable"]["bookableonline"]',value)}}else{value="not bookable online";if(NewMind.env.platform.type=="enterprise"){value=NewMind.ETWP.GetResource('NewMind.env.lang.resources.searchresults["dynamicmapping"]["filters"]["bookable"]["notbookableonline"]',value)}}break;case"grading":if(typeof prod.gradings==="undefined"){bIgnore=true}else{var intGradeNumber=0;if(!isNaN(prod.gradings)){if(prod.gradings>0){intGradeNumber=prod.gradings;intGradeNumber=parseInt(String(intGradeNumber).substring(String(intGradeNumber).length-1),10)}}for(var iGrading=0;iGrading<prod.gradings.length;iGrading++){var intGradeNumberTemp=prod.gradings[iGrading].grade_number;intGradeNumberTemp=parseInt(String(intGradeNumberTemp).substring(String(intGradeNumberTemp).length-1),10);if(intGradeNumberTemp>intGradeNumber){intGradeNumber=intGradeNumberTemp}}if(intGradeNumber>0){if(NewMind.env.platform.type=="enterprise"){value=intGradeNumber.toString()+" "+NewMind.ETWP.GetResource('NewMind.env.lang.resources.searchresults["dynamicmapping"]["filters"]["grading"]["star(s)"]',"Star(s)")}else{value=intGradeNumber.toString()+" Star(s)"}}else{value="Awaiting Grading";if(NewMind.env.platform.type=="enterprise"){value=NewMind.ETWP.GetResource('NewMind.env.lang.resources.searchresults["dynamicmapping"]["filters"]["grading"]["awaitinggrading"]',value)}}}break}if(!bIgnore){var objFData=this.FilterData[sFilter]||this.createFilterItem(sFilter);if(typeof (value)!=="string"||value===""){value="Other";if(NewMind.env.platform.type=="enterprise"){value=NewMind.ETWP.GetResource('NewMind.env.lang.resources.searchresults["dynamicmapping"]["filters"]["other"]',value)}}var oCat=objFData.values[value]||this.createValueItem(objFData,value);oCat.markers.push(oNewMarker);if(!oNewMarker.applicableFilterVals){oNewMarker.applicableFilterVals=[]}oNewMarker.applicableFilterVals.push(oCat);oCat.elmNumberSpan.innerHTML="("+oCat.markers.length.toString()+")";if(!oCat.elmCheckbox.checked){oNewMarker.hide()}objFData.values[value]=oCat;this.FilterData[sFilter]=objFData;if(NewMind.mapping.DisableFilterAnimation!==true){var jqEleP=$(oCat.elmNumberSpan.parentNode);if(jqEleP.queue("fx").length===0){try{jqEleP.queue(setBg).animate({backgroundColor:"#FFF"},1000).queue(clearBg)}catch(e){jqEleP.css({backgroundColor:""})}}}}}},createFilterItem:function(sFilterName){var oFilterItem={elmFieldset:undefined,values:{}};oFilterItem.elmFieldset=document.createElement("fieldset");this.FilterPane.appendChild(oFilterItem.elmFieldset);var eLeg=document.createElement("legend");var sTitle;if(NewMind.env.platform.type=="enterprise"){sTitle=NewMind.ETWP.GetResource('NewMind.env.lang.resources.searchresults["dynamicmapping"]["filters"]["'+sFilterName+'"]["title"]',sFilterName)}else{sTitle=sFilterName}eLeg.innerHTML=sTitle.replace(/^[a-z]/,function(a){return a.toUpperCase()});oFilterItem.elmFieldset.appendChild(eLeg);var eUl=document.createElement("ul");oFilterItem.elmFieldset.appendChild(eUl);var dVf=this.discreteValuedFilters[sFilterName];if(dVf){for(var iFv in dVf){if(!dVf.hasOwnProperty||dVf.hasOwnProperty(iFv)){oFilterItem.values[dVf[iFv]]=this.createValueItem(oFilterItem,dVf[iFv],true)}}}return oFilterItem},createValueItem:function(oFd,sValueName,bDontOrder){var oV={elmListItem:undefined,elmCheckbox:undefined,elmNumberSpan:undefined,markers:[]};oV.elmListItem=document.createElement("li");var eUl=oFd.elmFieldset.getElementsByTagName("ul")[0];var bAddedNode=false;if(!bDontOrder){for(var iLiNum=0;iLiNum<eUl.childNodes.length;iLiNum++){var cLi=eUl.childNodes[iLiNum];var cLbl=cLi.getElementsByTagName("label")[0];var cNameSpan=cLbl.getElementsByTagName("span")[0];if(cNameSpan.innerHTML>sValueName){eUl.insertBefore(oV.elmListItem,cLi);bAddedNode=true;break}}}if(!bAddedNode){eUl.appendChild(oV.elmListItem)}oV.elmCheckbox=document.createElement("input");oV.elmCheckbox.type="checkbox";oV.elmCheckbox.id="chk-prodfilter-"+NewMind.mapping.getNextInteger();oV.elmListItem.appendChild(oV.elmCheckbox);oV.elmCheckbox.checked=true;var eLbl=document.createElement("label");eLbl.setAttribute("for",oV.elmCheckbox.id);eLbl.innerHTML='<span class="filterValue">'+sValueName+'</span><span class="numOfProds">(0)</span>';oV.elmListItem.appendChild(eLbl);oV.elmNumberSpan=eLbl.getElementsByTagName("span")[1];var oT=this;$(oV.elmCheckbox).click(function(){oT.onFilterToggle(this,oV)});return oV},updateFilterList:function(){var bbViewPort=this.ProdMarkerOverlay.parentMap.mapstractionMap.getBounds();for(var sFilterName in this.FilterData){var oFilterData=this.FilterData[sFilterName];var iValsInView=0;for(var sValueName in oFilterData.values){var oValData=oFilterData.values[sValueName];var iProdsInView=0;for(var iMarkerNum in oValData.markers){if(!oValData.markers.hasOwnProperty||oValData.markers.hasOwnProperty(iMarkerNum)){if(bbViewPort.contains(oValData.markers[iMarkerNum].location)){iProdsInView++}}}if(iProdsInView>0){iValsInView++;oValData.elmNumberSpan.innerHTML="("+iProdsInView.toString()+")";oValData.elmListItem.style.display="block"}else{oValData.elmListItem.style.display="none"}}oFilterData.elmFieldset.style.display=((iValsInView>0)?"block":"none")}}};NewMind.tourism.ProductSearchResultsWidget=function(prodMarkerOverlay,filterPaneElement){this.ProdMarkerOverlay=prodMarkerOverlay;prodMarkerOverlay.markerAdded.subscribe(this.onMarkerAdded,this,true);this.ProdMarkerOverlay.parentMap.mapstractionMap.addEventListener("moveend",this.onMapMove,this)};NewMind.tourism.ProductSearchResultsWidget.prototype={onMarkerAdded:function(type,args,me){},onMapMove:function(){this.updateFilterList()},updateFilterList:function(){var bbViewPort=this.ProdMarkerOverlay.parentMap.mapstractionMap.getBounds();var llCenter=this.ProdMarkerOverlay.parentMap.mapstractionMap.getCenter();var aryDist=[];var iDist=0;for(var iMarkerNum=0;iMarkerNum<this.ProdMarkerOverlay.LoadedMarkers.length;iMarkerNum++){var markerData=this.ProdMarkerOverlay.LoadedMarkers[iMarkerNum];if(bbViewPort.contains(markerData.location)){if(NewMind.tourism.ProductMarkerFilterWidget.prototype.checkWhetherMarkerShouldShow(markerData)){aryDist[iDist]=[];aryDist[iDist][0]=markerData.getAttribute("product").product_key;var toPoint=markerData.location;var distance=llCenter.distance(toPoint);aryDist[iDist][1]=distance;iDist++}}else{this.toggleListItem(markerData,"remove")}}aryDist.sort(this.sortMultiDimensional);$("div#mapProductList").find("ul").find("li").remove();for(i=0;i<aryDist.length;i++){for(iListMarkerNum=0;iListMarkerNum<this.ProdMarkerOverlay.LoadedMarkers.length;iListMarkerNum++){var listmarkerData=this.ProdMarkerOverlay.LoadedMarkers[iListMarkerNum];if(listmarkerData.getAttribute("product").product_key===aryDist[i][0]){this.createListItem(listmarkerData)}}}},sortMultiDimensional:function(a,b){return((a[1]<b[1])?-1:((a[1]>b[1])?1:0))},createListItem:function(oNewMarker){var prod=oNewMarker.getAttribute("product");var intCtrlKey=NewMind.env.install.mapping.configurations[this.ProdMarkerOverlay.parentMap.getContainerID()].controlkey;var elmli='<li class="pk_'+prod.product_key+'"><a href="#map-'+intCtrlKey+'"><img src="'+oNewMarker.iconUrl+'" /></a><a href="#map-'+intCtrlKey+'">'+prod.product_name+"</a>, "+prod.address4+"</li>";$("div#mapProductList").find("ul").append(elmli).find("li.pk_"+prod.product_key).find("a").click(function(e){oNewMarker.openBubble()})},toggleListItem:function(oNewMarker,state){var prod=oNewMarker.getAttribute("product");var $listItm=$("div#mapProductList").find("ul").find("li.pk_"+prod.product_key);if(state==="hide"){$listItm.fadeOut()}else{if(state==="remove"){$listItm.fadeOut("slow").remove()}else{$listItm.fadeIn()}}}}})();


