var Prototype={Version:'1.6.0',Browser:{IE:!!(window.attachEvent&&!window.opera),Opera:!!window.opera,WebKit:navigator.userAgent.indexOf('AppleWebKit/')>-1,Gecko:navigator.userAgent.indexOf('Gecko')>-1&&navigator.userAgent.indexOf('KHTML')==-1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)},BrowserFeatures:{XPath:!!document.evaluate,ElementExtensions:!!window.HTMLElement,SpecificElementExtensions:document.createElement('div').__proto__&&document.createElement('div').__proto__!==document.createElement('form').__proto__},ScriptFragment:'<script[^>]*>([\\S\\s]*?)<\/script>',JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(x){return x}};if(Prototype.Browser.MobileSafari)Prototype.BrowserFeatures.SpecificElementExtensions=false;if(Prototype.Browser.WebKit)Prototype.BrowserFeatures.XPath=false;var Class={create:function(){var parent=null,properties=$A(arguments);if(Object.isFunction(properties[0]))parent=properties.shift();function klass(){this.initialize.apply(this,arguments);};Object.extend(klass,Class.Methods);klass.superclass=parent;klass.subclasses=[];if(parent){var subclass=function(){};subclass.prototype=parent.prototype;klass.prototype=new subclass;parent.subclasses.push(klass);}for(var i=0;i<properties.length;i++)klass.addMethods(properties[i]);if(!klass.prototype.initialize)klass.prototype.initialize=Prototype.emptyFunction;klass.prototype.constructor=klass;return klass;}};Class.Methods={addMethods:function(source){var ancestor=this.superclass&&this.superclass.prototype;var properties=Object.keys(source);if(!Object.keys({toString:true}).length)properties.push("toString","valueOf");for(var i=0,length=properties.length;i<length;i++){var property=properties[i],value=source[property];if(ancestor&&Object.isFunction(value)&&value.argumentNames().first()=="$super"){var method=value,value=Object.extend((function(m){return function(){return ancestor[m].apply(this,arguments)};})(property).wrap(method),{valueOf:function(){return method},toString:function(){return method.toString()}});}this.prototype[property]=value;}return this;}};var Abstract={};Object.extend=function(destination,source){for(var property in source)destination[property]=source[property];return destination;};Object.extend(Object,{inspect:function(object){try{if(object===undefined)return'undefined';if(object===null)return'null';return object.inspect?object.inspect():object.toString();}catch(e){if(e instanceof RangeError)return'...';throw e;}},toJSON:function(object){var type=typeof object;switch(type){case'undefined':case'function':case'unknown':return;case'boolean':return object.toString();}if(object===null)return'null';if(object.toJSON)return object.toJSON();if(Object.isElement(object))return;var results=[];for(var property in object){var value=Object.toJSON(object[property]);if(value!==undefined)results.push(property.toJSON()+': '+value);}return'{'+results.join(', ')+'}';},toQueryString:function(object){return $H(object).toQueryString();},toHTML:function(object){return object&&object.toHTML?object.toHTML():String.interpret(object);},keys:function(object){var keys=[];for(var property in object)keys.push(property);return keys;},values:function(object){var values=[];for(var property in object)values.push(object[property]);return values;},clone:function(object){return Object.extend({},object);},isElement:function(object){return object&&object.nodeType==1;},isArray:function(object){return object&&object.constructor===Array;},isHash:function(object){return object instanceof Hash;},isFunction:function(object){return typeof object=="function";},isString:function(object){return typeof object=="string";},isNumber:function(object){return typeof object=="number";},isUndefined:function(object){return typeof object=="undefined";}});Object.extend(Function.prototype,{argumentNames:function(){var names=this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip");return names.length==1&&!names[0]?[]:names;},bind:function(){if(arguments.length<2&&arguments[0]===undefined)return this;var __method=this,args=$A(arguments),object=args.shift();return function(){return __method.apply(object,args.concat($A(arguments)));}},bindAsEventListener:function(){var __method=this,args=$A(arguments),object=args.shift();return function(event){return __method.apply(object,[event||window.event].concat(args));}},curry:function(){if(!arguments.length)return this;var __method=this,args=$A(arguments);return function(){return __method.apply(this,args.concat($A(arguments)));}},delay:function(){var __method=this,args=$A(arguments),timeout=args.shift()*1000;return window.setTimeout(function(){return __method.apply(__method,args);},timeout);},wrap:function(wrapper){var __method=this;return function(){return wrapper.apply(this,[__method.bind(this)].concat($A(arguments)));}},methodize:function(){if(this._methodized)return this._methodized;var __method=this;return this._methodized=function(){return __method.apply(null,[this].concat($A(arguments)));};}});Function.prototype.defer=Function.prototype.delay.curry(0.01);Date.prototype.toJSON=function(){return'"'+this.getUTCFullYear()+'-'+(this.getUTCMonth()+1).toPaddedString(2)+'-'+this.getUTCDate().toPaddedString(2)+'T'+this.getUTCHours().toPaddedString(2)+':'+this.getUTCMinutes().toPaddedString(2)+':'+this.getUTCSeconds().toPaddedString(2)+'Z"';};var Try={these:function(){var returnValue;for(var i=0,length=arguments.length;i<length;i++){var lambda=arguments[i];try{returnValue=lambda();break;}catch(e){}}return returnValue;}};RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(str){return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g,'\\$1');};var PeriodicalExecuter=Class.create({initialize:function(callback,frequency){this.callback=callback;this.frequency=frequency;this.currentlyExecuting=false;this.registerCallback();},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000);},execute:function(){this.callback(this);},stop:function(){if(!this.timer)return;clearInterval(this.timer);this.timer=null;},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute();}finally{this.currentlyExecuting=false;}}}});Object.extend(String,{interpret:function(value){return value==null?'':String(value);},specialChar:{'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','\\':'\\\\'}});Object.extend(String.prototype,{gsub:function(pattern,replacement){var result='',source=this,match;replacement=arguments.callee.prepareReplacement(replacement);while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length);}else{result+=source,source='';}}return result;},sub:function(pattern,replacement,count){replacement=this.gsub.prepareReplacement(replacement);count=count===undefined?1:count;return this.gsub(pattern,function(match){if(--count<0)return match[0];return replacement(match);});},scan:function(pattern,iterator){this.gsub(pattern,iterator);return String(this);},truncate:function(length,truncation){length=length||30;truncation=truncation===undefined?'...':truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this);},strip:function(){return this.replace(/^\s+/,'').replace(/\s+$/,'');},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,'');},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,'img'),'');},extractScripts:function(){var matchAll=new RegExp(Prototype.ScriptFragment,'img');var matchOne=new RegExp(Prototype.ScriptFragment,'im');return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||['',''])[1];});},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script)});},escapeHTML:function(){var self=arguments.callee;self.text.data=this;return self.div.innerHTML;},unescapeHTML:function(){var div=new Element('div');div.innerHTML=this.stripTags();return div.childNodes[0]?(div.childNodes.length>1?$A(div.childNodes).inject('',function(memo,node){return memo+node.nodeValue}):div.childNodes[0].nodeValue):'';},toQueryParams:function(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match)return{};return match[1].split(separator||'&').inject({},function(hash,pair){if((pair=pair.split('='))[0]){var key=decodeURIComponent(pair.shift());var value=pair.length>1?pair.join('='):pair[0];if(value!=undefined)value=decodeURIComponent(value);if(key in hash){if(!Object.isArray(hash[key]))hash[key]=[hash[key]];hash[key].push(value);}else hash[key]=value;}return hash;});},toArray:function(){return this.split('');},succ:function(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1);},times:function(count){return count<1?'':new Array(count+1).join(this);},camelize:function(){var parts=this.split('-'),len=parts.length;if(len==1)return parts[0];var camelized=this.charAt(0)=='-'?parts[0].charAt(0).toUpperCase()+parts[0].substring(1):parts[0];for(var i=1;i<len;i++)camelized+=parts[i].charAt(0).toUpperCase()+parts[i].substring(1);return camelized;},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase();},underscore:function(){return this.gsub(/::/,'/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();},dasherize:function(){return this.gsub(/_/,'-');},inspect:function(useDoubleQuotes){var escapedString=this.gsub(/[\x00-\x1f\\]/,function(match){var character=String.specialChar[match[0]];return character?character:'\\u00'+match[0].charCodeAt().toPaddedString(2,16);});if(useDoubleQuotes)return'"'+escapedString.replace(/"/g,'\\"')+'"';return"'"+escapedString.replace(/'/g,'\\\'')+"'";},toJSON:function(){return this.inspect(true);},unfilterJSON:function(filter){return this.sub(filter||Prototype.JSONFilter,'#{1}');},isJSON:function(){var str=this.replace(/\\./g,'@').replace(/"[^"\\\n\r]*"/g,'');return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);},evalJSON:function(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON())return eval('('+json+')');}catch(e){}throw new SyntaxError('Badly formed JSON string: '+this.inspect());},include:function(pattern){return this.indexOf(pattern)>-1;},startsWith:function(pattern){return this.indexOf(pattern)===0;},endsWith:function(pattern){var d=this.length-pattern.length;return d>=0&&this.lastIndexOf(pattern)===d;},empty:function(){return this=='';},blank:function(){return/^\s*$/.test(this);},interpolate:function(object,pattern){return new Template(this,pattern).evaluate(object);}});if(Prototype.Browser.WebKit||Prototype.Browser.IE)Object.extend(String.prototype,{escapeHTML:function(){return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');},unescapeHTML:function(){return this.replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');}});String.prototype.gsub.prepareReplacement=function(replacement){if(Object.isFunction(replacement))return replacement;var template=new Template(replacement);return function(match){return template.evaluate(match)};};String.prototype.parseQuery=String.prototype.toQueryParams;Object.extend(String.prototype.escapeHTML,{div:document.createElement('div'),text:document.createTextNode('')});with(String.prototype.escapeHTML)div.appendChild(text);var Template=Class.create({initialize:function(template,pattern){this.template=template.toString();this.pattern=pattern||Template.Pattern;},evaluate:function(object){if(Object.isFunction(object.toTemplateReplacements))object=object.toTemplateReplacements();return this.template.gsub(this.pattern,function(match){if(object==null)return'';var before=match[1]||'';if(before=='\\')return match[2];var ctx=object,expr=match[3];var pattern=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/,match=pattern.exec(expr);if(match==null)return before;while(match!=null){var comp=match[1].startsWith('[')?match[2].gsub('\\\\]',']'):match[1];ctx=ctx[comp];if(null==ctx||''==match[3])break;expr=expr.substring('['==match[3]?match[1].length:match[0].length);match=pattern.exec(expr);}return before+String.interpret(ctx);}.bind(this));}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable={each:function(iterator,context){var index=0;iterator=iterator.bind(context);try{this._each(function(value){iterator(value,index++);});}catch(e){if(e!=$break)throw e;}return this;},eachSlice:function(number,iterator,context){iterator=iterator?iterator.bind(context):Prototype.K;var index=-number,slices=[],array=this.toArray();while((index+=number)<array.length)slices.push(array.slice(index,index+number));return slices.collect(iterator,context);},all:function(iterator,context){iterator=iterator?iterator.bind(context):Prototype.K;var result=true;this.each(function(value,index){result=result&&!!iterator(value,index);if(!result)throw $break;});return result;},any:function(iterator,context){iterator=iterator?iterator.bind(context):Prototype.K;var result=false;this.each(function(value,index){if(result=!!iterator(value,index))throw $break;});return result;},collect:function(iterator,context){iterator=iterator?iterator.bind(context):Prototype.K;var results=[];this.each(function(value,index){results.push(iterator(value,index));});return results;},detect:function(iterator,context){iterator=iterator.bind(context);var result;this.each(function(value,index){if(iterator(value,index)){result=value;throw $break;}});return result;},findAll:function(iterator,context){iterator=iterator.bind(context);var results=[];this.each(function(value,index){if(iterator(value,index))results.push(value);});return results;},grep:function(filter,iterator,context){iterator=iterator?iterator.bind(context):Prototype.K;var results=[];if(Object.isString(filter))filter=new RegExp(filter);this.each(function(value,index){if(filter.match(value))results.push(iterator(value,index));});return results;},include:function(object){if(Object.isFunction(this.indexOf))if(this.indexOf(object)!=-1)return true;var found=false;this.each(function(value){if(value==object){found=true;throw $break;}});return found;},inGroupsOf:function(number,fillWith){fillWith=fillWith===undefined?null:fillWith;return this.eachSlice(number,function(slice){while(slice.length<number)slice.push(fillWith);return slice;});},inject:function(memo,iterator,context){iterator=iterator.bind(context);this.each(function(value,index){memo=iterator(memo,value,index);});return memo;},invoke:function(method){var args=$A(arguments).slice(1);return this.map(function(value){return value[method].apply(value,args);});},max:function(iterator,context){iterator=iterator?iterator.bind(context):Prototype.K;var result;this.each(function(value,index){value=iterator(value,index);if(result==undefined||value>=result)result=value;});return result;},min:function(iterator,context){iterator=iterator?iterator.bind(context):Prototype.K;var result;this.each(function(value,index){value=iterator(value,index);if(result==undefined||value<result)result=value;});return result;},partition:function(iterator,context){iterator=iterator?iterator.bind(context):Prototype.K;var trues=[],falses=[];this.each(function(value,index){(iterator(value,index)?trues:falses).push(value);});return[trues,falses];},pluck:function(property){var results=[];this.each(function(value){results.push(value[property]);});return results;},reject:function(iterator,context){iterator=iterator.bind(context);var results=[];this.each(function(value,index){if(!iterator(value,index))results.push(value);});return results;},sortBy:function(iterator,context){iterator=iterator.bind(context);return this.map(function(value,index){return{value:value,criteria:iterator(value,index)};}).sort(function(left,right){var a=left.criteria,b=right.criteria;return a<b?-1:a>b?1:0;}).pluck('value');},toArray:function(){return this.map();},zip:function(){var iterator=Prototype.K,args=$A(arguments);if(Object.isFunction(args.last()))iterator=args.pop();var collections=[this].concat(args).map($A);return this.map(function(value,index){return iterator(collections.pluck(index));});},size:function(){return this.toArray().length;},inspect:function(){return'#<Enumerable:'+this.toArray().inspect()+'>';}};Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,filter:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray,every:Enumerable.all,some:Enumerable.any});function $A(iterable){if(!iterable)return[];if(iterable.toArray)return iterable.toArray();var length=iterable.length,results=new Array(length);while(length--)results[length]=iterable[length];return results;}if(Prototype.Browser.WebKit){function $A(iterable){if(!iterable)return[];if(!(Object.isFunction(iterable)&&iterable=='[object NodeList]')&&iterable.toArray)return iterable.toArray();var length=iterable.length,results=new Array(length);while(length--)results[length]=iterable[length];return results;}}Array.from=$A;Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse)Array.prototype._reverse=Array.prototype.reverse;Object.extend(Array.prototype,{_each:function(iterator){for(var i=0,length=this.length;i<length;i++)iterator(this[i]);},clear:function(){this.length=0;return this;},first:function(){return this[0];},last:function(){return this[this.length-1];},compact:function(){return this.select(function(value){return value!=null;});},flatten:function(){return this.inject([],function(array,value){return array.concat(Object.isArray(value)?value.flatten():[value]);});},without:function(){var values=$A(arguments);return this.select(function(value){return!values.include(value);});},reverse:function(inline){return(inline!==false?this:this.toArray())._reverse();},reduce:function(){return this.length>1?this:this[0];},uniq:function(sorted){return this.inject([],function(array,value,index){if(0==index||(sorted?array.last()!=value:!array.include(value)))array.push(value);return array;});},intersect:function(array){return this.uniq().findAll(function(item){return array.detect(function(value){return item===value});});},clone:function(){return[].concat(this);},size:function(){return this.length;},inspect:function(){return'['+this.map(Object.inspect).join(', ')+']';},toJSON:function(){var results=[];this.each(function(object){var value=Object.toJSON(object);if(value!==undefined)results.push(value);});return'['+results.join(', ')+']';}});if(Object.isFunction(Array.prototype.forEach))Array.prototype._each=Array.prototype.forEach;if(!Array.prototype.indexOf)Array.prototype.indexOf=function(item,i){i||(i=0);var length=this.length;if(i<0)i=length+i;for(;i<length;i++)if(this[i]===item)return i;return-1;};if(!Array.prototype.lastIndexOf)Array.prototype.lastIndexOf=function(item,i){i=isNaN(i)?this.length:(i<0?this.length+i:i)+1;var n=this.slice(0,i).reverse().indexOf(item);return(n<0)?n:i-n-1;};Array.prototype.toArray=Array.prototype.clone;function $w(string){if(!Object.isString(string))return[];string=string.strip();return string?string.split(/\s+/):[];}if(Prototype.Browser.Opera){Array.prototype.concat=function(){var array=[];for(var i=0,length=this.length;i<length;i++)array.push(this[i]);for(var i=0,length=arguments.length;i<length;i++){if(Object.isArray(arguments[i])){for(var j=0,arrayLength=arguments[i].length;j<arrayLength;j++)array.push(arguments[i][j]);}else{array.push(arguments[i]);}}return array;};}Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16);},succ:function(){return this+1;},times:function(iterator){$R(0,this,true).each(iterator);return this;},toPaddedString:function(length,radix){var string=this.toString(radix||10);return'0'.times(length-string.length)+string;},toJSON:function(){return isFinite(this)?this.toString():'null';}});$w('abs round ceil floor').each(function(method){Number.prototype[method]=Math[method].methodize();});function $H(object){return new Hash(object);};var Hash=Class.create(Enumerable,(function(){if(function(){var i=0,Test=function(value){this.key=value};Test.prototype.key='foo';for(var property in new Test('bar'))i++;return i>1;}()){function each(iterator){var cache=[];for(var key in this._object){var value=this._object[key];if(cache.include(key))continue;cache.push(key);var pair=[key,value];pair.key=key;pair.value=value;iterator(pair);}}}else{function each(iterator){for(var key in this._object){var value=this._object[key],pair=[key,value];pair.key=key;pair.value=value;iterator(pair);}}}function toQueryPair(key,value){if(Object.isUndefined(value))return key;return key+'='+encodeURIComponent(String.interpret(value));};return{initialize:function(object){this._object=Object.isHash(object)?object.toObject():Object.clone(object);},_each:each,set:function(key,value){return this._object[key]=value;},get:function(key){return this._object[key];},unset:function(key){var value=this._object[key];delete this._object[key];return value;},toObject:function(){return Object.clone(this._object);},keys:function(){return this.pluck('key');},values:function(){return this.pluck('value');},index:function(value){var match=this.detect(function(pair){return pair.value===value;});return match&&match.key;},merge:function(object){return this.clone().update(object);},update:function(object){return new Hash(object).inject(this,function(result,pair){result.set(pair.key,pair.value);return result;});},toQueryString:function(){return this.map(function(pair){var key=encodeURIComponent(pair.key),values=pair.value;if(values&&typeof values=='object'){if(Object.isArray(values))return values.map(toQueryPair.curry(key)).join('&');}return toQueryPair(key,values);}).join('&');},inspect:function(){return'#<Hash:{'+this.map(function(pair){return pair.map(Object.inspect).join(': ');}).join(', ')+'}>';},toJSON:function(){return Object.toJSON(this.toObject());},clone:function(){return new Hash(this);}}})());Hash.prototype.toTemplateReplacements=Hash.prototype.toObject;Hash.from=$H;var ObjectRange=Class.create(Enumerable,{initialize:function(start,end,exclusive){this.start=start;this.end=end;this.exclusive=exclusive;},_each:function(iterator){var value=this.start;while(this.include(value)){iterator(value);value=value.succ();}},include:function(value){if(value<this.start)return false;if(this.exclusive)return value<this.end;return value<=this.end;}});var $R=function(start,end,exclusive){return new ObjectRange(start,end,exclusive);};var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject('Msxml2.XMLHTTP')},function(){return new ActiveXObject('Microsoft.XMLHTTP')})||false;},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(iterator){this.responders._each(iterator);},register:function(responder){if(!this.include(responder))this.responders.push(responder);},unregister:function(responder){this.responders=this.responders.without(responder);},dispatch:function(callback,request,transport,json){this.each(function(responder){if(Object.isFunction(responder[callback])){try{responder[callback].apply(responder,[request,transport,json]);}catch(e){}}});}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(options){this.options={method:'post',asynchronous:true,contentType:'application/x-www-form-urlencoded',encoding:'UTF-8',parameters:'',evalJSON:true,evalJS:true};Object.extend(this.options,options||{});this.options.method=this.options.method.toLowerCase();if(Object.isString(this.options.parameters))this.options.parameters=this.options.parameters.toQueryParams();}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,url,options){$super(options);this.transport=Ajax.getTransport();this.request(url);},request:function(url){this.url=url;this.method=this.options.method;var params=Object.clone(this.options.parameters);if(!['get','post'].include(this.method)){params['_method']=this.method;this.method='post';}this.parameters=params;if(params=Object.toQueryString(params)){if(this.method=='get')this.url+=(this.url.include('?')?'&':'?')+params;else if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))params+='&_=';}try{var response=new Ajax.Response(this);if(this.options.onCreate)this.options.onCreate(response);Ajax.Responders.dispatch('onCreate',this,response);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous)this.respondToReadyState.bind(this).defer(1);this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=='post'?(this.options.postBody||params):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType)this.onStateChange();}catch(e){this.dispatchException(e);}},onStateChange:function(){var readyState=this.transport.readyState;if(readyState>1&&!((readyState==4)&&this._complete))this.respondToReadyState(this.transport.readyState);},setRequestHeaders:function(){var headers={'X-Requested-With':'XMLHttpRequest','X-Prototype-Version':Prototype.Version,'Accept':'text/javascript, text/html, application/xml, text/xml, */*'};if(this.method=='post'){headers['Content-type']=this.options.contentType+(this.options.encoding?'; charset='+this.options.encoding:'');if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005)headers['Connection']='close';}if(typeof this.options.requestHeaders=='object'){var extras=this.options.requestHeaders;if(Object.isFunction(extras.push))for(var i=0,length=extras.length;i<length;i+=2)headers[extras[i]]=extras[i+1];else $H(extras).each(function(pair){headers[pair.key]=pair.value});}for(var name in headers)this.transport.setRequestHeader(name,headers[name]);},success:function(){var status=this.getStatus();return!status||(status>=200&&status<300);},getStatus:function(){try{return this.transport.status||0;}catch(e){return 0}},respondToReadyState:function(readyState){var state=Ajax.Request.Events[readyState],response=new Ajax.Response(this);if(state=='Complete'){try{this._complete=true;(this.options['on'+response.status]||this.options['on'+(this.success()?'Success':'Failure')]||Prototype.emptyFunction)(response,response.headerJSON);}catch(e){this.dispatchException(e);}var contentType=response.getHeader('Content-type');if(this.options.evalJS=='force'||(this.options.evalJS&&contentType&&contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))this.evalResponse();}try{(this.options['on'+state]||Prototype.emptyFunction)(response,response.headerJSON);Ajax.Responders.dispatch('on'+state,this,response,response.headerJSON);}catch(e){this.dispatchException(e);}if(state=='Complete'){this.transport.onreadystatechange=Prototype.emptyFunction;}},getHeader:function(name){try{return this.transport.getResponseHeader(name);}catch(e){return null}},evalResponse:function(){try{return eval((this.transport.responseText||'').unfilterJSON());}catch(e){this.dispatchException(e);}},dispatchException:function(exception){(this.options.onException||Prototype.emptyFunction)(this,exception);Ajax.Responders.dispatch('onException',this,exception);}});Ajax.Request.Events=['Uninitialized','Loading','Loaded','Interactive','Complete'];Ajax.Response=Class.create({initialize:function(request){this.request=request;var transport=this.transport=request.transport,readyState=this.readyState=transport.readyState;if((readyState>2&&!Prototype.Browser.IE)||readyState==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(transport.responseText);this.headerJSON=this._getHeaderJSON();}if(readyState==4){var xml=transport.responseXML;this.responseXML=xml===undefined?null:xml;this.responseJSON=this._getResponseJSON();}},status:0,statusText:'',getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||'';}catch(e){return''}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders();}catch(e){return null}},getResponseHeader:function(name){return this.transport.getResponseHeader(name);},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders();},_getHeaderJSON:function(){var json=this.getHeader('X-JSON');if(!json)return null;json=decodeURIComponent(escape(json));try{return json.evalJSON(this.request.options.sanitizeJSON);}catch(e){this.request.dispatchException(e);}},_getResponseJSON:function(){var options=this.request.options;if(!options.evalJSON||(options.evalJSON!='force'&&!(this.getHeader('Content-type')||'').include('application/json')))return null;try{return this.transport.responseText.evalJSON(options.sanitizeJSON);}catch(e){this.request.dispatchException(e);}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,container,url,options){this.container={success:(container.success||container),failure:(container.failure||(container.success?null:container))};options=options||{};var onComplete=options.onComplete;options.onComplete=(function(response,param){this.updateContent(response.responseText);if(Object.isFunction(onComplete))onComplete(response,param);}).bind(this);$super(url,options);},updateContent:function(responseText){var receiver=this.container[this.success()?'success':'failure'],options=this.options;if(!options.evalScripts)responseText=responseText.stripScripts();if(receiver=$(receiver)){if(options.insertion){if(Object.isString(options.insertion)){var insertion={};insertion[options.insertion]=responseText;receiver.insert(insertion);}else options.insertion(receiver,responseText);}else receiver.update(responseText);}if(this.success()){if(this.onComplete)this.onComplete.bind(this).defer();}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,container,url,options){$super(options);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=container;this.url=url;this.start();},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent();},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments);},updateComplete:function(response){if(this.options.decay){this.decay=(response.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=response.responseText;}this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency);},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options);}});function $(element){if(arguments.length>1){for(var i=0,elements=[],length=arguments.length;i<length;i++)elements.push($(arguments[i]));return elements;}if(Object.isString(element))element=document.getElementById(element);return Element.extend(element);}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(expression,parentElement){var results=[];var query=document.evaluate(expression,$(parentElement)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var i=0,length=query.snapshotLength;i<length;i++)results.push(Element.extend(query.snapshotItem(i)));return results;};}if(!window.Node)var Node={};if(!Node.ELEMENT_NODE){Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12});}(function(){var element=this.Element;this.Element=function(tagName,attributes){attributes=attributes||{};tagName=tagName.toLowerCase();var cache=Element.cache;if(Prototype.Browser.IE&&attributes.name){tagName='<'+tagName+' name="'+attributes.name+'">';delete attributes.name;return Element.writeAttribute(document.createElement(tagName),attributes);}if(!cache[tagName])cache[tagName]=Element.extend(document.createElement(tagName));return Element.writeAttribute(cache[tagName].cloneNode(false),attributes);};Object.extend(this.Element,element||{});}).call(window);Element.cache={};Element.Methods={visible:function(element){return $(element).style.display!='none';},toggle:function(element){element=$(element);Element[Element.visible(element)?'hide':'show'](element);return element;},hide:function(element){$(element).style.display='none';return element;},show:function(element){$(element).style.display='';return element;},remove:function(element){element=$(element);element.parentNode.removeChild(element);return element;},update:function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content))return element.update().insert(content);content=Object.toHTML(content);element.innerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element;},replace:function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();else if(!Object.isElement(content)){content=Object.toHTML(content);var range=element.ownerDocument.createRange();range.selectNode(element);content.evalScripts.bind(content).defer();content=range.createContextualFragment(content.stripScripts());}element.parentNode.replaceChild(content,element);return element;},insert:function(element,insertions){element=$(element);if(Object.isString(insertions)||Object.isNumber(insertions)||Object.isElement(insertions)||(insertions&&(insertions.toElement||insertions.toHTML)))insertions={bottom:insertions};var content,t,range;for(position in insertions){content=insertions[position];position=position.toLowerCase();t=Element._insertionTranslations[position];if(content&&content.toElement)content=content.toElement();if(Object.isElement(content)){t.insert(element,content);continue;}content=Object.toHTML(content);range=element.ownerDocument.createRange();t.initializeRange(element,range);t.insert(element,range.createContextualFragment(content.stripScripts()));content.evalScripts.bind(content).defer();}return element;},wrap:function(element,wrapper,attributes){element=$(element);if(Object.isElement(wrapper))$(wrapper).writeAttribute(attributes||{});else if(Object.isString(wrapper))wrapper=new Element(wrapper,attributes);else wrapper=new Element('div',wrapper);if(element.parentNode)element.parentNode.replaceChild(wrapper,element);wrapper.appendChild(element);return wrapper;},inspect:function(element){element=$(element);var result='<'+element.tagName.toLowerCase();$H({'id':'id','className':'class'}).each(function(pair){var property=pair.first(),attribute=pair.last();var value=(element[property]||'').toString();if(value)result+=' '+attribute+'='+value.inspect(true);});return result+'>';},recursivelyCollect:function(element,property){element=$(element);var elements=[];while(element=element[property])if(element.nodeType==1)elements.push(Element.extend(element));return elements;},ancestors:function(element){return $(element).recursivelyCollect('parentNode');},descendants:function(element){return $A($(element).getElementsByTagName('*')).each(Element.extend);},firstDescendant:function(element){element=$(element).firstChild;while(element&&element.nodeType!=1)element=element.nextSibling;return $(element);},immediateDescendants:function(element){if(!(element=$(element).firstChild))return[];while(element&&element.nodeType!=1)element=element.nextSibling;if(element)return[element].concat($(element).nextSiblings());return[];},previousSiblings:function(element){return $(element).recursivelyCollect('previousSibling');},nextSiblings:function(element){return $(element).recursivelyCollect('nextSibling');},siblings:function(element){element=$(element);return element.previousSiblings().reverse().concat(element.nextSiblings());},match:function(element,selector){if(Object.isString(selector))selector=new Selector(selector);return selector.match($(element));},up:function(element,expression,index){element=$(element);if(arguments.length==1)return $(element.parentNode);var ancestors=element.ancestors();return expression?Selector.findElement(ancestors,expression,index):ancestors[index||0];},down:function(element,expression,index){element=$(element);if(arguments.length==1)return element.firstDescendant();var descendants=element.descendants();return expression?Selector.findElement(descendants,expression,index):descendants[index||0];},previous:function(element,expression,index){element=$(element);if(arguments.length==1)return $(Selector.handlers.previousElementSibling(element));var previousSiblings=element.previousSiblings();return expression?Selector.findElement(previousSiblings,expression,index):previousSiblings[index||0];},next:function(element,expression,index){element=$(element);if(arguments.length==1)return $(Selector.handlers.nextElementSibling(element));var nextSiblings=element.nextSiblings();return expression?Selector.findElement(nextSiblings,expression,index):nextSiblings[index||0];},select:function(){var args=$A(arguments),element=$(args.shift());return Selector.findChildElements(element,args);},adjacent:function(){var args=$A(arguments),element=$(args.shift());return Selector.findChildElements(element.parentNode,args).without(element);},identify:function(element){element=$(element);var id=element.readAttribute('id'),self=arguments.callee;if(id)return id;do{id='anonymous_element_'+self.counter++}while($(id));element.writeAttribute('id',id);return id;},readAttribute:function(element,name){element=$(element);if(Prototype.Browser.IE){var t=Element._attributeTranslations.read;if(t.values[name])return t.values[name](element,name);if(t.names[name])name=t.names[name];if(name.include(':')){return(!element.attributes||!element.attributes[name])?null:element.attributes[name].value;}}return element.getAttribute(name);},writeAttribute:function(element,name,value){element=$(element);var attributes={},t=Element._attributeTranslations.write;if(typeof name=='object')attributes=name;else attributes[name]=value===undefined?true:value;for(var attr in attributes){var name=t.names[attr]||attr,value=attributes[attr];if(t.values[attr])name=t.values[attr](element,value);if(value===false||value===null)element.removeAttribute(name);else if(value===true)element.setAttribute(name,name);else element.setAttribute(name,value);}return element;},getHeight:function(element){return $(element).getDimensions().height;},getWidth:function(element){return $(element).getDimensions().width;},classNames:function(element){return new Element.ClassNames(element);},hasClassName:function(element,className){if(!(element=$(element)))return;var elementClassName=element.className;return(elementClassName.length>0&&(elementClassName==className||new RegExp("(^|\\s)"+className+"(\\s|$)").test(elementClassName)));},addClassName:function(element,className){if(!(element=$(element)))return;if(!element.hasClassName(className))element.className+=(element.className?' ':'')+className;return element;},removeClassName:function(element,className){if(!(element=$(element)))return;element.className=element.className.replace(new RegExp("(^|\\s+)"+className+"(\\s+|$)"),' ').strip();return element;},toggleClassName:function(element,className){if(!(element=$(element)))return;return element[element.hasClassName(className)?'removeClassName':'addClassName'](className);},cleanWhitespace:function(element){element=$(element);var node=element.firstChild;while(node){var nextNode=node.nextSibling;if(node.nodeType==3&&!/\S/.test(node.nodeValue))element.removeChild(node);node=nextNode;}return element;},empty:function(element){return $(element).innerHTML.blank();},descendantOf:function(element,ancestor){element=$(element),ancestor=$(ancestor);if(element.compareDocumentPosition)return(element.compareDocumentPosition(ancestor)&8)===8;if(element.sourceIndex&&!Prototype.Browser.Opera){var e=element.sourceIndex,a=ancestor.sourceIndex,nextAncestor=ancestor.nextSibling;if(!nextAncestor){do{ancestor=ancestor.parentNode;}while(!(nextAncestor=ancestor.nextSibling)&&ancestor.parentNode);}if(nextAncestor)return(e>a&&e<nextAncestor.sourceIndex);}while(element=element.parentNode)if(element==ancestor)return true;return false;},scrollTo:function(element){element=$(element);var pos=element.cumulativeOffset();window.scrollTo(pos[0],pos[1]);return element;},getStyle:function(element,style){element=$(element);style=style=='float'?'cssFloat':style.camelize();var value=element.style[style];if(!value){var css=document.defaultView.getComputedStyle(element,null);value=css?css[style]:null;}if(style=='opacity')return value?parseFloat(value):1.0;return value=='auto'?null:value;},getOpacity:function(element){return $(element).getStyle('opacity');},setStyle:function(element,styles){element=$(element);var elementStyle=element.style,match;if(Object.isString(styles)){element.style.cssText+=';'+styles;return styles.include('opacity')?element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]):element;}for(var property in styles)if(property=='opacity')element.setOpacity(styles[property]);else elementStyle[(property=='float'||property=='cssFloat')?(elementStyle.styleFloat===undefined?'cssFloat':'styleFloat'):property]=styles[property];return element;},setOpacity:function(element,value){element=$(element);element.style.opacity=(value==1||value==='')?'':(value<0.00001)?0:value;return element;},getDimensions:function(element){element=$(element);var display=$(element).getStyle('display');if(display!='none'&&display!=null)return{width:element.offsetWidth,height:element.offsetHeight};var els=element.style;var originalVisibility=els.visibility;var originalPosition=els.position;var originalDisplay=els.display;els.visibility='hidden';els.position='absolute';els.display='block';var originalWidth=element.clientWidth;var originalHeight=element.clientHeight;els.display=originalDisplay;els.position=originalPosition;els.visibility=originalVisibility;return{width:originalWidth,height:originalHeight};},makePositioned:function(element){element=$(element);var pos=Element.getStyle(element,'position');if(pos=='static'||!pos){element._madePositioned=true;element.style.position='relative';if(window.opera){element.style.top=0;element.style.left=0;}}return element;},undoPositioned:function(element){element=$(element);if(element._madePositioned){element._madePositioned=undefined;element.style.position=element.style.top=element.style.left=element.style.bottom=element.style.right='';}return element;},makeClipping:function(element){element=$(element);if(element._overflow)return element;element._overflow=Element.getStyle(element,'overflow')||'auto';if(element._overflow!=='hidden')element.style.overflow='hidden';return element;},undoClipping:function(element){element=$(element);if(!element._overflow)return element;element.style.overflow=element._overflow=='auto'?'':element._overflow;element._overflow=null;return element;},cumulativeOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;}while(element);return Element._returnOffset(valueL,valueT);},positionedOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;if(element){if(element.tagName=='BODY')break;var p=Element.getStyle(element,'position');if(p=='relative'||p=='absolute')break;}}while(element);return Element._returnOffset(valueL,valueT);},absolutize:function(element){element=$(element);if(element.getStyle('position')=='absolute')return;var offsets=element.positionedOffset();var top=offsets[1];var left=offsets[0];var width=element.clientWidth;var height=element.clientHeight;element._originalLeft=left-parseFloat(element.style.left||0);element._originalTop=top-parseFloat(element.style.top||0);element._originalWidth=element.style.width;element._originalHeight=element.style.height;element.style.position='absolute';element.style.top=top+'px';element.style.left=left+'px';element.style.width=width+'px';element.style.height=height+'px';return element;},relativize:function(element){element=$(element);if(element.getStyle('position')=='relative')return;element.style.position='relative';var top=parseFloat(element.style.top||0)-(element._originalTop||0);var left=parseFloat(element.style.left||0)-(element._originalLeft||0);element.style.top=top+'px';element.style.left=left+'px';element.style.height=element._originalHeight;element.style.width=element._originalWidth;return element;},cumulativeScrollOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.scrollTop||0;valueL+=element.scrollLeft||0;element=element.parentNode;}while(element);return Element._returnOffset(valueL,valueT);},getOffsetParent:function(element){if(element.offsetParent)return $(element.offsetParent);if(element==document.body)return $(element);while((element=element.parentNode)&&element!=document.body)if(Element.getStyle(element,'position')!='static')return $(element);return $(document.body);},viewportOffset:function(forElement){var valueT=0,valueL=0;var element=forElement;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body&&Element.getStyle(element,'position')=='absolute')break;}while(element=element.offsetParent);element=forElement;do{if(!Prototype.Browser.Opera||element.tagName=='BODY'){valueT-=element.scrollTop||0;valueL-=element.scrollLeft||0;}}while(element=element.parentNode);return Element._returnOffset(valueL,valueT);},clonePosition:function(element,source){var options=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});source=$(source);var p=source.viewportOffset();element=$(element);var delta=[0,0];var parent=null;if(Element.getStyle(element,'position')=='absolute'){parent=element.getOffsetParent();delta=parent.viewportOffset();}if(parent==document.body){delta[0]-=document.body.offsetLeft;delta[1]-=document.body.offsetTop;}if(options.setLeft)element.style.left=(p[0]-delta[0]+options.offsetLeft)+'px';if(options.setTop)element.style.top=(p[1]-delta[1]+options.offsetTop)+'px';if(options.setWidth)element.style.width=source.offsetWidth+'px';if(options.setHeight)element.style.height=source.offsetHeight+'px';return element;}};Element.Methods.identify.counter=1;Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:'class',htmlFor:'for'},values:{}}};if(!document.createRange||Prototype.Browser.Opera){Element.Methods.insert=function(element,insertions){element=$(element);if(Object.isString(insertions)||Object.isNumber(insertions)||Object.isElement(insertions)||(insertions&&(insertions.toElement||insertions.toHTML)))insertions={bottom:insertions};var t=Element._insertionTranslations,content,position,pos,tagName;for(position in insertions){content=insertions[position];position=position.toLowerCase();pos=t[position];if(content&&content.toElement)content=content.toElement();if(Object.isElement(content)){pos.insert(element,content);continue;}content=Object.toHTML(content);tagName=((position=='before'||position=='after')?element.parentNode:element).tagName.toUpperCase();if(t.tags[tagName]){var fragments=Element._getContentFromAnonymousElement(tagName,content.stripScripts());if(position=='top'||position=='after')fragments.reverse();fragments.each(pos.insert.curry(element));}else element.insertAdjacentHTML(pos.adjacency,content.stripScripts());content.evalScripts.bind(content).defer();}return element;};}if(Prototype.Browser.Opera){Element.Methods._getStyle=Element.Methods.getStyle;Element.Methods.getStyle=function(element,style){switch(style){case'left':case'top':case'right':case'bottom':if(Element._getStyle(element,'position')=='static')return null;default:return Element._getStyle(element,style);}};Element.Methods._readAttribute=Element.Methods.readAttribute;Element.Methods.readAttribute=function(element,attribute){if(attribute=='title')return element.title;return Element._readAttribute(element,attribute);};}else if(Prototype.Browser.IE){$w('positionedOffset getOffsetParent viewportOffset').each(function(method){Element.Methods[method]=Element.Methods[method].wrap(function(proceed,element){element=$(element);var position=element.getStyle('position');if(position!='static')return proceed(element);element.setStyle({position:'relative'});var value=proceed(element);element.setStyle({position:position});return value;});});Element.Methods.getStyle=function(element,style){element=$(element);style=(style=='float'||style=='cssFloat')?'styleFloat':style.camelize();var value=element.style[style];if(!value&&element.currentStyle)value=element.currentStyle[style];if(style=='opacity'){if(value=(element.getStyle('filter')||'').match(/alpha\(opacity=(.*)\)/))if(value[1])return parseFloat(value[1])/100;return 1.0;}if(value=='auto'){if((style=='width'||style=='height')&&(element.getStyle('display')!='none'))return element['offset'+style.capitalize()]+'px';return null;}return value;};Element.Methods.setOpacity=function(element,value){function stripAlpha(filter){return filter.replace(/alpha\([^\)]*\)/gi,'');};element=$(element);var currentStyle=element.currentStyle;if((currentStyle&&!currentStyle.hasLayout)||(!currentStyle&&element.style.zoom=='normal'))element.style.zoom=1;var filter=element.getStyle('filter'),style=element.style;if(value==1||value===''){(filter=stripAlpha(filter))?style.filter=filter:style.removeAttribute('filter');return element;}else if(value<0.00001)value=0;style.filter=stripAlpha(filter)+'alpha(opacity='+(value*100)+')';return element;};Element._attributeTranslations={read:{names:{'class':'className','for':'htmlFor'},values:{_getAttr:function(element,attribute){return element.getAttribute(attribute,2);},_getAttrNode:function(element,attribute){var node=element.getAttributeNode(attribute);return node?node.value:"";},_getEv:function(element,attribute){var attribute=element.getAttribute(attribute);return attribute?attribute.toString().slice(23,-2):null;},_flag:function(element,attribute){return $(element).hasAttribute(attribute)?attribute:null;},style:function(element){return element.style.cssText.toLowerCase();},title:function(element){return element.title;}}}};Element._attributeTranslations.write={names:Object.clone(Element._attributeTranslations.read.names),values:{checked:function(element,value){element.checked=!!value;},style:function(element,value){element.style.cssText=value?value:'';}}};Element._attributeTranslations.has={};$w('colSpan rowSpan vAlign dateTime accessKey tabIndex '+'encType maxLength readOnly longDesc').each(function(attr){Element._attributeTranslations.write.names[attr.toLowerCase()]=attr;Element._attributeTranslations.has[attr.toLowerCase()]=attr;});(function(v){Object.extend(v,{href:v._getAttr,src:v._getAttr,type:v._getAttr,action:v._getAttrNode,disabled:v._flag,checked:v._flag,readonly:v._flag,multiple:v._flag,onload:v._getEv,onunload:v._getEv,onclick:v._getEv,ondblclick:v._getEv,onmousedown:v._getEv,onmouseup:v._getEv,onmouseover:v._getEv,onmousemove:v._getEv,onmouseout:v._getEv,onfocus:v._getEv,onblur:v._getEv,onkeypress:v._getEv,onkeydown:v._getEv,onkeyup:v._getEv,onsubmit:v._getEv,onreset:v._getEv,onselect:v._getEv,onchange:v._getEv});})(Element._attributeTranslations.read.values);}else if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(element,value){element=$(element);element.style.opacity=(value==1)?0.999999:(value==='')?'':(value<0.00001)?0:value;return element;};}else if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(element,value){element=$(element);element.style.opacity=(value==1||value==='')?'':(value<0.00001)?0:value;if(value==1)if(element.tagName=='IMG'&&element.width){element.width++;element.width--;}else try{var n=document.createTextNode(' ');element.appendChild(n);element.removeChild(n);}catch(e){}return element;};Element.Methods.cumulativeOffset=function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body)if(Element.getStyle(element,'position')=='absolute')break;element=element.offsetParent;}while(element);return Element._returnOffset(valueL,valueT);};}if(Prototype.Browser.IE||Prototype.Browser.Opera){Element.Methods.update=function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content))return element.update().insert(content);content=Object.toHTML(content);var tagName=element.tagName.toUpperCase();if(tagName in Element._insertionTranslations.tags){$A(element.childNodes).each(function(node){element.removeChild(node)});Element._getContentFromAnonymousElement(tagName,content.stripScripts()).each(function(node){element.appendChild(node)});}else element.innerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element;};}if(document.createElement('div').outerHTML){Element.Methods.replace=function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content)){element.parentNode.replaceChild(content,element);return element;}content=Object.toHTML(content);var parent=element.parentNode,tagName=parent.tagName.toUpperCase();if(Element._insertionTranslations.tags[tagName]){var nextSibling=element.next();var fragments=Element._getContentFromAnonymousElement(tagName,content.stripScripts());parent.removeChild(element);if(nextSibling)fragments.each(function(node){parent.insertBefore(node,nextSibling)});else fragments.each(function(node){parent.appendChild(node)});}else element.outerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element;};}Element._returnOffset=function(l,t){var result=[l,t];result.left=l;result.top=t;return result;};Element._getContentFromAnonymousElement=function(tagName,html){var div=new Element('div'),t=Element._insertionTranslations.tags[tagName];div.innerHTML=t[0]+html+t[1];t[2].times(function(){div=div.firstChild});return $A(div.childNodes);};Element._insertionTranslations={before:{adjacency:'beforeBegin',insert:function(element,node){element.parentNode.insertBefore(node,element);},initializeRange:function(element,range){range.setStartBefore(element);}},top:{adjacency:'afterBegin',insert:function(element,node){element.insertBefore(node,element.firstChild);},initializeRange:function(element,range){range.selectNodeContents(element);range.collapse(true);}},bottom:{adjacency:'beforeEnd',insert:function(element,node){element.appendChild(node);}},after:{adjacency:'afterEnd',insert:function(element,node){element.parentNode.insertBefore(node,element.nextSibling);},initializeRange:function(element,range){range.setStartAfter(element);}},tags:{TABLE:['<table>','</table>',1],TBODY:['<table><tbody>','</tbody></table>',2],TR:['<table><tbody><tr>','</tr></tbody></table>',3],TD:['<table><tbody><tr><td>','</td></tr></tbody></table>',4],SELECT:['<select>','</select>',1]}};(function(){this.bottom.initializeRange=this.top.initializeRange;Object.extend(this.tags,{THEAD:this.tags.TBODY,TFOOT:this.tags.TBODY,TH:this.tags.TD});}).call(Element._insertionTranslations);Element.Methods.Simulated={hasAttribute:function(element,attribute){attribute=Element._attributeTranslations.has[attribute]||attribute;var node=$(element).getAttributeNode(attribute);return node&&node.specified;}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);if(!Prototype.BrowserFeatures.ElementExtensions&&document.createElement('div').__proto__){window.HTMLElement={};window.HTMLElement.prototype=document.createElement('div').__proto__;Prototype.BrowserFeatures.ElementExtensions=true;}Element.extend=(function(){if(Prototype.BrowserFeatures.SpecificElementExtensions)return Prototype.K;var Methods={},ByTag=Element.Methods.ByTag;var extend=Object.extend(function(element){if(!element||element._extendedByPrototype||element.nodeType!=1||element==window)return element;var methods=Object.clone(Methods),tagName=element.tagName,property,value;if(ByTag[tagName])Object.extend(methods,ByTag[tagName]);for(property in methods){value=methods[property];if(Object.isFunction(value)&&!(property in element))element[property]=value.methodize();}element._extendedByPrototype=Prototype.emptyFunction;return element;},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(Methods,Element.Methods);Object.extend(Methods,Element.Methods.Simulated);}}});extend.refresh();return extend;})();Element.hasAttribute=function(element,attribute){if(element.hasAttribute)return element.hasAttribute(attribute);return Element.Methods.Simulated.hasAttribute(element,attribute);};Element.addMethods=function(methods){var F=Prototype.BrowserFeatures,T=Element.Methods.ByTag;if(!methods){Object.extend(Form,Form.Methods);Object.extend(Form.Element,Form.Element.Methods);Object.extend(Element.Methods.ByTag,{"FORM":Object.clone(Form.Methods),"INPUT":Object.clone(Form.Element.Methods),"SELECT":Object.clone(Form.Element.Methods),"TEXTAREA":Object.clone(Form.Element.Methods)});}if(arguments.length==2){var tagName=methods;methods=arguments[1];}if(!tagName)Object.extend(Element.Methods,methods||{});else{if(Object.isArray(tagName))tagName.each(extend);else extend(tagName);}function extend(tagName){tagName=tagName.toUpperCase();if(!Element.Methods.ByTag[tagName])Element.Methods.ByTag[tagName]={};Object.extend(Element.Methods.ByTag[tagName],methods);};function copy(methods,destination,onlyIfAbsent){onlyIfAbsent=onlyIfAbsent||false;for(var property in methods){var value=methods[property];if(!Object.isFunction(value))continue;if(!onlyIfAbsent||!(property in destination))destination[property]=value.methodize();}};function findDOMClass(tagName){var klass;var trans={"OPTGROUP":"OptGroup","TEXTAREA":"TextArea","P":"Paragraph","FIELDSET":"FieldSet","UL":"UList","OL":"OList","DL":"DList","DIR":"Directory","H1":"Heading","H2":"Heading","H3":"Heading","H4":"Heading","H5":"Heading","H6":"Heading","Q":"Quote","INS":"Mod","DEL":"Mod","A":"Anchor","IMG":"Image","CAPTION":"TableCaption","COL":"TableCol","COLGROUP":"TableCol","THEAD":"TableSection","TFOOT":"TableSection","TBODY":"TableSection","TR":"TableRow","TH":"TableCell","TD":"TableCell","FRAMESET":"FrameSet","IFRAME":"IFrame"};if(trans[tagName])klass='HTML'+trans[tagName]+'Element';if(window[klass])return window[klass];klass='HTML'+tagName+'Element';if(window[klass])return window[klass];klass='HTML'+tagName.capitalize()+'Element';if(window[klass])return window[klass];window[klass]={};window[klass].prototype=document.createElement(tagName).__proto__;return window[klass];};if(F.ElementExtensions){copy(Element.Methods,HTMLElement.prototype);copy(Element.Methods.Simulated,HTMLElement.prototype,true);}if(F.SpecificElementExtensions){for(var tag in Element.Methods.ByTag){var klass=findDOMClass(tag);if(Object.isUndefined(klass))continue;copy(T[tag],klass.prototype);}}Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh)Element.extend.refresh();Element.cache={};};document.viewport={getDimensions:function(){var dimensions={};$w('width height').each(function(d){var D=d.capitalize();dimensions[d]=self['inner'+D]||(document.documentElement['client'+D]||document.body['client'+D]);});return dimensions;},getWidth:function(){return this.getDimensions().width;},getHeight:function(){return this.getDimensions().height;},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop);}};var Selector=Class.create({initialize:function(expression){this.expression=expression.strip();this.compileMatcher();},compileMatcher:function(){if(Prototype.BrowserFeatures.XPath&&!(/(\[[\w-]*?:|:checked)/).test(this.expression))return this.compileXPathMatcher();var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m;if(Selector._cache[e]){this.matcher=Selector._cache[e];return;}this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in ps){p=ps[i];if(m=e.match(p)){this.matcher.push(Object.isFunction(c[i])?c[i](m):new Template(c[i]).evaluate(m));e=e.replace(m[0],'');break;}}}this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join('\n'));Selector._cache[this.expression]=this.matcher;},compileXPathMatcher:function(){var e=this.expression,ps=Selector.patterns,x=Selector.xpath,le,m;if(Selector._cache[e]){this.xpath=Selector._cache[e];return;}this.matcher=['.//*'];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in ps){if(m=e.match(ps[i])){this.matcher.push(Object.isFunction(x[i])?x[i](m):new Template(x[i]).evaluate(m));e=e.replace(m[0],'');break;}}}this.xpath=this.matcher.join('');Selector._cache[this.expression]=this.xpath;},findElements:function(root){root=root||document;if(this.xpath)return document._getElementsByXPath(this.xpath,root);return this.matcher(root);},match:function(element){this.tokens=[];var e=this.expression,ps=Selector.patterns,as=Selector.assertions;var le,p,m;while(e&&le!==e&&(/\S/).test(e)){le=e;for(var i in ps){p=ps[i];if(m=e.match(p)){if(as[i]){this.tokens.push([i,Object.clone(m)]);e=e.replace(m[0],'');}else{return this.findElements(document).include(element);}}}}var match=true,name,matches;for(var i=0,token;token=this.tokens[i];i++){name=token[0],matches=token[1];if(!Selector.assertions[name](element,matches)){match=false;break;}}return match;},toString:function(){return this.expression;},inspect:function(){return"#<Selector:"+this.expression.inspect()+">";}});Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:'/following-sibling::*',tagName:function(m){if(m[1]=='*')return'';return"[local-name()='"+m[1].toLowerCase()+"' or local-name()='"+m[1].toUpperCase()+"']";},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:"[@#{1}]",attr:function(m){m[3]=m[5]||m[6];return new Template(Selector.xpath.operators[m[2]]).evaluate(m);},pseudo:function(m){var h=Selector.xpath.pseudos[m[1]];if(!h)return'';if(Object.isFunction(h))return h(m);return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m);},operators:{'=':"[@#{1}='#{3}']",'!=':"[@#{1}!='#{3}']",'^=':"[starts-with(@#{1}, '#{3}')]",'$=':"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']",'*=':"[contains(@#{1}, '#{3}')]",'~=':"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",'|=':"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{'first-child':'[not(preceding-sibling::*)]','last-child':'[not(following-sibling::*)]','only-child':'[not(preceding-sibling::* or following-sibling::*)]','empty':"[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]",'checked':"[@checked]",'disabled':"[@disabled]",'enabled':"[not(@disabled)]",'not':function(m){var e=m[6],p=Selector.patterns,x=Selector.xpath,le,m,v;var exclusion=[];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in p){if(m=e.match(p[i])){v=Object.isFunction(x[i])?x[i](m):new Template(x[i]).evaluate(m);exclusion.push("("+v.substring(1,v.length-1)+")");e=e.replace(m[0],'');break;}}}return"[not("+exclusion.join(" and ")+")]";},'nth-child':function(m){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",m);},'nth-last-child':function(m){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",m);},'nth-of-type':function(m){return Selector.xpath.pseudos.nth("position() ",m);},'nth-last-of-type':function(m){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",m);},'first-of-type':function(m){m[6]="1";return Selector.xpath.pseudos['nth-of-type'](m);},'last-of-type':function(m){m[6]="1";return Selector.xpath.pseudos['nth-last-of-type'](m);},'only-of-type':function(m){var p=Selector.xpath.pseudos;return p['first-of-type'](m)+p['last-of-type'](m);},nth:function(fragment,m){var mm,formula=m[6],predicate;if(formula=='even')formula='2n+0';if(formula=='odd')formula='2n+1';if(mm=formula.match(/^(\d+)$/))return'['+fragment+"= "+mm[1]+']';if(mm=formula.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(mm[1]=="-")mm[1]=-1;var a=mm[1]?Number(mm[1]):1;var b=mm[2]?Number(mm[2]):0;predicate="[((#{fragment} - #{b}) mod #{a} = 0) and "+"((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(predicate).evaluate({fragment:fragment,a:a,b:b});}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);   c = false;',className:'n = h.className(n, r, "#{1}", c); c = false;',id:'n = h.id(n, r, "#{1}", c);        c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}"); c = false;',attr:function(m){m[3]=(m[5]||m[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}"); c = false;').evaluate(m);},pseudo:function(m){if(m[6])m[6]=m[6].replace(/"/g,'\\"');return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:{laterSibling:/^\s*~\s*/,child:/^\s*>\s*/,adjacent:/^\s*\+\s*/,descendant:/^\s/,tagName:/^\s*(\*|[\w\-]+)(\b|$)?/,id:/^#([\w\-\*]+)(\b|$)/,className:/^\.([\w\-\*]+)(\b|$)/,pseudo:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s)|(?=:))/,attrPresence:/^\[([\w]+)\]/,attr:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/},assertions:{tagName:function(element,matches){return matches[1].toUpperCase()==element.tagName.toUpperCase();},className:function(element,matches){return Element.hasClassName(element,matches[1]);},id:function(element,matches){return element.id===matches[1];},attrPresence:function(element,matches){return Element.hasAttribute(element,matches[1]);},attr:function(element,matches){var nodeValue=Element.readAttribute(element,matches[1]);return Selector.operators[matches[2]](nodeValue,matches[3]);}},handlers:{concat:function(a,b){for(var i=0,node;node=b[i];i++)a.push(node);return a;},mark:function(nodes){for(var i=0,node;node=nodes[i];i++)node._counted=true;return nodes;},unmark:function(nodes){for(var i=0,node;node=nodes[i];i++)node._counted=undefined;return nodes;},index:function(parentNode,reverse,ofType){parentNode._counted=true;if(reverse){for(var nodes=parentNode.childNodes,i=nodes.length-1,j=1;i>=0;i--){var node=nodes[i];if(node.nodeType==1&&(!ofType||node._counted))node.nodeIndex=j++;}}else{for(var i=0,j=1,nodes=parentNode.childNodes;node=nodes[i];i++)if(node.nodeType==1&&(!ofType||node._counted))node.nodeIndex=j++;}},unique:function(nodes){if(nodes.length==0)return nodes;var results=[],n;for(var i=0,l=nodes.length;i<l;i++)if(!(n=nodes[i])._counted){n._counted=true;results.push(Element.extend(n));}return Selector.handlers.unmark(results);},descendant:function(nodes){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++)h.concat(results,node.getElementsByTagName('*'));return results;},child:function(nodes){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++){for(var j=0,children=[],child;child=node.childNodes[j];j++)if(child.nodeType==1&&child.tagName!='!')results.push(child);}return results;},adjacent:function(nodes){for(var i=0,results=[],node;node=nodes[i];i++){var next=this.nextElementSibling(node);if(next)results.push(next);}return results;},laterSibling:function(nodes){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++)h.concat(results,Element.nextSiblings(node));return results;},nextElementSibling:function(node){while(node=node.nextSibling)if(node.nodeType==1)return node;return null;},previousElementSibling:function(node){while(node=node.previousSibling)if(node.nodeType==1)return node;return null;},tagName:function(nodes,root,tagName,combinator){tagName=tagName.toUpperCase();var results=[],h=Selector.handlers;if(nodes){if(combinator){if(combinator=="descendant"){for(var i=0,node;node=nodes[i];i++)h.concat(results,node.getElementsByTagName(tagName));return results;}else nodes=this[combinator](nodes);if(tagName=="*")return nodes;}for(var i=0,node;node=nodes[i];i++)if(node.tagName.toUpperCase()==tagName)results.push(node);return results;}else return root.getElementsByTagName(tagName);},id:function(nodes,root,id,combinator){var targetNode=$(id),h=Selector.handlers;if(!targetNode)return[];if(!nodes&&root==document)return[targetNode];if(nodes){if(combinator){if(combinator=='child'){for(var i=0,node;node=nodes[i];i++)if(targetNode.parentNode==node)return[targetNode];}else if(combinator=='descendant'){for(var i=0,node;node=nodes[i];i++)if(Element.descendantOf(targetNode,node))return[targetNode];}else if(combinator=='adjacent'){for(var i=0,node;node=nodes[i];i++)if(Selector.handlers.previousElementSibling(targetNode)==node)return[targetNode];}else nodes=h[combinator](nodes);}for(var i=0,node;node=nodes[i];i++)if(node==targetNode)return[targetNode];return[];}return(targetNode&&Element.descendantOf(targetNode,root))?[targetNode]:[];},className:function(nodes,root,className,combinator){if(nodes&&combinator)nodes=this[combinator](nodes);return Selector.handlers.byClassName(nodes,root,className);},byClassName:function(nodes,root,className){if(!nodes)nodes=Selector.handlers.descendant([root]);var needle=' '+className+' ';for(var i=0,results=[],node,nodeClassName;node=nodes[i];i++){nodeClassName=node.className;if(nodeClassName.length==0)continue;if(nodeClassName==className||(' '+nodeClassName+' ').include(needle))results.push(node);}return results;},attrPresence:function(nodes,root,attr){if(!nodes)nodes=root.getElementsByTagName("*");var results=[];for(var i=0,node;node=nodes[i];i++)if(Element.hasAttribute(node,attr))results.push(node);return results;},attr:function(nodes,root,attr,value,operator){if(!nodes)nodes=root.getElementsByTagName("*");var handler=Selector.operators[operator],results=[];for(var i=0,node;node=nodes[i];i++){var nodeValue=Element.readAttribute(node,attr);if(nodeValue===null)continue;if(handler(nodeValue,value))results.push(node);}return results;},pseudo:function(nodes,name,value,root,combinator){if(nodes&&combinator)nodes=this[combinator](nodes);if(!nodes)nodes=root.getElementsByTagName("*");return Selector.pseudos[name](nodes,value,root);}},pseudos:{'first-child':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++){if(Selector.handlers.previousElementSibling(node))continue;results.push(node);}return results;},'last-child':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++){if(Selector.handlers.nextElementSibling(node))continue;results.push(node);}return results;},'only-child':function(nodes,value,root){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++)if(!h.previousElementSibling(node)&&!h.nextElementSibling(node))results.push(node);return results;},'nth-child':function(nodes,formula,root){return Selector.pseudos.nth(nodes,formula,root);},'nth-last-child':function(nodes,formula,root){return Selector.pseudos.nth(nodes,formula,root,true);},'nth-of-type':function(nodes,formula,root){return Selector.pseudos.nth(nodes,formula,root,false,true);},'nth-last-of-type':function(nodes,formula,root){return Selector.pseudos.nth(nodes,formula,root,true,true);},'first-of-type':function(nodes,formula,root){return Selector.pseudos.nth(nodes,"1",root,false,true);},'last-of-type':function(nodes,formula,root){return Selector.pseudos.nth(nodes,"1",root,true,true);},'only-of-type':function(nodes,formula,root){var p=Selector.pseudos;return p['last-of-type'](p['first-of-type'](nodes,formula,root),formula,root);},getIndices:function(a,b,total){if(a==0)return b>0?[b]:[];return $R(1,total).inject([],function(memo,i){if(0==(i-b)%a&&(i-b)/a>=0)memo.push(i);return memo;});},nth:function(nodes,formula,root,reverse,ofType){if(nodes.length==0)return[];if(formula=='even')formula='2n+0';if(formula=='odd')formula='2n+1';var h=Selector.handlers,results=[],indexed=[],m;h.mark(nodes);for(var i=0,node;node=nodes[i];i++){if(!node.parentNode._counted){h.index(node.parentNode,reverse,ofType);indexed.push(node.parentNode);}}if(formula.match(/^\d+$/)){formula=Number(formula);for(var i=0,node;node=nodes[i];i++)if(node.nodeIndex==formula)results.push(node);}else if(m=formula.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(m[1]=="-")m[1]=-1;var a=m[1]?Number(m[1]):1;var b=m[2]?Number(m[2]):0;var indices=Selector.pseudos.getIndices(a,b,nodes.length);for(var i=0,node,l=indices.length;node=nodes[i];i++){for(var j=0;j<l;j++)if(node.nodeIndex==indices[j])results.push(node);}}h.unmark(nodes);h.unmark(indexed);return results;},'empty':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++){if(node.tagName=='!'||(node.firstChild&&!node.innerHTML.match(/^\s*$/)))continue;results.push(node);}return results;},'not':function(nodes,selector,root){var h=Selector.handlers,selectorType,m;var exclusions=new Selector(selector).findElements(root);h.mark(exclusions);for(var i=0,results=[],node;node=nodes[i];i++)if(!node._counted)results.push(node);h.unmark(exclusions);return results;},'enabled':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++)if(!node.disabled)results.push(node);return results;},'disabled':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++)if(node.disabled)results.push(node);return results;},'checked':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++)if(node.checked)results.push(node);return results;}},operators:{'=':function(nv,v){return nv==v;},'!=':function(nv,v){return nv!=v;},'^=':function(nv,v){return nv.startsWith(v);},'$=':function(nv,v){return nv.endsWith(v);},'*=':function(nv,v){return nv.include(v);},'~=':function(nv,v){return(' '+nv+' ').include(' '+v+' ');},'|=':function(nv,v){return('-'+nv.toUpperCase()+'-').include('-'+v.toUpperCase()+'-');}},matchElements:function(elements,expression){var matches=new Selector(expression).findElements(),h=Selector.handlers;h.mark(matches);for(var i=0,results=[],element;element=elements[i];i++)if(element._counted)results.push(element);h.unmark(matches);return results;},findElement:function(elements,expression,index){if(Object.isNumber(expression)){index=expression;expression=false;}return Selector.matchElements(elements,expression||'*')[index||0];},findChildElements:function(element,expressions){var exprs=expressions.join(','),expressions=[];exprs.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(m){expressions.push(m[1].strip());});var results=[],h=Selector.handlers;for(var i=0,l=expressions.length,selector;i<l;i++){selector=new Selector(expressions[i].strip());h.concat(results,selector.findElements(element));}return(l>1)?h.unique(results):results;}});function $$(){return Selector.findChildElements(document,$A(arguments));}var Form={reset:function(form){$(form).reset();return form;},serializeElements:function(elements,options){if(typeof options!='object')options={hash:!!options};else if(options.hash===undefined)options.hash=true;var key,value,submitted=false,submit=options.submit;var data=elements.inject({},function(result,element){if(!element.disabled&&element.name){key=element.name;value=$(element).getValue();if(value!=null&&(element.type!='submit'||(!submitted&&submit!==false&&(!submit||key==submit)&&(submitted=true)))){if(key in result){if(!Object.isArray(result[key]))result[key]=[result[key]];result[key].push(value);}else result[key]=value;}}return result;});return options.hash?data:Object.toQueryString(data);}};Form.Methods={serialize:function(form,options){return Form.serializeElements(Form.getElements(form),options);},getElements:function(form){return $A($(form).getElementsByTagName('*')).inject([],function(elements,child){if(Form.Element.Serializers[child.tagName.toLowerCase()])elements.push(Element.extend(child));return elements;});},getInputs:function(form,typeName,name){form=$(form);var inputs=form.getElementsByTagName('input');if(!typeName&&!name)return $A(inputs).map(Element.extend);for(var i=0,matchingInputs=[],length=inputs.length;i<length;i++){var input=inputs[i];if((typeName&&input.type!=typeName)||(name&&input.name!=name))continue;matchingInputs.push(Element.extend(input));}return matchingInputs;},disable:function(form){form=$(form);Form.getElements(form).invoke('disable');return form;},enable:function(form){form=$(form);Form.getElements(form).invoke('enable');return form;},findFirstElement:function(form){var elements=$(form).getElements().findAll(function(element){return'hidden'!=element.type&&!element.disabled;});var firstByIndex=elements.findAll(function(element){return element.hasAttribute('tabIndex')&&element.tabIndex>=0;}).sortBy(function(element){return element.tabIndex}).first();return firstByIndex?firstByIndex:elements.find(function(element){return['input','select','textarea'].include(element.tagName.toLowerCase());});},focusFirstElement:function(form){form=$(form);form.findFirstElement().activate();return form;},request:function(form,options){form=$(form),options=Object.clone(options||{});var params=options.parameters,action=form.readAttribute('action')||'';if(action.blank())action=window.location.href;options.parameters=form.serialize(true);if(params){if(Object.isString(params))params=params.toQueryParams();Object.extend(options.parameters,params);}if(form.hasAttribute('method')&&!options.method)options.method=form.method;return new Ajax.Request(action,options);}};Form.Element={focus:function(element){$(element).focus();return element;},select:function(element){$(element).select();return element;}};Form.Element.Methods={serialize:function(element){element=$(element);if(!element.disabled&&element.name){var value=element.getValue();if(value!=undefined){var pair={};pair[element.name]=value;return Object.toQueryString(pair);}}return'';},getValue:function(element){element=$(element);var method=element.tagName.toLowerCase();return Form.Element.Serializers[method](element);},setValue:function(element,value){element=$(element);var method=element.tagName.toLowerCase();Form.Element.Serializers[method](element,value);return element;},clear:function(element){$(element).value='';return element;},present:function(element){return $(element).value!='';},activate:function(element){element=$(element);try{element.focus();if(element.select&&(element.tagName.toLowerCase()!='input'||!['button','reset','submit'].include(element.type)))element.select();}catch(e){}return element;},disable:function(element){element=$(element);element.blur();element.disabled=true;return element;},enable:function(element){element=$(element);element.disabled=false;return element;}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(element,value){switch(element.type.toLowerCase()){case'checkbox':case'radio':return Form.Element.Serializers.inputSelector(element,value);default:return Form.Element.Serializers.textarea(element,value);}},inputSelector:function(element,value){if(value===undefined)return element.checked?element.value:null;else element.checked=!!value;},textarea:function(element,value){if(value===undefined)return element.value;else element.value=value;},select:function(element,index){if(index===undefined)return this[element.type=='select-one'?'selectOne':'selectMany'](element);else{var opt,value,single=!Object.isArray(index);for(var i=0,length=element.length;i<length;i++){opt=element.options[i];value=this.optionValue(opt);if(single){if(value==index){opt.selected=true;return;}}else opt.selected=index.include(value);}}},selectOne:function(element){var index=element.selectedIndex;return index>=0?this.optionValue(element.options[index]):null;},selectMany:function(element){var values,length=element.length;if(!length)return null;for(var i=0,values=[];i<length;i++){var opt=element.options[i];if(opt.selected)values.push(this.optionValue(opt));}return values;},optionValue:function(opt){return Element.extend(opt).hasAttribute('value')?opt.value:opt.text;}};Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,element,frequency,callback){$super(callback,frequency);this.element=$(element);this.lastValue=this.getValue();},execute:function(){var value=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(value)?this.lastValue!=value:String(this.lastValue)!=String(value)){this.callback(this.element,value);this.lastValue=value;}}});Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element);}});Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element);}});Abstract.EventObserver=Class.create({initialize:function(element,callback){this.element=$(element);this.callback=callback;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=='form')this.registerFormCallbacks();else this.registerCallback(this.element);},onElementEvent:function(){var value=this.getValue();if(this.lastValue!=value){this.callback(this.element,value);this.lastValue=value;}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this);},registerCallback:function(element){if(element.type){switch(element.type.toLowerCase()){case'checkbox':case'radio':Event.observe(element,'click',this.onElementEvent.bind(this));break;default:Event.observe(element,'change',this.onElementEvent.bind(this));break;}}}});Form.Element.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element);}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element);}});if(!window.Event)var Event={};Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,cache:{},relatedTarget:function(event){var element;switch(event.type){case'mouseover':element=event.fromElement;break;case'mouseout':element=event.toElement;break;default:return null;}return Element.extend(element);}});Event.Methods=(function(){var isButton;if(Prototype.Browser.IE){var buttonMap={0:1,1:4,2:2};isButton=function(event,code){return event.button==buttonMap[code];};}else if(Prototype.Browser.WebKit){isButton=function(event,code){switch(code){case 0:return event.which==1&&!event.metaKey;case 1:return event.which==1&&event.metaKey;default:return false;}};}else{isButton=function(event,code){return event.which?(event.which===code+1):(event.button===code);};}return{isLeftClick:function(event){return isButton(event,0)},isMiddleClick:function(event){return isButton(event,1)},isRightClick:function(event){return isButton(event,2)},element:function(event){var node=Event.extend(event).target;return Element.extend(node.nodeType==Node.TEXT_NODE?node.parentNode:node);},findElement:function(event,expression){var element=Event.element(event);return element.match(expression)?element:element.up(expression);},pointer:function(event){return{x:event.pageX||(event.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)),y:event.pageY||(event.clientY+(document.documentElement.scrollTop||document.body.scrollTop))};},pointerX:function(event){return Event.pointer(event).x},pointerY:function(event){return Event.pointer(event).y},stop:function(event){Event.extend(event);event.preventDefault();event.stopPropagation();event.stopped=true;}};})();Event.extend=(function(){var methods=Object.keys(Event.Methods).inject({},function(m,name){m[name]=Event.Methods[name].methodize();return m;});if(Prototype.Browser.IE){Object.extend(methods,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});return function(event){if(!event)return false;if(event._extendedByPrototype)return event;event._extendedByPrototype=Prototype.emptyFunction;var pointer=Event.pointer(event);Object.extend(event,{target:event.srcElement,relatedTarget:Event.relatedTarget(event),pageX:pointer.x,pageY:pointer.y});return Object.extend(event,methods);};}else{Event.prototype=Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(Event.prototype,methods);return Prototype.K;}})();Object.extend(Event,(function(){var cache=Event.cache;function getEventID(element){if(element._eventID)return element._eventID;arguments.callee.id=arguments.callee.id||1;return element._eventID=++arguments.callee.id;};function getDOMEventName(eventName){if(eventName&&eventName.include(':'))return"dataavailable";return eventName;};function getCacheForID(id){return cache[id]=cache[id]||{};};function getWrappersForEventName(id,eventName){var c=getCacheForID(id);return c[eventName]=c[eventName]||[];};function createWrapper(element,eventName,handler){var id=getEventID(element);var c=getWrappersForEventName(id,eventName);if(c.pluck("handler").include(handler))return false;var wrapper=function(event){if(!Event||!Event.extend||(event.eventName&&event.eventName!=eventName))return false;Event.extend(event);handler.call(element,event)};wrapper.handler=handler;c.push(wrapper);return wrapper;};function findWrapper(id,eventName,handler){var c=getWrappersForEventName(id,eventName);return c.find(function(wrapper){return wrapper.handler==handler});};function destroyWrapper(id,eventName,handler){var c=getCacheForID(id);if(!c[eventName])return false;c[eventName]=c[eventName].without(findWrapper(id,eventName,handler));};function destroyCache(){for(var id in cache)for(var eventName in cache[id])cache[id][eventName]=null;};if(window.attachEvent){window.attachEvent("onunload",destroyCache);}return{observe:function(element,eventName,handler){element=$(element);var name=getDOMEventName(eventName);var wrapper=createWrapper(element,eventName,handler);if(!wrapper)return element;if(element.addEventListener){element.addEventListener(name,wrapper,false);}else{element.attachEvent("on"+name,wrapper);}return element;},stopObserving:function(element,eventName,handler){element=$(element);var id=getEventID(element),name=getDOMEventName(eventName);if(!handler&&eventName){getWrappersForEventName(id,eventName).each(function(wrapper){element.stopObserving(eventName,wrapper.handler);});return element;}else if(!eventName){Object.keys(getCacheForID(id)).each(function(eventName){element.stopObserving(eventName);});return element;}var wrapper=findWrapper(id,eventName,handler);if(!wrapper)return element;if(element.removeEventListener){element.removeEventListener(name,wrapper,false);}else{element.detachEvent("on"+name,wrapper);}destroyWrapper(id,eventName,handler);return element;},fire:function(element,eventName,memo){element=$(element);if(element==document&&document.createEvent&&!element.dispatchEvent)element=document.documentElement;if(document.createEvent){var event=document.createEvent("HTMLEvents");event.initEvent("dataavailable",true,true);}else{var event=document.createEventObject();event.eventType="ondataavailable";}event.eventName=eventName;event.memo=memo||{};if(document.createEvent){element.dispatchEvent(event);}else{element.fireEvent(event.eventType,event);}return event;}};})());Object.extend(Event,Event.Methods);Element.addMethods({fire:Event.fire,observe:Event.observe,stopObserving:Event.stopObserving});Object.extend(document,{fire:Element.Methods.fire.methodize(),observe:Element.Methods.observe.methodize(),stopObserving:Element.Methods.stopObserving.methodize()});(function(){var timer,fired=false;function fireContentLoadedEvent(){if(fired)return;if(timer)window.clearInterval(timer);document.fire("dom:loaded");fired=true;};if(document.addEventListener){if(Prototype.Browser.WebKit){timer=window.setInterval(function(){if(/loaded|complete/.test(document.readyState))fireContentLoadedEvent();},0);Event.observe(window,"load",fireContentLoadedEvent);}else{document.addEventListener("DOMContentLoaded",fireContentLoadedEvent,false);}}else{document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");$("__onDOMContentLoaded").onreadystatechange=function(){if(this.readyState=="complete"){this.onreadystatechange=null;fireContentLoadedEvent();}};}})();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(element,content){return Element.insert(element,{before:content});},Top:function(element,content){return Element.insert(element,{top:content});},Bottom:function(element,content){return Element.insert(element,{bottom:content});},After:function(element,content){return Element.insert(element,{after:content});}};var $continue=new Error('"throw $continue" is deprecated, use "return" instead');var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;},within:function(element,x,y){if(this.includeScrollOffsets)return this.withinIncludingScrolloffsets(element,x,y);this.xcomp=x;this.ycomp=y;this.offset=Element.cumulativeOffset(element);return(y>=this.offset[1]&&y<this.offset[1]+element.offsetHeight&&x>=this.offset[0]&&x<this.offset[0]+element.offsetWidth);},withinIncludingScrolloffsets:function(element,x,y){var offsetcache=Element.cumulativeScrollOffset(element);this.xcomp=x+offsetcache[0]-this.deltaX;this.ycomp=y+offsetcache[1]-this.deltaY;this.offset=Element.cumulativeOffset(element);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+element.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+element.offsetWidth);},overlap:function(mode,element){if(!mode)return 0;if(mode=='vertical')return((this.offset[1]+element.offsetHeight)-this.ycomp)/element.offsetHeight;if(mode=='horizontal')return((this.offset[0]+element.offsetWidth)-this.xcomp)/element.offsetWidth;},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(element){Position.prepare();return Element.absolutize(element);},relativize:function(element){Position.prepare();return Element.relativize(element);},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(source,target,options){options=options||{};return Element.clonePosition(target,source,options);}};if(!document.getElementsByClassName)document.getElementsByClassName=function(instanceMethods){function iter(name){return name.blank()?null:"[contains(concat(' ', @class, ' '), ' "+name+" ')]";};instanceMethods.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(element,className){className=className.toString().strip();var cond=/\s/.test(className)?$w(className).map(iter).join(''):iter(className);return cond?document._getElementsByXPath('.//*'+cond,element):[];}:function(element,className){className=className.toString().strip();var elements=[],classNames=(/\s/.test(className)?$w(className):null);if(!classNames&&!className)return elements;var nodes=$(element).getElementsByTagName('*');className=' '+className+' ';for(var i=0,child,cn;child=nodes[i];i++){if(child.className&&(cn=' '+child.className+' ')&&(cn.include(className)||(classNames&&classNames.all(function(name){return!name.toString().blank()&&cn.include(' '+name+' ');}))))elements.push(Element.extend(child));}return elements;};return function(className,parentElement){return $(parentElement||document.body).getElementsByClassName(className);};}(Element.Methods);Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(element){this.element=$(element);},_each:function(iterator){this.element.className.split(/\s+/).select(function(name){return name.length>0;})._each(iterator);},set:function(className){this.element.className=className;},add:function(classNameToAdd){if(this.include(classNameToAdd))return;this.set($A(this).concat(classNameToAdd).join(' '));},remove:function(classNameToRemove){if(!this.include(classNameToRemove))return;this.set($A(this).without(classNameToRemove).join(' '));},toString:function(){return $A(this).join(' ');}};Object.extend(Element.ClassNames.prototype,Enumerable);Element.addMethods();function AJAXMAP(k,df,dS,by){this.k=k;this.bP=$(k);this.aR=null;this.ec=[];this.al=256;this.P=0;this.H=0;this.aJ=265960;this.aK=6647720;this.K=265960;this.L=6647720;this.l={'bottom':0,'left':0,'top':0,'right':0};this.bX=0;this.bY=0;this.cQ=dS;this.m=4;this.df=df;this.aL=1;this.aN=4;this.aW=1;this.aG=0;this.as=null;this.co=false;this.n={'x':0,'y':0};this.f={'x':0,'y':0};this.U=null;this.bw=null;this.cH=0;this.V=null;this.M=0;this.aA={'x':0,'y':0};this.dC=32633;this.az='EPSG:32633';this.aQ=false;this.aI=null;this.bM=null;this.Q=null;this.A=null;this.aZ=false;this.o=[];this.ay=null;this.by=by?by:'test';this.aD={};this.aD['blank']=new Image();this.aD['loading']=this.aD['blank'];this.aY=[];this.aq=[];this.ai=[];this.ci=null;this.eo=null;this.trackCoords=null;this.aT=true;this.aU=false;this.dj=0;this.dk=0;this.af=true;this.O=null;this.eq={'x':0,'y':0};this.cu=true;this.bS=false;this.G=[];this.zoomCounter=0;this.zoomTimerId=null;this.cF='default';this.cJ=false;};AJAXMAP.ZOOMLEVELS=[56,128,256,512,1024,2048,5120,10240,20480,40960,81920,131072,262144,524288,1000000];AJAXMAP.prototype={init:function(I,ck,dw){if(I)I=this.Z(I);if(ck){this.m=ck;}if(dw){this.aG=dw;}this.M=AJAXMAP.ZOOMLEVELS[this.m]/256;if(I){var cM=new Coordinate(I.x,I.y,I.srs);var am=this.am(I);this.aJ=am.x;this.aK=am.y;this.K=am.x;this.L=am.y;}this.cU();tileLayer=new Layer({'type':'webatlastile','visible':true,'name':'Tile Webatlas'});this.addLayer(tileLayer);Event.observe(this.k+'mouselayer','mousemove',this.cx.bindAsEventListener(this));Event.observe(this.k+'mouselayer','click',this.aS.bindAsEventListener(this));Event.observe(this.k+'mouselayer','mousedown',this.bb.bindAsEventListener(this));Event.observe(this.k+'mouselayer','mouseup',this.bu.bindAsEventListener(this));Event.observe(this.k+'mouselayer','mouseout',this.bk.bindAsEventListener(this));Event.observe(this.k+'mouselayer','mouseover',this.bt.bindAsEventListener(this));Event.observe(this.k+'mouselayer','dblclick',this.bO.bindAsEventListener(this));Event.observe(this.k+'mouselayer','contextmenu',this.cq.bindAsEventListener(this));if(this.cQ){Event.observe(window,'resize',this.resizeEventHandler.bindAsEventListener(this));}Event.observe($(this.k),"mousewheel",this.ds.bindAsEventListener(this));Event.observe($(this.k),"DOMMouseScroll",this.ds.bindAsEventListener(this));if(this.P==0&&this.H==0){this.P=this.bP.offsetWidth;this.H=this.bP.offsetHeight;}if(this.P==0&&this.H==0){this.cl();}if(this.cQ){this.dh(false);}else{this.ae(false);}if(I)this.bv(cM,false);this.cJ=true;},bb:function(T){this.n=this.bx(T);this.bw=new Coordinate(this.l.left+(this.M*this.n.x),this.l.top-(this.M*this.n.y),this.az);this.co=true;if(this.cv(T)=="MIDDLE"&&!this.aU){this.ci.style.zIndex='2';this.aZ=true;this.Q.style.display='block';this.Q.style.top=this.f.y+"px";this.Q.style.left=this.f.x+"px";this.Q.style.width="0px";this.Q.style.height="0px";}if(this.cF=='DrawBoundingBox'){this.ci.style.zIndex='2';this.Q.style.display='block';this.Q.style.top=this.f.y+"px";this.Q.style.left=this.f.x+"px";this.Q.style.width="0px";this.Q.style.height="0px";}$(this.k).fire("map:grabbed");T.stop();},aS:function(T){$(this.k).fire("map:mouseClicked",{'mouseMapCoords':this.U,'mouseCoords':this.f});},cq:function(T){},bO:function(T){if(this.af)if(!this.aU)this.zoomIn(new Coordinate(this.U.x,this.U.y));},bu:function(T){this.release(this.aA);this.Q.style.display='none';this.V=new Coordinate(this.l.left+(this.M*(this.P/2)),this.l.top-(this.M*(this.H/2)),this.az);if(this.aZ&&this.A!=null){this.zoomOnBoundingBox(this.A);this.A=null;this.aZ=false;}if(this.cF=='DrawBoundingBox'&&this.A!=null){var en={'bottom':this.A.y1,'left':this.A.x1,'top':this.A.y2,'right':this.A.x2};$(this.k).fire("map:boundingboxSelected",{'boundingbox':en});this.A=null;}$(this.k).fire("map:mouseUp",{'button':this.cv(T)});},bk:function(T){this.release(this.aA);$(this.k).fire("map:mouseOut");},bt:function(T){$(this.k).fire("map:mouseOver");},cx:function(T){this.f=this.bx(T);if(this.af){if(this.co){this.cH++;if(this.cH%3==0){if(this.aZ){this.A={'x1':0,'y1':0,'x2':0,'y2':0};if(this.f.y<this.n.y){this.Q.style.top=this.f.y+"px";this.Q.style.height=this.n.y-this.f.y+"px";this.A.y1=-(this.n.y*this.M-this.L);this.A.y2=-(this.f.y*this.M-this.L);}else{this.Q.style.top=this.n.y+"px";this.Q.style.height=this.f.y-this.n.y+"px";this.A.y1=-(this.f.y*this.M-this.L);this.A.y2=-(this.n.y*this.M-this.L);}if(this.f.x<this.n.x){this.Q.style.left=this.f.x+"px";this.Q.style.width=this.n.x-this.f.x+"px";this.A.x1=this.f.x*this.M+this.K;this.A.x2=this.n.x*this.M+this.K;}else{this.Q.style.left=this.n.x+"px";this.Q.style.width=this.f.x-this.n.x+"px";this.A.x2=this.f.x*this.M+this.K;this.A.x1=this.n.x*this.M+this.K;}}else{this.aA={'x':this.f.x-this.n.x,'y':this.f.y-this.n.y};this.aE(this.aA,true);$(this.k).fire("map:dragging",{'offsetCoords':this.aA});if(!this.bS){$(this.k).fire("map:dragBegin",{'mouseMapCoords':this.U,'mouseCoords':this.f,'boundingBox':this.l});this.bS=true;}}}}else{this.U=new Coordinate(this.f.x*this.M+this.K,-(this.f.y*this.M-this.L),this.az);}}if(this.cF=='DrawBoundingBox'){this.A={'x1':0,'y1':0,'x2':0,'y2':0};if(this.f.y<this.n.y){this.Q.style.top=this.f.y+"px";this.Q.style.height=this.n.y-this.f.y+"px";this.A.y1=-(this.n.y*this.M-this.L);this.A.y2=-(this.f.y*this.M-this.L);}else{this.Q.style.top=this.n.y+"px";this.Q.style.height=this.f.y-this.n.y+"px";this.A.y1=-(this.f.y*this.M-this.L);this.A.y2=-(this.n.y*this.M-this.L);}if(this.f.x<this.n.x){this.Q.style.left=this.f.x+"px";this.Q.style.width=this.n.x-this.f.x+"px";this.A.x1=this.f.x*this.M+this.K;this.A.x2=this.n.x*this.M+this.K;}else{this.Q.style.left=this.n.x+"px";this.Q.style.width=this.f.x-this.n.x+"px";this.A.x2=this.f.x*this.M+this.K;this.A.x1=this.n.x*this.M+this.K;}}$(this.k).fire("map:mouseMoved",{'mouseMapCoords':this.U,'mouseCoords':this.f});this.U=new Coordinate(this.f.x*this.M+this.K,-(this.f.y*this.M-this.L),this.az);return false;},setState:function(cL){this.cF=cL;if(cL=='DrawBoundingBox'){this.disallowMouseNavigation();}else{this.allowMouseNavigation();}},move:function(aA,cn){this.aA=aA;this.aE(this.aA,true);this.release(aA,cn);this.V=new Coordinate(this.l.left+(this.M*(this.P/2)),this.l.top-(this.M*(this.H/2)),this.az);},resizeEventHandler:function(e){this.resize();},resize:function(H,P){this.aX();var user=false;if(H!=null){var D=P;var C=H;user=true;}else{var D=0;var C=0;if(window.innerWidth){D=window.innerWidth;C=window.innerHeight;}else{D=document.compatMode=='CSS1Compat'?document.documentElement.clientWidth:document.body.clientWidth;C=document.compatMode=='CSS1Compat'?document.documentElement.clientHeight:document.body.clientHeight;}if(D%2){D--;}if(C%2){C--;}}this.P=D;this.H=C;if(user){$(this.k).style.width=D+"px";$(this.k).style.height=C+"px";if(this.O!=null){this.O.element.width=D;this.O.element.height=C;}}else{aj=this.ba($(this.k));ah=this.aV($(this.k));$(this.k).style.width=D-ah+"px";$(this.k).style.height=C-aj+"px";if(this.O!=null){this.O.element.width=D-ah;this.O.element.height=C-aj;}}if(H==null){this.P=D-ah;this.H=C-aj;}this.ae(true);this.updateBB();$(this.k).fire("map:resized");},cl:function(){var D=0;var C=0;if(window.innerWidth){D=window.innerWidth;C=window.innerHeight;}else{D=document.compatMode=='CSS1Compat'?document.documentElement.clientWidth:document.body.clientWidth;C=document.compatMode=='CSS1Compat'?document.documentElement.clientHeight:document.body.clientHeight;}if(D%2){D--;}if(C%2){C--;}aj=this.ba($(this.k));ah=this.aV($(this.k));this.P=D-ah;this.H=C-aj;},dh:function(load,H,P){this.aX();var user=false;if(H!=null){var D=P;var C=H;user=true;}else{var D=0;var C=0;if(window.innerWidth){D=window.innerWidth;C=window.innerHeight;}else{D=document.compatMode=='CSS1Compat'?document.documentElement.clientWidth:document.body.clientWidth;C=document.compatMode=='CSS1Compat'?document.documentElement.clientHeight:document.body.clientHeight;}if(D%2){D--;}if(C%2){C--;}}this.P=D;this.H=C;aj=this.ba($(this.k));ah=this.aV($(this.k));if(user){$(this.k).style.width=D+"px";$(this.k).style.height=C+"px";if(this.O!=null){this.O.element.width=D-ah;this.O.element.height=C-aj;}}else{$(this.k).style.width=D-ah+"px";$(this.k).style.height=C-aj+"px";if(this.O!=null){this.O.element.width=D-ah;this.O.element.height=C-aj;}}if(H==null){this.P=D-ah;this.H=C-aj;}this.ae(false);$(this.k).fire("map:resized");},cz:function(){for(var i=0;i<this.G.length;i++){if(this.G[i].type!='wmsoverlay'){for(var c=0;c<this.G[i].tiles.length;c++){for(var r=0;r<this.G[i].tiles[c].length;r++){var F=this.G[i].tiles[c][r];this.bL(F);}}}}},bx:function(T){return{'x':Event.pointerX(T)-this.aV($(this.k)),'y':Event.pointerY(T)-this.ba($(this.k))};},ae:function(cW){if(this.H==0)this.H=200;if(this.P==0)this.P=200;var rows=Math.ceil(this.H/this.al)+1;var cols=Math.ceil(this.P/this.al)+1;this.ek=rows;this.ej=cols;for(var i=0;i<this.G.length;i++){this.G[i].tiles=[];if(this.G[i].visible==true){for(var c=0;c<cols;c++){var cT=[];for(var r=0;r<rows;r++){this.aW=this.aW==this.aN?this.aW=this.aL:this.aW+1;var F={'element':null,'posx':256*c,'posy':256*r,'xIndex':c,'yIndex':r,'host':this.aW,'layer':this.G[i]};cT.push(F);}this.G[i].tiles.push(cT);}}}this.aE({'x':0,'y':0},cW);},aE:function(ab,cW){if(!ab){ab={'x':0,'y':0};}this.aI.style.top=ab.y+"px";this.aI.style.left=ab.x+"px";for(i=0;i<this.aY.length;i++){var overlay=this.aY[i];}for(i=0;i<this.aq.length;i++){var overlay=this.aq[i];overlay.style.left=ab.x+'px';overlay.style.top=ab.y+'px';}this.ay.style.top=this.dj+ab.y+'px';this.ay.style.left=this.dk+ab.x+'px';for(i=0;i<this.o.length;i++){var d=this.o[i];d.element.style.left=d.x+ab.x+'px';d.element.style.top=d.y+ab.y+'px';}for(var i=0;i<this.G.length;i++){if(this.G[i].type!='wmsoverlay'){for(var c=0;c<this.G[i].tiles.length;c++){for(var r=0;r<this.G[i].tiles[c].length;r++){var F=this.G[i].tiles[c][r];F.posx=(F.xIndex*this.al)+this.bX+ab.x;F.posy=(F.yIndex*this.al)+this.bY+ab.y;var bE=true;if(F.posx>this.P){do{F.xIndex-=this.G[i].tiles.length;F.posx=(F.xIndex*this.al)+this.bX+ab.x;}while(F.posx>this.P);if(F.posx+this.al<0){bE=false;}}else{while(F.posx<-this.al){F.xIndex+=this.G[i].tiles.length;F.posx=(F.xIndex*this.al)+this.bX+ab.x;}if(F.posx>this.P){bE=false;}}if(F.posy>this.H){do{F.yIndex-=this.G[i].tiles[c].length;F.posy=(F.yIndex*this.al)+this.bY+ab.y;}while(F.posy>this.H);if(F.posy+this.al<0){bE=false;}}else{while(F.posy<-this.al){F.yIndex+=this.G[i].tiles[c].length;F.posy=(F.yIndex*this.al)+this.bY+ab.y;}if(F.posy>this.H){bE=false;}}if(cW&&bE){this.bL(F);}if(F.element){F.element.style.top=F.posy+'px';F.element.style.left=F.posx+'px';}}}}}},addNavigationGUI:function(gui){gui.mapControl=this;this.as.appendChild(gui.element);gui.element.style.zIndex=2;},addDrawCanvas:function(canvasIn){this.O=canvasIn;this.O.parent=this;var ac=this.k+'canvas';this.O.element.setAttribute('id',ac);this.aI.appendChild(this.O.element);var D=0;var C=0;if(window.innerWidth){D=window.innerWidth;C=window.innerHeight;}else{D=document.compatMode=='CSS1Compat'?document.documentElement.clientWidth:document.body.clientWidth;C=document.compatMode=='CSS1Compat'?document.documentElement.clientHeight:document.body.clientHeight;}this.O.element.width=this.P;this.O.element.height=this.H;if(/msie/i.test(navigator.userAgent)){var hack=G_vmlCanvasManager.initElement(this.getDrawCanvas().element);this.getDrawCanvas().element=hack;}canvas=this.O.element;this.O.surface=canvas.getContext("2d");},getDrawCanvas:function(){return this.O;},centerOnCoords:function(aa,mouse){aa=this.Z(aa);var coordsperpixel=256/AJAXMAP.ZOOMLEVELS[this.m];if(mouse){var ab={'x':Math.floor(((aa.x-this.K)*-coordsperpixel)+(this.f.x)),'y':Math.floor(((aa.y-this.L)*coordsperpixel)+(this.f.y))};}else{var ab={'x':Math.floor(((aa.x-this.K)*-coordsperpixel)+(this.P/2)),'y':Math.floor(((aa.y-this.L)*coordsperpixel)+(this.H/2))};}this.cg();this.aE(ab,true);this.release(ab,false);this.V={'x':this.l.left+(this.M*(this.P/2)),'y':this.l.top-(this.M*(this.H/2))};this.V=new Coordinate(this.l.left+(this.M*(this.P/2)),this.l.top-(this.M*(this.H/2)),this.az);},bv:function(aa,mouse){aa=this.Z(aa);var coordsperpixel=256/AJAXMAP.ZOOMLEVELS[this.m];if(mouse){var ab={'x':Math.floor(((aa.x-this.K)*-coordsperpixel)+(this.f.x)),'y':Math.floor(((aa.y-this.L)*coordsperpixel)+(this.f.y))};}else{var ab={'x':Math.floor(((aa.x-this.K)*-coordsperpixel)+(this.P/2)),'y':Math.floor(((aa.y-this.L)*coordsperpixel)+(this.H/2))};}this.cg();this.aE(ab,true);this.release(ab,false);},addAnnotation:function(d){d.coordinate=this.Z(d.coordinate);screenCoords=this.geoToScreenCoordinates(d.coordinate);var div=document.createElement('div');div.setAttribute('id',d.id);var img=document.createElement('img');d.element=div;d.parent=this;Event.observe(d.element,'click',d.aS.bindAsEventListener(d));Event.observe(d.element,'mouseover',d.bt.bindAsEventListener(d));Event.observe(d.element,'mouseout',d.bk.bindAsEventListener(d));Event.observe(d.element,'mouseup',d.bu.bindAsEventListener(d));Event.observe(d.element,'mousedown',d.bb.bindAsEventListener(d));img.src=d.iconURL;div.style.position="absolute";div.style.left=screenCoords.x+d.xOffset+'px';div.style.top=screenCoords.y+d.yOffset+'px';d.x=screenCoords.x+d.xOffset;d.y=screenCoords.y+d.yOffset;div.appendChild(img);d.img=img;div.appendChild(img);this.as.appendChild(d.element);d.element.style.zIndex=1;this.o.push(d);return d.id;},removeAnnotation:function(id){for(var i=0;i<this.o.length;i++){var d=this.o[i];if(d.id==id){this.as.removeChild(d.element);this.o.splice(i,1);return;}}},removeAnnotationGroup:function(dF){var removed=0;do{removed=0;for(var i=0;i<this.o.length;i++){var d=this.o[i];if(d.group==dF){this.as.removeChild(d.element);this.o.splice(i,1);removed=1;break;}}}while(removed==1);},getAnnotation:function(id){for(i=0;i<this.o.length;i++){var d=this.o[i];if(d.id==id){return d;}}},getAnnotations:function(){return this.o;},showAnnotationPopup:function(d){if(this.aT){this.ay.innerHTML=d.title+'<p>'+d.description+'</p>';var be=0;var bd=0;if(d.x>this.P-250){be=-275;}else{be=25;}if(d.y<150){bd=0;}else{bd=-150;}this.ay.style.top=d.y+bd+'px';this.ay.style.left=d.x+be+'px';this.dk=d.x+be;this.dj=d.y+bd;this.popupTimerId=setTimeout("$('"+this.k+"annotation_popup').style.display = 'block'",700);}},hideAnnotationPopup:function(d){clearTimeout(this.popupTimerId);$(this.k+'annotation_popup').style.display='none';},addLayer:function(bQ){bQ.id="layer_"+this.G.length;this.G.push(bQ);if(this.cJ==true){this.aX();this.ae(true);if(bQ.type=="wmsoverlay")this.bq();}return bQ.id;},removeLayer:function(dG){for(var i=0;i<this.G.length;i++){if(this.G[i].id==dG){this.G.splice(i,1);return;}}},showLayer:function(id,zindex){for(var i=0;i<this.G.length;i++){if(this.G[i].id==id){if(zindex){this.G[i].zindex=zindex;}if(this.G[i].visible==false){this.G[i].visible=true;this.aX();this.ae(true);}}}},hideLayer:function(id){for(var i=0;i<this.G.length;i++){if(this.G[i].id==id)if(this.G[i].visible==true){this.G[i].visible=false;this.aX();this.ae(true);}}this.cz();},getLayers:function(){return this.G;},cw:function(ab){for(i=0;i<this.o.length;i++){var d=this.o[i];d.x=d.x+ab.x;d.y=d.y+ab.y;}},cg:function(){for(var i=0;i<this.o.length;i++){d=this.o[i];if(d.upperbound<this.m||d.lowerbound>this.m){d.element.style.display='none';}else{d.element.style.display='block';}screenCoords=this.geoToScreenCoordinates(d.coordinate);d.x=screenCoords.x+d.xOffset;d.y=screenCoords.y+d.yOffset;d.element.style.left=d.x+'px';d.element.style.top=d.y+'px';}},refreshAnnotations:function(){for(var i=0;i<this.o.length;i++){d=this.o[i];if(d.upperbound<this.m||d.lowerbound>this.m){d.element.style.display='none';}else{d.element.style.display='block';}screenCoords=this.geoToScreenCoordinates(d.coordinate);d.x=screenCoords.x+d.xOffset;d.y=screenCoords.y+d.yOffset;d.element.style.left=d.x+'px';d.element.style.top=d.y+'px';}},dO:function(annotation){d=annotation;if(d.upperbound<this.m||d.lowerbound>this.m){d.element.style.display='none';}else{d.element.style.display='block';}screenCoords=this.geoToScreenCoordinates(d.coordinate);d.x=screenCoords.x+d.xOffset;d.y=screenCoords.y+d.yOffset;d.element.style.left=d.x+'px';d.element.style.top=d.y+'px';},clearAnnotations:function(){for(var i=0;i<this.o.length;i++){var d=this.o[i];this.as.removeChild(d.element);}this.o=[];},loadGeoRSS:function(url){if(document.implementation&&document.implementation.createDocument){xmlDoc=document.implementation.createDocument("","",null);xmlDoc.async="false";xmlDoc.onload=this.addAnnotationsFromXML;}else if(document.documentElement&&typeof document.documentElement.style.maxHeight!="undefined"){var xmlIsland=document.getElementById("xmlI");xmlIsland.async=false;xmlIsland.load(url);xmlDoc=xmlIsland;this.addAnnotationsFromXML();return;}else if(window.ActiveXObject){xmlDoc=new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async="false";xmlDoc.onreadystatechange=this.addAnnotationsFromXML;}else{alert('Your browser can\'t handle this script');return;}xmlDoc.load(url);},addAnnotationsFromXML:function(){var x=xmlDoc.getElementsByTagName('item');for(i=0;i<x.length;i++){var icon="media/icons/newsfire-icon.png";for(j=0;j<x[i].childNodes.length;j++){if(x[i].childNodes[j].nodeType!=1){continue;}if(x[i].childNodes[j].tagName=='title'){var title=x[i].childNodes[j].firstChild.nodeValue;}if(x[i].childNodes[j].tagName=='description'){var description=x[i].childNodes[j].firstChild.nodeValue;}if(x[i].childNodes[j].tagName=='icon'){icon=x[i].childNodes[j].firstChild.nodeValue;}if(x[i].childNodes[j].tagName=='geo:lat'){var geoLat=x[i].childNodes[j].firstChild.nodeValue;}if(x[i].childNodes[j].tagName=='geo:long'){var geoLon=x[i].childNodes[j].firstChild.nodeValue;}var coords={'y':Number(geoLon),'x':Number(geoLat)};var newCoords=map.decimalDegreesToUTM(coords);map.trackCoords=newCoords;}map.addAnnotation(new Annotation(newCoords,title,description,icon));}},disableZoom:function(){this.aU=true;},enableZoom:function(){this.aU=false;},animateZoomIn:function(){var tiles=this.G[0].tiles;for(var i=0;i<tiles.length;i++){tileCol=tiles[i];for(var j=0;j<tileCol.length;j++){var tile=tileCol[j];var qx=parseInt((tile.posx+128)/256);var qy=parseInt((tile.posy+128)/256);if(tile.element!=null){tile.element.style.width=parseInt(tile.element.style.width)+40+'px';tile.element.style.height=parseInt(tile.element.style.height)+40+'px';tile.element.style.left=-50+parseInt(tile.element.style.left)+qx*40+'px';tile.element.style.top=-50+parseInt(tile.element.style.top)+qy*40+'px';}}}if(this.zoomCounter==5){this.zoomCounter=0;clearInterval(this.zoomTimerId);map.zoomIn();return;}this.zoomCounter++;var self=this;},animateZoomOut:function(){var tiles=this.G[0].tiles;for(var i=0;i<tiles.length;i++){tileCol=tiles[i];for(var j=0;j<tileCol.length;j++){var tile=tileCol[j];var qx=parseInt((tile.posx+256)/256);var qy=parseInt((tile.posy+256)/256);if(tile.element!=null){tile.element.style.width=parseInt(tile.element.style.width)-40+'px';tile.element.style.height=parseInt(tile.element.style.height)-40+'px';tile.element.style.left=50+parseInt(tile.element.style.left)-qx*40+'px';tile.element.style.top=50+parseInt(tile.element.style.top)-qy*40+'px';}}}if(this.zoomCounter==5){this.zoomCounter=0;clearInterval(this.zoomTimerId);map.zoomOut();return;}this.zoomCounter++;var self=this;},zoomIn:function(I){if(this.m>0){this.aX();if(!this.V){this.V=new Coordinate(this.l.left+(this.M*(this.P/2)),this.l.top-(this.M*(this.H/2)),this.az);}if(I){I=this.Z(I);this.V=I;}this.bX=0;this.bY=0;this.m=this.m-1;this.M=AJAXMAP.ZOOMLEVELS[this.m]/256;var ag=this.am(this.V);this.aJ=ag.x;this.aK=ag.y;this.K=this.aJ;this.L=this.aK;this.ae(false);this.bv(this.V);$(this.k).fire("map:zoomedIn",{'boundingBox':this.l});$(this.k).fire("map:zoomed");}},zoomOut:function(I){if(this.m<AJAXMAP.ZOOMLEVELS.length-1){this.aX();if(!this.V){this.V=new Coordinate(this.l.left+(this.M*(this.P/2)),this.l.top-(this.M*(this.H/2)),this.az);}if(I){I=this.Z(I);this.V=I;}this.bX=0;this.bY=0;this.m=parseInt(this.m)+1;this.M=AJAXMAP.ZOOMLEVELS[this.m]/256;var ag=this.am(this.V);this.aJ=ag.x;this.aK=ag.y;this.K=this.aJ;this.L=this.aK;this.ae(false);this.bv(this.V);$(this.k).fire("map:zoomedOut",{'boundingBox':this.l});$(this.k).fire("map:zoomed");}},mouseZoomIn:function(){if(this.m>0){this.aX();if(!this.V&&!this.aQ){this.V=new Coordinate(this.l.left+(this.M*(this.P/2)),this.l.top-(this.M*(this.H/2)),this.az);}if(this.aQ){this.V=new Coordinate(this.U.x,this.U.y,this.az);}this.bX=0;this.bY=0;this.m=this.m-1;this.M=AJAXMAP.ZOOMLEVELS[this.m]/256;var ag=this.am(this.V);this.aJ=ag.x;this.aK=ag.y;this.K=this.aJ;this.L=this.aK;this.ae(false);this.bv(this.V,this.aQ);$(this.k).fire("map:zoomedIn",{'boundingBox':this.l});$(this.k).fire("map:zoomed");}},mouseZoomOut:function(){if(this.m<AJAXMAP.ZOOMLEVELS.length-1){this.aX();if(!this.V&&!this.aQ){this.V=new Coordinate(this.l.left+(this.M*(this.P/2)),this.l.top-(this.M*(this.H/2)),this.az);}if(this.aQ){this.V=new Coordinate(this.U.x,this.U.y,this.az);}this.bX=0;this.bY=0;this.m=parseInt(this.m)+1;this.M=AJAXMAP.ZOOMLEVELS[this.m]/256;var ag=this.am(this.V);this.aJ=ag.x;this.aK=ag.y;this.K=this.aJ;this.L=this.aK;this.ae(false);this.bv(this.V,this.aQ);$(this.k).fire("map:zoomedOut",{'boundingBox':this.l});$(this.k).fire("map:zoomed");}},zoom:function(level,I){if(level<AJAXMAP.ZOOMLEVELS.length&&level>=0){this.aX();if(!this.V){this.V=new Coordinate(this.l.left+(this.M*(this.P/2)),this.l.top-(this.M*(this.H/2)),this.az);}if(I){I=this.Z(I);this.V=I;}this.bX=0;this.bY=0;this.m=level;this.M=AJAXMAP.ZOOMLEVELS[this.m]/256;var ag=this.am(this.V);this.aJ=ag.x;this.aK=ag.y;this.K=this.aJ;this.L=this.aK;this.ae(false);this.bv(this.V,false);$(this.k).fire("map:zoomed");}},centerAndZoom:function(cG,level){if(level==this.m)this.bv(cG,false);else this.zoom(level,cG);},zoomOnBoundingBox:function(aa,center,ct){var dI=aa.x2-aa.x1;var dD=aa.y2-aa.y1;var dm=this.P/2;var di=this.H/2;var aP=new Coordinate(aa.x1+(dI/2),aa.y1+(dD/2),this.az);for(var i=0;i<AJAXMAP.ZOOMLEVELS.length;i++){var dB=AJAXMAP.ZOOMLEVELS[i];var bT=dB/256;var dq=aP.x+(dm*bT);var dn=aP.y+(di*bT);if(dq>aa.x2&&dn>aa.y2){if(this.m==i&&!center){return{'zoom':i,'coordinate':aP};}if(!ct&&this.m>0){this.zoom(i,aP);}return{'zoom':i,'coordinate':aP};}}if(!ct){this.zoom(i,aP);}return{'zoom':i,'coordinate':aP};},zoomOnAnnotations:function(){if(this.o.length==0){return;}var x1=this.o[0].coordinate.x;var y1=this.o[0].coordinate.y;var x2=this.o[0].coordinate.x;var y2=this.o[0].coordinate.y;for(i=0;i<this.o.length;i++){if(this.o[i].coordinate.x>x2){x2=this.o[i].coordinate.x;}if(this.o[i].coordinate.x<x1){x1=this.o[i].coordinate.x;}if(this.o[i].coordinate.y>y2){y2=this.o[i].coordinate.y;}if(this.o[i].coordinate.y<y1){y1=this.o[i].coordinate.y;}}this.zoomOnBoundingBox({'x1':x1,'y1':y1,'x2':x2,'y2':y2},true);},cU:function(){this.bP.style.position="absolute";this.bP.style.zIndex=10;this.bP.style.overflow="hidden";var cV=document.getElementById(this.k);var g=document.createElement('div');var ac=this.k+'tilelayer';g.innerHTML='<!-- -->';g.setAttribute('id',ac);this.bP.appendChild(g);g.style.position="absolute";g.style.top="0px";g.style.left="0px";g.style.width="100%";g.style.height="100%";g.style.overflow="hidden";this.aR=g;var cV=document.getElementById(this.k);var g=document.createElement('div');var ac=this.k+'staticdrawlayer';g.innerHTML='<!-- -->';g.setAttribute('id',ac);g.style.position="absolute";g.style.top="0px";g.style.left="0px";g.style.width="100%";g.style.height="100%";g.style.zIndex=1000;this.bP.appendChild(g);this.bM=g;var cV=document.getElementById(this.k);var g=document.createElement('div');var ac=this.k+'drawlayer';g.innerHTML='<!-- -->';g.setAttribute('id',ac);g.style.position="absolute";g.style.top="0px";g.style.left="0px";g.style.width="100%";g.style.height="100%";g.style.zIndex=1000;this.bP.appendChild(g);this.aI=g;var cV=document.getElementById(this.k);var g=document.createElement('div');var ac=this.k+'mouselayer';g.innerHTML='<!-- -->';g.setAttribute('id',ac);g.style.position="absolute";g.style.top="0px";g.style.left="0px";g.style.width="100%";g.style.height="100%";g.style.zIndex=1000;g.style.overflow="hidden";this.bP.appendChild(g);this.as=g;var cV=document.getElementById(this.k);var g=document.createElement('div');var ac=this.k+'zoomBox';g.innerHTML='<!-- -->';g.setAttribute('id',ac);this.as.appendChild(g);g.style.position="absolute";g.style.border="solid 1px";g.style.width="0px";g.style.height="0px";g.style.top="0px";g.style.left="10px";g.style.display='none';g.style.zIndex=2;this.Q=g;var g=document.createElement('div');var ac=this.k+'surface';g.innerHTML='<!-- -->';g.setAttribute('id',ac);g.style.position="absolute";g.style.top="0px";g.style.left="0px";g.style.width="100%";g.style.height="100%";g.style.zIndex=0;g.style.background="url(media/interface/default/blank_1px.gif)";this.as.appendChild(g);this.ci=g;var cV=document.getElementById(this.k);var g=document.createElement('div');var ac=this.k+'annotation_popup';g.innerHTML='<!-- -->';g.setAttribute('id',ac);this.as.appendChild(g);g.style.position="absolute";g.style.width="250px";g.style.height="150px";g.style.top="29px";g.style.left="130px";g.style.display='none';g.style.padding='10px';g.style.zIndex=1000;g.style.backgroundColor='white';g.style.border='solid 1px';this.ay=g;},bL:function(F){var bo,cj;var bW=this.aJ+(F.xIndex*AJAXMAP.ZOOMLEVELS[this.m]);var ca=this.aK-(F.yIndex*AJAXMAP.ZOOMLEVELS[this.m])-AJAXMAP.ZOOMLEVELS[this.m];if(F.layer.type=='webatlastile'){bo=cj='http://ts'+F.host+'.webatlas.no/?x1='+bW+'&y1='+ca+'&z='+AJAXMAP.ZOOMLEVELS[this.m]+'&s='+this.aG+'&l=1';}if(F.layer.type=='osmtile'){c=new Coordinate(bW,ca);cC=this.UTMToLatLon(c);tilename=this.getOSMName(cC.y,cC.x,this.m);bo=cj='http://b.tile.openstreetmap.org/'+tilename+'.png';}else if(F.layer.type=='wms'){bo=cj=F.layer.wmsRequest.url+'?REQUEST=GetMap&SERVICE='+F.layer.wmsRequest.service+'&SRS='+F.layer.wmsRequest.srs+'&VERSION='+F.layer.wmsRequest.version+'&FORMAT='+F.layer.wmsRequest.format+'&LAYERS='+F.layer.wmsRequest.layers+'&STYLES='+F.layer.wmsRequest.styles+'&TRANSPARENT=true'+'&BBOX='+bW+','+ca+','+(bW+AJAXMAP.ZOOMLEVELS[this.m])+','+(ca+AJAXMAP.ZOOMLEVELS[this.m])+'&WIDTH=256&HEIGHT=256';}if(F.element!=null&&F.element.parentNode!=null&&F.element.relativeSrc!=cj){this.aR.removeChild(F.element);}var bf=this.aD[bo];if(!bf){bf=this.aD[bo]=this.bn(cj);}bf.onload=null;if(bf.image){bf.image.onload=null;}if(!bf.parentNode){F.element=this.aR.appendChild(bf);}if(F.element!=null){F.element.style.zIndex=F.layer.zIndex;}},dE:function(tile,forceBlankImage){var tileImgId,src;var useBlankImage=false;var bW=this.aJ+(tile.xIndex*AJAXMAP.ZOOMLEVELS[this.m]);var ca=this.aK-(tile.yIndex*AJAXMAP.ZOOMLEVELS[this.m])-AJAXMAP.ZOOMLEVELS[this.m];if(tile.layer.type=='webatlastile'){tileImgId=src='http://ts'+tile.host+'.webatlas.no/?x1='+bW+'&y1='+ca+'&z='+AJAXMAP.ZOOMLEVELS[this.m]+'&s='+this.aG+'&l=1';}if(tile.element!=null&&tile.element.parentNode!=null&&tile.element.relativeSrc!=src){this.aR.removeChild(tile.element);}var tileImg=this.aD[tileImgId];if(!tileImg){tileImg=this.aD[tileImgId]=this.bn(src);}var loadingImgId='loading:'+bW+':'+ca;var loadingImg=this.aD[loadingImgId];if(!loadingImg){loadingImg=this.aD[loadingImgId]=this.bn(this.aD['loading'].src);}loadingImg.targetSrc=tileImgId;var well=this.aR;tile.element=well.appendChild(loadingImg);tileImg.onload=function(){if(loadingImg.parentNode&&loadingImg.targetSrc==tileImgId){tileImg.style.top=loadingImg.style.top;tileImg.style.left=loadingImg.style.left;well.replaceChild(tileImg,loadingImg);tile.element=tileImg;}tileImg.onload=null;return false;};if(tile.element!=null){tile.element.style.zIndex=tile.layer.zIndex-1000;}},toggleMapStyle:function(){if(this.aG==0){this.aG=1;}else{this.aG=0;}this.cz();this.aE({'x':0,'y':0});},bn:function(cj){var aF=document.createElement('img');aF.src=cj;aF.alt="Loading Tile...";aF.relativeSrc=cj;aF.className='tile';aF.style.width=this.al+'px';aF.style.height=this.al+'px';aF.style.top="-256px";aF.style.left="-256px";aF.style.position='absolute';return aF;},aX:function(){this.ec=null;for(eb in this.aD){var aF=this.aD[eb];aF.onload=null;aF.src='media/interface/blank.png';if(aF.image){aF.image.onload=null;}if(aF.parentNode!=null){this.aR.removeChild(aF);}}this.aD={};this.aD['blank']=new Image();this.aD['loading']=this.aD['blank'];},release:function(J,cn){if(!(J.x+J.y)==0){this.aI.style.top=0+"px";this.aI.style.left=0+"px";this.bX+=J.x;this.bY+=J.y;this.cw(J);this.aA={'x':0,'y':0};this.K-=J.x*this.M;this.L=this.L+J.y*this.M;var bK=this.L-this.H*this.M;var bZ=this.K+this.P*this.M;this.l={'bottom':bK,'left':this.K,'top':this.L,'right':bZ};this.U=new Coordinate(this.f.x*this.M+this.K,-(this.f.y*this.M-this.L),this.az);if(!cn){$(this.k).fire("map:moved",{'mouseMapCoords':this.U,'mouseCoords':this.f,'boundingBox':this.l,'move':J});$(this.k).fire("map:dragEnd",{'mouseMapCoords':this.U,'mouseCoords':this.f,'boundingBox':this.l});this.bS=false;}this.updateWMSLayers();this.cK();}this.co=false;this.ci.style.zIndex='0';},updateBB:function(){var bK=this.L-this.H*this.M;var bZ=this.K+this.P*this.M;this.l={'bottom':bK,'left':this.K,'top':this.L,'right':bZ};},cK:function(){if(this.cu==true){var aF=document.createElement('img');aF.src="http://services.webatlas.no/weblog/Log2.aspx?"+"WMS-REQUEST=BBOX="+this.l.left+","+this.l.bottom+","+this.l.right+","+this.l.top+"&MAPSTYLE="+this.aG+"&ZOOMLEVEL="+AJAXMAP.ZOOMLEVELS[this.m]+"&PROVIDER="+this.by+"&CUSTOMER="+this.by+"&SERVER=";for(var i=this.aL;i<=this.aN;i++){aF.src+='ts'+i+',';}aF=null;}},disableLogging:function(){this.cu=false;},getOSMName:function(dW,eh,ck){var dX=parseInt(Math.floor((eh+180)/360*(Math.pow(2,ck))));var dY=parseInt(Math.floor((1-Math.log(Math.tan(dW*Math.PI/180)+1/Math.cos(dW*Math.PI/180))/Math.PI)/2*(Math.pow(2,ck))));return(""+ck+"/"+dX+"/"+dY);},addWMSLayer:function(bN,dH,dK){if(bN.id==null){bN.id=this.ai.length;}er=dH?dH:0;el=dK?dK:99;bN.lb=er;bN.ub=el;for(var i=0;i<this.ai.length;i++){if(bN.id==this.ai[i].id){this.ai[i]=bN;this.updateWMSLayers();return bN.id;}}this.ai.push(bN);this.updateWMSLayers();return bN.id;},removeWMSLayer:function(ep){for(var i=0;i<this.ai.length;i++){if(ep==this.ai[i].id){this.ai.splice(i,1);this.updateWMSLayers();return;}}},updateWMSLayers:function(){var tilelayer=this.aI;for(var i=0;i<this.aY.length;i++){tilelayer.removeChild(this.aY[i]);}this.aY=[];for(var i=0;i<this.ai.length;i++){var req=this.ai[i];if(req.lb<=this.m&&req.ub>=this.m){var img=document.createElement('img');var url=req.url;var dc=$H({"REQUEST":"GetMap","SERVICE":req.service,"VERSION":req.version,"SRS":this.az,"FORMAT":req.format,"LAYERS":req.layers,"TRANSPARENT":"true","STYLES":req.styles,"WIDTH":this.P,"HEIGHT":this.H,"BBOX":[this.l.left,this.l.bottom,this.l.right,this.l.top].join(',')});var bh="";if(url.indexOf("?")==-1){bh="?";}else if(!(url.endsWith("?")||url.endsWith("&"))){bh="&";}url=url+bh+dc.toQueryString();img.src=url;img.alt="Loading custom layer...";img.relativeSrc=this.ai[i].serverURL;img.className='overlay';img.style.position='absolute';img.style.top=0+'px';img.style.left=0+'px';tilelayer.appendChild(img);this.aY.push(img)}}this.bq();},bq:function(){var tilelayer=this.aR;for(var i=0;i<this.aq.length;i++){tilelayer.removeChild(this.aq[i]);}this.aq=[];for(var i=0;i<this.G.length;i++){if(this.G[i].type=='wmsoverlay'){var req=this.G[i].wmsRequest;var img=document.createElement('img');var url=req.url;var dc=$H({"REQUEST":"GetMap","SERVICE":req.service,"VERSION":req.version,"SRS":this.az,"FORMAT":req.format,"LAYERS":req.layers,"TRANSPARENT":"true","STYLES":req.styles,"WIDTH":this.P,"HEIGHT":this.H,"BBOX":[this.l.left,this.l.bottom,this.l.right,this.l.top].join(',')});var bh="";if(url.indexOf("?")==-1){bh="?";}else if(!(url.endsWith("?")||url.endsWith("&"))){bh="&";}url=url+bh+dc.toQueryString();img.src=url;img.alt="Loading custom layer...";img.className='overlay';img.style.position='absolute';img.style.top=0+'px';img.style.left=0+'px';img.style.zIndex=this.G[i].zIndex;tilelayer.appendChild(img);this.aq.push(img)}}},getDistancelatlon:function(aa){var dv=0.0;var R=6371;for(var i=0;i<aa.length-1;i++){var point1=aa[i];var point2=aa[i+1];point1=this.UTMToLatLon(point1);point2=this.UTMToLatLon(point2);var distance=Math.acos(Math.sin(point1.y*Math.PI/180)*Math.sin(point2.y*Math.PI/180)+Math.cos(point1.y*Math.PI/180)*Math.cos(point2.y*Math.PI/180)*Math.cos((point2.x-point1.x)*Math.PI/180))*R;dv+=distance;}return dv;},getHeight:function(){return this.H;},getWidth:function(){return this.P;},getDrawLayer:function(){return this.aI;},getStaticDrawLayer:function(){return this.bM;},getMouseLayer:function(){return this.as;},getMapContainer:function(){return this.k;},getTrackCoords:function(){tmpcoord=this.trackCoords;this.trackCoords=null;return tmpcoord;},getCenterCoordinate:function(){return new Coordinate(this.l.left+(this.M*(this.P/2)),this.l.top-(this.M*(this.H/2)),this.az);},getBoundingBox:function(){return this.l;},setEPSG:function(epsg){this.dC=epsg;},getEPSG:function(){return this.dC;},setMapStyle:function(dP){this.aG=dP;this.cz();this.aE({'x':0,'y':0});},disableAnnotationInfo:function(){this.aT=false;},enableAnnotationInfo:function(){this.aT=true;},getMapStyle:function(){return this.aG;},getCurrentMouseCoords:function(){return this.f;},getMouseDownCoords:function(){return this.n;},getMouseDownMapCoords:function(){return this.bw;},getMouseMapCoords:function(){return this.U;},setMouseZoom:function(dx){this.aQ=dx;},allowMouseNavigation:function(){this.af=true;},disallowMouseNavigation:function(){this.af=false;},getZoomLevel:function(){return this.m;},ba:function(cB){cD=cB.offsetTop;aO=cB.offsetParent;while(aO!=null){cD+=aO.offsetTop;if(aO!=null){aO=aO.offsetParent;}}return cD;},aV:function(cB){cD=cB.offsetLeft;aO=cB.offsetParent;while(aO!=null){cD+=aO.offsetLeft;aO=aO.offsetParent;}return cD;},cv:function(T){if(T.which==null){de=(T.button<2)?"LEFT":((T.button==4)?"MIDDLE":"RIGHT");}else{de=(T.which<2)?"LEFT":((T.which==2)?"MIDDLE":"RIGHT");}return de;},Z:function(I){return I.transform(this.az);},geoToScreenCoordinates:function(J){J=this.Z(J);var bU=256/AJAXMAP.ZOOMLEVELS[this.m];var bX=(J.x-this.K)*bU;var bY=(this.L-J.y)*bU;return{'x':bX,'y':bY};},getPixelLatLon:function(pixel){var coordsperpixel=AJAXMAP.ZOOMLEVELS[this.m]/256;utm={'x':(this.l.left+(pixel.x*coordsperpixel)),'y':(this.l.top-(pixel.y*coordsperpixel))};latLon=this.UTMToLatLon(new Coordinate(utm.x,utm.y));return latLon;},decimalDegreesToUTM:function(J){return J.toUTM(J.x,J.y,J.epsgToZone(this.az));},UTMToLatLon:function(cb){return cb.fromUTM(cb.x,cb.y,cb.epsgToZone(this.az));},getDistance:function(points){var t=0.0;for(var i=0;i<points.length-1;i++){var point1=points[i];var point2=points[i+1];var distance=Math.sqrt((point2.x-point1.x)*(point2.x-point1.x)+(point1.y-point2.y)*(point1.y-point2.y));t+=distance;}return this.cy(t,0);},getCircuit:function(points){var t=0.0;if(points.length>2){for(var i=0;i<points.length-1;i++){var point1=points[i];var point2=points[i+1];var distance=Math.sqrt((point2.x-point1.x)*(point2.x-point1.x)+(point1.y-point2.y)*(point1.y-point2.y));t+=distance;}}if(points.length>2){var distance=Math.sqrt((points[points.length-1].x-points[0].x)*(points[points.length-1].x-points[0].x)+(points[0].y-points[points.length-1].y)*(points[0].y-points[points.length-1].y));t+=distance;}return this.cy(t,0);},getArea:function(points){var t=0.0;if(points.length>2){var numPoints=points.length;t=(points[points.length-1].x*points[0].y)-(points[0].x*points[points.length-1].y);for(var i=0;i<numPoints-1;i++){t=t+(points[i].x*points[i+1].y)-(points[i+1].x*points[i].y);}t=t/2;}if(t<0){t=-t;}return this.cy(t,0);},am:function(J){var dR=parseInt(J.x/AJAXMAP.ZOOMLEVELS[this.m]);var dU=parseInt(J.y/AJAXMAP.ZOOMLEVELS[this.m]);var ea=AJAXMAP.ZOOMLEVELS[this.m]*dR;var dZ=AJAXMAP.ZOOMLEVELS[this.m]*dU;return new Coordinate(ea,dZ,J.srs);},cy:function(Num,Places){if(Places>0){if((Num.toString().length-Num.toString().lastIndexOf('.'))>(Places+1)){var Rounder=Math.pow(10,Places);return Math.round(Num*Rounder)/Rounder;}else return Num;}else return Math.round(Num);},ds:function(T){var bR=0;if(!T){T=window.event;}if(T.wheelDelta){bR=T.wheelDelta/120;}else if(T.detail){bR=-T.detail/3;}if(bR){this.dQ(bR);}if(T.preventDefault){T.preventDefault();}T.returnValue=false;},dQ:function(bR){if(!this.aU){if(bR<0){if(this.af)this.mouseZoomOut();}else{if(this.af)this.mouseZoomIn();}}}};function Annotation(J,dr,cr,cP,be,bd,cA,cE,cO){this.parent=null;this.id=++annotationStatic.annotationCount;this.coordinate=J;this.title=dr?dr:"";this.description=cr?cr:"";this.lowerbound=cA?cA:0;this.upperbound=cE?cE:99;this.xOffset=be?parseInt(be):0;this.yOffset=bd?parseInt(bd):0;this.group=cO?cO:0;this.x=0;this.y=0;this.img=null;this.iconURL=cP?cP:'http://www.webatlas.no/webatlasapi/v/071009/media/interface/default/markers/flag_blue.gif';this.element=null;};var annotationStatic={'annotationCount':0};Annotation.prototype={aS:function(T){$(this.element).fire("annotation:mouseClicked",{'annotation':this});},bu:function(T){$(this.element).fire("annotation:mouseUp",{'annotation':this});},bb:function(T){$(this.element).fire("annotation:mouseDown",{'annotation':this});},bk:function(T){$(this.element).fire("annotation:mouseOut",{'annotation':this});this.parent.hideAnnotationPopup();},bt:function(T){$(this.element).fire("annotation:mouseIn",{'annotation':this});this.parent.showAnnotationPopup(this);},dN:0};function Layer(ar){this.type=ar.type?ar.type:'webatlastile';this.name=ar.name?ar.name:'';this.zIndex=ar.zIndex?ar.zIndex:0;this.wmsRequest=ar.wmsrequest?ar.wmsrequest:null;if(ar.visible!='undefined'&&ar.visible!=null)this.visible=ar.visible;else this.visible=true;};Layer.prototype={};function Coordinate(bX,bY,az){this.x=bX;this.y=bY;this.srs=az?az:'EPSG:32633';};Coordinate.prototype={toUTM:function(x,y,zone){var dL=parseFloat(x);var ei=parseFloat(y);var cN=Math.PI;var eg=cN/4;var ce=cN/180;var cf=180.0/cN;var du=6378137;var v=0.00669438;var cZ=0.9996;var bg;var ad;var ed;var cI;var dg;var bj;var dJ;var dy=(dL+180)-parseInt((dL+180)/360)*360-180;var aH=ei*ce;var dM=dy*ce;var cc;var bc;bc=Math.abs(zone);bg=(bc-1)*6-180+3;cc=bg*ce;ad=(v)/(1-v);ed=du/Math.sqrt(1-v*Math.sin(aH)*Math.sin(aH));cI=Math.tan(aH)*Math.tan(aH);dg=ad*Math.cos(aH)*Math.cos(aH);bj=Math.cos(aH)*(dM-cc);dJ=du*((1-v/4-3*v*v/64-5*v*v*v/256)*aH-(3*v/8+3*v*v/32+45*v*v*v/1024)*Math.sin(2*aH)+(15*v*v/256+45*v*v*v/1024)*Math.sin(4*aH)-(35*v*v*v/3072)*Math.sin(6*aH));var cX=(cZ*ed*(bj+(1-cI+dg)*bj*bj*bj/6+(5-18*cI+cI*cI+72*dg-58*ad)*bj*bj*bj*bj*bj/120)+500000.0);var cs=(cZ*(dJ+ed*Math.tan(aH)*(bj*bj/2+(5-cI+9*dg+4*dg*dg)*bj*bj*bj*bj/24+(61-58*cI+cI*cI+600*dg-330*ad)*bj*bj*bj*bj*bj*bj/720)));if(zone<0)cs+=10000000.0;return new Coordinate(cX,cs,zone>=0?"EPSG:326"+zone:"EPSG:327"+(-zone));},fromUTM:function(x,y,zone){var cN=Math.PI;var ce=cN/180;var cf=180.0/cN;var cZ=0.9996;var du=6378137;var v=0.00669438;var ad=(v)/(1-v);var bC=(1-Math.sqrt(1-v))/(1+Math.sqrt(1-v));var dT,cp,bV,ee,bi,dJ;var bg;var cY,ef,ax;var bc=zone;var y0=0;if(bc<0){y0=10000000.0;}bg=(bc-1)*6-180+3;dJ=(y-y0)/cZ;cY=dJ/(du*(1-v/4-3*v*v/64-5*v*v*v/256));ax=cY+(3*bC/2-27*bC*bC*bC/32)*Math.sin(2*cY)+(21*bC*bC/16-55*bC*bC*bC*bC/32)*Math.sin(4*cY)+(151*bC*bC*bC/96)*Math.sin(6*cY);ef=ax*cf;dT=du/Math.sqrt(1-v*Math.sin(ax)*Math.sin(ax));cp=Math.tan(ax)*Math.tan(ax);bV=ad*Math.cos(ax)*Math.cos(ax);ee=du*(1-v)/Math.pow(1-v*Math.sin(ax)*Math.sin(ax),1.5);bi=(x-500000.0)/(dT*cZ);Lat=ax-(dT*Math.tan(ax)/ee)*(bi*bi/2-(5+3*cp+10*bV-4*bV*bV-9*ad)*bi*bi*bi*bi/24+(61+90*cp+298*bV+45*cp*cp-252*ad-3*bV*bV)*bi*bi*bi*bi*bi*bi/720);Lat=Lat*cf;Long=(bi-(1+2*cp+bV)*bi*bi*bi/6+(5-2*bV+28*cp-3*bV*bV+8*ad+24*cp*cp)*bi*bi*bi*bi*bi/120)/Math.cos(ax);Long=bg+Long*cf;return new Coordinate(Long,Lat,"EPSG:4326");},epsgToZone:function(epsg_code){if(epsg_code.indexOf("EPSG:")==0){if(epsg_code.substr(5,3)=="326")return parseInt(epsg_code.substr(8,3));if(epsg_code.substr(5,3)=="327")return-parseInt(epsg_code.substr(8,3));}return 0;},transform:function(to_srs){if(this.srs==to_srs)return new Coordinate(this.x,this.y,this.srs);var from_zone=this.epsgToZone(this.srs);var to_zone=this.epsgToZone(to_srs);if(from_zone==0&&this.srs!="EPSG:4326")throw"Unknown cooddinate system: "+this.srs;if(to_zone==0&&to_srs!="EPSG:4326")throw"Unknown cooddinate system: "+to_srs;if(from_zone==0&&to_zone!=0)return this.toUTM(this.x,this.y,to_zone);if(from_zone!=0&&to_zone==0)return this.fromUTM(this.x,this.y,from_zone);if(from_zone!=0&&to_zone!=0){var geo=this.fromUTM(this.x,this.y,from_zone);return geo.toUTM(geo.x,geo.y,to_zone);}throw"Unable to transform between "+this.srs+" and "+to_srs;}};function Move(bX,bY){this.x=bX;this.y=bY;};Move.prototype={};function WMSRequest(dp,G,db,cR,da,cS){this.id=++WMSRequestStatic.WMSRequestCount;this.url=dp;this.layers=G;this.format=db?db:'image/png';this.service=cR?cR:'WMS';this.styles=da?da:'';this.version=cS?cS:'1.1';this.srs='EPSG:32633';};var WMSRequestStatic={'WMSRequestCount':0};WMSRequest.prototype={addLayer:function(bQ){this.layers+=','+bQ;}};function WAPICanvas(){var g=document.createElement('canvas');g.setAttribute('width',100);g.setAttribute('height',100);g.style.position="absolute";g.style.top="0px";g.style.left="0px";g.style.width="100%";g.style.height="100%";g.style.zIndex=1000;this.element=g;this.surface=null;this.lines=[];this.parent=null;this.w={'X':0,'Y':0};this.B={'X':200,'Y':200};Event.observe(document,'map:resized',this.redraw.bindAsEventListener(this));Event.observe(document,'map:moved',this.redraw.bindAsEventListener(this));Event.observe(document,'map:zoomed',this.redraw.bindAsEventListener(this));};WAPICanvas.prototype={addPolyLine:function(dz,cd){this.lines.push(dz);if(typeof cd=='undefined')this.redraw();if(cd==false)this.redraw();},redraw:function(){this.surface.clearRect(0,0,this.element.width,this.element.height);this.w={'X':0,'Y':0};this.B={'X':this.parent.getWidth(),'Y':this.parent.getHeight()};for(var i=0;i<this.lines.length;i++){this.surface.beginPath();this.surface.strokeStyle=this.lines[i].rgba;this.surface.lineWidth=this.lines[i].lineWidth;this.surface.lineCap='round';var bs=[];for(var j=0;j<this.lines[i].coordinates.length;j++){var dA=this.parent.geoToScreenCoordinates(this.lines[i].coordinates[j]);bs.push(dA);}for(var j=0;j<bs.length;j++){if(j!=bs.length-1){var dA=bs[j];var dV=bs[j+1];var lineSegment={'Start':{'X':parseInt(dA.x),'Y':parseInt(dA.y)},'End':{'X':parseInt(dV.x),'Y':parseInt(dV.y)}};lineSegment.Dy=lineSegment.End.Y-lineSegment.Start.Y;lineSegment.Dx=lineSegment.End.X-lineSegment.Start.X;var intersects=this.clipLine(lineSegment);if(intersects==true){this.surface.moveTo(lineSegment.Start.X,lineSegment.Start.Y);this.surface.lineTo(lineSegment.End.X,lineSegment.End.Y);}}}this.surface.stroke();}},clear:function(){this.surface.clearRect(0,0,this.element.width,this.element.height);this.lines=[];},clipStartTop:function(line){line.Start.X+=line.Dx*(this.w.Y-line.Start.Y)/line.Dy;line.Start.Y=this.w.Y;},clipStartBottom:function(line){line.Start.X+=line.Dx*(this.B.Y-line.Start.Y)/line.Dy;line.Start.Y=this.B.Y;},clipStartRight:function(line){line.Start.Y+=line.Dy*(this.B.X-line.Start.X)/line.Dx;line.Start.X=this.B.X;},clipStartLeft:function(line){line.Start.Y+=line.Dy*(this.w.X-line.Start.X)/line.Dx;line.Start.X=this.w.X;},clipEndTop:function(line){line.End.X+=line.Dx*(this.w.Y-line.End.Y)/line.Dy;line.End.Y=this.w.Y;},clipEndBottom:function(line){line.End.X+=line.Dx*(this.B.Y-line.End.Y)/line.Dy;line.End.Y=this.B.Y;},clipEndRight:function(line){line.End.Y+=line.Dy*(this.B.X-line.End.X)/line.Dx;line.End.X=this.B.X;},clipEndLeft:function(line){line.End.Y+=line.Dy*(this.w.X-line.End.X)/line.Dx;line.End.X=this.w.X;},clipLine:function(line){var lineCode=0;if(line.End.Y<this.w.Y)lineCode+=8;else if(line.End.Y>this.B.Y)lineCode+=4;if(line.End.X>this.B.X)lineCode+=2;else if(line.End.X<this.w.X)lineCode+=1;if(line.Start.Y<this.w.Y)lineCode+=128;else if(line.Start.Y>this.B.Y)lineCode+=64;if(line.Start.X>this.B.X)lineCode+=32;else if(line.Start.X<this.w.X)lineCode+=16;switch(lineCode){case 0:return true;case 1:this.clipEndLeft(line);return true;case 2:this.clipEndRight(line);return true;case 4:this.clipEndBottom(line);return true;case 5:this.clipEndLeft(line);if(line.End.Y>this.B.Y)this.clipEndBottom(line);return true;case 6:this.clipEndRight(line);if(line.End.Y>this.B.Y)this.clipEndBottom(line);return true;case 8:this.clipEndTop(line);return true;case 9:this.clipEndLeft(line);if(line.End.Y<this.w.Y)this.clipEndTop(line);return true;case 10:this.clipEndRight(line);if(line.End.Y<this.w.Y)this.clipEndTop(line);return true;case 16:this.clipStartLeft(line);return true;case 18:this.clipStartLeft(line);this.clipEndRight(line);return true;case 20:this.clipStartLeft(line);if(line.Start.Y>this.B.Y)return false;this.clipEndBottom(line);return true;case 22:this.clipStartLeft(line);if(line.Start.Y>this.B.Y)return false;this.clipEndBottom(line);if(line.End.X>this.B.X)this.clipEndRight(line);return true;case 24:this.clipStartLeft(line);if(line.Start.Y<this.w.Y)return false;this.clipEndTop(line);return true;case 26:this.clipStartLeft(line);if(line.Start.Y<this.w.Y)return false;this.clipEndTop(line);if(line.End.X>this.B.X)this.clipEndRight(line);return true;case 32:this.clipStartRight(line);return true;case 33:this.clipStartRight(line);this.clipEndLeft(line);return true;case 36:this.clipStartRight(line);if(line.Start.Y>this.B.Y)return false;this.clipEndBottom(line);return true;case 37:this.clipStartRight(line);if(line.Start.Y>this.B.Y)return false;this.clipEndBottom(line);if(line.End.X<this.w.X)this.clipEndLeft(line);return true;case 40:this.clipStartRight(line);if(line.Start.Y<this.w.Y)return false;this.clipEndTop(line);return true;case 41:this.clipStartRight(line);if(line.Start.Y<this.w.Y)return false;this.clipEndTop(line);if(line.End.X<this.w.X)this.clipEndLeft(line);return true;case 64:this.clipStartBottom(line);return true;case 65:this.clipStartBottom(line);if(line.Start.X<this.w.X)return false;this.clipEndLeft(line);if(line.End.Y>this.B.Y)this.clipEndBottom(line);return true;case 66:this.clipStartBottom(line);if(line.Start.X>this.B.X)return false;this.clipEndRight(line);return true;case 72:this.clipStartBottom(line);this.clipEndTop(line);return true;case 73:this.clipStartBottom(line);if(line.Start.X<this.w.X)return false;this.clipEndLeft(line);if(line.End.Y<this.w.Y)this.clipEndTop(line);return true;case 74:this.clipStartBottom(line);if(line.Start.X>this.B.X)return false;this.clipEndRight(line);if(line.End.Y<this.w.Y)this.clipEndTop(line);return true;case 80:this.clipStartLeft(line);if(line.Start.Y>this.B.Y)this.clipStartBottom(line);return true;case 82:this.clipEndRight(line);if(line.End.Y>this.B.Y)return false;this.clipStartBottom(line);if(line.Start.X<this.w.X)this.clipStartLeft(line);return true;case 88:this.clipEndTop(line);if(line.End.X<this.w.X)return false;this.clipStartBottom(line);if(line.Start.X<this.w.X)this.clipStartLeft(line);return true;case 90:this.clipStartLeft(line);if(line.Start.Y<this.w.Y)return false;this.clipEndRight(line);if(line.End.Y>this.B.Y)return false;if(line.Start.Y>this.B.Y)this.clipStartBottom(line);if(line.End.Y<this.w.Y)this.clipEndTop(line);return true;case 96:this.clipStartRight(line);if(line.Start.Y>this.B.Y)this.clipStartBottom(line);return true;case 97:this.clipEndLeft(line);if(line.End.Y>this.B.Y)return false;this.clipStartBottom(line);if(line.Start.X>this.B.X)this.clipStartRight(line);return true;case 104:this.clipEndTop(line);if(line.End.X>this.B.X)return false;this.clipStartRight(line);if(line.Start.Y>this.B.Y)this.clipStartBottom(line);return true;case 105:this.clipEndLeft(line);if(line.End.Y>this.B.Y)return false;this.clipStartRight(line);if(line.Start.Y<this.w.Y)return false;if(line.End.Y<this.w.Y)this.clipEndTop(line);if(line.Start.Y>this.B.Y)this.clipStartBottom(line);return true;case 128:this.clipStartTop(line);return true;case 129:this.clipStartTop(line);if(line.Start.X<this.w.X)return false;this.clipEndLeft(line);return true;case 130:this.clipStartTop(line);if(line.Start.X>this.B.X)return false;this.clipEndRight(line);return true;case 132:this.clipStartTop(line);this.clipEndBottom(line);return true;case 133:this.clipStartTop(line);if(line.Start.X<this.w.X)return false;this.clipEndLeft(line);if(line.End.Y>this.B.Y)this.clipEndBottom(line);return true;case 134:this.clipStartTop(line);if(line.Start.X>this.B.X)return false;this.clipEndRight(line);if(line.End.Y>this.B.Y)this.clipEndBottom(line);return true;case 144:this.clipStartLeft(line);if(line.Start.Y<this.w.Y)this.clipStartTop(line);return true;case 146:this.clipEndRight(line);if(line.End.Y<this.w.Y)return false;this.clipStartTop(line);if(line.Start.X<this.w.X)this.clipStartLeft(line);return true;case 148:this.clipEndBottom(line);if(line.End.X<this.w.X)return false;this.clipStartLeft(line);if(line.Start.Y<this.w.Y)this.clipStartTop(line);return true;case 150:this.clipStartLeft(line);if(line.Start.Y>this.B.Y)return false;this.clipEndRight(line);if(line.End.Y<this.w.Y)return false;if(line.Start.Y<this.w.Y)this.clipStartTop(line);if(line.End.Y>this.B.Y)this.clipEndBottom(line);return true;case 160:this.clipStartRight(line);if(line.Start.Y<this.w.Y)this.clipStartTop(line);return true;case 161:this.clipEndLeft(line);if(line.End.Y<this.w.Y)return false;this.clipStartTop(line);if(line.Start.X>this.B.X)this.clipStartRight(line);return true;case 164:this.clipEndBottom(line);if(line.End.X>this.B.X)return false;this.clipStartRight(line);if(line.Start.Y<this.w.Y)this.clipStartTop(line);return true;case 165:this.clipEndLeft(line);if(line.End.Y<this.w.Y)return false;this.clipStartRight(line);if(line.Start.Y>this.B.Y)return false;if(line.End.Y>this.B.Y)this.clipEndBottom(line);if(line.Start.Y<this.w.Y)this.clipStartTop(line);return true;}return false;}};function PolyLine(aa,bD){this.coordinates=aa?aa:[];if(bD){this.rgba=bD.rgba?bD.rgba:"rgba(0,0,0,1.0)";this.lineWidth=bD.lineWidth?bD.lineWidth:2;}else{this.rgba="rgba(0,0,0,1.0)";this.lineWidth=2;}};PolyLine.prototype={addPoint:function(cG){this.coordinates.push(cG);}};function GUI(aw){this.aM="http://www.webatlas.no/webatlasapi/v/latest/media/interface/default/";this.aw=aw?aw:'small';this.mapControl=null;this.element=document.createElement('div');divIdName='guibackground';this.element.style.position="absolute";this.element.style.left="16px";this.element.setAttribute('id',divIdName);Event.observe(this.element,'mouseup',this.bI.bindAsEventListener(this));Event.observe(this.element,'dblclick',this.bI.bindAsEventListener(this));Event.observe(this.element,'mousedown',this.bI.bindAsEventListener(this));var aC=document.createElement('div');aC.style.background="url("+this.aM+this.aw+"/east.jpg)";aC.style.position="absolute";aC.style.width="16px";aC.style.height="16px";aC.style.left="32px";aC.style.top="34px";aC.setAttribute('id','eastButton');this.element.appendChild(aC);Event.observe(aC,'click',this.bH.bindAsEventListener(this));var aB=document.createElement('div');aB.style.background="url("+this.aM+this.aw+"/west.jpg)";aB.style.position="absolute";aB.style.width="16px";aB.style.height="16px";aB.style.left="0px";aB.style.top="34px";aB.setAttribute('id','westButton');this.element.appendChild(aB);Event.observe(aB,'click',this.bJ.bindAsEventListener(this));var at=document.createElement('div');at.style.background="url("+this.aM+this.aw+"/north.jpg)";at.style.position="absolute";at.style.width="16px";at.style.height="16px";at.style.left="16px";at.style.top="17px";at.setAttribute('id','northButton');this.element.appendChild(at);Event.observe(at,'click',this.bG.bindAsEventListener(this));var au=document.createElement('div');au.style.background="url("+this.aM+this.aw+"/south.jpg)";au.style.position="absolute";au.style.width="16px";au.style.height="16px";au.style.left="16px";au.style.top="50px";au.setAttribute('id','southButton');this.element.appendChild(au);Event.observe(au,'click',this.bF.bindAsEventListener(this));var ao=document.createElement('div');ao.style.background="url("+this.aM+this.aw+"/normal.jpg)";ao.style.position="absolute";ao.style.width="48px";ao.style.height="16px";ao.style.left="0px";ao.style.top="104px";ao.setAttribute('id','style_normalButton');this.element.appendChild(ao);Event.observe(ao,'click',this.bm.bindAsEventListener(this));var av=document.createElement('div');av.style.background="url("+this.aM+this.aw+"/ortho.jpg)";av.style.position="absolute";av.style.width="48px";av.style.height="16px";av.style.left="0px";av.style.top="122px";av.setAttribute('id','style_orthoButton');this.element.appendChild(av);Event.observe(av,'click',this.bp.bindAsEventListener(this));var ap=document.createElement('div');ap.style.background="url("+this.aM+this.aw+"/hybrid.jpg)";ap.style.position="absolute";ap.style.width="48px";ap.style.height="16px";ap.style.left="0px";ap.style.top="140px";ap.setAttribute('id','style_hybridButton');this.element.appendChild(ap);Event.observe(ap,'click',this.bl.bindAsEventListener(this));var an=document.createElement('div');an.style.background="url("+this.aM+this.aw+"/zoom_In.jpg)";an.style.position="absolute";an.style.width="16px";an.style.height="16px";an.style.left="16px";an.style.top="68px";an.setAttribute('id','zoomInButton');this.element.appendChild(an);Event.observe(an,'click',this.bB.bindAsEventListener(this));var ak=document.createElement('div');ak.style.background="url("+this.aM+this.aw+"/zoom_Out.jpg)";ak.style.position="absolute";ak.style.width="16px";ak.style.height="16px";ak.style.left="16px";ak.style.top="86px";ak.setAttribute('id','zoomOutButton');this.element.appendChild(ak);Event.observe(ak,'click',this.bA.bindAsEventListener(this));};GUI.prototype={bF:function(bz){aA=new Move(0,parseInt(-this.mapControl.getHeight()/3));this.mapControl.move(aA);bz.stop();},bG:function(bz){aA=new Move(0,parseInt(this.mapControl.getHeight()/3));this.mapControl.move(aA);bz.stop();},bH:function(bz){aA=new Move(parseInt(-this.mapControl.getWidth()/3),0);this.mapControl.move(aA);bz.stop();},bJ:function(bz){aA=new Move(parseInt(this.mapControl.getHeight()/3),0);this.mapControl.move(aA);bz.stop();},bm:function(bz){this.mapControl.setMapStyle(0);bz.stop();},bp:function(bz){this.mapControl.setMapStyle(1);bz.stop();},bl:function(bz){this.mapControl.setMapStyle(2);bz.stop();},bB:function(bz){this.mapControl.zoomIn();bz.stop();},bA:function(bz){this.mapControl.zoomOut();bz.stop();},bI:function(bz){bz.stop();}};function MapUtilities(map)
{this.map=map;this.setMapStyle=function(style,activeButton,revertButton)
{activeButton=typeof(activeButton)=='undefined'?null:activeButton;revertButton=typeof(revertButton)=='undefined'?null:revertButton;this.map.setMapStyle(style);if(revertButton!==null)
{$j(revertButton).addClass('ui-state-default').removeClass('ui-state-highlight');}
if(activeButton!==null)
{$j(activeButton).addClass('ui-state-highlight').removeClass('ui-state-default');}}}
function Measurement(map)
{this.map=map;this.points=[];this.annotations={points:[]};this.mapMovement=false;this.pointAddingEnabled=false;this.polyLine=null;this.redraw=function()
{if(this.map.getDrawCanvas()==null)
{this.map.addDrawCanvas(new WAPICanvas());}
this.map.getDrawCanvas().clear();var polyLine=this.getPolyLine();if(polyLine)
{this.map.getDrawCanvas().addPolyLine(polyLine);}}
this.redrawAnnotations=function()
{for(annotationGroup in this.annotations)
{if(annotationGroup.length>0)
{for(var i=0;i<annotationGroup.length;i++)
{this.map.addAnnotation(annotationGroup[i]);}}}}
this.getPolyLine=function()
{return this.polyLine;}
this.clearPoints=function()
{this.map.getDrawCanvas().clear();this.map.removeAnnotationGroup('measurement-path-annotations');this.points=[];this.annotations.points=[];this.polyLine=null;}
this.addPoint=function(coords)
{this.points.push(coords);var currentIndex=this.points.length-1;if(this.map.getDrawCanvas()==null)
{this.map.addDrawCanvas(new WAPICanvas());}
if(this.polyLine==null)
{this.polyLine=new PolyLine([],{'rgba':"rgba(255,0,0,0.6)",'lineWidth':6});this.map.getDrawCanvas().clear();this.map.getDrawCanvas().addPolyLine(this.polyLine);}
this.polyLine.addPoint(this.points[currentIndex]);this.map.getDrawCanvas().redraw();var annotation=new Annotation(this.points[currentIndex],'Punkt '+(currentIndex+1),'','/images/points_measure.png',-7,-7,null,null,'measurement-path-annotations');annotation.pointReference=currentIndex;this.annotations.points.push({id:annotation.id,pointReference:annotation.pointReference});this.map.addAnnotation(annotation);this.updateAnnotations();}
this.updateAnnotations=function()
{for(var i=0;i<this.annotations.points.length;i++)
{var currentIndex=this.annotations.points[i].pointReference;var annotationId=this.annotations.points[i].id;var description='';description+=(currentIndex-1>=0)?'Avstand til forrige punkt: '+Math.round(this.getLengthBetweenPoints(this.points[currentIndex],this.points[currentIndex-1]))+'m<br />':'';description+=(currentIndex+1<this.points.length)?'Avstand til neste punkt: '+Math.round(this.getLengthBetweenPoints(this.points[currentIndex],this.points[currentIndex+1]))+'m<br />':'';this.map.getAnnotation(annotationId).description=description;}}
this.getArea=function()
{var area=0.0;if(this.points.length<3)
{return 0.0;}
for(var i=0;i<this.points.length;i++)
{i_n=i+1;if(i_n==this.points.length)
{i_n=0}
area+=((this.points[i].x*this.points[i_n].y)-(this.points[i_n].x*this.points[i].y));}
if(area<0)
{area=area*-1;}
return area/2;}
this.getAreaFormatted=function()
{var squareMeters=this.getArea();if(squareMeters>=1000000)
{return(squareMeters/1000000.0).toFixed(1)+" km²";}
else if(squareMeters>1000)
{return(squareMeters/1000.0).toFixed(1)+" m&aring;l";}
else
{return squareMeters.toFixed(1)+" m²";}}
this.getLengthBetweenPoints=function(point1,point2)
{var k1=point1.x-point2.x;var k2=point1.y-point2.y;var hyp=Math.sqrt(Math.pow(k1,2)+Math.pow(k2,2));return hyp;}
this.getTotalLengthFormatted=function()
{var meters=this.getTotalLengthInMeters();var distance={};distance.miles=Math.floor(meters/10000);distance.km=Math.floor(meters/1000)-(distance.miles*10);distance.m=Math.round(meters%1000);var formatted='';formatted+=distance.miles>0?distance.miles+'mil ':'';formatted+=distance.km>0?distance.km+'km ':'';formatted+=distance.m>0?distance.m+'m':'';return formatted;}
this.getTotalLengthInMeters=function()
{var totalLength=0;for(var i=1;i<this.points.length;i++)
{var hyp=this.getLengthBetweenPoints(this.points[i],this.points[i-1]);totalLength+=hyp;}
return totalLength;}
this.getPoints=function()
{if(this.points.length>0)
{return this.points;}
else
{return false;}}
this.loadFromPoints=function(loadPoints)
{this.map.removeAnnotationGroup('measurement-path-annotations');this.points=[];this.annotations.points=[];for(var p=0;p<loadPoints.length;p++)
{this.addPoint(new Coordinate(loadPoints[p].x,loadPoints[p].y));}}}
(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.6rc5",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n){return}for(var m=0;m<n.length;m++){if(j.options[n[m][0]]){n[m][1].apply(j.element,k)}}}},contains:function(k,j){return document.compareDocumentPosition?k.compareDocumentPosition(j)&16:k!==j&&k.contains(j)},cssCache:{},css:function(j){if(c.ui.cssCache[j]){return c.ui.cssCache[j]}var k=c('<div class="ui-gen"></div>').addClass(j).css({position:"absolute",top:"-5000px",left:"-5000px",display:"block"}).appendTo("body");c.ui.cssCache[j]=!!((!(/auto|default/).test(k.css("cursor"))||(/^[1-9]/).test(k.css("height"))||(/^[1-9]/).test(k.css("width"))||!(/none/).test(k.css("backgroundImage"))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(k.css("backgroundColor"))));try{c("body").get(0).removeChild(k.get(0))}catch(l){}return c.ui.cssCache[j]},hasScroll:function(m,k){if(c(m).css("overflow")=="hidden"){return false}var j=(k&&k=="left")?"scrollLeft":"scrollTop",l=false;if(m[j]>0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return!!c.data(l,j[3])},tabbable:function(k){var l=k.nodeName.toLowerCase();function j(m){return!(c(m).is(":hidden")||c(m).parents(":hidden").length)}return(k.tabIndex>=0&&(("a"==l&&k.href)||(/input|select|textarea|button/.test(l)&&"hidden"!=k.type&&!k.disabled))&&j(k))}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p)));(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()});this._init()};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(k,l,m){var n=this.options[k],j=(k==this.widgetEventPrefix?k:this.widgetEventPrefix+k);l=c.Event(l);l.type=j;this.element.trigger(l,m);return!(c.isFunction(n)&&n.call(this.element[0],l,m)===false||l.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return!this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=true;this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);(function(a){a.widget("ui.draggable",a.extend({},a.ui.mouse,{_init:function(){if(this.options.helper=="original"&&!(/^(?:r|a|f)/).test(this.element.css("position"))){this.element[0].style.position="relative"}(this.options.cssNamespace&&this.element.addClass(this.options.cssNamespace+"-draggable"));(this.options.disabled&&this.element.addClass(this.options.cssNamespace+"-draggable-disabled"));this._mouseInit()},destroy:function(){if(!this.element.data("draggable")){return}this.element.removeData("draggable").unbind(".draggable").removeClass(this.options.cssNamespace+"-draggable "+this.options.cssNamespace+"-draggable-dragging "+this.options.cssNamespace+"-draggable-disabled");this._mouseDestroy()},_mouseCapture:function(b){var c=this.options;if(this.helper||c.disabled||a(b.target).is("."+this.options.cssNamespace+"-resizable-handle")){return false}this.handle=this._getHandle(b);if(!this.handle){return false}return true},_mouseStart:function(b){var c=this.options;this.helper=this._createHelper(b);this._cacheHelperProportions();if(a.ui.ddmanager){a.ui.ddmanager.current=this}this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(b);this.originalPageX=b.pageX;this.originalPageY=b.pageY;if(c.cursorAt){this._adjustOffsetFromHelper(c.cursorAt)}if(c.containment){this._setContainment()}this._trigger("start",b);this._cacheHelperProportions();if(a.ui.ddmanager&&!c.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,b)}this.helper.addClass(c.cssNamespace+"-draggable-dragging");this._mouseDrag(b,true);return true},_mouseDrag:function(b,d){this.position=this._generatePosition(b);this.positionAbs=this._convertPositionTo("absolute");if(!d){var c=this._uiHash();this._trigger("drag",b,c);this.position=c.position}if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}if(a.ui.ddmanager){a.ui.ddmanager.drag(this,b)}return false},_mouseStop:function(c){var d=false;if(a.ui.ddmanager&&!this.options.dropBehaviour){d=a.ui.ddmanager.drop(this,c)}if(this.dropped){d=this.dropped;this.dropped=false}if((this.options.revert=="invalid"&&!d)||(this.options.revert=="valid"&&d)||this.options.revert===true||(a.isFunction(this.options.revert)&&this.options.revert.call(this.element,d))){var b=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){b._trigger("stop",c);b._clear()})}else{this._trigger("stop",c);this._clear()}return false},_getHandle:function(b){var c=!this.options.handle||!a(this.options.handle,this.element).length?true:false;a(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==b.target){c=true}});return c},_createHelper:function(c){var d=this.options;var b=a.isFunction(d.helper)?a(d.helper.apply(this.element[0],[c])):(d.helper=="clone"?this.element.clone():this.element);if(!b.parents("body").length){b.appendTo((d.appendTo=="parent"?this.element[0].parentNode:d.appendTo))}if(b[0]!=this.element[0]&&!(/(fixed|absolute)/).test(b.css("position"))){b.css("position","absolute")}return b},_adjustOffsetFromHelper:function(b){if(b.left!=undefined){this.offset.click.left=b.left+this.margins.left}if(b.right!=undefined){this.offset.click.left=this.helperProportions.width-b.right+this.margins.left}if(b.top!=undefined){this.offset.click.top=b.top+this.margins.top}if(b.bottom!=undefined){this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])){b.left+=this.scrollParent.scrollLeft();b.top+=this.scrollParent.scrollTop()}if((this.offsetParent[0]==document.body&&a.browser.mozilla)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)){b={top:0,left:0}}return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var b=this.element.position();return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e=this.options;if(e.containment=="parent"){e.containment=this.helper[0].parentNode}if(e.containment=="document"||e.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(e.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(e.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(e.containment)){var c=a(e.containment)[0];var d=a(e.containment).offset();var b=(a(c).css("overflow")!="hidden");this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(b?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(f,h){if(!h){h=this.position}var c=f=="absolute"?1:-1;var e=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(b[0].tagName);return{top:(h.top+this.offset.relative.top*c+this.offset.parent.top*c-(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(g?0:b.scrollTop()))*c),left:(h.left+this.offset.relative.left*c+this.offset.parent.left*c-(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:b.scrollLeft())*c)}},_generatePosition:function(e){var h=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,i=(/(html|body)/i).test(b[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}var d=e.pageX;var c=e.pageY;if(this.originalPosition){if(this.containment){if(e.pageX-this.offset.click.left<this.containment[0]){d=this.containment[0]+this.offset.click.left}if(e.pageY-this.offset.click.top<this.containment[1]){c=this.containment[1]+this.offset.click.top}if(e.pageX-this.offset.click.left>this.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:(!(g-this.offset.click.top<this.containment[1])?g-h.grid[1]:g+h.grid[1])):g;var f=this.originalPageX+Math.round((d-this.originalPageX)/h.grid[0])*h.grid[0];d=this.containment?(!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:(!(f-this.offset.click.left<this.containment[0])?f-h.grid[0]:f+h.grid[0])):f}}return{top:(c-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(i?0:b.scrollTop()))),left:(d-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():i?0:b.scrollLeft()))}},_clear:function(){this.helper.removeClass(this.options.cssNamespace+"-draggable-dragging");if(this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval){this.helper.remove()}this.helper=null;this.cancelHelperRemoval=false},_trigger:function(b,c,d){d=d||this._uiHash();a.ui.plugin.call(this,b,[c,d]);if(b=="drag"){this.positionAbs=this._convertPositionTo("absolute")}return a.widget.prototype._trigger.call(this,b,c,d)},plugins:{},_uiHash:function(b){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,options:this.options}}}));a.extend(a.ui.draggable,{version:"1.6rc5",eventPrefix:"drag",defaults:{appendTo:"parent",axis:false,cancel:":input,option",connectToSortable:false,containment:false,cssNamespace:"ui",cursor:"default",cursorAt:null,delay:0,distance:1,grid:false,handle:false,helper:"original",iframeFix:false,opacity:null,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:null}});a.ui.plugin.add("draggable","connectToSortable",{start:function(b,d){var c=a(this).data("draggable");c.sortables=[];a(d.options.connectToSortable).each(function(){a(this+"").each(function(){if(a.data(this,"sortable")){var e=a.data(this,"sortable");c.sortables.push({instance:e,shouldRevert:e.options.revert});e._refreshItems();e._trigger("activate",b,c)}})})},stop:function(b,d){var c=a(this).data("draggable");a.each(c.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;c.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert){this.instance.options.revert=true}this.instance._mouseStop(b);this.instance.element.triggerHandler("sortreceive",[b,a.extend(this.instance._uiHash(),{sender:c.element})],this.instance.options.receive);this.instance.options.helper=this.instance.options._helper;if(c.options.helper=="original"){this.instance.currentItem.css({top:"auto",left:"auto"})}}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",b,c)}})},drag:function(c,f){var e=a(this).data("draggable"),b=this;var d=function(i){var n=this.offset.click.top,m=this.offset.click.left;var g=this.positionAbs.top,k=this.positionAbs.left;var j=i.height,l=i.width;var p=i.top,h=i.left;return a.ui.isOver(g+n,k+m,p,h,j,l)};a.each(e.sortables,function(g){if(d.call(e,this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=a(b).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return f.helper[0]};c.target=this.instance.currentItem[0];this.instance._mouseCapture(c,true);this.instance._mouseStart(c,true,true);this.instance.offset.click.top=e.offset.click.top;this.instance.offset.click.left=e.offset.click.left;this.instance.offset.parent.left-=e.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=e.offset.parent.top-this.instance.offset.parent.top;e._trigger("toSortable",c);e.dropped=this.instance.element;this.instance.fromOutside=true}if(this.instance.currentItem){this.instance._mouseDrag(c)}}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._mouseStop(c,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder){this.instance.placeholder.remove()}e._trigger("fromSortable",c);e.dropped=false}}})}});a.ui.plugin.add("draggable","cursor",{start:function(c,d){var b=a("body");if(b.css("cursor")){d.options._cursor=b.css("cursor")}b.css("cursor",d.options.cursor)},stop:function(b,c){if(c.options._cursor){a("body").css("cursor",c.options._cursor)}}});a.ui.plugin.add("draggable","iframeFix",{start:function(b,c){a(c.options.iframeFix===true?"iframe":c.options.iframeFix).each(function(){a('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(a(this).offset()).appendTo("body")})},stop:function(b,c){a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});a.ui.plugin.add("draggable","opacity",{start:function(c,d){var b=a(d.helper);if(b.css("opacity")){d.options._opacity=b.css("opacity")}b.css("opacity",d.options.opacity)},stop:function(b,c){if(c.options._opacity){a(c.helper).css("opacity",c.options._opacity)}}});a.ui.plugin.add("draggable","scroll",{start:function(c,d){var e=d.options;var b=a(this).data("draggable");if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){b.overflowOffset=b.scrollParent.offset()}},drag:function(d,e){var f=e.options,b=false;var c=a(this).data("draggable");if(c.scrollParent[0]!=document&&c.scrollParent[0].tagName!="HTML"){if((c.overflowOffset.top+c.scrollParent[0].offsetHeight)-d.pageY<f.scrollSensitivity){c.scrollParent[0].scrollTop=b=c.scrollParent[0].scrollTop+f.scrollSpeed}else{if(d.pageY-c.overflowOffset.top<f.scrollSensitivity){c.scrollParent[0].scrollTop=b=c.scrollParent[0].scrollTop-f.scrollSpeed}}if((c.overflowOffset.left+c.scrollParent[0].offsetWidth)-d.pageX<f.scrollSensitivity){c.scrollParent[0].scrollLeft=b=c.scrollParent[0].scrollLeft+f.scrollSpeed}else{if(d.pageX-c.overflowOffset.left<f.scrollSensitivity){c.scrollParent[0].scrollLeft=b=c.scrollParent[0].scrollLeft-f.scrollSpeed}}}else{if(d.pageY-a(document).scrollTop()<f.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()-f.scrollSpeed)}else{if(a(window).height()-(d.pageY-a(document).scrollTop())<f.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()+f.scrollSpeed)}}if(d.pageX-a(document).scrollLeft()<f.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()-f.scrollSpeed)}else{if(a(window).width()-(d.pageX-a(document).scrollLeft())<f.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()+f.scrollSpeed)}}}if(b!==false&&a.ui.ddmanager&&!f.dropBehaviour){a.ui.ddmanager.prepareOffsets(c,d)}}});a.ui.plugin.add("draggable","snap",{start:function(b,d){var c=a(this).data("draggable");c.snapElements=[];a(d.options.snap.constructor!=String?(d.options.snap.items||":data(draggable)"):d.options.snap).each(function(){var f=a(this);var e=f.offset();if(this!=c.element[0]){c.snapElements.push({item:this,width:f.outerWidth(),height:f.outerHeight(),top:e.top,left:e.left})}})},drag:function(q,o){var g=a(this).data("draggable");var w=o.options.snapTolerance;var v=o.absolutePosition.left,u=v+g.helperProportions.width,f=o.absolutePosition.top,e=f+g.helperProportions.height;for(var s=g.snapElements.length-1;s>=0;s--){var p=g.snapElements[s].left,n=p+g.snapElements[s].width,m=g.snapElements[s].top,y=m+g.snapElements[s].height;if(!((p-w<v&&v<n+w&&m-w<f&&f<y+w)||(p-w<v&&v<n+w&&m-w<e&&e<y+w)||(p-w<u&&u<n+w&&m-w<f&&f<y+w)||(p-w<u&&u<n+w&&m-w<e&&e<y+w))){if(g.snapElements[s].snapping){(g.options.snap.release&&g.options.snap.release.call(g.element,q,a.extend(g._uiHash(),{snapItem:g.snapElements[s].item})))}g.snapElements[s].snapping=false;continue}if(o.options.snapMode!="inner"){var c=Math.abs(m-e)<=w;var x=Math.abs(y-f)<=w;var j=Math.abs(p-u)<=w;var k=Math.abs(n-v)<=w;if(c){o.position.top=g._convertPositionTo("relative",{top:m-g.helperProportions.height,left:0}).top}if(x){o.position.top=g._convertPositionTo("relative",{top:y,left:0}).top}if(j){o.position.left=g._convertPositionTo("relative",{top:0,left:p-g.helperProportions.width}).left}if(k){o.position.left=g._convertPositionTo("relative",{top:0,left:n}).left}}var h=(c||x||j||k);if(o.options.snapMode!="outer"){var c=Math.abs(m-f)<=w;var x=Math.abs(y-e)<=w;var j=Math.abs(p-v)<=w;var k=Math.abs(n-u)<=w;if(c){o.position.top=g._convertPositionTo("relative",{top:m,left:0}).top}if(x){o.position.top=g._convertPositionTo("relative",{top:y-g.helperProportions.height,left:0}).top}if(j){o.position.left=g._convertPositionTo("relative",{top:0,left:p}).left}if(k){o.position.left=g._convertPositionTo("relative",{top:0,left:n-g.helperProportions.width}).left}}if(!g.snapElements[s].snapping&&(c||x||j||k||h)){(g.options.snap.snap&&g.options.snap.snap.call(g.element,q,a.extend(g._uiHash(),{snapItem:g.snapElements[s].item})))}g.snapElements[s].snapping=(c||x||j||k||h)}}});a.ui.plugin.add("draggable","stack",{start:function(b,c){var d=a.makeArray(a(c.options.stack.group)).sort(function(f,e){return(parseInt(a(f).css("zIndex"),10)||c.options.stack.min)-(parseInt(a(e).css("zIndex"),10)||c.options.stack.min)});a(d).each(function(e){this.style.zIndex=c.options.stack.min+e});this[0].style.zIndex=c.options.stack.min+d.length}});a.ui.plugin.add("draggable","zIndex",{start:function(c,d){var b=a(d.helper);if(b.css("zIndex")){d.options._zIndex=b.css("zIndex")}b.css("zIndex",d.options.zIndex)},stop:function(b,c){if(c.options._zIndex){a(c.helper).css("zIndex",c.options._zIndex)}}})})(jQuery);(function(b){var a={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"};b.widget("ui.dialog",{_init:function(){this.originalTitle=this.element.attr("title");this.options.title=this.options.title||this.originalTitle;var l=this,m=this.options,j=m.title||"&nbsp;",d=b.ui.dialog.getTitleId(this.element),k=(this.uiDialog=b("<div/>")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+m.dialogClass).css({position:"absolute",overflow:"hidden",zIndex:m.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(n){(m.closeOnEscape&&n.keyCode&&n.keyCode==b.ui.keyCode.ESCAPE&&l.close())}).attr({role:"dialog","aria-labelledby":d}).mousedown(function(){l.moveToTop()}),f=this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(k),e=(this.uiDialogTitlebar=b("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(k),i=b('<a href="#"/>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){i.addClass("ui-state-hover")},function(){i.removeClass("ui-state-hover")}).focus(function(){i.addClass("ui-state-focus")}).blur(function(){i.removeClass("ui-state-focus")}).mousedown(function(n){n.stopPropagation()}).click(function(){l.close();return false}).appendTo(e),g=(this.uiDialogTitlebarCloseText=b("<span/>")).addClass("ui-icon ui-icon-closethick").text(m.closeText).appendTo(i),c=b("<span/>").addClass("ui-dialog-title").attr("id",d).html(j).prependTo(e),h=(this.uiDialogButtonPane=b("<div></div>")).addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix").appendTo(k);e.find("*").add(e).disableSelection();(m.draggable&&b.fn.draggable&&this._makeDraggable());(m.resizable&&b.fn.resizable&&this._makeResizable());this._createButtons(m.buttons);this._isOpen=false;(m.bgiframe&&b.fn.bgiframe&&k.bgiframe());(m.autoOpen&&this.open())},destroy:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide();this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");this.uiDialog.remove();(this.originalTitle&&this.element.attr("title",this.originalTitle))},close:function(){if(false===this._trigger("beforeclose")){return}(this.overlay&&this.overlay.destroy());this.uiDialog.hide(this.options.hide).unbind("keypress.ui-dialog");this._trigger("close");b.ui.dialog.overlay.resize();this._isOpen=false},isOpen:function(){return this._isOpen},moveToTop:function(f){if((this.options.modal&&!f)||(!this.options.stack&&!this.options.modal)){return this._trigger("focus")}var e=this.options.zIndex,d=this.options;b(".ui-dialog:visible").each(function(){e=Math.max(e,parseInt(b(this).css("z-index"),10)||d.zIndex)});(this.overlay&&this.overlay.$el.css("z-index",++e));var c={scrollTop:this.element.attr("scrollTop"),scrollLeft:this.element.attr("scrollLeft")};this.uiDialog.css("z-index",++e);this.element.attr(c);this._trigger("focus")},open:function(){if(this._isOpen){return}this.overlay=this.options.modal?new b.ui.dialog.overlay(this):null;(this.uiDialog.next().length&&this.uiDialog.appendTo("body"));this._size();this._position(this.options.position);this.uiDialog.show(this.options.show);this.moveToTop(true);(this.options.modal&&this.uiDialog.bind("keypress.ui-dialog",function(e){if(e.keyCode!=b.ui.keyCode.TAB){return}var d=b(":tabbable",this),f=d.filter(":first")[0],c=d.filter(":last")[0];if(e.target==c&&!e.shiftKey){setTimeout(function(){f.focus()},1)}else{if(e.target==f&&e.shiftKey){setTimeout(function(){c.focus()},1)}}}));this.uiDialog.find(":tabbable:first").focus();this._trigger("open");this._isOpen=true},_createButtons:function(f){var e=this,c=false,d=this.uiDialogButtonPane;d.empty().hide();b.each(f,function(){return!(c=true)});if(c){d.show();b.each(f,function(g,h){b('<button type="button"></button>').addClass("ui-state-default ui-corner-all").text(g).click(function(){h.apply(e.element[0],arguments)}).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")}).focus(function(){b(this).addClass("ui-state-focus")}).blur(function(){b(this).removeClass("ui-state-focus")}).appendTo(d)})}},_makeDraggable:function(){var c=this,d=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content",helper:d.dragHelper,handle:".ui-dialog-titlebar",containment:"document",start:function(){(d.dragStart&&d.dragStart.apply(c.element[0],arguments))},drag:function(){(d.drag&&d.drag.apply(c.element[0],arguments))},stop:function(){(d.dragStop&&d.dragStop.apply(c.element[0],arguments));b.ui.dialog.overlay.resize()}})},_makeResizable:function(f){f=(f===undefined?this.options.resizable:f);var c=this,e=this.options,d=typeof f=="string"?f:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",alsoResize:this.element,helper:e.resizeHelper,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:e.minHeight,start:function(){(e.resizeStart&&e.resizeStart.apply(c.element[0],arguments))},resize:function(){(e.resize&&e.resize.apply(c.element[0],arguments))},handles:d,stop:function(){(e.resizeStop&&e.resizeStop.apply(c.element[0],arguments));b.ui.dialog.overlay.resize()}}).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_position:function(h){var d=b(window),e=b(document),f=e.scrollTop(),c=e.scrollLeft(),g=f;if(b.inArray(h,["center","top","right","bottom","left"])>=0){h=[h=="right"||h=="left"?h:"center",h=="top"||h=="bottom"?h:"middle"]}if(h.constructor!=Array){h=["center","middle"]}if(h[0].constructor==Number){c+=h[0]}else{switch(h[0]){case"left":c+=0;break;case"right":c+=d.width()-this.uiDialog.outerWidth();break;default:case"center":c+=(d.width()-this.uiDialog.outerWidth())/2}}if(h[1].constructor==Number){f+=h[1]}else{switch(h[1]){case"top":f+=0;break;case"bottom":f+=d.height()-this.uiDialog.outerHeight();break;default:case"middle":f+=(d.height()-this.uiDialog.outerHeight())/2}}f=Math.max(f,g);this.uiDialog.css({top:f,left:c})},_setData:function(d,e){(a[d]&&this.uiDialog.data(a[d],e));switch(d){case"buttons":this._createButtons(e);break;case"closeText":this.uiDialogTitlebarCloseText.text(e);break;case"draggable":(e?this._makeDraggable():this.uiDialog.draggable("destroy"));break;case"height":this.uiDialog.height(e);break;case"position":this._position(e);break;case"resizable":var c=this.uiDialog,f=this.uiDialog.is(":data(resizable)");(f&&!e&&c.resizable("destroy"));(f&&typeof e=="string"&&c.resizable("option","handles",e));(f||this._makeResizable(e));break;case"title":b(".ui-dialog-title",this.uiDialogTitlebar).html(e||"&nbsp;");break;case"width":this.uiDialog.width(e);break}b.widget.prototype._setData.apply(this,arguments)},_size:function(){var d=this.options;this.element.css({height:0,minHeight:0,width:"auto"});var c=this.uiDialog.css({height:"auto",width:d.width}).height();this.element.css({minHeight:d.minHeight-c,height:d.height=="auto"?"auto":d.height-c})}});b.extend(b.ui.dialog,{version:"1.6rc5",defaults:{autoOpen:true,bgiframe:false,buttons:{},closeOnEscape:true,closeText:"close",draggable:true,height:"auto",minHeight:150,minWidth:150,modal:false,overlay:{},position:"center",resizable:true,stack:true,width:300,zIndex:1000},getter:"isOpen",uuid:0,getTitleId:function(c){return"ui-dialog-title-"+(c.attr("id")||++this.uuid)},overlay:function(c){this.$el=b.ui.dialog.overlay.create(c)}});b.extend(b.ui.dialog.overlay,{instances:[],events:b.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(c){return c+".dialog-overlay"}).join(" "),create:function(d){if(this.instances.length===0){setTimeout(function(){b("a, :input").bind(b.ui.dialog.overlay.events,function(){var f=false;var h=b(this).parents(".ui-dialog");if(h.length){var e=b(".ui-dialog-overlay");if(e.length){var g=parseInt(e.css("z-index"),10);e.each(function(){g=Math.max(g,parseInt(b(this).css("z-index"),10))});f=parseInt(h.css("z-index"),10)>g}else{f=true}}return f})},1);b(document).bind("keydown.dialog-overlay",function(e){(d.options.closeOnEscape&&e.keyCode&&e.keyCode==b.ui.keyCode.ESCAPE&&d.close())});b(window).bind("resize.dialog-overlay",b.ui.dialog.overlay.resize)}var c=b("<div></div>").appendTo(document.body).addClass("ui-dialog-overlay").css(b.extend({borderWidth:0,margin:0,padding:0,position:"absolute",top:0,left:0,width:this.width(),height:this.height()},d.options.overlay));(d.options.bgiframe&&b.fn.bgiframe&&c.bgiframe());this.instances.push(c);return c},destroy:function(c){this.instances.splice(b.inArray(this.instances,c),1);if(this.instances.length===0){b("a, :input").add([document,window]).unbind(".dialog-overlay")}c.remove()},height:function(){if(b.browser.msie&&b.browser.version<7){var d=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);var c=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(d<c){return b(window).height()+"px"}else{return d+"px"}}else{return b(document).height()+"px"}},width:function(){if(b.browser.msie&&b.browser.version<7){var c=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);var d=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);if(c<d){return b(window).width()+"px"}else{return c+"px"}}else{return b(document).width()+"px"}},resize:function(){var c=b([]);b.each(b.ui.dialog.overlay.instances,function(){c=c.add(this)});c.css({width:0,height:0}).css({width:b.ui.dialog.overlay.width(),height:b.ui.dialog.overlay.height()})}});b.extend(b.ui.dialog.overlay.prototype,{destroy:function(){b.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);(function(b){b.widget("ui.resizable",b.extend({},b.ui.mouse,{_init:function(){var q=this,r=this.options;var u=this.element.css("position");this.originalElement=this.element;this.element.addClass("ui-resizable").css({position:/static/.test(u)?"relative":u});b.extend(r,{_aspectRatio:!!(r.aspectRatio),helper:r.helper||r.ghost||r.animate?r.helper||"ui-resizable-helper":null,knobHandles:r.knobHandles===true?"ui-resizable-knob-handle":r.knobHandles});var j="1px solid #DEDEDE";r.defaultTheme={"ui-resizable":{display:"block"},"ui-resizable-handle":{position:"absolute",background:"#F2F2F2",fontSize:"0.1px"},"ui-resizable-n":{cursor:"n-resize",height:"4px",left:"0px",right:"0px",borderTop:j},"ui-resizable-s":{cursor:"s-resize",height:"4px",left:"0px",right:"0px",borderBottom:j},"ui-resizable-e":{cursor:"e-resize",width:"4px",top:"0px",bottom:"0px",borderRight:j},"ui-resizable-w":{cursor:"w-resize",width:"4px",top:"0px",bottom:"0px",borderLeft:j},"ui-resizable-se":{cursor:"se-resize",width:"4px",height:"4px",borderRight:j,borderBottom:j},"ui-resizable-sw":{cursor:"sw-resize",width:"4px",height:"4px",borderBottom:j,borderLeft:j},"ui-resizable-ne":{cursor:"ne-resize",width:"4px",height:"4px",borderRight:j,borderTop:j},"ui-resizable-nw":{cursor:"nw-resize",width:"4px",height:"4px",borderLeft:j,borderTop:j}};r.knobTheme={"ui-resizable-handle":{background:"#F2F2F2",border:"1px solid #808080",height:"8px",width:"8px"},"ui-resizable-n":{cursor:"n-resize",top:"0px",left:"45%"},"ui-resizable-s":{cursor:"s-resize",bottom:"0px",left:"45%"},"ui-resizable-e":{cursor:"e-resize",right:"0px",top:"45%"},"ui-resizable-w":{cursor:"w-resize",left:"0px",top:"45%"},"ui-resizable-se":{cursor:"se-resize",right:"0px",bottom:"0px"},"ui-resizable-sw":{cursor:"sw-resize",left:"0px",bottom:"0px"},"ui-resizable-nw":{cursor:"nw-resize",left:"0px",top:"0px"},"ui-resizable-ne":{cursor:"ne-resize",right:"0px",top:"0px"}};r._nodeName=this.element[0].nodeName;if(r._nodeName.match(/canvas|textarea|input|select|button|img/i)){var c=this.element;if(/relative/.test(c.css("position"))&&b.browser.opera){c.css({position:"relative",top:"auto",left:"auto"})}c.wrap(b('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:c.css("position"),width:c.outerWidth(),height:c.outerHeight(),top:c.css("top"),left:c.css("left")}));var l=this.element;this.element=this.element.parent();this.element.data("resizable",this);this.element.css({marginLeft:l.css("marginLeft"),marginTop:l.css("marginTop"),marginRight:l.css("marginRight"),marginBottom:l.css("marginBottom")});l.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});if(b.browser.safari&&r.preventDefault){l.css("resize","none")}r.proportionallyResize=l.css({position:"static",zoom:1,display:"block"});this.element.css({margin:l.css("margin")});this._proportionallyResize()}if(!r.handles){r.handles=!b(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}}if(r.handles.constructor==String){r.zIndex=r.zIndex||1000;if(r.handles=="all"){r.handles="n,e,s,w,se,sw,ne,nw"}var s=r.handles.split(",");r.handles={};var h={handle:"position: absolute; display: none; overflow:hidden;",n:"top: 0pt; width:100%;",e:"right: 0pt; height:100%;",s:"bottom: 0pt; width:100%;",w:"left: 0pt; height:100%;",se:"bottom: 0pt; right: 0px;",sw:"bottom: 0pt; left: 0px;",ne:"top: 0pt; right: 0px;",nw:"top: 0pt; left: 0px;"};for(var v=0;v<s.length;v++){var w=b.trim(s[v]),p=r.defaultTheme,g="ui-resizable-"+w,d=!b.ui.css(g)&&!r.knobHandles,t=b.ui.css("ui-resizable-knob-handle"),x=b.extend(p[g],p["ui-resizable-handle"]),e=b.extend(r.knobTheme[g],!t?r.knobTheme["ui-resizable-handle"]:{});var m=/sw|se|ne|nw/.test(w)?{zIndex:++r.zIndex}:{};var k=(d?h[w]:""),f=b(['<div class="ui-resizable-handle ',g,'" style="',k,h.handle,'"></div>'].join("")).css(m);if("se"==w){f.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}r.handles[w]=".ui-resizable-"+w;this.element.append(f.css(d?x:{}).css(r.knobHandles?e:{}).addClass(r.knobHandles?"ui-resizable-knob-handle":"").addClass(r.knobHandles))}if(r.knobHandles){this.element.addClass("ui-resizable-knob").css(!b.ui.css("ui-resizable-knob")?{}:{})}}this._renderAxis=function(A){A=A||this.element;for(var o in r.handles){if(r.handles[o].constructor==String){r.handles[o]=b(r.handles[o],this.element).show()}if(r.transparent){r.handles[o].css({opacity:0})}if(this.element.is(".ui-wrapper")&&r._nodeName.match(/textarea|input|select|button/i)){var y=b(r.handles[o],this.element),z=0;z=/sw|ne|nw|se|n|s/.test(o)?y.outerHeight():y.outerWidth();var n=["padding",/ne|nw|n/.test(o)?"Top":/se|sw|s/.test(o)?"Bottom":/^e$/.test(o)?"Right":"Left"].join("");if(!r.transparent){A.css(n,z)}this._proportionallyResize()}if(!b(r.handles[o]).length){continue}}};this._renderAxis(this.element);r._handles=b(".ui-resizable-handle",q.element);if(r.disableSelection){r._handles.disableSelection()}r._handles.mouseover(function(){if(!r.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}q.axis=r.axis=i&&i[1]?i[1]:"se"}});if(r.autoHide){r._handles.hide();b(q.element).addClass("ui-resizable-autohide").hover(function(){b(this).removeClass("ui-resizable-autohide");r._handles.show()},function(){if(!r.resizing){b(this).addClass("ui-resizable-autohide");r._handles.hide()}})}this._mouseInit()},destroy:function(){var e=this.element,d=e.children(".ui-resizable").get(0);this._mouseDestroy();var c=function(f){b(f).removeClass("ui-resizable ui-resizable-disabled").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};c(e);if(e.is(".ui-wrapper")&&d){e.parent().append(b(d).css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")})).end().remove();c(d)}},_mouseCapture:function(d){if(this.options.disabled){return false}var e=false;for(var c in this.options.handles){if(b(this.options.handles[c])[0]==d.target){e=true}}if(!e){return false}return true},_mouseStart:function(d){var e=this.options,c=this.element.position(),f=this.element,j=function(o){return parseInt(o,10)||0},i=b.browser.msie&&b.browser.version<7;e.resizing=true;e.documentScroll={top:b(document).scrollTop(),left:b(document).scrollLeft()};if(f.is(".ui-draggable")||(/absolute/).test(f.css("position"))){var l=b.browser.msie&&!e.containment&&(/absolute/).test(f.css("position"))&&!(/relative/).test(f.parent().css("position"));var m=l?e.documentScroll.top:0,h=l?e.documentScroll.left:0;f.css({position:"absolute",top:(c.top+m),left:(c.left+h)})}if(b.browser.opera&&(/relative/).test(f.css("position"))){f.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var n=j(this.helper.css("left")),g=j(this.helper.css("top"));if(e.containment){n+=b(e.containment).scrollLeft()||0;g+=b(e.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:n,top:g};this.size=e.helper||i?{width:f.outerWidth(),height:f.outerHeight()}:{width:f.width(),height:f.height()};this.originalSize=e.helper||i?{width:f.outerWidth(),height:f.outerHeight()}:{width:f.width(),height:f.height()};this.originalPosition={left:n,top:g};this.sizeDiff={width:f.outerWidth()-f.width(),height:f.outerHeight()-f.height()};this.originalMousePosition={left:d.pageX,top:d.pageY};e.aspectRatio=(typeof e.aspectRatio=="number")?e.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);if(e.preserveCursor){var k=b(".ui-resizable-"+this.axis).css("cursor");b("body").css("cursor",k=="auto"?this.axis+"-resize":k)}this._propagate("start",d);return true},_mouseDrag:function(c){var f=this.helper,e=this.options,k={},n=this,h=this.originalMousePosition,l=this.axis;var p=(c.pageX-h.left)||0,m=(c.pageY-h.top)||0;var g=this._change[l];if(!g){return false}var j=g.apply(this,[c,p,m]),i=b.browser.msie&&b.browser.version<7,d=this.sizeDiff;if(e._aspectRatio||c.shiftKey){j=this._updateRatio(j,c)}j=this._respectSize(j,c);this._propagate("resize",c);f.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!e.helper&&e.proportionallyResize){this._proportionallyResize()}this._updateCache(j);this._trigger("resize",c,this.ui());return false},_mouseStop:function(f){this.options.resizing=false;var g=this.options,j=function(n){return parseInt(n,10)||0},l=this;if(g.helper){var e=g.proportionallyResize,c=e&&(/textarea/i).test(e.get(0).nodeName),d=c&&b.ui.hasScroll(e.get(0),"left")?0:l.sizeDiff.height,i=c?0:l.sizeDiff.width;var m={width:(l.size.width-i),height:(l.size.height-d)},h=(parseInt(l.element.css("left"),10)+(l.position.left-l.originalPosition.left))||null,k=(parseInt(l.element.css("top"),10)+(l.position.top-l.originalPosition.top))||null;if(!g.animate){this.element.css(b.extend(m,{top:k,left:h}))}if(g.helper&&!g.animate){this._proportionallyResize()}}if(g.preserveCursor){b("body").css("cursor","auto")}this._propagate("stop",f);if(g.helper){this.helper.remove()}return false},_updateCache:function(c){var d=this.options;this.offset=this.helper.offset();if(c.left){this.position.left=c.left}if(c.top){this.position.top=c.top}if(c.height){this.size.height=c.height}if(c.width){this.size.width=c.width}},_updateRatio:function(f,e){var g=this.options,h=this.position,d=this.size,c=this.axis;if(f.height){f.width=(d.height*g.aspectRatio)}else{if(f.width){f.height=(d.width/g.aspectRatio)}}if(c=="sw"){f.left=h.left+(d.width-f.width);f.top=null}if(c=="nw"){f.top=h.top+(d.height-f.height);f.left=h.left+(d.width-f.width)}return f},_respectSize:function(j,e){var h=this.helper,g=this.options,p=g._aspectRatio||e.shiftKey,n=this.axis,r=j.width&&g.maxWidth&&g.maxWidth<j.width,k=j.height&&g.maxHeight&&g.maxHeight<j.height,f=j.width&&g.minWidth&&g.minWidth>j.width,q=j.height&&g.minHeight&&g.minHeight>j.height;if(f){j.width=g.minWidth}if(q){j.height=g.minHeight}if(r){j.width=g.maxWidth}if(k){j.height=g.maxHeight}var d=this.originalPosition.left+this.originalSize.width,m=this.position.top+this.size.height;var i=/sw|nw|w/.test(n),c=/nw|ne|n/.test(n);if(f&&i){j.left=d-g.minWidth}if(r&&i){j.left=d-g.maxWidth}if(q&&c){j.top=m-g.minHeight}if(k&&c){j.top=m-g.maxHeight}var l=!j.width&&!j.height;if(l&&!j.left&&j.top){j.top=null}else{if(l&&!j.top&&j.left){j.left=null}}return j},_proportionallyResize:function(){var g=this.options;if(!g.proportionallyResize){return}var e=g.proportionallyResize,d=this.helper||this.element;if(!g.borderDif){var c=[e.css("borderTopWidth"),e.css("borderRightWidth"),e.css("borderBottomWidth"),e.css("borderLeftWidth")],f=[e.css("paddingTop"),e.css("paddingRight"),e.css("paddingBottom"),e.css("paddingLeft")];g.borderDif=b.map(c,function(h,k){var j=parseInt(h,10)||0,l=parseInt(f[k],10)||0;return j+l})}if(b.browser.msie&&!a(d)){return}e.css({height:(d.height()-g.borderDif[0]-g.borderDif[2])||0,width:(d.width()-g.borderDif[1]-g.borderDif[3])||0})},_renderProxy:function(){var d=this.element,g=this.options;this.elementOffset=d.offset();if(g.helper){this.helper=this.helper||b('<div style="overflow:hidden;"></div>');var c=b.browser.msie&&b.browser.version<7,e=(c?1:0),f=(c?2:-1);this.helper.addClass(g.helper).css({width:d.outerWidth()+f,height:d.outerHeight()+f,position:"absolute",left:this.elementOffset.left-e+"px",top:this.elementOffset.top-e+"px",zIndex:++g.zIndex});this.helper.appendTo("body");if(g.disableSelection){this.helper.disableSelection()}}else{this.helper=d}},_change:{e:function(e,d,c){return{width:this.originalSize.width+d}},w:function(f,d,c){var h=this.options,e=this.originalSize,g=this.originalPosition;return{left:g.left+d,width:e.width-d}},n:function(f,d,c){var h=this.options,e=this.originalSize,g=this.originalPosition;return{top:g.top+c,height:e.height-c}},s:function(e,d,c){return{height:this.originalSize.height+c}},se:function(e,d,c){return b.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,d,c]))},sw:function(e,d,c){return b.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,d,c]))},ne:function(e,d,c){return b.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,d,c]))},nw:function(e,d,c){return b.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,d,c]))}},_propagate:function(d,c){b.ui.plugin.call(this,d,[c,this.ui()]);(d!="resize"&&this._trigger(d,c,this.ui()))},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,options:this.options,originalSize:this.originalSize,originalPosition:this.originalPosition}}}));b.extend(b.ui.resizable,{version:"1.6rc5",eventPrefix:"resize",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input,option",containment:false,delay:0,disableSelection:true,distance:1,ghost:false,grid:false,knobHandles:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,preserveCursor:true,preventDefault:true,proportionallyResize:false,transparent:false}});b.ui.plugin.add("resizable","alsoResize",{start:function(d,e){var g=e.options,c=b(this).data("resizable"),f=function(h){b(h).each(function(){b(this).data("resizable-alsoresize",{width:parseInt(b(this).width(),10),height:parseInt(b(this).height(),10),left:parseInt(b(this).css("left"),10),top:parseInt(b(this).css("top"),10)})})};if(typeof(g.alsoResize)=="object"&&!g.alsoResize.parentNode){if(g.alsoResize.length){g.alsoResize=g.alsoResize[0];f(g.alsoResize)}else{b.each(g.alsoResize,function(h,i){f(h)})}}else{f(g.alsoResize)}},resize:function(e,g){var h=g.options,d=b(this).data("resizable"),f=d.originalSize,j=d.originalPosition;var i={height:(d.size.height-f.height)||0,width:(d.size.width-f.width)||0,top:(d.position.top-j.top)||0,left:(d.position.left-j.left)||0},c=function(k,l){b(k).each(function(){var o=b(this),p=b(this).data("resizable-alsoresize"),n={},m=l&&l.length?l:["width","height","top","left"];b.each(m||["width","height","top","left"],function(q,s){var r=(p[s]||0)+(i[s]||0);if(r&&r>=0){n[s]=r||null}});if(/relative/.test(o.css("position"))&&b.browser.opera){d._revertToRelativePosition=true;o.css({position:"absolute",top:"auto",left:"auto"})}o.css(n)})};if(typeof(h.alsoResize)=="object"&&!h.alsoResize.nodeType){b.each(h.alsoResize,function(k,l){c(k,l)})}else{c(h.alsoResize)}},stop:function(d,e){var c=b(this).data("resizable");if(c._revertToRelativePosition&&b.browser.opera){c._revertToRelativePosition=false;el.css({position:"relative"})}b(this).removeData("resizable-alsoresize-start")}});b.ui.plugin.add("resizable","animate",{stop:function(g,l){var h=l.options,m=b(this).data("resizable");var f=h.proportionallyResize,c=f&&(/textarea/i).test(f.get(0).nodeName),d=c&&b.ui.hasScroll(f.get(0),"left")?0:m.sizeDiff.height,j=c?0:m.sizeDiff.width;var e={width:(m.size.width-j),height:(m.size.height-d)},i=(parseInt(m.element.css("left"),10)+(m.position.left-m.originalPosition.left))||null,k=(parseInt(m.element.css("top"),10)+(m.position.top-m.originalPosition.top))||null;m.element.animate(b.extend(e,k&&i?{top:k,left:i}:{}),{duration:h.animateDuration,easing:h.animateEasing,step:function(){var n={width:parseInt(m.element.css("width"),10),height:parseInt(m.element.css("height"),10),top:parseInt(m.element.css("top"),10),left:parseInt(m.element.css("left"),10)};if(f){f.css({width:n.width,height:n.height})}m._updateCache(n);m._propagate("resize",g)}})}});b.ui.plugin.add("resizable","containment",{start:function(d,l){var g=l.options,n=b(this).data("resizable"),i=n.element;var e=g.containment,h=(e instanceof b)?e.get(0):(/parent/.test(e))?i.parent().get(0):e;if(!h){return}n.containerElement=b(h);if(/document/.test(e)||e==document){n.containerOffset={left:0,top:0};n.containerPosition={left:0,top:0};n.parentData={element:b(document),left:0,top:0,width:b(document).width(),height:b(document).height()||document.body.parentNode.scrollHeight}}else{n.containerOffset=b(h).offset();n.containerPosition=b(h).position();n.containerSize={height:b(h).innerHeight(),width:b(h).innerWidth()};var k=n.containerOffset,c=n.containerSize.height,j=n.containerSize.width,f=(b.ui.hasScroll(h,"left")?h.scrollWidth:j),m=(b.ui.hasScroll(h)?h.scrollHeight:c);n.parentData={element:h,left:k.left,top:k.top,width:f,height:m}}},resize:function(e,l){var g=l.options,p=b(this).data("resizable"),d=p.containerSize,k=p.containerOffset,i=p.size,j=p.position,m=g._aspectRatio||e.shiftKey,c={top:0,left:0},f=p.containerElement;if(f[0]!=document&&(/static/).test(f.css("position"))){c=p.containerPosition}if(j.left<(g.helper?k.left:0)){p.size.width=p.size.width+(g.helper?(p.position.left-k.left):(p.position.left-c.left));if(m){p.size.height=p.size.width/g.aspectRatio}p.position.left=g.helper?k.left:0}if(j.top<(g.helper?k.top:0)){p.size.height=p.size.height+(g.helper?(p.position.top-k.top):p.position.top);if(m){p.size.width=p.size.height*g.aspectRatio}p.position.top=g.helper?k.top:0}var h=Math.abs((g.helper?p.offset.left-c.left:(p.offset.left-c.left))+p.sizeDiff.width),n=Math.abs((g.helper?p.offset.top-c.top:(p.offset.top-k.top))+p.sizeDiff.height);if(h+p.size.width>=p.parentData.width){p.size.width=p.parentData.width-h;if(m){p.size.height=p.size.width/g.aspectRatio}}if(n+p.size.height>=p.parentData.height){p.size.height=p.parentData.height-n;if(m){p.size.width=p.size.height*g.aspectRatio}}},stop:function(d,l){var e=l.options,n=b(this).data("resizable"),j=n.position,k=n.containerOffset,c=n.containerPosition,f=n.containerElement;var g=b(n.helper),p=g.offset(),m=g.outerWidth()-n.sizeDiff.width,i=g.outerHeight()-n.sizeDiff.height;if(e.helper&&!e.animate&&(/relative/).test(f.css("position"))){b(this).css({left:p.left-c.left-k.left,width:m,height:i})}if(e.helper&&!e.animate&&(/static/).test(f.css("position"))){b(this).css({left:p.left-c.left-k.left,width:m,height:i})}}});b.ui.plugin.add("resizable","ghost",{start:function(e,f){var g=f.options,c=b(this).data("resizable"),h=g.proportionallyResize,d=c.size;if(!h){c.ghost=c.element.clone()}else{c.ghost=h.clone()}c.ghost.css({opacity:0.25,display:"block",position:"relative",height:d.height,width:d.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof g.ghost=="string"?g.ghost:"");c.ghost.appendTo(c.helper)},resize:function(d,e){var f=e.options,c=b(this).data("resizable"),g=f.proportionallyResize;if(c.ghost){c.ghost.css({position:"relative",height:c.size.height,width:c.size.width})}},stop:function(d,e){var f=e.options,c=b(this).data("resizable"),g=f.proportionallyResize;if(c.ghost&&c.helper){c.helper.get(0).removeChild(c.ghost.get(0))}}});b.ui.plugin.add("resizable","grid",{resize:function(c,k){var f=k.options,m=b(this).data("resizable"),i=m.size,g=m.originalSize,h=m.originalPosition,l=m.axis,j=f._aspectRatio||c.shiftKey;f.grid=typeof f.grid=="number"?[f.grid,f.grid]:f.grid;var e=Math.round((i.width-g.width)/(f.grid[0]||1))*(f.grid[0]||1),d=Math.round((i.height-g.height)/(f.grid[1]||1))*(f.grid[1]||1);if(/^(se|s|e)$/.test(l)){m.size.width=g.width+e;m.size.height=g.height+d}else{if(/^(ne)$/.test(l)){m.size.width=g.width+e;m.size.height=g.height+d;m.position.top=h.top-d}else{if(/^(sw)$/.test(l)){m.size.width=g.width+e;m.size.height=g.height+d;m.position.left=h.left-e}else{m.size.width=g.width+e;m.size.height=g.height+d;m.position.top=h.top-d;m.position.left=h.left-e}}}}});function a(c){return!(b(c).is(":hidden")||b(c).parents(":hidden").length)}})(jQuery);(function(c){c.effects=c.effects||{};c.extend(c.effects,{version:"1.6rc5",save:function(f,g){for(var e=0;e<g.length;e++){if(g[e]!==null){f.data("ec.storage."+g[e],f[0].style[g[e]])}}},restore:function(f,g){for(var e=0;e<g.length;e++){if(g[e]!==null){f.css(g[e],f.data("ec.storage."+g[e]))}}},setMode:function(e,f){if(f=="toggle"){f=e.is(":hidden")?"show":"hide"}return f},getBaseline:function(f,g){var h,e;switch(f[0]){case"top":h=0;break;case"middle":h=0.5;break;case"bottom":h=1;break;default:h=f[0]/g.height}switch(f[1]){case"left":e=0;break;case"center":e=0.5;break;case"right":e=1;break;default:e=f[1]/g.width}return{x:e,y:h}},createWrapper:function(e){if(e.parent().is(".ui-effects-wrapper")){return e.parent()}var f={width:e.outerWidth(true),height:e.outerHeight(true),"float":e.css("float")};e.wrap('<div class="ui-effects-wrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');var i=e.parent();if(e.css("position")=="static"){i.css({position:"relative"});e.css({position:"relative"})}else{var h=e.css("top");if(isNaN(parseInt(h,10))){h="auto"}var g=e.css("left");if(isNaN(parseInt(g,10))){g="auto"}i.css({position:e.css("position"),top:h,left:g,zIndex:e.css("z-index")}).show();e.css({position:"relative",top:0,left:0})}i.css(f);return i},removeWrapper:function(e){if(e.parent().is(".ui-effects-wrapper")){return e.parent().replaceWith(e)}return e},setTransition:function(f,h,e,g){g=g||{};c.each(h,function(k,j){unit=f.cssUnit(j);if(unit[0]>0){g[j]=unit[0]*e+unit[1]}});return g},animateClass:function(g,h,j,i){var e=(typeof j=="function"?j:(i?i:null));var f=(typeof j=="string"?j:null);return this.each(function(){var p={};var m=c(this);var o=m.attr("style")||"";if(typeof o=="object"){o=o.cssText}if(g.toggle){m.hasClass(g.toggle)?g.remove=g.toggle:g.add=g.toggle}var k=c.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(g.add){m.addClass(g.add)}if(g.remove){m.removeClass(g.remove)}var l=c.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(g.add){m.removeClass(g.add)}if(g.remove){m.addClass(g.remove)}for(var q in l){if(typeof l[q]!="function"&&l[q]&&q.indexOf("Moz")==-1&&q.indexOf("length")==-1&&l[q]!=k[q]&&(q.match(/color/i)||(!q.match(/color/i)&&!isNaN(parseInt(l[q],10))))&&(k.position!="static"||(k.position=="static"&&!q.match(/left|top|bottom|right/)))){p[q]=l[q]}}m.animate(p,h,f,function(){if(typeof c(this).attr("style")=="object"){c(this).attr("style")["cssText"]="";c(this).attr("style")["cssText"]=o}else{c(this).attr("style",o)}if(g.add){c(this).addClass(g.add)}if(g.remove){c(this).removeClass(g.remove)}if(e){e.apply(this,arguments)}})})}});c.fn.extend({_show:c.fn.show,_hide:c.fn.hide,__toggle:c.fn.toggle,_addClass:c.fn.addClass,_removeClass:c.fn.removeClass,_toggleClass:c.fn.toggleClass,effect:function(f,e,g,h){return c.effects[f]?c.effects[f].call(this,{method:f,options:e||{},duration:g,callback:h}):null},show:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._show.apply(this,arguments)}else{var e=arguments[1]||{};e.mode="show";return this.effect.apply(this,[arguments[0],e,arguments[2]||e.duration,arguments[3]||e.callback])}},hide:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._hide.apply(this,arguments)}else{var e=arguments[1]||{};e.mode="hide";return this.effect.apply(this,[arguments[0],e,arguments[2]||e.duration,arguments[3]||e.callback])}},toggle:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))||(arguments[0].constructor==Function)){return this.__toggle.apply(this,arguments)}else{var e=arguments[1]||{};e.mode="toggle";return this.effect.apply(this,[arguments[0],e,arguments[2]||e.duration,arguments[3]||e.callback])}},addClass:function(f,e,h,g){return e?c.effects.animateClass.apply(this,[{add:f},e,h,g]):this._addClass(f)},removeClass:function(f,e,h,g){return e?c.effects.animateClass.apply(this,[{remove:f},e,h,g]):this._removeClass(f)},toggleClass:function(f,e,h,g){return e?c.effects.animateClass.apply(this,[{toggle:f},e,h,g]):this._toggleClass(f)},morph:function(e,g,f,i,h){return c.effects.animateClass.apply(this,[{add:g,remove:e},f,i,h])},switchClass:function(){return this.morph.apply(this,arguments)},cssUnit:function(e){var f=this.css(e),g=[];c.each(["em","px","%","pt"],function(h,j){if(f.indexOf(j)>0){g=[parseFloat(f),j]}});return g}});c.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(f,e){c.fx.step[e]=function(g){if(g.state==0){g.start=d(g.elem,e);g.end=b(g.end)}g.elem.style[e]="rgb("+[Math.max(Math.min(parseInt((g.pos*(g.end[0]-g.start[0]))+g.start[0],10),255),0),Math.max(Math.min(parseInt((g.pos*(g.end[1]-g.start[1]))+g.start[1],10),255),0),Math.max(Math.min(parseInt((g.pos*(g.end[2]-g.start[2]))+g.start[2],10),255),0)].join(",")+")"}});function b(f){var e;if(f&&f.constructor==Array&&f.length==3){return f}if(e=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(f)){return[parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3],10)]}if(e=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(f)){return[parseFloat(e[1])*2.55,parseFloat(e[2])*2.55,parseFloat(e[3])*2.55]}if(e=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(f)){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}if(e=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(f)){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}if(e=/rgba\(0, 0, 0, 0\)/.exec(f)){return a.transparent}return a[c.trim(f).toLowerCase()]}function d(g,e){var f;do{f=c.curCSS(g,e);if(f!=""&&f!="transparent"||c.nodeName(g,"body")){break}e="backgroundColor"}while(g=g.parentNode);return b(f)}var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};c.easing.jswing=c.easing.swing;c.extend(c.easing,{def:"easeOutQuad",swing:function(f,g,e,i,h){return c.easing[c.easing.def](f,g,e,i,h)},easeInQuad:function(f,g,e,i,h){return i*(g/=h)*g+e},easeOutQuad:function(f,g,e,i,h){return-i*(g/=h)*(g-2)+e},easeInOutQuad:function(f,g,e,i,h){if((g/=h/2)<1){return i/2*g*g+e}return-i/2*((--g)*(g-2)-1)+e},easeInCubic:function(f,g,e,i,h){return i*(g/=h)*g*g+e},easeOutCubic:function(f,g,e,i,h){return i*((g=g/h-1)*g*g+1)+e},easeInOutCubic:function(f,g,e,i,h){if((g/=h/2)<1){return i/2*g*g*g+e}return i/2*((g-=2)*g*g+2)+e},easeInQuart:function(f,g,e,i,h){return i*(g/=h)*g*g*g+e},easeOutQuart:function(f,g,e,i,h){return-i*((g=g/h-1)*g*g*g-1)+e},easeInOutQuart:function(f,g,e,i,h){if((g/=h/2)<1){return i/2*g*g*g*g+e}return-i/2*((g-=2)*g*g*g-2)+e},easeInQuint:function(f,g,e,i,h){return i*(g/=h)*g*g*g*g+e},easeOutQuint:function(f,g,e,i,h){return i*((g=g/h-1)*g*g*g*g+1)+e},easeInOutQuint:function(f,g,e,i,h){if((g/=h/2)<1){return i/2*g*g*g*g*g+e}return i/2*((g-=2)*g*g*g*g+2)+e},easeInSine:function(f,g,e,i,h){return-i*Math.cos(g/h*(Math.PI/2))+i+e},easeOutSine:function(f,g,e,i,h){return i*Math.sin(g/h*(Math.PI/2))+e},easeInOutSine:function(f,g,e,i,h){return-i/2*(Math.cos(Math.PI*g/h)-1)+e},easeInExpo:function(f,g,e,i,h){return(g==0)?e:i*Math.pow(2,10*(g/h-1))+e},easeOutExpo:function(f,g,e,i,h){return(g==h)?e+i:i*(-Math.pow(2,-10*g/h)+1)+e},easeInOutExpo:function(f,g,e,i,h){if(g==0){return e}if(g==h){return e+i}if((g/=h/2)<1){return i/2*Math.pow(2,10*(g-1))+e}return i/2*(-Math.pow(2,-10*--g)+2)+e},easeInCirc:function(f,g,e,i,h){return-i*(Math.sqrt(1-(g/=h)*g)-1)+e},easeOutCirc:function(f,g,e,i,h){return i*Math.sqrt(1-(g=g/h-1)*g)+e},easeInOutCirc:function(f,g,e,i,h){if((g/=h/2)<1){return-i/2*(Math.sqrt(1-g*g)-1)+e}return i/2*(Math.sqrt(1-(g-=2)*g)+1)+e},easeInElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}return-(g*Math.pow(2,10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j))+e},easeOutElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}return g*Math.pow(2,-10*h)*Math.sin((h*k-i)*(2*Math.PI)/j)+l+e},easeInOutElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k/2)==2){return e+l}if(!j){j=k*(0.3*1.5)}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}if(h<1){return-0.5*(g*Math.pow(2,10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j))+e}return g*Math.pow(2,-10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j)*0.5+l+e},easeInBack:function(f,g,e,j,i,h){if(h==undefined){h=1.70158}return j*(g/=i)*g*((h+1)*g-h)+e},easeOutBack:function(f,g,e,j,i,h){if(h==undefined){h=1.70158}return j*((g=g/i-1)*g*((h+1)*g+h)+1)+e},easeInOutBack:function(f,g,e,j,i,h){if(h==undefined){h=1.70158}if((g/=i/2)<1){return j/2*(g*g*(((h*=(1.525))+1)*g-h))+e}return j/2*((g-=2)*g*(((h*=(1.525))+1)*g+h)+2)+e},easeInBounce:function(f,g,e,i,h){return i-c.easing.easeOutBounce(f,h-g,0,i,h)+e},easeOutBounce:function(f,g,e,i,h){if((g/=h)<(1/2.75)){return i*(7.5625*g*g)+e}else{if(g<(2/2.75)){return i*(7.5625*(g-=(1.5/2.75))*g+0.75)+e}else{if(g<(2.5/2.75)){return i*(7.5625*(g-=(2.25/2.75))*g+0.9375)+e}else{return i*(7.5625*(g-=(2.625/2.75))*g+0.984375)+e}}}},easeInOutBounce:function(f,g,e,i,h){if(g<h/2){return c.easing.easeInBounce(f,g*2,0,i,h)*0.5+e}return c.easing.easeOutBounce(f,g*2-h,0,i,h)*0.5+i*0.5+e}})})(jQuery);(function(a){a.effects.highlight=function(b){return this.queue(function(){var e=a(this),d=["backgroundImage","backgroundColor","opacity"];var h=a.effects.setMode(e,b.options.mode||"show");var c=b.options.color||"#ffff99";var g=e.css("backgroundColor");a.effects.save(e,d);e.show();e.css({backgroundImage:"none",backgroundColor:c});var f={backgroundColor:g};if(h=="hide"){f.opacity=0}e.animate(f,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(h=="hide"){e.hide()}a.effects.restore(e,d);if(h=="show"&&a.browser.msie){this.style.removeAttribute("filter")}if(b.callback){b.callback.apply(this,arguments)}e.dequeue()}})})}})(jQuery);var jsonParse=(function(){var number='(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)';var oneChar='(?:[^\\0-\\x08\\x0a-\\x1f\"\\\\]'
+'|\\\\(?:[\"/\\\\bfnrt]|u[0-9A-Fa-f]{4}))';var string='(?:\"'+oneChar+'*\")';var jsonToken=new RegExp('(?:false|true|null|[\\{\\}\\[\\]]'
+'|'+number
+'|'+string
+')','g');var escapeSequence=new RegExp('\\\\(?:([^u])|u(.{4}))','g');var escapes={'"':'"','/':'/','\\':'\\','b':'\b','f':'\f','n':'\n','r':'\r','t':'\t'};function unescapeOne(_,ch,hex){return ch?escapes[ch]:String.fromCharCode(parseInt(hex,16));}
var EMPTY_STRING=new String('');var SLASH='\\';var firstTokenCtors={'{':Object,'[':Array};return function(json){var toks=json.match(jsonToken);var result;var tok=toks[0];if('{'===tok){result={};}else if('['===tok){result=[];}else{throw new Error(tok);}
var key;var stack=[result];for(var i=1,n=toks.length;i<n;++i){tok=toks[i];var cont;switch(tok.charCodeAt(0)){default:cont=stack[0];cont[key||cont.length]=+(tok);key=void 0;break;case 0x22:tok=tok.substring(1,tok.length-1);if(tok.indexOf(SLASH)!==-1){tok=tok.replace(escapeSequence,unescapeOne);}
cont=stack[0];if(!key){if(cont instanceof Array){key=cont.length;}else{key=tok||EMPTY_STRING;break;}}
cont[key]=tok;key=void 0;break;case 0x5b:cont=stack[0];stack.unshift(cont[key||cont.length]=[]);key=void 0;break;case 0x5d:stack.shift();break;case 0x66:cont=stack[0];cont[key||cont.length]=false;key=void 0;break;case 0x6e:cont=stack[0];cont[key||cont.length]=null;key=void 0;break;case 0x74:cont=stack[0];cont[key||cont.length]=true;key=void 0;break;case 0x7b:cont=stack[0];stack.unshift(cont[key||cont.length]={});key=void 0;break;case 0x7d:stack.shift();break;}}
if(stack.length){throw new Error();}
return result;};})();if(!window.CanvasRenderingContext2D){(function(){var I=Math,i=I.round,L=I.sin,M=I.cos,m=10,A=m/2,Q={init:function(a){var b=a||document;if(/MSIE/.test(navigator.userAgent)&&!window.opera){var c=this;b.attachEvent("onreadystatechange",function(){c.r(b)})}},r:function(a){if(a.readyState=="complete"){if(!a.namespaces["s"]){a.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml")}var b=a.createStyleSheet();b.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}g_vml_\\:*{behavior:url(#default#VML)}";var c=a.getElementsByTagName("canvas");for(var d=0;d<c.length;d++){if(!c[d].getContext){this.initElement(c[d])}}}},q:function(a){var b=a.outerHTML,c=a.ownerDocument.createElement(b);if(b.slice(-2)!="/>"){var d="/"+a.tagName,e;while((e=a.nextSibling)&&e.tagName!=d){e.removeNode()}if(e){e.removeNode()}}a.parentNode.replaceChild(c,a);return c},initElement:function(a){a=this.q(a);a.getContext=function(){if(this.l){return this.l}return this.l=new K(this)};a.attachEvent("onpropertychange",V);a.attachEvent("onresize",W);var b=a.attributes;if(b.width&&b.width.specified){a.style.width=b.width.nodeValue+"px"}else{a.width=a.clientWidth}if(b.height&&b.height.specified){a.style.height=b.height.nodeValue+"px"}else{a.height=a.clientHeight}return a}};function V(a){var b=a.srcElement;switch(a.propertyName){case"width":b.style.width=b.attributes.width.nodeValue+"px";b.getContext().clearRect();break;case"height":b.style.height=b.attributes.height.nodeValue+"px";b.getContext().clearRect();break}}function W(a){var b=a.srcElement;if(b.firstChild){b.firstChild.style.width=b.clientWidth+"px";b.firstChild.style.height=b.clientHeight+"px"}}Q.init();var R=[];for(var E=0;E<16;E++){for(var F=0;F<16;F++){R[E*16+F]=E.toString(16)+F.toString(16)}}function J(){return[[1,0,0],[0,1,0],[0,0,1]]}function G(a,b){var c=J();for(var d=0;d<3;d++){for(var e=0;e<3;e++){var g=0;for(var h=0;h<3;h++){g+=a[d][h]*b[h][e]}c[d][e]=g}}return c}function N(a,b){b.fillStyle=a.fillStyle;b.lineCap=a.lineCap;b.lineJoin=a.lineJoin;b.lineWidth=a.lineWidth;b.miterLimit=a.miterLimit;b.shadowBlur=a.shadowBlur;b.shadowColor=a.shadowColor;b.shadowOffsetX=a.shadowOffsetX;b.shadowOffsetY=a.shadowOffsetY;b.strokeStyle=a.strokeStyle;b.d=a.d;b.e=a.e}function O(a){var b,c=1;a=String(a);if(a.substring(0,3)=="rgb"){var d=a.indexOf("(",3),e=a.indexOf(")",d+1),g=a.substring(d+1,e).split(",");b="#";for(var h=0;h<3;h++){b+=R[Number(g[h])]}if(g.length==4&&a.substr(3,1)=="a"){c=g[3]}}else{b=a}return[b,c]}function S(a){switch(a){case"butt":return"flat";case"round":return"round";case"square":default:return"square"}}function K(a){this.a=J();this.m=[];this.k=[];this.c=[];this.strokeStyle="#000";this.fillStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=m*1;this.globalAlpha=1;this.canvas=a;var b=a.ownerDocument.createElement("div");b.style.width=a.clientWidth+"px";b.style.height=a.clientHeight+"px";b.style.overflow="hidden";b.style.position="absolute";a.appendChild(b);this.j=b;this.d=1;this.e=1}var j=K.prototype;j.clearRect=function(){this.j.innerHTML="";this.c=[]};j.beginPath=function(){this.c=[]};j.moveTo=function(a,b){this.c.push({type:"moveTo",x:a,y:b});this.f=a;this.g=b};j.lineTo=function(a,b){this.c.push({type:"lineTo",x:a,y:b});this.f=a;this.g=b};j.bezierCurveTo=function(a,b,c,d,e,g){this.c.push({type:"bezierCurveTo",cp1x:a,cp1y:b,cp2x:c,cp2y:d,x:e,y:g});this.f=e;this.g=g};j.quadraticCurveTo=function(a,b,c,d){var e=this.f+0.6666666666666666*(a-this.f),g=this.g+0.6666666666666666*(b-this.g),h=e+(c-this.f)/3,l=g+(d-this.g)/3;this.bezierCurveTo(e,g,h,l,c,d)};j.arc=function(a,b,c,d,e,g){c*=m;var h=g?"at":"wa",l=a+M(d)*c-A,n=b+L(d)*c-A,o=a+M(e)*c-A,f=b+L(e)*c-A;if(l==o&&!g){l+=0.125}this.c.push({type:h,x:a,y:b,radius:c,xStart:l,yStart:n,xEnd:o,yEnd:f})};j.rect=function(a,b,c,d){this.moveTo(a,b);this.lineTo(a+c,b);this.lineTo(a+c,b+d);this.lineTo(a,b+d);this.closePath()};j.strokeRect=function(a,b,c,d){this.beginPath();this.moveTo(a,b);this.lineTo(a+c,b);this.lineTo(a+c,b+d);this.lineTo(a,b+d);this.closePath();this.stroke()};j.fillRect=function(a,b,c,d){this.beginPath();this.moveTo(a,b);this.lineTo(a+c,b);this.lineTo(a+c,b+d);this.lineTo(a,b+d);this.closePath();this.fill()};j.createLinearGradient=function(a,b,c,d){var e=new H("gradient");return e};j.createRadialGradient=function(a,b,c,d,e,g){var h=new H("gradientradial");h.n=c;h.o=g;h.i.x=a;h.i.y=b;return h};j.drawImage=function(a,b){var c,d,e,g,h,l,n,o,f=a.runtimeStyle.width,k=a.runtimeStyle.height;a.runtimeStyle.width="auto";a.runtimeStyle.height="auto";var q=a.width,r=a.height;a.runtimeStyle.width=f;a.runtimeStyle.height=k;if(arguments.length==3){c=arguments[1];d=arguments[2];h=(l=0);n=(e=q);o=(g=r)}else if(arguments.length==5){c=arguments[1];d=arguments[2];e=arguments[3];g=arguments[4];h=(l=0);n=q;o=r}else if(arguments.length==9){h=arguments[1];l=arguments[2];n=arguments[3];o=arguments[4];c=arguments[5];d=arguments[6];e=arguments[7];g=arguments[8]}else{throw"Invalid number of arguments";}var s=this.b(c,d),t=[],v=10,w=10;t.push(" <g_vml_:group",' coordsize="',m*v,",",m*w,'"',' coordorigin="0,0"',' style="width:',v,";height:",w,";position:absolute;");if(this.a[0][0]!=1||this.a[0][1]){var x=[];x.push("M11='",this.a[0][0],"',","M12='",this.a[1][0],"',","M21='",this.a[0][1],"',","M22='",this.a[1][1],"',","Dx='",i(s.x/m),"',","Dy='",i(s.y/m),"'");var p=s,y=this.b(c+e,d),z=this.b(c,d+g),B=this.b(c+e,d+g);p.x=Math.max(p.x,y.x,z.x,B.x);p.y=Math.max(p.y,y.y,z.y,B.y);t.push("padding:0 ",i(p.x/m),"px ",i(p.y/m),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",x.join(""),", sizingmethod='clip');")}else{t.push("top:",i(s.y/m),"px;left:",i(s.x/m),"px;")}t.push(' ">','<g_vml_:image src="',a.src,'"',' style="width:',m*e,";"," height:",m*g,';"',' cropleft="',h/q,'"',' croptop="',l/r,'"',' cropright="',(q-h-n)/q,'"',' cropbottom="',(r-l-o)/r,'"'," />","</g_vml_:group>");this.j.insertAdjacentHTML("BeforeEnd",t.join(""))};j.stroke=function(a){var b=[],c=O(a?this.fillStyle:this.strokeStyle),d=c[0],e=c[1]*this.globalAlpha,g=10,h=10;b.push("<g_vml_:shape",' fillcolor="',d,'"',' filled="',Boolean(a),'"',' style="position:absolute;width:',g,";height:",h,';"',' coordorigin="0 0" coordsize="',m*g," ",m*h,'"',' stroked="',!a,'"',' strokeweight="',this.lineWidth,'"',' strokecolor="',d,'"',' path="');var l={x:null,y:null},n={x:null,y:null};for(var o=0;o<this.c.length;o++){var f=this.c[o];if(f.type=="moveTo"){b.push(" m ");var k=this.b(f.x,f.y);b.push(i(k.x),",",i(k.y))}else if(f.type=="lineTo"){b.push(" l ");var k=this.b(f.x,f.y);b.push(i(k.x),",",i(k.y))}else if(f.type=="close"){b.push(" x ")}else if(f.type=="bezierCurveTo"){b.push(" c ");var k=this.b(f.x,f.y),q=this.b(f.cp1x,f.cp1y),r=this.b(f.cp2x,f.cp2y);b.push(i(q.x),",",i(q.y),",",i(r.x),",",i(r.y),",",i(k.x),",",i(k.y))}else if(f.type=="at"||f.type=="wa"){b.push(" ",f.type," ");var k=this.b(f.x,f.y),s=this.b(f.xStart,f.yStart),t=this.b(f.xEnd,f.yEnd);b.push(i(k.x-this.d*f.radius),",",i(k.y-this.e*f.radius)," ",i(k.x+this.d*f.radius),",",i(k.y+this.e*f.radius)," ",i(s.x),",",i(s.y)," ",i(t.x),",",i(t.y))}if(k){if(l.x==null||k.x<l.x){l.x=k.x}if(n.x==null||k.x>n.x){n.x=k.x}if(l.y==null||k.y<l.y){l.y=k.y}if(n.y==null||k.y>n.y){n.y=k.y}}}b.push(' ">');if(typeof this.fillStyle=="object"){var v={x:"50%",y:"50%"},w=n.x-l.x,x=n.y-l.y,p=w>x?w:x;v.x=i(this.fillStyle.i.x/w*100+50)+"%";v.y=i(this.fillStyle.i.y/x*100+50)+"%";var y=[];if(this.fillStyle.p=="gradientradial"){var z=this.fillStyle.n/p*100,B=this.fillStyle.o/p*100-z}else{var z=0,B=100}var C={offset:null,color:null},D={offset:null,color:null};this.fillStyle.h.sort(function(T,U){return T.offset-U.offset});for(var o=0;o<this.fillStyle.h.length;o++){var u=this.fillStyle.h[o];y.push(u.offset*B+z,"% ",u.color,",");if(u.offset>C.offset||C.offset==null){C.offset=u.offset;C.color=u.color}if(u.offset<D.offset||D.offset==null){D.offset=u.offset;D.color=u.color}}y.pop();b.push("<g_vml_:fill",' color="',D.color,'"',' color2="',C.color,'"',' type="',this.fillStyle.p,'"',' focusposition="',v.x,", ",v.y,'"',' colors="',y.join(""),'"',' opacity="',e,'" />')}else if(a){b.push('<g_vml_:fill color="',d,'" opacity="',e,'" />')}else{b.push("<g_vml_:stroke",' opacity="',e,'"',' joinstyle="',this.lineJoin,'"',' miterlimit="',this.miterLimit,'"',' endcap="',S(this.lineCap),'"',' weight="',this.lineWidth,'px"',' color="',d,'" />')}b.push("</g_vml_:shape>");this.j.insertAdjacentHTML("beforeEnd",b.join(""));this.c=[]};j.fill=function(){this.stroke(true)};j.closePath=function(){this.c.push({type:"close"})};j.b=function(a,b){return{x:m*(a*this.a[0][0]+b*this.a[1][0]+this.a[2][0])-A,y:m*(a*this.a[0][1]+b*this.a[1][1]+this.a[2][1])-A}};j.save=function(){var a={};N(this,a);this.k.push(a);this.m.push(this.a);this.a=G(J(),this.a)};j.restore=function(){N(this.k.pop(),this);this.a=this.m.pop()};j.translate=function(a,b){var c=[[1,0,0],[0,1,0],[a,b,1]];this.a=G(c,this.a)};j.rotate=function(a){var b=M(a),c=L(a),d=[[b,c,0],[-c,b,0],[0,0,1]];this.a=G(d,this.a)};j.scale=function(a,b){this.d*=a;this.e*=b;var c=[[a,0,0],[0,b,0],[0,0,1]];this.a=G(c,this.a)};j.clip=function(){};j.arcTo=function(){};j.createPattern=function(){return new P};function H(a){this.p=a;this.n=0;this.o=0;this.h=[];this.i={x:0,y:0}}H.prototype.addColorStop=function(a,b){b=O(b);this.h.push({offset:1-a,color:b})};function P(){}G_vmlCanvasManager=Q;CanvasRenderingContext2D=K;CanvasGradient=H;CanvasPattern=P})()};function launchMapSharing()
{if($j("#dialog-share-map").dialog("isOpen"))
{$j("#dialog-share-map").dialog("close");}
else
{var data=YAHOO.lang.JSON.stringify(updateSettings());$j.post('/ajax/storePermanentLink.php',{data:data},function(data){$j("#share-link").attr('value',data.url);$j("#dialog-share-map").dialog("open");$j("div.ui-dialog-overlay").click(function(){$j("#dialog-share-map").dialog("close");});},'json');}}
function toggleFullscreen()
{settings.map.fullscreen=!settings.map.fullscreen;var data=YAHOO.lang.JSON.stringify(updateSettings());$j.post('/ajax/settingsStore.php',{action:'store',data:data},function(data){window.location.assign('/');},'json');}
function toggleMeasurementBox()
{if($j("#toolbox-measurement").hasClass("toolbox-hidden"))
{$j("#toolbox-measurement").show();$j("#toolbox-measurement").removeClass("toolbox-hidden");}
else
{if(measurement.pointAddingEnabled)
{togglePathPointsAdding({currentTarget:"#tool-measurement-toggle-path-points-adding"});}
$j("#toolbox-measurement").hide();$j("#toolbox-measurement").addClass("toolbox-hidden");}}
function togglePathPointsAdding(e)
{if(measurement.pointAddingEnabled)
{measurement.pointAddingEnabled=false;$j(e.currentTarget).addClass('ui-state-default').removeClass('ui-state-highlight');$j('#map-holder').css('cursor','auto');}
else
{measurement.pointAddingEnabled=true;$j(e.currentTarget).addClass('ui-state-highlight').removeClass('ui-state-default');$j('#map-holder').css('cursor','crosshair');}}
function clearPathPoints()
{measurement.clearPoints();$j("#tool-measurement-path-display span").html('');$j("#tool-measurement-area-display span").html('');}
function mapDragBeginEvent(e)
{map.dragStartedAt={x:e.memo.mouseCoords.x,y:e.memo.mouseCoords.y};}
function mapDragEndEvent(e)
{if(measurement.addingEnabled)
{measurement.mapMovement=true;}}
function mapZoomInEvent(e)
{$j("#zoomInButton").parent().effect("highlight");}
function mapZoomOutEvent(e)
{$j("#zoomOutButton").parent().effect("highlight");}
function mapClickEvent(e)
{if(measurement.pointAddingEnabled)
{if(!measurement.mapMovement)
{measurement.addPoint(e.memo.mouseMapCoords);if(!settings.measurement.points)
{settings.measurement.points=[];}
$j("#tool-measurement-path-display span").html(measurement.getTotalLengthFormatted());$j("#tool-measurement-area-display span").html(measurement.getAreaFormatted());}
else
{measurement.mapMovement=false;}}}
function toolClickEvent(e)
{$j(e.currentTarget).effect("highlight");var action=$j(e.currentTarget).attr('id');switch(action)
{case'tool-fullscreen':toggleFullscreen();break;case'tool-zoom-in':map.zoomIn();break;case'tool-zoom-out':map.zoomOut();break;case'tool-share-map':launchMapSharing();break;case'tool-toggle-measurement':toggleMeasurementBox();break;case'tool-view-vector':util.setMapStyle(0,e.currentTarget,$j(e.currentTarget).parent().find("li#tool-view-vector.ui-state-highlight, #tool-view-ortho.ui-state-highlight, #tool-view-hybrid.ui-state-highlight"));break;case'tool-view-ortho':util.setMapStyle(1,e.currentTarget,$j(e.currentTarget).parent().find("li#tool-view-vector.ui-state-highlight, #tool-view-ortho.ui-state-highlight, #tool-view-hybrid.ui-state-highlight"));break;case'tool-view-hybrid':util.setMapStyle(2,e.currentTarget,$j(e.currentTarget).parent().find("li#tool-view-vector.ui-state-highlight, #tool-view-ortho.ui-state-highlight, #tool-view-hybrid.ui-state-highlight"));break;case'nw':map.move(new Move(100,100));break;case'n':map.move(new Move(0,100));break;case'ne':map.move(new Move(-100,100.001));break;case'w':map.move(new Move(100,0));break;case'e':map.move(new Move(-100,0));break;case'sw':map.move(new Move(100.001,-100));break;case's':map.move(new Move(0,-100));break;case'se':map.move(new Move(-100,-100));break;case'tool-measurement-toggle-path-points-adding':togglePathPointsAdding(e);break;case'tool-measurement-clear-path-points':clearPathPoints();break;}}
function documentKeyUp(evObj)
{if(evObj.keyCode==32&&measurement.temporaryMoveInProgress&&!measurement.pointAddingEnabled)
{measurement.temporaryMoveInProgress=false;measurement.pointAddingEnabled=true;$j("#map-holder").css('cursor','crosshair');return false;}}
function documentKeyDown(evObj)
{if(evObj.keyCode==32)
{if(measurement.pointAddingEnabled)
{measurement.temporaryMoveInProgress=true;measurement.pointAddingEnabled=false;$j("#map-holder").css('cursor','move');}
if(measurement.temporaryMoveInProgress)
{evObj.preventDefault();evObj.stopPropagation();}}}