// ETWP Javascript Minimiser 1.5.0.0

// Included: D:\Shared\Replicated\Shared_JS\jQuery\1.2.6\jquery-1.2.6.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\plugins\calendar\jquery.datePicker.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 1.2.6 - New Wave Javascript
 *
 * Copyright (c) 2008 John Resig (jquery.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * $Date: 2008/06/13 10:46:07 $
 * $Rev: 5685 $
 */
(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else
return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else
return(this[0].value||"").replace(/\r/g,"");}return undefined;}if(value.constructor==Number)value+='';return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else
this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else
return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(target===copy)continue;if(deep&&copy&&typeof copy=="object"&&!copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy;}return target;};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else
script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!==undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object)if(callback.apply(object[name],args)===false)break;}else
for(;i<length;)if(callback.apply(object[i++],args)===false)break;}else{if(length==undefined){for(name in object)if(callback.call(object[name],name,object[name])===false)break;}else
for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem+='';if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else
ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&&notxml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&&notxml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else
while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++])if(elem.nodeType!=8)first[pos++]=elem;}else
while(elem=second[i++])first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv!=!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)ret[ret.length]=value;}return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else
for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var 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 timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<args.length)jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else
jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!='string')return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,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(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else
xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else
jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else
for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else
s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})();


/*	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);


/**
 * Copyright (c) 2007 Kelvin Luck (http://www.kelvinluck.com/)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $Id: jquery.datePicker.js,v 1.1 2008/11/26 09:37:37 EPotapova Exp $
 **/

(function($){
    
	$.fn.extend({
/**
 * Render a calendar table into any matched elements.
 * 
 * @param Object s (optional) Customize your calendars.
 * @option Number month The month to render (NOTE that months are zero based). Default is today's month.
 * @option Number year The year to render. Default is today's year.
 * @option Function renderCallback A reference to a function that is called as each cell is rendered and which can add classes and event listeners to the created nodes. Default is no callback.
 * @option Number showHeader Whether or not to show the header row, possible values are: $.dpConst.SHOW_HEADER_NONE (no header), $.dpConst.SHOW_HEADER_SHORT (first letter of each day) and $.dpConst.SHOW_HEADER_LONG (full name of each day). Default is $.dpConst.SHOW_HEADER_SHORT.
 * @option String hoverClass The class to attach to each cell when you hover over it (to allow you to use hover effects in IE6 which doesn't support the :hover pseudo-class on elements other than links). Default is dp-hover. Pass false if you don't want a hover class.
 * @type jQuery
 * @name renderCalendar
 * @cat plugins/datePicker
 * @author Kelvin Luck (http://www.kelvinluck.com/)
 *
 * @example $('#calendar-me').renderCalendar({month:0, year:2007});
 * @desc Renders a calendar displaying January 2007 into the element with an id of calendar-me.
 *
 * @example
 * var testCallback = function($td, thisDate, month, year)
 * {
 * if ($td.is('.current-month') && thisDate.getDay() == 4) {
 *		var d = thisDate.getDate();
 *		$td.bind(
 *			'click',
 *			function()
 *			{
 *				alert('You clicked on ' + d + '/' + (Number(month)+1) + '/' + year);
 *			}
 *		).addClass('thursday');
 *	} else if (thisDate.getDay() == 5) {
 *		$td.html('Friday the ' + $td.html() + 'th');
 *	}
 * }
 * $('#calendar-me').renderCalendar({month:0, year:2007, renderCallback:testCallback});
 * 
 * @desc Renders a calendar displaying January 2007 into the element with an id of calendar-me. Every Thursday in the current month has a class of "thursday" applied to it, is clickable and shows an alert when clicked. Every Friday on the calendar has the number inside replaced with text.
 **/
		renderCalendar  :   function(s)
		{
			var dc = function(a)
			{
				return document.createElement(a);
			};
			
			s = $.extend(
				{
					month			: null,
					year			: null,
					renderCallback	: null,
					showHeader		: $.dpConst.SHOW_HEADER_SHORT,
					dpController	: null,
					hoverClass		: 'dp-hover'
				}
				, s
			);
			
			if (s.showHeader != $.dpConst.SHOW_HEADER_NONE) {
				var headRow = $(dc('tr'));
				for (var i=Date.firstDayOfWeek; i<Date.firstDayOfWeek+7; i++) {
					var weekday = i%7;
					var day = Date.dayNames[weekday];
					headRow.append(
						jQuery(dc('th')).attr({'scope':'col', 'abbr':day, 'title':day, 'class':(weekday == 0 || weekday == 6 ? 'weekend' : 'weekday')}).html(s.showHeader == $.dpConst.SHOW_HEADER_SHORT ? day.substr(0, 1) : day)
					);
				}
			};
			
			var calendarTable = $(dc('table'))
									.attr(
										{
											'cellspacing':2,
											'className':'jCalendar'
										}
									)
									.append(
										(s.showHeader != $.dpConst.SHOW_HEADER_NONE ? 
											$(dc('thead'))
												.append(headRow)
											:
											dc('thead')
										)
									);
			var tbody = $(dc('tbody'));
			
			var today = (new Date()).zeroTime();
			
			var month = s.month == undefined ? today.getMonth() : s.month;
			var year = s.year || today.getFullYear();
			
			var currentDate = new Date(year, month, 1);
			
			
			var firstDayOffset = Date.firstDayOfWeek - currentDate.getDay() + 1;
			if (firstDayOffset > 1) firstDayOffset -= 7;
			var weeksToDraw = Math.ceil(( (-1*firstDayOffset+1) + currentDate.getDaysInMonth() ) /7);
			currentDate.addDays(firstDayOffset-1);
			
			var doHover = function()
			{
				if (s.hoverClass) {
					$(this).addClass(s.hoverClass);
				}
			};
			var unHover = function()
			{
				if (s.hoverClass) {
					$(this).removeClass(s.hoverClass);
				}
			};
			
			var w = 0;
			while (w++<weeksToDraw) {
				var r = jQuery(dc('tr'));
				for (var i=0; i<7; i++) {
					var thisMonth = currentDate.getMonth() == month;
					var d = $(dc('td'))
								.text(currentDate.getDate() + '')
								.attr('className', (thisMonth ? 'current-month ' : 'other-month ') +
													(currentDate.isWeekend() ? 'weekend ' : 'weekday ') +
													(thisMonth && currentDate.getTime() == today.getTime() ? 'today ' : '')
								)
								.hover(doHover, unHover)
							;
					if (s.renderCallback) {
						s.renderCallback(d, currentDate, month, year);
					}
					r.append(d);
					currentDate.addDays(1);
				}
				tbody.append(r);
			}
			calendarTable.append(tbody);
			
			return this.each(
				function()
				{
					$(this).empty().append(calendarTable);
				}
			);
		},
/**
 * Create a datePicker associated with each of the matched elements.
 *
 * The matched element will receive a few custom events with the following signatures:
 *
 * dateSelected(event, date, $td, status)
 * Triggered when a date is selected. event is a reference to the event, date is the Date selected, $td is a jquery object wrapped around the TD that was clicked on and status is whether the date was selected (true) or deselected (false)
 * 
 * dpClosed(event, selected)
 * Triggered when the date picker is closed. event is a reference to the event and selected is an Array containing Date objects.
 *
 * dpMonthChanged(event, displayedMonth, displayedYear)
 * Triggered when the month of the popped up calendar is changed. event is a reference to the event, displayedMonth is the number of the month now displayed (zero based) and displayedYear is the year of the month.
 *
 * dpDisplayed(event, $datePickerDiv)
 * Triggered when the date picker is created. $datePickerDiv is the div containing the date picker. Use this event to add custom content/ listeners to the popped up date picker.
 *
 * @param Object s (optional) Customize your date pickers.
 * @option Number month The month to render when the date picker is opened (NOTE that months are zero based). Default is today's month.
 * @option Number year The year to render when the date picker is opened. Default is today's year.
 * @option String startDate The first date date can be selected.
 * @option String endDate The last date that can be selected.
 * @option Boolean inline Whether to create the datePicker as inline (e.g. always on the page) or as a model popup. Default is false (== modal popup)
 * @option Boolean createButton Whether to create a .dp-choose-date anchor directly after the matched element which when clicked will trigger the showing of the date picker. Default is true.
 * @option Boolean showYearNavigation Whether to display buttons which allow the user to navigate through the months a year at a time. Default is true.
 * @option Boolean closeOnSelect Whether to close the date picker when a date is selected. Default is true.
 * @option Boolean displayClose Whether to create a "Close" button within the date picker popup. Default is false.
 * @option Boolean selectMultiple Whether a user should be able to select multiple dates with this date picker. Default is false.
 * @option Boolean clickInput If the matched element is an input type="text" and this option is true then clicking on the input will cause the date picker to appear.
 * @option Number verticalPosition The vertical alignment of the popped up date picker to the matched element. One of $.dpConst.POS_TOP and $.dpConst.POS_BOTTOM. Default is $.dpConst.POS_TOP.
 * @option Number horizontalPosition The horizontal alignment of the popped up date picker to the matched element. One of $.dpConst.POS_LEFT and $.dpConst.POS_RIGHT.
 * @option Number verticalOffset The number of pixels offset from the defined verticalPosition of this date picker that it should pop up in. Default in 0.
 * @option Number horizontalOffset The number of pixels offset from the defined horizontalPosition of this date picker that it should pop up in. Default in 0.
 * @option (Function|Array) renderCallback A reference to a function (or an array of seperate functions) that is called as each cell is rendered and which can add classes and event listeners to the created nodes. Each callback function will receive four arguments; a jquery object wrapping the created TD, a Date object containing the date this TD represents, a number giving the currently rendered month and a number giving the currently rendered year. Default is no callback.
 * @option String hoverClass The class to attach to each cell when you hover over it (to allow you to use hover effects in IE6 which doesn't support the :hover pseudo-class on elements other than links). Default is dp-hover. Pass false if you don't want a hover class.
 * @type jQuery
 * @name datePicker
 * @cat plugins/datePicker
 * @author Kelvin Luck (http://www.kelvinluck.com/)
 *
 * @example $('input.date-picker').datePicker();
 * @desc Creates a date picker button next to all matched input elements. When the button is clicked on the value of the selected date will be placed in the corresponding input (formatted according to Date.format).
 *
 * @example demo/index.html
 * @desc See the projects homepage for many more complex examples...
 **/
		datePicker : function(s)
		{			
			if (!$.event._dpCache) $.event._dpCache = [];
			
			// initialise the date picker controller with the relevant settings...
			s = $.extend(
				{
					month				: undefined,
					year				: undefined,
					startDate			: undefined,
					endDate				: undefined,
					inline				: false,
					renderCallback		: [],
					createButton		: false,//true,
					showYearNavigation	: true,
					closeOnSelect		: true,
					displayClose		: false,
					selectMultiple		: false,
					clickInput			: false,
					verticalPosition	: $.dpConst.POS_TOP,
					horizontalPosition	: $.dpConst.POS_LEFT,
					verticalOffset		: 0,
					horizontalOffset	: 0,
					hoverClass			: 'dp-hover'
				}
				, s
			);
			
			return this.each(
				function()
				{
					var $this = $(this);
					var alreadyExists = true;
					
					if (!this._dpId) {
						this._dpId = $.event.guid++;
						$.event._dpCache[this._dpId] = new DatePicker(this);
						alreadyExists = false;
					}
					
					if (s.inline) {
						s.createButton = false;
						s.displayClose = false;
						s.closeOnSelect = false;
						$this.empty();
					}
					
					var controller = $.event._dpCache[this._dpId];
					
					controller.init(s);
					
					if (!alreadyExists && s.createButton) {
						// create it!
						controller.button = $('<a href="#" class="dp-choose-date" title="' + $.dpText.TEXT_CHOOSE_DATE + '">' + $.dpText.TEXT_CHOOSE_DATE + '</a>')
								.bind(
									'click',
									function()
									{
										$this.dpDisplay(this);
										this.blur();
										return false;
									}
								);
						$this.after(controller.button);
					}
					
					if (!alreadyExists && $this.is(':text')) {
						$this
							.bind(
								'dateSelected',
								function(e, selectedDate, $td)
								{
									this.value = selectedDate.asString();
								}
							).bind(
								'change',
								function()
								{
									var d = Date.fromString(this.value);
									if (d) {
										controller.setSelected(d, true, true);
									}
								}
							);
						if (s.clickInput) {
							$this.bind(
								'click',
								function()
								{
									$this.dpDisplay();
								}
							);
						}
						var d = Date.fromString(this.value);
						if (this.value != '' && d) {
							controller.setSelected(d, true, true);
						}
					}
					
					$this.addClass('dp-applied');
					
				}
			)
		},
/**
 * Disables or enables this date picker
 *
 * @param Boolean s Whether to disable (true) or enable (false) this datePicker
 * @type jQuery
 * @name dpSetDisabled
 * @cat plugins/datePicker
 * @author Kelvin Luck (http://www.kelvinluck.com/)
 *
 * @example $('.date-picker').datePicker();
 * $('.date-picker').dpSetDisabled(true);
 * @desc Prevents this date picker from displaying and adds a class of dp-disabled to it (and it's associated button if it has one) for styling purposes. If the matched element is an input field then it will also set the disabled attribute to stop people directly editing the field.
 **/
		dpSetDisabled : function(s)
		{
			return _w.call(this, 'setDisabled', s);
		},
/**
 * Updates the first selectable date for any date pickers on any matched elements.
 *
 * @param String d A string representing the first selectable date (formatted according to Date.format).
 * @type jQuery
 * @name dpSetStartDate
 * @cat plugins/datePicker
 * @author Kelvin Luck (http://www.kelvinluck.com/)
 *
 * @example $('.date-picker').datePicker();
 * $('.date-picker').dpSetStartDate('01/01/2000');
 * @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the first selectable date for each of these to the first day of the millenium.
 **/
		dpSetStartDate : function(d)
		{
			return _w.call(this, 'setStartDate', d);
		},
/**
 * Updates the last selectable date for any date pickers on any matched elements.
 *
 * @param String d A string representing the last selectable date (formatted according to Date.format).
 * @type jQuery
 * @name dpSetEndDate
 * @cat plugins/datePicker
 * @author Kelvin Luck (http://www.kelvinluck.com/)
 *
 * @example $('.date-picker').datePicker();
 * $('.date-picker').dpSetEndDate('01/01/2010');
 * @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the last selectable date for each of these to the first Janurary 2010.
 **/
		dpSetEndDate : function(d)
		{
			return _w.call(this, 'setEndDate', d);
		},
/**
 * Gets a list of Dates currently selected by this datePicker. This will be an empty array if no dates are currently selected or NULL if there is no datePicker associated with the matched element.
 *
 * @type Array
 * @name dpGetSelected
 * @cat plugins/datePicker
 * @author Kelvin Luck (http://www.kelvinluck.com/)
 *
 * @example $('.date-picker').datePicker();
 * alert($('.date-picker').dpGetSelected());
 * @desc Will alert an empty array (as nothing is selected yet)
 **/
		dpGetSelected : function()
		{
			var c = _getController(this[0]);
			if (c) {
				return c.getSelected();
			}
			return null;
		},
/**
 * Selects or deselects a date on any matched element's date pickers. Deselcting is only useful on date pickers where selectMultiple==true. Selecting will only work if the passed date is within the startDate and endDate boundries for a given date picker.
 *
 * @param String d A string representing the date you want to select (formatted according to Date.format).
 * @param Boolean v Whether you want to select (true) or deselect (false) this date. Optional - default = true.
 * @param Boolean m Whether you want the date picker to open up on the month of this date when it is next opened. Optional - default = true.
 * @type jQuery
 * @name dpSetSelected
 * @cat plugins/datePicker
 * @author Kelvin Luck (http://www.kelvinluck.com/)
 *
 * @example $('.date-picker').datePicker();
 * $('.date-picker').dpSetSelected('01/01/2010');
 * @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the selected date on these date pickers to the first Janurary 2010. When the date picker is next opened it will display Janurary 2010.
 **/
		dpSetSelected : function(d, v, m)
		{
			if (v == undefined) v=true;
			if (m == undefined) m=true;
			return _w.call(this, 'setSelected', Date.fromString(d), v, m);
		},
/**
 * Sets the month that will be displayed when the date picker is next opened. If the passed month is before startDate then the month containing startDate will be displayed instead. If the passed month is after endDate then the month containing the endDate will be displayed instead.
 *
 * @param Number m The month you want the date picker to display. Optional - defaults to the currently displayed month.
 * @param Number y The year you want the date picker to display. Optional - defaults to the currently displayed year.
 * @type jQuery
 * @name dpSetDisplayedMonth
 * @cat plugins/datePicker
 * @author Kelvin Luck (http://www.kelvinluck.com/)
 *
 * @example $('.date-picker').datePicker();
 * $('.date-picker').dpSetDisplayedMonth(10, 2008);
 * @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the selected date on these date pickers to the first Janurary 2010. When the date picker is next opened it will display Janurary 2010.
 **/
		dpSetDisplayedMonth : function(m, y)
		{
			return _w.call(this, 'setDisplayedMonth', Number(m), Number(y));
		},
/**
 * Displays the date picker associated with the matched elements. Since only one date picker can be displayed at once then the date picker associated with the last matched element will be the one that is displayed.
 *
 * @param HTMLElement e An element that you want the date picker to pop up relative in position to. Optional - default behaviour is to pop up next to the element associated with this date picker.
 * @type jQuery
 * @name dpDisplay
 * @cat plugins/datePicker
 * @author Kelvin Luck (http://www.kelvinluck.com/)
 *
 * @example $('#date-picker').datePicker();
 * $('#date-picker').dpDisplay();
 * @desc Creates a date picker associated with the element with an id of date-picker and then causes it to pop up.
 **/
		dpDisplay : function(e)
		{
			return _w.call(this, 'display', e);
		},
/**
 * Sets a function or array of functions that is called when each TD of the date picker popup is rendered to the page
 *
 * @param (Function|Array) a A function or an array of functions that are called when each td is rendered. Each function will receive four arguments; a jquery object wrapping the created TD, a Date object containing the date this TD represents, a number giving the currently rendered month and a number giving the currently rendered year.
 * @type jQuery
 * @name dpSetRenderCallback
 * @cat plugins/datePicker
 * @author Kelvin Luck (http://www.kelvinluck.com/)
 *
 * @example $('#date-picker').datePicker();
 * $('#date-picker').dpSetRenderCallback(function($td, thisDate, month, year)
 * {
 * 	// do stuff as each td is rendered dependant on the date in the td and the displayed month and year
 * });
 * @desc Creates a date picker associated with the element with an id of date-picker and then creates a function which is called as each td is rendered when this date picker is displayed.
 **/
		dpSetRenderCallback : function(a)
		{
			return _w.call(this, 'setRenderCallback', a);
		},
/**
 * Sets the position that the datePicker will pop up (relative to it's associated element)
 *
 * @param Number v The vertical alignment of the created date picker to it's associated element. Possible values are $.dpConst.POS_TOP and $.dpConst.POS_BOTTOM
 * @param Number h The horizontal alignment of the created date picker to it's associated element. Possible values are $.dpConst.POS_LEFT and $.dpConst.POS_RIGHT
 * @type jQuery
 * @name dpSetPosition
 * @cat plugins/datePicker
 * @author Kelvin Luck (http://www.kelvinluck.com/)
 *
 * @example $('#date-picker').datePicker();
 * $('#date-picker').dpSetPosition($.dpConst.POS_BOTTOM, $.dpConst.POS_RIGHT);
 * @desc Creates a date picker associated with the element with an id of date-picker and makes it so that when this date picker pops up it will be bottom and right aligned to the #date-picker element.
 **/
		dpSetPosition : function(v, h)
		{
			return _w.call(this, 'setPosition', v, h);
		},
/**
 * Sets the offset that the popped up date picker will have from it's default position relative to it's associated element (as set by dpSetPosition)
 *
 * @param Number v The vertical offset of the created date picker.
 * @param Number h The horizontal offset of the created date picker.
 * @type jQuery
 * @name dpSetOffset
 * @cat plugins/datePicker
 * @author Kelvin Luck (http://www.kelvinluck.com/)
 *
 * @example $('#date-picker').datePicker();
 * $('#date-picker').dpSetOffset(-20, 200);
 * @desc Creates a date picker associated with the element with an id of date-picker and makes it so that when this date picker pops up it will be 20 pixels above and 200 pixels to the right of it's default position.
 **/
		dpSetOffset : function(v, h)
		{
			return _w.call(this, 'setOffset', v, h);
		},
/**
 * Closes the open date picker associated with this element.
 *
 * @type jQuery
 * @name dpClose
 * @cat plugins/datePicker
 * @author Kelvin Luck (http://www.kelvinluck.com/)
 *
 * @example $('.date-pick')
 *		.datePicker()
 *		.bind(
 *			'focus',
 *			function()
 *			{
 *				$(this).dpDisplay();
 *			}
 *		).bind(
 *			'blur',
 *			function()
 *			{
 *				$(this).dpClose();
 *			}
 *		);
 * @desc Creates a date picker and makes it appear when the relevant element is focused and disappear when it is blurred.
 **/
		dpClose : function()
		{
			return _w.call(this, '_closeCalendar', false, this[0]);
		},
		// private function called on unload to clean up any expandos etc and prevent memory links...
		_dpDestroy : function()
		{
			// TODO - implement this?
		}
	});
	
	// private internal function to cut down on the amount of code needed where we forward
	// dp* methods on the jQuery object on to the relevant DatePicker controllers...
	var _w = function(f, a1, a2, a3)
	{
		return this.each(
			function()
			{
				var c = _getController(this);
				if (c) {
					c[f](a1, a2, a3);
				}
			}
		);
	};
	
	function DatePicker(ele)
	{
		this.ele = ele;
		
		// initial values...
		this.displayedMonth		=	null;
		this.displayedYear		=	null;
		this.startDate			=	null;
		this.endDate			=	null;
		this.showYearNavigation	=	null;
		this.closeOnSelect		=	null;
		this.displayClose		=	null;
		this.selectMultiple		=	null;
		this.verticalPosition	=	null;
		this.horizontalPosition	=	null;
		this.verticalOffset		=	null;
		this.horizontalOffset	=	null;
		this.button				=	null;
		this.renderCallback		=	[];
		this.selectedDates		=	{};
		this.inline				=	null;
		this.context			=	'#dp-popup';
	};
	$.extend(
		DatePicker.prototype,
		{	
			init : function(s)
			{
				this.setStartDate(s.startDate);
				this.setEndDate(s.endDate);
				this.setDisplayedMonth(Number(s.month), Number(s.year));
				this.setRenderCallback(s.renderCallback);
				this.showYearNavigation = s.showYearNavigation;
				this.closeOnSelect = s.closeOnSelect;
				this.displayClose = s.displayClose;
				this.selectMultiple = s.selectMultiple;
				this.verticalPosition = s.verticalPosition;
				this.horizontalPosition = s.horizontalPosition;
				this.hoverClass = s.hoverClass;
				this.setOffset(s.verticalOffset, s.horizontalOffset);
				this.inline = s.inline;
				if (this.inline) {
					this.context = this.ele;
					this.display();
				}
			},
			setStartDate : function(d)
			{
				if (d) {
					this.startDate = Date.fromString(d);
				}
				if (!this.startDate) {
					this.startDate = (new Date()).zeroTime();
				}
				this.setDisplayedMonth(this.displayedMonth, this.displayedYear);
			},
			setEndDate : function(d)
			{
				if (d) {
					this.endDate = Date.fromString(d);
				}
				if (!this.endDate) {
					this.endDate = (new Date('12/31/2999')); // using the JS Date.parse function which expects mm/dd/yyyy
				}
				if (this.endDate.getTime() < this.startDate.getTime()) {
					this.endDate = this.startDate;
				}
				this.setDisplayedMonth(this.displayedMonth, this.displayedYear);
			},
			setPosition : function(v, h)
			{
				this.verticalPosition = v;
				this.horizontalPosition = h;
			},
			setOffset : function(v, h)
			{
				this.verticalOffset = parseInt(v) || 0;
				this.horizontalOffset = parseInt(h) || 0;
			},
			setDisabled : function(s)
			{
				$e = $(this.ele);
				$e[s ? 'addClass' : 'removeClass']('dp-disabled');
				if (this.button) {
					$but = $(this.button);
					$but[s ? 'addClass' : 'removeClass']('dp-disabled');
					$but.attr('title', s ? '' : $.dpText.TEXT_CHOOSE_DATE);
				}
				if ($e.is(':text')) {
					$e.attr('disabled', s ? 'disabled' : '');
				}
			},
			setDisplayedMonth : function(m, y)
			{
				if (this.startDate == undefined || this.endDate == undefined) {
					return;
				}
				var s = new Date(this.startDate.getTime());
				s.setDate(1);
				var e = new Date(this.endDate.getTime());
				e.setDate(1);
				
				var t;
				if ((!m && !y) || (isNaN(m) && isNaN(y))) {
					// no month or year passed - default to current month
					t = new Date().zeroTime();
					t.setDate(1);
				} else if (isNaN(m)) {
					// just year passed in - presume we want the displayedMonth
					t = new Date(y, this.displayedMonth, 1);
				} else if (isNaN(y)) {
					// just month passed in - presume we want the displayedYear
					t = new Date(this.displayedYear, m, 1);
				} else {
					// year and month passed in - that's the date we want!
					t = new Date(y, m, 1)
				}
				
				// check if the desired date is within the range of our defined startDate and endDate
				if (t.getTime() < s.getTime()) {
					t = s;
				} else if (t.getTime() > e.getTime()) {
					t = e;
				}
				this.displayedMonth = t.getMonth();
				this.displayedYear = t.getFullYear();
			},
			setSelected : function(d, v, moveToMonth)
			{
				if (this.selectMultiple == false) {
					this.selectedDates = {};
					$('td.selected', this.context).removeClass('selected');
				}
				if (moveToMonth) {
					this.setDisplayedMonth(d.getMonth(), d.getFullYear());
				}
				this.selectedDates[d.toString()] = v;
			},
			isSelected : function(d)
			{
				return this.selectedDates[d.toString()];
			},
			getSelected : function()
			{
				var r = [];
				for(s in this.selectedDates) {
					if (this.selectedDates[s] == true) {
						r.push(Date.parse(s));
					}
				}
				return r;
			},
			display : function(eleAlignTo)
			{
				if ($(this.ele).is('.dp-disabled')) return;
				
				eleAlignTo = eleAlignTo || this.ele;
				var c = this;
				var $ele = $(eleAlignTo);
				var eleOffset = $ele.offset();
				
				var $createIn;
				var attrs;
				var attrsCalendarHolder;
				var cssRules;
				
				if (c.inline) {
					$createIn = $(this.ele);
					attrs = {
						'id'		:	'calendar-' + this.ele._dpId,
						'className'	:	'dp-popup dp-popup-inline'
					};
					cssRules = {
					};
				} else {
					$createIn = $('body');
					attrs = {
						'id'		:	'dp-popup',
						'className'	:	'dp-popup'
					};
					cssRules = {
						'top'	:	eleOffset.top + c.verticalOffset,
						'left'	:	eleOffset.left + c.horizontalOffset
					};
					
					var _checkMouse = function(e)
					{
						var el = e.target;
						var cal = $('#dp-popup')[0];
						
						while (true){
							if (el == cal) {
								return true;
							} else if (el == document) {
								c._closeCalendar();
								return false;
							} else {
								el = $(el).parent()[0];
							}
						}
					};
					this._checkMouse = _checkMouse;
				
					this._closeCalendar(true);
				}
				
				
				$createIn
					.append(
						$('<div></div>')
							.attr(attrs)
							.css(cssRules)
							.append(
								$('<h2></h2>'),
								$('<div class="dp-nav-prev"></div>')
									.append(
										$('<a class="dp-nav-prev-year" href="#" title="' + $.dpText.TEXT_PREV_YEAR + '">&lt;&lt;</a>')
											.bind(
												'click',
												function()
												{
													return c._displayNewMonth.call(c, this, 0, -1);
												}
											),
										$('<a class="dp-nav-prev-month" href="#" title="' + $.dpText.TEXT_PREV_MONTH + '">&lt;</a>')
											.bind(
												'click',
												function()
												{
													return c._displayNewMonth.call(c, this, -1, 0);
												}
											)
									),
								$('<div class="dp-nav-next"></div>')
									.append(
										$('<a class="dp-nav-next-year" href="#" title="' + $.dpText.TEXT_NEXT_YEAR + '">&gt;&gt;</a>')
											.bind(
												'click',
												function()
												{
													return c._displayNewMonth.call(c, this, 0, 1);
												}
											),
										$('<a class="dp-nav-next-month" href="#" title="' + $.dpText.TEXT_NEXT_MONTH + '">&gt;</a>')
											.bind(
												'click',
												function()
												{
													return c._displayNewMonth.call(c, this, 1, 0);
												}
											)
									),
								$('<div></div>')
									.attr('className', 'dp-calendar')
							)
							.bgIframe()
						);
					
				var $pop = this.inline ? $('.dp-popup', this.context) : $('#dp-popup');
				
				if (this.showYearNavigation == false) {
					$('.dp-nav-prev-year, .dp-nav-next-year', c.context).css('display', 'none');
				}
				if (this.displayClose) {
					$pop.append(
						$('<a href="#" id="dp-close">' + $.dpText.TEXT_CLOSE + '</a>')
							.bind(
								'click',
								function()
								{
									c._closeCalendar();
									return false;
								}
							)
					);
				}
				c._renderCalendar();
				
				$(this.ele).trigger('dpDisplayed', $pop);
				
				if (!c.inline) {
					if (this.verticalPosition == $.dpConst.POS_BOTTOM) {
						$pop.css('top', eleOffset.top + $ele.height() - $pop.height() + c.verticalOffset);
					}
					if (this.horizontalPosition == $.dpConst.POS_RIGHT) {
						$pop.css('left', eleOffset.left + $ele.width() - $pop.width() + c.horizontalOffset);
					}
					$(document).bind('mousedown', this._checkMouse);
				}
			},
			setRenderCallback : function(a)
			{
				if (a && typeof(a) == 'function') {
					a = [a];
				}
				this.renderCallback = this.renderCallback.concat(a);
			},
			cellRender : function ($td, thisDate, month, year) {
				var c = this.dpController;
				var d = new Date(thisDate.getTime());
				
				// add our click handlers to deal with it when the days are clicked...
				
				$td.bind(
					'click',
					function()
					{
						var $this = $(this);
						if (!$this.is('.disabled')) {
							c.setSelected(d, !$this.is('.selected') || !c.selectMultiple);
							var s = c.isSelected(d);
							$(c.ele).trigger('dateSelected', [d, $td, s]);
							$(c.ele).trigger('change');
							if (c.closeOnSelect) {
								c._closeCalendar();
							} else {
								$this[s ? 'addClass' : 'removeClass']('selected');
							}
						}
					}
				);
				
				if (c.isSelected(d)) {
					$td.addClass('selected');
				}
				
				// call any extra renderCallbacks that were passed in
				for (var i=0; i<c.renderCallback.length; i++) {
					c.renderCallback[i].apply(this, arguments);
				}
				
				
			},
			// ele is the clicked button - only proceed if it doesn't have the class disabled...
			// m and y are -1, 0 or 1 depending which direction we want to go in...
			_displayNewMonth : function(ele, m, y) 
			{
				if (!$(ele).is('.disabled')) {
					this.setDisplayedMonth(this.displayedMonth + m, this.displayedYear + y);
					this._clearCalendar();
					this._renderCalendar();
					$(this.ele).trigger('dpMonthChanged', [this.displayedMonth, this.displayedYear]);
				}
				ele.blur();
				return false;
			},
			_renderCalendar : function()
			{
				// set the title...
				$('h2', this.context).html(Date.monthNames[this.displayedMonth] + ' ' + this.displayedYear);
				
				// render the calendar...
				$('.dp-calendar', this.context).renderCalendar(
					{
						month			: this.displayedMonth,
						year			: this.displayedYear,
						renderCallback	: this.cellRender,
						dpController	: this,
						hoverClass		: this.hoverClass
					}
				);
				
				// update the status of the control buttons and disable dates before startDate or after endDate...
				// TODO: When should the year buttons be disabled? When you can't go forward a whole year from where you are or is that annoying?
				if (this.displayedYear == this.startDate.getFullYear() && this.displayedMonth == this.startDate.getMonth()) {
					$('.dp-nav-prev-year', this.context).addClass('disabled');
					$('.dp-nav-prev-month', this.context).addClass('disabled');
					$('.dp-calendar td.other-month', this.context).each(
						function()
						{
							var $this = $(this);
							if (Number($this.text()) > 20) {
								$this.addClass('disabled');
							}
						}
					);
					var d = this.startDate.getDate();
					$('.dp-calendar td.current-month', this.context).each(
						function()
						{
							var $this = $(this);
							if (Number($this.text()) < d) {
								$this.addClass('disabled');
							}
						}
					);
				} else {
					$('.dp-nav-prev-year', this.context).removeClass('disabled');
					$('.dp-nav-prev-month', this.context).removeClass('disabled');
					var d = this.startDate.getDate();
					if (d > 20) {
						// check if the startDate is last month as we might need to add some disabled classes...
						var sd = new Date(this.startDate.getTime());
						sd.addMonths(1);
						if (this.displayedYear == sd.getFullYear() && this.displayedMonth == sd.getMonth()) {
							$('dp-calendar td.other-month', this.context).each(
								function()
								{
									var $this = $(this);
									if (Number($this.text()) < d) {
										$this.addClass('disabled');
									}
								}
							);
						}
					}
				}
				if (this.displayedYear == this.endDate.getFullYear() && this.displayedMonth == this.endDate.getMonth()) {
					$('.dp-nav-next-year', this.context).addClass('disabled');
					$('.dp-nav-next-month', this.context).addClass('disabled');
					$('.dp-calendar td.other-month', this.context).each(
						function()
						{
							var $this = $(this);
							if (Number($this.text()) < 14) {
								$this.addClass('disabled');
							}
						}
					);
					var d = this.endDate.getDate();
					$('.dp-calendar td.current-month', this.context).each(
						function()
						{
							var $this = $(this);
							if (Number($this.text()) > d) {
								$this.addClass('disabled');
							}
						}
					);
				} else {
					$('.dp-nav-next-year', this.context).removeClass('disabled');
					$('.dp-nav-next-month', this.context).removeClass('disabled');
					var d = this.endDate.getDate();
					if (d < 13) {
						// check if the endDate is next month as we might need to add some disabled classes...
						var ed = new Date(this.endDate.getTime());
						ed.addMonths(-1);
						if (this.displayedYear == ed.getFullYear() && this.displayedMonth == ed.getMonth()) {
							$('.dp-calendar td.other-month', this.context).each(
								function()
								{
									var $this = $(this);
									if (Number($this.text()) > d) {
										$this.addClass('disabled');
									}
								}
							);
						}
					}
				}
			},
			_closeCalendar : function(programatic, ele)
			{
				if (!ele || ele == this.ele)
				{
					$(document).unbind('mousedown', this._checkMouse);
					this._clearCalendar();
					$('#dp-popup a').unbind();
					$('#dp-popup').empty().remove();
					if (!programatic) {
						$(this.ele).trigger('dpClosed', [this.getSelected()]);
					}
				}
			},
			// empties the current dp-calendar div and makes sure that all events are unbound
			// and expandos removed to avoid memory leaks...
			_clearCalendar : function()
			{
				// TODO.
				$('.dp-calendar td', this.context).unbind();
				$('.dp-calendar', this.context).empty();
			}
		}
	);
	
	// static constants
	$.dpConst = {
		SHOW_HEADER_NONE	:	0,
		SHOW_HEADER_SHORT	:	1,
		SHOW_HEADER_LONG	:	2,
		POS_TOP				:	0,
		POS_BOTTOM			:	1,
		POS_LEFT			:	0,
		POS_RIGHT			:	1
	};
	// localisable text
	$.dpText = {
		TEXT_PREV_YEAR		:	'Previous year',
		TEXT_PREV_MONTH		:	'Previous month',
		TEXT_NEXT_YEAR		:	'Next year',
		TEXT_NEXT_MONTH		:	'Next month',
		TEXT_CLOSE			:	'Close',
		TEXT_CHOOSE_DATE	:	'Choose date'
	};
	// version
	$.dpVersion = '$Id: jquery.datePicker.js,v 1.1 2008/11/26 09:37:37 EPotapova Exp $';

	function _getController(ele)
	{
		if (ele._dpId) return $.event._dpCache[ele._dpId];
		return false;
	};
	
	// make it so that no error is thrown if bgIframe plugin isn't included (allows you to use conditional
	// comments to only include bgIframe where it is needed in IE without breaking this plugin).
	if ($.fn.bgIframe == undefined) {
		$.fn.bgIframe = function() {return this; };
	};


	// clean-up
	$(window)
		.bind('unload', function() {
			var els = $.event._dpCache || [];
			for (var i in els) {
				$(els[i].ele)._dpDestroy();
			}
		});
		
	
})(jQuery);



(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()}}}}})();


